Getting Registry info and using it ????

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HI All,
I am basically installing network driver programatically on Win2000 using
utility provided in DDK2000 samples which is snetcfg.exe which is a command
line utility where you can provide the .inf file for the driver you want.
But I have modified the 'C' program to install only my network driver. Now
the .inf file it needs can be stored anywhere on the computer and I am
storing the the path for the inf file in the registery and using that path
in the function. But the problem is if i provide a variable then the
function doesn't work at all but if I give the hard coded path then it works
absolutely fine..But important is I need to use the variable path read from
the registry and not the specific path..This is the way I am doing it..
****************************************************************************
****************************
LPCTSTR lpSubKey =  (LPCTSTR)"SOFTWARE\\Classes\\FirewallApplication";
HKEY hKey;
char szFullPath[200];
DWORD dwBufLen;
//const unsigned short * temp;
PCWSTR temp;
HRESULT hRes;

RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                 (LPCTSTR)lpSubKey,
                 0, KEY_QUERY_VALUE, &hKey );

/*the value of szFullPath is the correct value it shows while debugging*/
RegQueryValueEx(hKey, (LPCTSTR)"FullPath", NULL, NULL,(LPBYTE) &szFullPath,
&dwBufLen);

RegCloseKey( hKey );

 printf( "The fullpath is %s \n", &szFullPath );

/*if i use this temp in the HrInstallNetComponent function then it installs
the driver correctly*/
//temp =  L"C:\\Program Files\\LoadApplication7\\netsf.inf";

/*And this doesn't work but I want to use variable path*/
temp = (PCWSTR) szFullPath;

printf( "The fullpath is %s \n", temp );

printf("Please wait while it installs the Network Driver for you

/*if I use szFullPath variable directly then also it doesn't work and give
me the same hRes value.Only works with harcoded string*/
hRes = HrInstallNetComponent(L"ms_sFilter", NC_NetService,temp);  //80070002
is the hRes while running the exe

printf( "The Result is %x \n", hRes );

****************************************************************************
Thanks in advance,
Cheers,
Monika




[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux