2 * Copyright 2012 Andrew Eikum for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/test.h"
27 static void test_WNetGetUniversalName(void)
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
){
37 drive_type
= GetDriveTypeW(driveW
);
39 info_size
= sizeof(buffer
);
40 ret
= WNetGetUniversalNameA(driveA
, UNIVERSAL_NAME_INFO_LEVEL
,
43 if(drive_type
== DRIVE_REMOTE
)
44 ok(ret
== WN_NO_ERROR
, "WNetGetUniversalNameA failed: %08x\n", ret
);
46 /* WN_NO_NET_OR_BAD_PATH (DRIVE_FIXED) returned from the virtual drive (usual Q:)
47 created by the microsoft application virtualization client */
48 ok((ret
== WN_NOT_CONNECTED
) || (ret
== WN_NO_NET_OR_BAD_PATH
),
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
);
55 ret
= WNetGetUniversalNameA(driveA
, UNIVERSAL_NAME_INFO_LEVEL
,
57 if(drive_type
== DRIVE_REMOTE
)
58 todo_wine
ok(ret
== WN_BAD_VALUE
, "WNetGetUniversalNameA failed: %08x\n", ret
);
60 ok(ret
== WN_NOT_CONNECTED
|| ret
== WN_NO_NET_OR_BAD_PATH
,
61 "(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA
, ret
);
63 fail_size
= sizeof(driveA
) / sizeof(char) - 1;
64 ret
= WNetGetUniversalNameA(driveA
, UNIVERSAL_NAME_INFO_LEVEL
,
66 if(drive_type
== DRIVE_REMOTE
)
67 ok(ret
== WN_MORE_DATA
, "WNetGetUniversalNameA failed: %08x\n", ret
);
69 ret
= WNetGetUniversalNameA(driveandpathA
, UNIVERSAL_NAME_INFO_LEVEL
,
71 if(drive_type
== DRIVE_REMOTE
)
72 todo_wine
ok(ret
== WN_NO_ERROR
, "WNetGetUniversalNameA failed: %08x\n", ret
);
74 info_size
= sizeof(buffer
);
75 ret
= WNetGetUniversalNameW(driveW
, UNIVERSAL_NAME_INFO_LEVEL
,
78 if(drive_type
== DRIVE_REMOTE
)
79 ok(ret
== WN_NO_ERROR
, "WNetGetUniversalNameW failed: %08x\n", ret
);
81 ok((ret
== WN_NOT_CONNECTED
) || (ret
== WN_NO_NET_OR_BAD_PATH
),
82 "WNetGetUniversalNameW(%s, ...) returned %u (drive_type: %u)\n",
83 wine_dbgstr_w(driveW
), ret
, drive_type
);
84 if(drive_type
!= DRIVE_REMOTE
)
85 ok(info_size
== sizeof(buffer
), "Got wrong size: %u\n", info_size
);
89 static void test_WNetGetRemoteName(void)
93 DWORD drive_type
, info_size
, fail_size
;
94 char driveA
[] = "A:\\";
95 char driveandpathA
[] = "A:\\file.txt";
96 WCHAR driveW
[] = {'A',':','\\',0};
98 for(; *driveA
<= 'Z'; ++*driveA
, ++*driveandpathA
, ++*driveW
){
99 drive_type
= GetDriveTypeW(driveW
);
101 info_size
= sizeof(buffer
);
102 ret
= WNetGetUniversalNameA(driveA
, REMOTE_NAME_INFO_LEVEL
,
105 if(drive_type
== DRIVE_REMOTE
)
106 ok(ret
== WN_NO_ERROR
, "WNetGetUniversalNameA failed: %08x\n", ret
);
108 ok(ret
== WN_NOT_CONNECTED
|| ret
== WN_NO_NET_OR_BAD_PATH
,
109 "(%s) WNetGetUniversalNameA gave wrong error: %u\n", driveA
, ret
);
111 ok(info_size
== sizeof(buffer
), "Got wrong size: %u\n", info_size
);
114 ret
= WNetGetUniversalNameA(driveA
, REMOTE_NAME_INFO_LEVEL
,
117 if(drive_type
== DRIVE_REMOTE
)
118 ok(ret
== WN_BAD_VALUE
, "WNetGetUniversalNameA failed: %08x\n", ret
);
120 ok(ret
== WN_NOT_CONNECTED
|| ret
== WN_NO_NET_OR_BAD_PATH
,
121 "(%s) WNetGetUniversalNameA gave wrong error: %u\n", driveA
, ret
);
123 ret
= WNetGetUniversalNameA(driveA
, REMOTE_NAME_INFO_LEVEL
,
125 todo_wine
ok(ret
== WN_BAD_POINTER
, "WNetGetUniversalNameA failed: %08x\n", ret
);
127 ret
= WNetGetUniversalNameA(driveA
, REMOTE_NAME_INFO_LEVEL
,
131 if(((GetVersion() & 0x8000ffff) == 0x00000004) || /* NT40 */
132 (drive_type
== DRIVE_REMOTE
))
133 ok(ret
== WN_BAD_POINTER
, "WNetGetUniversalNameA failed: %08x\n", ret
);
135 ok(ret
== WN_NOT_CONNECTED
|| ret
== WN_BAD_VALUE
,
136 "(%s) WNetGetUniversalNameA gave wrong error: %u\n", driveA
, ret
); }
138 fail_size
= sizeof(driveA
) / sizeof(char) - 1;
139 ret
= WNetGetUniversalNameA(driveA
, REMOTE_NAME_INFO_LEVEL
,
141 if(drive_type
== DRIVE_REMOTE
)
142 todo_wine
ok(ret
== WN_MORE_DATA
, "WNetGetUniversalNameA failed: %08x\n", ret
);
144 ret
= WNetGetUniversalNameA(driveandpathA
, REMOTE_NAME_INFO_LEVEL
,
146 if(drive_type
== DRIVE_REMOTE
)
147 todo_wine
ok(ret
== WN_NO_ERROR
, "WNetGetUniversalNameA failed: %08x\n", ret
);
149 info_size
= sizeof(buffer
);
150 ret
= WNetGetUniversalNameW(driveW
, REMOTE_NAME_INFO_LEVEL
,
153 if(drive_type
== DRIVE_REMOTE
)
154 ok(ret
== WN_NO_ERROR
, "WNetGetUniversalNameW failed: %08x\n", ret
);
156 ok(ret
== WN_NOT_CONNECTED
|| ret
== WN_NO_NET_OR_BAD_PATH
,
157 "(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA
, ret
);
159 ok(info_size
== sizeof(buffer
), "Got wrong size: %u\n", info_size
);
165 test_WNetGetUniversalName();
166 test_WNetGetRemoteName();