How to make the Windows to run a console program during OS startup?

  • Thread starter Thread starter Don Burn
  • Start date Start date
D

Don Burn

You cannot do it instead of Chkdisk, but you can use a native API program in
addition to ChkDisk, see http://www.sysinternals.com/ntw2k/info/native.shtml
.. Note this does not use the Win32 API so you are going to have to write a
custom application for this, and be aware that much of this API is
officially undocumented and subject to change.
 
If there is a Ntxxxx function documented in the windows DDK (or MSDN), the
prototype will be the same in ntdll.dll as in ntoskrnl.exe. This is because
ntdll.dll ntxxx functions all call through to the same functions in
ntoskrnl.exe.
 
How to make the Windows to run a console program during OS startup, like the
Chkdsk program to do when the OS does not shutdown properly? Now I want to
run my program instead of Chkdsk during the OS startup, is there a way to do
that?

Thank you very much!



Regards,
ZhangZQ
 
There should be a equivalent call to NtOpenFile named as ZwOpenFile() in
ntdll.dll. Native applications generally can call only API's from ntdll.dll
and can also send IOCTL's to drivers to get things done.
 
Don Burn,

That is the very useful information for me, thank you very very much!


Regards,
ZhangZQ
 
Don Burn,

I tried that program and it can display "hello world" in the blue screen,
very good! I haven't installed the DDK now so I still can't compile that
program, I have a question now, is it possible to call the Win32 API
CreateFile, ReadFile, WriteFile in that program?


Regards,
ZhangZQ
 
Oh, I think CreateFile, ReadFile, WriteFile must can't be called at that
time, and I found there is a NtOpenFile in NTDLL.dll, but can't find the
definition of that function so I disassembled that function and found it
call IoCreateFile, Ok, there are 2 solution now, but I don't know if it is
feasible,

1. Replace all the IO function that use the Win32 API with the DDK IO
function.
2. I also found LdrLoadDll in NTDLL.dll, is it possible to load the module
that implement the CreateFile, then there is no need to modify my existing
program.

What is your suggestion? Thank you very much!


Regards,
ZhangZQ
 
Back
Top