• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 611
  • Last Modified:

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?
0
aewarnick
Asked:
aewarnick
  • 5
  • 4
2 Solutions
 
bpmurrayCommented:
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.
0
 
aewarnickAuthor Commented:
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.
0
 
bpmurrayCommented:
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! :-)
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
aewarnickAuthor Commented:
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.
0
 
aewarnickAuthor Commented:
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
0
 
aewarnickAuthor Commented:
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.
0
 
John DarbyPMCommented:
I have setup all my CAD users to have a similar effect. However, I went about it a bit differently.

1. Created a new OU for specific users and assign a specific user profile (CAD user, Office Admin user, AD Admin user, etc)
2. Upon login, the specific user draws his/her user profile from the group policy
3. Admin users can then alter their own profile as they wish and other users have various grades of control depending on group membership

Leveraging using GPOs also prepared us for automated software deployment using Softgrid and SMS. This help with licensing and resource tracking.

If you absolutely must use your current method of manual copy to localhost\Default User, I would suggest attaching this procedure to a group policy and join whichever systems need this particular policy to receive the update. Of cousre, it will be a case of reboot the system and actively push the GPO.

I am unsure if this helped, but I am more than willing to help you write the GPO which suits your need.

Cheers,
John
0
 
bpmurrayCommented:
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?
0
 
aewarnickAuthor Commented:
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.
0
 
bpmurrayCommented:
I completely understand: that's why I keep pointing to the way Windows does it! You can load two files onto each machine: standard.dat and update-registry.bat. The batch file has a single line that says "REG LOAD HKU standard.dat". Place a shorcut to the batch file on the desktop. Double-click and Bob's your uncle.

All this with NO programming, i.e. a system guaranteed to be bug free (or at least as bug-free as the OS since it's part of the OS), and simpliciity and reliability built in.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now