Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, in DriverEntry I need to get full path of driver image. I am trying to get this path from registry, but I observed several entries:
Collapse | Copy Code
system32\DRIVERS\name.sys
\SystemRoot\system32\drivers\name.sys
\??\C:\cygwin\home\user\objchk_win7_amd64\amd64\name.sys


How to get this path correctly without parsing, creating own path?
Posted

1 solution

You can use this piece of code. This is untested code. Please revert if you have any queries


C++
char *lpFirstOccurance = NULL;
char buffer[1024];
char temp1[500];

lpFirstOccurance = (CHAR*)strstr(buffer, "\\SystemRoot");
if(strlen(buffer) > 0 && lpFirstOccurance != NULL)
{
	lpFirstOccurance += strlen("\\SystemRoot");
	sprintf(temp1, "%ls%s",tempStr.c_str(), lpFirstOccurance);
}
 
Share this answer
 
v2
Comments
Richard MacCutchan 4-Dec-13 8:20am    
Please format your code properly (as I have done for you) when posting suggested solutions.

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



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