Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am calling CreateFile() form a remote system(using COM). It's giving INVALID_HANDLE_VALUE.

I have checked the error code using GetLastError(), it giving 5.
Can anybody tell what is the problem??

The same code running ok in local mode :(( .
Posted

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Jan-11 9:12am    
Nothing else to say - a 5.
I can imagine further questions... let's see...
Adding to JSOP's answer.

The fact that it runs fine in your local machine does not mean it will run remotely via COM. You may need to configure the DCOM server to run as a higher privileged user. Alternatively, try writing to a path where you have permissions.
 
Share this answer
 
Comments
Espen Harlinn 19-Jan-11 9:36am    
5+ Good point about DCOM, not obvious to the unwary
Many thanks.
I am using this code to set the security parameter like this..
VB
CoSetProxyBlanket(pReptGen,    // pointer to enumerator
                RPC_C_AUTHN_WINNT,        // authentication service
                RPC_C_AUTHZ_NONE,         // authorization service
                NULL,                         // server principle name
                RPC_C_AUTHN_LEVEL_CALL,   // authentication level
                RPC_C_IMP_LEVEL_IMPERSONATE,    // impersonation level
                NULL,                         // identity of the client
                EOAC_NONE);               // capability flags


Here pReptGen is my object which I have created using CoCreateInstance.
Is it ok now??
 
Share this answer
 

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