?
Solved

The BootExecute Data Entry

Posted on 2006-04-21
25
Medium Priority
?
1,653 Views
Last Modified: 2013-11-20
Hi All
I want to run my program while Booting the system by inserting the program name in the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager

Here in BootExecute am giving value
         autocheck autochk *copyTest

here copyTest is a batch file which consists of a single command
        copy C:\Test1.txt D:\Test1.txt

but after restarting the system I donot see file copied.

Please tell me that how to run copyTest batch file while booting

Please reply.
Thanks
0
Comment
Question by:davinder101
  • 11
  • 8
  • 3
  • +1
23 Comments
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16505805
try it here.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
or
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce
if you only want it to act on the next reboot
0
 

Author Comment

by:davinder101
ID: 16505947
Hi AndyAinscow

Thanks for your responce
Infact what I need is to copy "pagefile.sys" and  I learned that while bootingafetr BootExecute data entry , Memory management keys are loaded and pagefile.sys is initialized,
and ifI  try in the keys told by you then pagefile.sys will not be copied because windows doesnot allow to access this file.

So please tell me copying file by using Boot Execute Data entry

Thanks
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16506344
Caution - if this screws your system up .....

try this - comma separate the commands and with the extension (maybe requires complete path eg. c:\copyTest.bat)
autocheck autochk *, copyTest.bat
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16506386
0
 

Author Comment

by:davinder101
ID: 16506665
Thanks AndyAinscow

Infact  trieed to run batch file by separating the command by comma, but it doesnot worked.
So please tell me to run that batch file with the help of  Boot Execute Registry key .

Thanks
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16506879
I have never used BootExecute.
If I want to run a program during startup I would use one of the registry entries I posted initially.
What you could try is to replace the 'autocheck autochk *' with something else that you could test had run correctly.  Try different separators ,; and make certain you supply correct paths (8.3 naming convention).

Don't try to modify the pagefile.sys initially - use something simple to test it on - the bat file *may* be failing because it is a system file you are playing with.
0
 
LVL 86

Accepted Solution

by:
jkr earned 800 total points
ID: 16507674
You cannot run any Win32 app (including cmd.exe and its copy command) from BootExecute, only Native applications with an 'NtProcessStartup()' entry point are allowed - see http://www.sysinternals.com/Information/NativeApplications.html
0
 

Author Comment

by:davinder101
ID: 16522416
Thanks you all
Thanks jkr , Infact I reda that page and learned about
native applicatopns, here having one problem is that how to build a native
application.
So please guide me to build the native application, I have windows 200
Professional .
Please guide me.

Thanks.
0
 

Author Comment

by:davinder101
ID: 16523655
Hi
Now I am trying to write a native application.
Here I having a problrm, when I include NTDDK.H then it gives error as folloews:

*******************************************************************************
*******************************************************************************
--------------------Configuration: Native - Win32 Debug--------------------
Compiling...
NATIVE.C
c:\program files\ntddk\inc\ddk\ntddk.h(7914) : error C2146: syntax error : missing ';' before identifier 'InterruptTime'
c:\program files\ntddk\inc\ddk\ntddk.h(7914) : error C2061: syntax error : identifier 'InterruptTime'
c:\program files\ntddk\inc\ddk\ntddk.h(7928) : error C2061: syntax error : identifier 'SystemTime'
c:\program files\ntddk\inc\ddk\ntddk.h(7928) : error C2059: syntax error : ';'
c:\program files\ntddk\inc\ddk\ntddk.h(7935) : error C2061: syntax error : identifier 'TimeZoneBias'
c:\program files\ntddk\inc\ddk\ntddk.h(7935) : error C2059: syntax error : ';'
c:\program files\ntddk\inc\ddk\ntddk.h(8048) : error C2059: syntax error : '}'
c:\program files\ntddk\inc\ddk\ntddk.h(9101) : error C2061: syntax error : identifier 'PCONTEXT'
c:\program files\ntddk\inc\ddk\ntddk.h(9102) : error C2059: syntax error : '}'
c:\program files\ntddk\inc\ddk\ntddk.h(10051) : error C2061: syntax error : identifier 'KeTickCount'
c:\program files\ntddk\inc\ddk\ntddk.h(10051) : error C2059: syntax error : ';'
c:\program files\ntddk\inc\ddk\ntddk.h(10075) : error C2040: 'KdDebuggerEnabled' : 'unsigned char *' differs in levels of indirection from 'unsigned char '
c:\program files\ntddk\inc\ddk\ntddk.h(10342) : fatal error C1189: #error :  "Target architecture not defined"
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\NATIVE.SBR': No such file or directory
Error executing bscmake.exe.

Native.exe - 14 error(s), 0 warning(s)
****************************************************************************
****************************************************************************

