Click here to Skip to main content
13,044,428 members (119,197 online)
Rate this:
Please Sign up or sign in to vote.
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 19-Jan-11 3:01am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

SAKryukov 19-Jan-11 9:12am
Nothing else to say - a 5.
I can imagine further questions... let's see...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
Espen Harlinn 19-Jan-11 9:36am
5+ Good point about DCOM, not obvious to the unwary
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Many thanks.
I am using this code to set the security parameter like this..
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??

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 20 Jan 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100