31 DWORD drive_type, info_size, fail_size;
32 char driveA[] =
"A:\\";
33 char driveandpathA[] =
"A:\\file.txt";
34 WCHAR driveW[] = {
'A',
':',
'\\',0};
36 for(; *driveA <=
'Z'; ++*driveA, ++*driveandpathA, ++*driveW){
39 info_size =
sizeof(
buffer);
49 "WNetGetUniversalNameA(%s, ...) returned %u (drive_type: %u)\n",
50 driveA,
ret, drive_type);
52 ok(info_size ==
sizeof(
buffer),
"Got wrong size: %u\n", info_size);
60 ok(fail_size > 1,
"Got %d\n", fail_size);
64 "(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA,
ret);
77 info_size =
sizeof(
buffer);
85 "WNetGetUniversalNameW(%s, ...) returned %u (drive_type: %u)\n",
88 ok(info_size ==
sizeof(
buffer),
"Got wrong size: %u\n", info_size);
96 DWORD drive_type, info_size, fail_size;
97 char driveA[] =
"A:\\";
98 char driveandpathA[] =
"A:\\file.txt";
99 WCHAR driveW[] = {
'A',
':',
'\\',0};
101 for(; *driveA <=
'Z'; ++*driveA, ++*driveandpathA, ++*driveW){
104 info_size =
sizeof(
buffer);
112 "(%s) WNetGetUniversalNameA gave wrong error: %u\n", driveA,
ret);
113 ok(info_size ==
sizeof(
buffer),
"Got wrong size: %u\n", info_size);
123 "(%s) WNetGetUniversalNameA gave wrong error: %u\n", driveA,
ret);
136 "(%s) WNetGetUniversalNameA gave wrong error: %u\n", driveA,
ret);
149 info_size =
sizeof(
buffer);
157 "(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA,
ret);
159 ok(info_size ==
sizeof(
buffer),
"Got wrong size: %u\n", info_size);
169#define MPR_GET_PROC(func) \
170 p ## func = (void*)GetProcAddress(hmpr, #func)
196 size =
offsetof( PASSWORD_CACHE_ENTRY, abResource[pce->cbResource + pce->cbPassword] );
197 ok(pce->cbEntry ==
size,
"cbEntry, got %d, expected %d\n", pce->cbEntry,
size);
200 ok(pce->iEntry == 0,
"iEntry, got %d, got %d\n", pce->iEntry, 0);
201 ok(pce->nType ==
m_type,
"nType, got %d, got %d\n", pce->nType,
m_type);
203 buf = (
char*)pce->abResource;
206 buf += pce->cbResource;
215 char resource_buf[32];
216 char password_buf[32];
225 if (pWNetCachePassword &&
226 pWNetGetCachedPassword &&
227 pWNetEnumCachedPasswords &&
228 pWNetRemoveCachedPassword)
234 ret = pWNetCachePassword(resource_buf, resource_len, password_buf, password_len,
m_type, 0);
239 strcpy(password_buf,
"------");
240 password_len =
sizeof(password_buf);
241 ret = pWNetGetCachedPassword(resource_buf, resource_len, password_buf, &password_len,
m_type);
243 ok(password_len ==
strlen(
m_password),
"password length different, got %d\n", password_len);
244 ok(
strncmp(password_buf,
m_password, password_len)==0,
"passwords different, got %.*s, expected %s\n", password_len, password_buf,
m_password);
248 prefix_buf[prefix_len] =
'0';
255 ret = pWNetRemoveCachedPassword(resource_buf, resource_len,
m_type);
258 win_skip(
"WNetCachePassword() is not supported.\n");
266 char outBuf[4],
drive[] =
"J:", letter;
268 if (!pWNetUseConnectionA)
270 win_skip(
"WNetUseConnection() is not supported.\n");
280 for (letter =
'J'; letter <=
'Z'; letter++)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
#define ERROR_INVALID_PARAMETER
#define HeapFree(x, y, z)
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
GLenum GLuint GLenum GLsizei const GLchar * buf
static void test_WNetUseConnection(void)
static const char * m_resource
static void test_WNetCachePassword(void)
static void test_WNetGetUniversalName(void)
static const char * m_password
#define MPR_GET_PROC(func)
static BOOL CALLBACK enum_password_proc(PASSWORD_CACHE_ENTRY *pce, DWORD param)
static void InitFunctionPtrs(void)
static void test_WNetGetRemoteName(void)
static const DWORD m_param
static BOOL m_callback_reached
DWORD WINAPI WNetGetCachedPassword(LPSTR pbResource, WORD cbResource, LPSTR pbPassword, LPWORD pcbPassword, BYTE nType)
UINT WINAPI WNetRemoveCachedPassword(LPSTR pbResource, WORD cbResource, BYTE nType)
UINT WINAPI WNetEnumCachedPasswords(LPSTR pbPrefix, WORD cbPrefix, BYTE nType, ENUMPASSWORDPROC enumPasswordProc, DWORD param)
DWORD WINAPI WNetCachePassword(LPSTR pbResource, WORD cbResource, LPSTR pbPassword, WORD cbPassword, BYTE nType, WORD x)
#define offsetof(TYPE, MEMBER)
#define ERROR_ALREADY_ASSIGNED
#define RESOURCEUSAGE_CONNECTABLE
#define RESOURCEDISPLAYTYPE_SHARE
#define REMOTE_NAME_INFO_LEVEL
struct _NETRESOURCEA NETRESOURCEA
#define RESOURCETYPE_DISK
#define UNIVERSAL_NAME_INFO_LEVEL
#define WN_NO_NET_OR_BAD_PATH
DWORD WINAPI WNetUseConnectionA(HWND hwndOwner, NETRESOURCEA *resource, LPCSTR password, LPCSTR userid, DWORD flags, LPSTR accessname, DWORD *buffer_size, DWORD *result)
DWORD WINAPI WNetCancelConnectionA(LPCSTR lpName, BOOL fForce)
DWORD WINAPI WNetGetUniversalNameW(LPCWSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize)
DWORD WINAPI WNetGetUniversalNameA(LPCSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize)