In my code, I am trying to open a directory of Solaris OS from Windows OS using FindFirstFile().

In Windows XP, the code is working fine but in Window 7 same code is not working.

FindFirstFile() returns INVALID HANDLE in Windows 7 and GetLastError() return error code 50,

which means "The request is not supported. "

Can anybody help me out why the same code working fine in Windows XP but not in Windows 7 ??

I tried with disabling all the firewalls in Windows 7 but the result were same.

Here is the sample code :

int _tmain(int argc, _TCHAR* argv[])
{
        char             *path = "\\\\mach_name\\usr1\\usrname\\mydir\\*.*";
        wchar_t        wstr[256];
        HANDLE        filehandle;
        WIN32_FIND_DATAW  fileinfoW;
        DWORD        i;

        mbstowcs (wstr, path, 256);
        filehandle  = FindFirstFileW(wstr, &fileinfoW);
        if (filehandle != INVALID_HANDLE_VALUE)
FindClose(filehandle);
else
                i = GetLastError();

        return 0;
}

It works fine in XP but in Windows 7 FindFirstFile() returns INVALID_HANDLE_VALUE and then GetLastError() reports Error Code 50.

Response awaited..

Thanks in advance

Looks like someone over at "social.answers.microsoft.com" is already answering this....

But, to be complete, I pasted the code into a new VS2008 project and ran it on my 64-bit Windows 7 installation, and it ran just fine.

On a subsequent run, I deliberately messed up the machine name but in that case got an error code 53 - ERROR_BAD_NETPATH.

What version of Visual Studio are you running? What version (32-bit/64-bit) of Windows 7 are you using?

Looks like someone over at "social.answers.microsoft.com" is already answering this....

But, to be complete, I pasted the code into a new VS2008 project and ran it on my 64-bit Windows 7 installation, and it ran just fine.

On a subsequent run, I deliberately messed up the machine name but in that case got an error code 53 - ERROR_BAD_NETPATH.

What version of Visual Studio are you running? What version (32-bit/64-bit) of Windows 7 are you using?

I am using 64 bit Windows 7 and Visual Studio 2008.
Please note that, I am trying to access directory that exists on a machine having Solaris OS installed on it.

I am using 64 bit Windows 7 and Visual Studio 2008.
Please note that, I am trying to access directory that exists on a machine having Solaris OS installed on it.

Hi,

I found the solution of my problem.

Actually "LAN Manager Authentication level" (Local Security Policy) was not set properly.

So, Windows 7 was not able to communicate to SAMBA server running on Solaris.

If, for someone, "LAN Manager Authentication level" is set properly and still he/she facing the same problem then one of the possible solution could be in the link below:

http://www.sevenforums.com/network-sharing/46680-windows-cannot-access-computer.html

Thanks..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.