Click here to Skip to main content
16,005,149 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: why did I get this error? Pin
Rudolf Jan6-Apr-06 0:51
Rudolf Jan6-Apr-06 0:51 
AnswerRe: why did I get this error? Pin
thatsme_cool6-Apr-06 1:48
thatsme_cool6-Apr-06 1:48 
AnswerRe: why did I get this error? Pin
David Crow6-Apr-06 3:20
David Crow6-Apr-06 3:20 
QuestionWin32 Owner Draw Pin
Anilkumar K V5-Apr-06 21:40
Anilkumar K V5-Apr-06 21:40 
AnswerRe: Win32 Owner Draw Pin
YaronNir6-Apr-06 2:55
YaronNir6-Apr-06 2:55 
GeneralRe: Win32 Owner Draw Pin
Anilkumar K V9-Apr-06 20:11
Anilkumar K V9-Apr-06 20:11 
GeneralRe: Win32 Owner Draw Pin
YaronNir9-Apr-06 20:14
YaronNir9-Apr-06 20:14 
QuestionWMI in VC++, Access Denied Pin
tobeymag5-Apr-06 21:33
tobeymag5-Apr-06 21:33 
Hi all,

I am trying to use WMI (just learning) in VC++. However, there seems
to be a problem when it comes to connecting to a Remote Host . Which
works very well on the local computer. The machine I am trying to
connect has Win2K on it and I have WinXP installed on my machine. Now,
when I try to execute the following code snippet, it gives me an Access
Denied error. Also when I try to query the same through WBEMTEST.exe,
everything work fine. Here is the code snippet : -


// Initialize Security
hrRetVal = CoInitializeSecurity(NULL,
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_CALL,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE,
0);


// CreateInstance
hrRetVal = CoCreateInstance(CLSID_WbemLocator,
NULL,
CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
IID_IWbemLocator,
(void **) &pWbemLocator);


BSTR bsNameSpace = SysAllocString(L"//RemoteComputer/root/cimv2");
BSTR bsUserName = SysAllocString(L"abc");
BSTR bsPassword = SysAllocString(L"123");


// Connect to the Server
hrRetVal = pWbemLocator->ConnectServer(bsNameSpace,
bsUserName,
bsPassword,
0,
NULL,
NULL,
0,
&pWbemServices);


// Query the Proxy Blanket for Authorization Level
hrRetVal = CoQueryProxyBlanket(pWbemServices,
NULL,
NULL,
NULL,
&dwAuthLevel,
NULL,
NULL,
NULL);


// Set the Proxy Blanket to the Authorization Level
hrRetVal = CoSetProxyBlanket(pWbemServices,
RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NAME,
NULL,
dwAuthLevel,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE);


// Execute Query --> Access Denied
hrRetVal = pWbemServices->ExecQuery(L"WQL",
L"Select * from Win32_Service",
WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumObject);


It is here that I receive an Access Denied error. I don't seem to know
what is th problem.
Any help would be appreciated.


Thanks
TobeyMag
AnswerRe: WMI in VC++, Access Denied Pin
tobeymag6-Apr-06 21:28
tobeymag6-Apr-06 21:28 
QuestionInternet Connection status Pin
mahesh_patil1665-Apr-06 21:31
mahesh_patil1665-Apr-06 21:31 
AnswerRe: Internet Connection status Pin
kakan5-Apr-06 21:56
professionalkakan5-Apr-06 21:56 
AnswerRe: Internet Connection status Pin
Mila0256-Apr-06 2:54
Mila0256-Apr-06 2:54 
GeneralRe: Internet Connection status Pin
kakan6-Apr-06 4:04
professionalkakan6-Apr-06 4:04 
QuestionFree Heap block modified after it was freed Pin
DirkBugner5-Apr-06 21:18
DirkBugner5-Apr-06 21:18 
AnswerRe: Free Heap block modified after it was freed Pin
toxcct5-Apr-06 21:32
toxcct5-Apr-06 21:32 
GeneralRe: Free Heap block modified after it was freed Pin
DirkBugner5-Apr-06 21:48
DirkBugner5-Apr-06 21:48 
QuestionSQLite ~ Access Pin
aukh5-Apr-06 20:55
aukh5-Apr-06 20:55 
AnswerRe: SQLite ~ Access Pin
scoroop6-Apr-06 0:05
scoroop6-Apr-06 0:05 
AnswerRe: SQLite ~ Access Pin
Waldermort6-Apr-06 2:02
Waldermort6-Apr-06 2:02 
GeneralRe: SQLite ~ Access Pin
aukh6-Apr-06 2:15
aukh6-Apr-06 2:15 
GeneralRe: SQLite ~ Access Pin
Ștefan-Mihai MOGA6-Apr-06 2:20
professionalȘtefan-Mihai MOGA6-Apr-06 2:20 
GeneralRe: SQLite ~ Access Pin
Waldermort6-Apr-06 7:19
Waldermort6-Apr-06 7:19 
Questionabout the checking dvd or cd Pin
abstar5-Apr-06 20:50
abstar5-Apr-06 20:50 
AnswerRe: about the checking dvd or cd Pin
Nibu babu thomas5-Apr-06 21:13
Nibu babu thomas5-Apr-06 21:13 
AnswerRe: about the checking dvd or cd Pin
abstar6-Apr-06 19:32
abstar6-Apr-06 19:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.