CreateFile problem
-
Hi I am using the following createfile function to open a file in network share. HANDLE file = CreateFile( File, GENERIC_READ , FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); When the file name is \\10.195.1.54\Temp\expample.ini file it is giving error 5. But when i input the network share name instead of ip like \\Extream\Temp\expample.ini it is opening. can you please help me what is the problem i am having?
Birajendu SonicWALL Bangalore India
-
Hi I am using the following createfile function to open a file in network share. HANDLE file = CreateFile( File, GENERIC_READ , FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); When the file name is \\10.195.1.54\Temp\expample.ini file it is giving error 5. But when i input the network share name instead of ip like \\Extream\Temp\expample.ini it is opening. can you please help me what is the problem i am having?
Birajendu SonicWALL Bangalore India
the system GetLastError API often can tell you about error details especially when you also try to retrieve the rror code and tranlate it into readable text. Use the following snippget of code and tell us what is the message you receive. That case you may be even be able to understand the pbm yourself.
std::string GetFormattedSystemError()
{
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();FormatMessageA( FORMAT\_MESSAGE\_ALLOCATE\_BUFFER | FORMAT\_MESSAGE\_FROM\_SYSTEM | FORMAT\_MESSAGE\_IGNORE\_INSERTS, NULL, dw, MAKELANGID(LANG\_NEUTRAL, SUBLANG\_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL ); char\* pMessage = (char\*) lpMsgBuf; return std::string(pMessage);
}
Good luck.
Easy Profiler : a compile-time profiler for C++ www.potatosoftware.com
-
Hi I am using the following createfile function to open a file in network share. HANDLE file = CreateFile( File, GENERIC_READ , FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); When the file name is \\10.195.1.54\Temp\expample.ini file it is giving error 5. But when i input the network share name instead of ip like \\Extream\Temp\expample.ini it is opening. can you please help me what is the problem i am having?
Birajendu SonicWALL Bangalore India
birajendu wrote:
When the file name is \\10.195.1.54\Temp\expample.ini file it is giving error 5.
Which equates to
ERROR_ACCESS_DENIED
. Are you sure that the Extream server has an IP address of 10.195.1.54?"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
birajendu wrote:
When the file name is \\10.195.1.54\Temp\expample.ini file it is giving error 5.
Which equates to
ERROR_ACCESS_DENIED
. Are you sure that the Extream server has an IP address of 10.195.1.54?"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Yes i am sure about that.cause i can open that loaction through exploler using \\10.195.1.54\temp. it is not about the perticular extreme server in my Corporate lan. This happens with all PC prsent in Lan, If i try thru the name of the system than it works fine , but though IP it does not work.... :) No idea why? I gave a another try.I connected two PC to a router. So here i got IP from router.There is no scenario of DNS here, so i tried trough IP only(some thing like \\192.168.1.2\temp\emaple.ini) and worked perfactly. SO i am confused where is the problem?
Birajendu SonicWALL Bangalore India