Sync to Wine-20040615:

Patrik Stridvall <ps@leissner.se>
- Fixed some issues found by winapi_check.
Krishna Murthy <Krishna.Murthy@guptaworldwide.com>
- WNetGetConnection(): use QueryDosDevice to return a fake remote name
  instead of the drive label.

svn path=/trunk/; revision=9679
This commit is contained in:
Gé van Geldorp 2004-06-16 06:58:48 +00:00
parent e054bf54e2
commit 6c4df3df68
2 changed files with 12 additions and 8 deletions

View file

@ -81,6 +81,9 @@ DWORD WINAPI DllCanUnloadNow(void)
return S_OK; return S_OK;
} }
/*****************************************************************
* DllMain [MPR.init]
*/
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
switch (fdwReason) { switch (fdwReason) {

View file

@ -1548,6 +1548,8 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName,
WCHAR wideRemoteStatic[MAX_PATH]; WCHAR wideRemoteStatic[MAX_PATH];
DWORD wideRemoteSize = sizeof(wideRemoteStatic) / sizeof(WCHAR); DWORD wideRemoteSize = sizeof(wideRemoteStatic) / sizeof(WCHAR);
MultiByteToWideChar(CP_ACP, 0, lpLocalName, -1, wideLocalName, len);
/* try once without memory allocation */ /* try once without memory allocation */
ret = WNetGetConnectionW(wideLocalName, wideRemoteStatic, ret = WNetGetConnectionW(wideLocalName, wideRemoteStatic,
&wideRemoteSize); &wideRemoteSize);
@ -1633,28 +1635,27 @@ DWORD WINAPI WNetGetConnectionW( LPCWSTR lpLocalName,
ret = WN_BAD_LOCALNAME; ret = WN_BAD_LOCALNAME;
else else
{ {
WCHAR label[40];
if (lpLocalName[1] == ':') if (lpLocalName[1] == ':')
{ {
switch(GetDriveTypeW(lpLocalName)) switch(GetDriveTypeW(lpLocalName))
{ {
case DRIVE_REMOTE: case DRIVE_REMOTE:
if (!GetVolumeInformationW( lpLocalName, label, sizeof(label),
NULL, NULL, NULL, NULL, 0 ))
label[0] = 0;
if (strlenW(label) + 1 > *lpBufferSize)
{ {
*lpBufferSize = strlenW(label) + 1; WCHAR remote[MAX_PATH];
if (!QueryDosDeviceW( lpLocalName, remote, MAX_PATH )) remote[0] = 0;
if (strlenW(remote) + 1 > *lpBufferSize)
{
*lpBufferSize = strlenW(remote) + 1;
ret = WN_MORE_DATA; ret = WN_MORE_DATA;
} }
else else
{ {
strcpyW( lpRemoteName, label ); strcpyW( lpRemoteName, remote );
*lpBufferSize = strlenW(lpRemoteName) + 1; *lpBufferSize = strlenW(lpRemoteName) + 1;
ret = WN_SUCCESS; ret = WN_SUCCESS;
} }
break; break;
}
case DRIVE_REMOVABLE: case DRIVE_REMOVABLE:
case DRIVE_FIXED: case DRIVE_FIXED:
case DRIVE_CDROM: case DRIVE_CDROM: