Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey,

Im working on Windows Embedded and writing in C++.
At the moment I'm writing a program to rename a harddisk from a driver. Im renaming the hard disk right after the first boot of the system.
The program is working fine. After the program is finished it has to reboot my computer.

But here is the problem:

The program has to check whether my system settings has changed or not.
If they changed, i have to wait, until the Dialog "Systems Settings Changed" poped up and restart.
Otherwise,I don't have to wait.

By now i found out, that windows is using the newdev.dll for installing devices.

Can i check somehow if the newdev.dll is in use?

I tried it with CreateFile() with READ and WRITE.
HANDLE hwnd;
hwnd=CreateFile(L"C:\\Windows\\System32\\newdev.dll",GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
std::cout << GetLastError();

In addtion I tried to load it with LoadLibrary. But that failed too.
HMODULE hwnd;

hwnd= LoadLibrary("C:\\Windows\\System32\\newdev.dll");
IF(hwnd == NULL)
{
   printf("In Use");
}


I hope you can help me.

Regards
Chris
Posted

1 solution

Fetch all hard disk data before the change event and compare it to the fetched data after your change. If something is changed youre done...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900