From: ttan on 23 Feb 2006 19:29 Since we are on this topic, I had another question: When I used netcfg to uninstall the driver, some time I got this error "could not lock INetcfg, it is already locked by "somename".... How do I unlock this or by pass this to continue my uninstall and do other stuff. Because everytime I got to this error message the node just hang until I do a reboot (press the power button, shutdown and restart don't work) and I have to re-uninstall again. otherwise it's not a clean install. thanks "ttan" wrote: > I moved the comdef.h right after the windows.h and still get the error. > I build the project under windows 2000 checked build enviroment. > > "Ivan Brugiolo [MSFT]" wrote: > > > I cannot repro on my side. > > > > -- > > This posting is provided "AS IS" with no warranties, and confers no rights. > > Use of any included script samples are subject to the terms specified at > > http://www.microsoft.com/info/cpyright.htm > > > > > > "ttan" <ttan(a)discussions.microsoft.com> wrote in message > > news:197DA36A-4624-42BC-93F5-0FDBF5A8DF2F(a)microsoft.com... > > > pch.h file > > > > > > #pragma warning (disable: 4786) > > > > > > #include <windows.h> > > > #include <netcfgx.h> > > > #include <netcfgn.h> > > > #include <comdef.h> > > > > > > #include <setupapi.h> > > > #include <devguid.h> > > > #include <tchar.h> > > > #include <stdio.h> > > > > > > "Ivan Brugiolo [MSFT]" wrote: > > > > > >> Can you show the oder of #includes ? > > >> normally `comdef.h` loves to be included right after windows.h > > >> and before other OLE2 headers > > >> > > >> -- > > >> -- > > >> This posting is provided "AS IS" with no warranties, and confers no > > >> rights. > > >> Use of any included script samples are subject to the terms specified at > > >> http://www.microsoft.com/info/cpyright.htm > > >> > > >> > > >> "ttan" <ttan(a)discussions.microsoft.com> wrote in message > > >> news:7E281978-2641-44FC-9A43-A9DF8458E7F1(a)microsoft.com... > > >> > Why do I get this error when I #include <comdef.h> to use _bstr_t and > > >> > WMI. > > >> > How do I fix this? > > >> > > > >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected > > >> > 'defined(id)' > > >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched > > >> > parenthesis : missing ')' > > >> > > > >> > I modified only two place in the source file see below: > > >> > ...... > > >> > C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY > > >> > ...... > > >> > TARGETLIBS=\ > > >> > $(SDK_LIB_PATH)\advapi32.lib \ > > >> > $(SDK_LIB_PATH)\comctl32.lib \ > > >> > $(SDK_LIB_PATH)\kernel32.lib \ > > >> > $(SDK_LIB_PATH)\ole32.lib \ > > >> > $(SDK_LIB_PATH)\oleaut32.lib \ > > >> > $(SDK_LIB_PATH)\user32.lib \ > > >> > $(SDK_LIB_PATH)\uuid.lib \ > > >> > $(SDK_LIB_PATH)\setupapi.lib\ > > >> > $(SDK_LIB_PATH)\Wbemuuid.lib\ > > >> > $(SDK_LIB_PATH)\Iphlpapi.lib > > >> > > >> > > >> > > > > > >
From: ttan on 23 Feb 2006 20:29 I also tried to move the define of header file into netcfg.cpp #include <comdef.h> #include "pch.h" #pragma hdrstop #include "netcfg.h" #include <wbemidl.h> #include <time.h> This time the error go away but complained another error: netcfg.cpp(1570): error C3861: '_bstr_t': identifier not found, even with argument-dependent lookup at line 1570 I called WMI function: IWbemLocator *pLoc = 0; hres = CoCreateInstance( CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLoc); if (FAILED(hres)) { wprintf(L"Failed to create IWbemLocator object. Error code x%0x\n", hres); CoUninitialize(); return NULL; // Program has failed. } // Connect to the root\cimv2 namespace with the // current user and obtain pointer pSvc // to make IWbemServices calls. IWbemServices *pSvc = 0; hres = pLoc->ConnectServer( _bstr_t(L"ROOT\\CIMV2"), // WMI namespace NULL, // User name NULL, // User password 0, // Locale NULL, // Security flags 0, // Authority 0, // Context object &pSvc // IWbemServices proxy ); Do you have any clude why it behave this way? "Ivan Brugiolo [MSFT]" wrote: > I cannot repro on my side. > > -- > This posting is provided "AS IS" with no warranties, and confers no rights. > Use of any included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm > > > "ttan" <ttan(a)discussions.microsoft.com> wrote in message > news:197DA36A-4624-42BC-93F5-0FDBF5A8DF2F(a)microsoft.com... > > pch.h file > > > > #pragma warning (disable: 4786) > > > > #include <windows.h> > > #include <netcfgx.h> > > #include <netcfgn.h> > > #include <comdef.h> > > > > #include <setupapi.h> > > #include <devguid.h> > > #include <tchar.h> > > #include <stdio.h> > > > > "Ivan Brugiolo [MSFT]" wrote: > > > >> Can you show the oder of #includes ? > >> normally `comdef.h` loves to be included right after windows.h > >> and before other OLE2 headers > >> > >> -- > >> -- > >> This posting is provided "AS IS" with no warranties, and confers no > >> rights. > >> Use of any included script samples are subject to the terms specified at > >> http://www.microsoft.com/info/cpyright.htm > >> > >> > >> "ttan" <ttan(a)discussions.microsoft.com> wrote in message > >> news:7E281978-2641-44FC-9A43-A9DF8458E7F1(a)microsoft.com... > >> > Why do I get this error when I #include <comdef.h> to use _bstr_t and > >> > WMI. > >> > How do I fix this? > >> > > >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected > >> > 'defined(id)' > >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched > >> > parenthesis : missing ')' > >> > > >> > I modified only two place in the source file see below: > >> > ...... > >> > C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY > >> > ...... > >> > TARGETLIBS=\ > >> > $(SDK_LIB_PATH)\advapi32.lib \ > >> > $(SDK_LIB_PATH)\comctl32.lib \ > >> > $(SDK_LIB_PATH)\kernel32.lib \ > >> > $(SDK_LIB_PATH)\ole32.lib \ > >> > $(SDK_LIB_PATH)\oleaut32.lib \ > >> > $(SDK_LIB_PATH)\user32.lib \ > >> > $(SDK_LIB_PATH)\uuid.lib \ > >> > $(SDK_LIB_PATH)\setupapi.lib\ > >> > $(SDK_LIB_PATH)\Wbemuuid.lib\ > >> > $(SDK_LIB_PATH)\Iphlpapi.lib > >> > >> > >> > > >
From: Ivan Brugiolo [MSFT] on 25 Feb 2006 14:55 There must be something in your pre-compiled headers that conflicts with comdef.h. Without more context, it would be hard to help. -- -- This posting is provided "AS IS" with no warranties, and confers no rights. Use of any included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "ttan" <ttan(a)discussions.microsoft.com> wrote in message news:53100E8C-B22C-41C7-A9DE-D15E7FA22658(a)microsoft.com... >I also tried to move the define of header file into netcfg.cpp > #include <comdef.h> > #include "pch.h" > #pragma hdrstop > #include "netcfg.h" > #include <wbemidl.h> > #include <time.h> > > This time the error go away but complained another error: > netcfg.cpp(1570): error C3861: '_bstr_t': identifier not found, even with > argument-dependent lookup > > at line 1570 I called WMI function: > > IWbemLocator *pLoc = 0; > > hres = CoCreateInstance( > CLSID_WbemLocator, > 0, > CLSCTX_INPROC_SERVER, > IID_IWbemLocator, (LPVOID *) &pLoc); > > if (FAILED(hres)) > { > wprintf(L"Failed to create IWbemLocator object. Error code x%0x\n", > hres); > CoUninitialize(); > return NULL; // Program has failed. > } > > // Connect to the root\cimv2 namespace with the > // current user and obtain pointer pSvc > // to make IWbemServices calls. > IWbemServices *pSvc = 0; > hres = pLoc->ConnectServer( > _bstr_t(L"ROOT\\CIMV2"), // WMI namespace > NULL, // User name > NULL, // User password > 0, // Locale > NULL, // Security flags > 0, // Authority > 0, // Context object > &pSvc // IWbemServices proxy > ); > > Do you have any clude why it behave this way? > > > > > > "Ivan Brugiolo [MSFT]" wrote: > >> I cannot repro on my side. >> >> -- >> This posting is provided "AS IS" with no warranties, and confers no >> rights. >> Use of any included script samples are subject to the terms specified at >> http://www.microsoft.com/info/cpyright.htm >> >> >> "ttan" <ttan(a)discussions.microsoft.com> wrote in message >> news:197DA36A-4624-42BC-93F5-0FDBF5A8DF2F(a)microsoft.com... >> > pch.h file >> > >> > #pragma warning (disable: 4786) >> > >> > #include <windows.h> >> > #include <netcfgx.h> >> > #include <netcfgn.h> >> > #include <comdef.h> >> > >> > #include <setupapi.h> >> > #include <devguid.h> >> > #include <tchar.h> >> > #include <stdio.h> >> > >> > "Ivan Brugiolo [MSFT]" wrote: >> > >> >> Can you show the oder of #includes ? >> >> normally `comdef.h` loves to be included right after windows.h >> >> and before other OLE2 headers >> >> >> >> -- >> >> -- >> >> This posting is provided "AS IS" with no warranties, and confers no >> >> rights. >> >> Use of any included script samples are subject to the terms specified >> >> at >> >> http://www.microsoft.com/info/cpyright.htm >> >> >> >> >> >> "ttan" <ttan(a)discussions.microsoft.com> wrote in message >> >> news:7E281978-2641-44FC-9A43-A9DF8458E7F1(a)microsoft.com... >> >> > Why do I get this error when I #include <comdef.h> to use _bstr_t >> >> > and >> >> > WMI. >> >> > How do I fix this? >> >> > >> >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected >> >> > 'defined(id)' >> >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched >> >> > parenthesis : missing ')' >> >> > >> >> > I modified only two place in the source file see below: >> >> > ...... >> >> > C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY >> >> > ...... >> >> > TARGETLIBS=\ >> >> > $(SDK_LIB_PATH)\advapi32.lib \ >> >> > $(SDK_LIB_PATH)\comctl32.lib \ >> >> > $(SDK_LIB_PATH)\kernel32.lib \ >> >> > $(SDK_LIB_PATH)\ole32.lib \ >> >> > $(SDK_LIB_PATH)\oleaut32.lib \ >> >> > $(SDK_LIB_PATH)\user32.lib \ >> >> > $(SDK_LIB_PATH)\uuid.lib \ >> >> > $(SDK_LIB_PATH)\setupapi.lib\ >> >> > $(SDK_LIB_PATH)\Wbemuuid.lib\ >> >> > $(SDK_LIB_PATH)\Iphlpapi.lib >> >> >> >> >> >> >> >> >>
First
|
Prev
|
Pages: 1 2 Prev: testcap ddk sample question. Next: Newbie: IoRegisterPlugPlayNotification |