So please tell me that how to remove these problems
using these order in Tools->option->Directories:
INCLUDE FILES:
    C:\PROGRAM FILES\MICROSOFT SDK\INCLUDE
    C:\PROGRAM FILES\NTDDK\INC
    C:\PROGRAM FILES\NTDDK\INC\DDK
    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
    C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE


LIBRARY FILES:
   C:\PROGRAM FILES\MICROSOFT SDK\LIB
   C:\PROGRAM FILES\NTDDK\LIBFRE\I386
   C:\PROGRAM FILES\NTDDK\LIBCHK\I386
   C:\PROGRAM FILES\NTDDK\LIB\I386\FREE
   C:\Program Files\Microsoft Visual Studio\VC98\LIB
   C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB

Please help me.

Thanks
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16523796
You might want to say why you want to copy the pagefile.sys left on the disk after the previous shutdown - you might get suggestions that are of use to you.
0
 

Author Comment

by:davinder101
ID: 16523917
hi AndyAinscow
Infact already told that making a wiping tool in which there is a option for wiping Page / Swap File now if user wants to wipe this file then he can select this option and application will wipe pagefile.sys,
And pagefile.sys cannt be deleted while system is running, so using native application.

Now Please tell me how to remove these errors.

Please reply.
Thanks
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16524090
Making a copy of a file leaves the original AND a copy - how does that wipe the file?  You now have two copies of it.
0
 

Author Comment

by:davinder101
ID: 16524219
Hi
here we will rename the original pagefile.sys and when Memeory Management keys will be loaded in Booting process then system will initialize a new pagefile.sys so have renemed pagefil.sys wil be wiped.

Please tell the way to remove errors.

Thanks
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16524282
Why not instruct the system to destroy the contents as part of the normal shutdown - much simpler/safer AND less coding for you.

Change the data value of the ClearPageFileAtShutdown value in the following registry key to a value of 1:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\ Memory Management

If the value does not exist, add the following value:
Value Name: ClearPageFileAtShutdown
Value Type: REG_DWORD
Value: 1

see
http://support.microsoft.com/kb/182086
0
 

Author Comment

by:davinder101
ID: 16524304
OK This will work but I want to do in that manner.

So Please Please tell me to remove that 14 errors that have mentioned in the last post.

Please reply.
Thansk
0
 
LVL 86

Expert Comment

by:jkr
ID: 16525514
How exactly are you building your program?
0
 

Author Comment

by:davinder101
ID: 16531635
Hi
jkr, Infact I didnt work on ddk yet before,
Anyway in order to compile Native apllication downloaded from SysInternal's page,

1) Install Win 2000 DDK on the system
2) Do setting in Tool -> Option -> Directories for DDK's Include file and Libraries.
3) create a new empty console based application in VC++ 6.0
4) Paste NATIVE.C and NATIVE.H files from downloaded source.
5) compile and Build the program.

After compiling found that 14 errors.

Please guide me.
Thansk
0
 
LVL 86

Expert Comment

by:jkr
ID: 16540737
Yup, you need to build that with the DDK tools. Copy a boilerplate project and edit the SOURCES file to resemble your code/app.
0
 

Author Comment

by:davinder101
ID: 16541558
Hi
I tried to make a Native application with the help of following links:
     http://www.codeproject.com/system/idd.asp  AND
     http://www.sysinternals.com/Information/NativeApplications.html

Here did settings and include library files for DDK.
and compile the program and compiled successfully, but when build the program it gives following error

*****************************************************************
Linking...
LINK : error LNK2001: unresolved external symbol _DriverEntry@8
hello.obj : error LNK2001: unresolved external symbol _NtTerminateProcess@8
hello.obj : error LNK2001: unresolved external symbol _NtDisplayString@4
Release/hello.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

hello.exe - 4 error(s), 0 warning(s)

******************************************************************

So Please tell me that how to remove these errors.
Thanks
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16541622
You must have a really good reason not to want to use the ClearPageFileAtShutdown registry entry with the extra work you have created for yourself.

I still don't understand why making a copy of the pagefile.sys is desirable for the stated purpose of wiping its contents.  Don't forget it is usually a large file and on a system with little disk space left maybe it could even leave your user with a system that won't boot.
0
 

Author Comment

by:davinder101
ID: 16542164
Hi All

I want to know that which NATIVE API is used for Renaming files.

Please reply
Thnaks & Regards

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 16549324
See my previously-posted solution to your other question:

    Page / Swap File
    http://www.experts-exchange.com//MFC/Q_21818860.html#16501354

(a comment to which you have not replied, BTW).

-- Dan
0
 

Author Comment

by:davinder101
ID: 16550219
Hi
No doubt that system will fill 0x00 at all the locations of pagefile.sys.
But what I need is to rename pagefile.sys, for this  learned that this can be done by usng native APIs.

So please tell me the native API for renaming any file.
Better if provide function code because Native APIs are undocumented.

Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question