Link to home
Start Free TrialLog in
Avatar of aewarnick
aewarnick

asked on

Win32_Directory with gcc???

How do I compile Win32_Directory with gcc?

The headers I need are:
comdef.h
Wbemidl.h
and the library would link to is:
wbemuuid

Here is the real delema.  Win32_Directory may not even be the answer I need.

At my place of business, we copy the user profile that we are currently working with to the Default User so that any regular user who logs on has a consistant profile to work with. Then we use DeepFreeze to preserve the current state.

I am making a program to do this because we work on hundreds of computers doing this over and over again. The trouble is, when I try to open the file, NTUSER.DAT and others in the active profile directory, I cannot, because the files are in use by windows.

I know there is a way to copy the active directory and all it's contents because Windows does it. The OS is Win 2000 and if you right click on My Computer - Properties - Users - From there you have the option to copy any profile, even if it is the active profile.

Is there an api call I can call to copy the active profile or some other way to do this?
Avatar of bpmurray
bpmurray
Flag of Ireland image

I think it's probably easier than that. NTUSER.DAT is, in fact, the HKEY_CURRENT_USER part of the registry, so you can use regedit32.exe to save the standard version (the "hive"?) and then use File/Import or File/Load Hive to sync the machine to the standard stuff.
Avatar of aewarnick
aewarnick

ASKER

That's is the kind of thing I'm trying to avoid though.  I need to do everything in my program to make this process fast and easy and efficient.
I suspect you also want it to be reliable, which is why regedt32.exe is a good solution. You only have to copy the data from the "correct" setting once, using File/Export. This will create a file called foo.reg. Then all you have to do for the other machines is call "regedt32 foo.reg" from a batch file. Sounds pretty simple, reproducible, efficient and reliable to me! :-)
That would mean putting a disk or some other media in each computer to call it.  Not a valid solution for me.  It's not near as efficient as having a program start when logging in and pressing a button to copy one profile over the Default User profile.
This seems to be a really hard or highly unknown issue.  Noone could answer it with any certainty on CodeGuru either.

Registry editors have to implement this some way.  They can even write to the registry file that is in use!  There must be a way to simply COPY the files in the active user directory
i.e. C:\Documents and Settings\TheUser
I guess registry editors would use registry functions to get registry keys and that is not what I need.  What I need SHOULD be very simple.  I simply want to copy the NTUSER.DAT file.
ASKER CERTIFIED SOLUTION
Avatar of John Darby
John Darby
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How do you want to execute this? I presume you want minimal intervention on the user machine, but can deploy a program. If this is the case, you can deploy a batch file and a registry hive and use the reg command:

    REG LOAD HKU myuser.dat

Would that work?
I simply want to do this the way Windows does it.  When I am logged in as the administrator account that I want to copy over, I can right click on My Computer and from there Copy the profile I'm using to the Default User profile.  My method will be much much more simple though: One push of a button from a program that will be installed on all the machines, and it's done.

Here is what I assume: Windows does not give itself special access to the NTUSER.DAT file.  It uses the RegGetKey (whatever the function is called) and other registry functions to parse the registry data into a registry file in the same format as the NTUSER.DAT file and then copies that file over the Default User NTUSER.DAT file.

Does that sound right?  If so, that's the way I'll have to do it.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial