2 * Unit test suite for environment functions.
4 * Copyright 2002 Dmitry Timoshkov
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/test.h"
28 static BOOL (WINAPI
*pGetComputerNameExA
)(COMPUTER_NAME_FORMAT
,LPSTR
,LPDWORD
);
29 static BOOL (WINAPI
*pGetComputerNameExW
)(COMPUTER_NAME_FORMAT
,LPWSTR
,LPDWORD
);
31 static void init_functionpointers(void)
33 HMODULE hkernel32
= GetModuleHandleA("kernel32.dll");
35 pGetComputerNameExA
= (void *)GetProcAddress(hkernel32
, "GetComputerNameExA");
36 pGetComputerNameExW
= (void *)GetProcAddress(hkernel32
, "GetComputerNameExW");
39 static void test_GetSetEnvironmentVariableA(void)
44 static const char name
[] = "SomeWildName";
45 static const char name_cased
[] = "sOMEwILDnAME";
46 static const char value
[] = "SomeWildValue";
48 ret
= SetEnvironmentVariableA(name
, value
);
50 "unexpected error in SetEnvironmentVariableA, GetLastError=%d\n",
53 /* Try to retrieve the environment variable we just set */
54 ret_size
= GetEnvironmentVariableA(name
, NULL
, 0);
55 ok(ret_size
== strlen(value
) + 1,
56 "should return length with terminating 0 ret_size=%d\n", ret_size
);
59 ret_size
= GetEnvironmentVariableA(name
, buf
, lstrlenA(value
));
60 ok(lstrcmpA(buf
, "foo") == 0, "should not touch the buffer\n");
61 ok(ret_size
== strlen(value
) + 1,
62 "should return length with terminating 0 ret_size=%d\n", ret_size
);
65 ret_size
= GetEnvironmentVariableA(name
, buf
, lstrlenA(value
) + 1);
66 ok(lstrcmpA(buf
, value
) == 0, "should touch the buffer\n");
67 ok(ret_size
== strlen(value
),
68 "should return length without terminating 0 ret_size=%d\n", ret_size
);
71 ret_size
= GetEnvironmentVariableA(name_cased
, buf
, lstrlenA(value
) + 1);
72 ok(lstrcmpA(buf
, value
) == 0, "should touch the buffer\n");
73 ok(ret_size
== strlen(value
),
74 "should return length without terminating 0 ret_size=%d\n", ret_size
);
76 /* Remove that environment variable */
77 ret
= SetEnvironmentVariableA(name_cased
, NULL
);
78 ok(ret
== TRUE
, "should erase existing variable\n");
81 ret_size
= GetEnvironmentVariableA(name
, buf
, lstrlenA(value
) + 1);
82 ok(lstrcmpA(buf
, "foo") == 0, "should not touch the buffer\n");
83 ok(ret_size
== 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND
,
84 "should not find variable but ret_size=%d GetLastError=%d\n",
85 ret_size
, GetLastError());
87 /* Check behavior of SetEnvironmentVariableA(name, "") */
88 ret
= SetEnvironmentVariableA(name
, value
);
90 "unexpected error in SetEnvironmentVariableA, GetLastError=%d\n",
94 ret_size
= GetEnvironmentVariableA(name_cased
, buf
, lstrlenA(value
) + 1);
95 ok(lstrcmpA(buf
, value
) == 0, "should touch the buffer\n");
96 ok(ret_size
== strlen(value
),
97 "should return length without terminating 0 ret_size=%d\n", ret_size
);
99 ret
= SetEnvironmentVariableA(name_cased
, "");
101 "should not fail with empty value but GetLastError=%d\n", GetLastError());
103 lstrcpyA(buf
, "foo");
105 ret_size
= GetEnvironmentVariableA(name
, buf
, lstrlenA(value
) + 1);
107 ((GetLastError() == 0 && lstrcmpA(buf
, "") == 0) ||
108 (GetLastError() == ERROR_ENVVAR_NOT_FOUND
)),
109 "%s should be set to \"\" (NT) or removed (Win9x) but ret_size=%d GetLastError=%d and buf=%s\n",
110 name
, ret_size
, GetLastError(), buf
);
112 /* Test the limits */
113 ret_size
= GetEnvironmentVariableA(NULL
, NULL
, 0);
114 ok(ret_size
== 0 && (GetLastError() == ERROR_INVALID_PARAMETER
|| GetLastError() == ERROR_ENVVAR_NOT_FOUND
),
115 "should not find variable but ret_size=%d GetLastError=%d\n",
116 ret_size
, GetLastError());
118 ret_size
= GetEnvironmentVariableA(NULL
, buf
, lstrlenA(value
) + 1);
119 ok(ret_size
== 0 && (GetLastError() == ERROR_INVALID_PARAMETER
|| GetLastError() == ERROR_ENVVAR_NOT_FOUND
),
120 "should not find variable but ret_size=%d GetLastError=%d\n",
121 ret_size
, GetLastError());
123 ret_size
= GetEnvironmentVariableA("", buf
, lstrlenA(value
) + 1);
124 ok(ret_size
== 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND
,
125 "should not find variable but ret_size=%d GetLastError=%d\n",
126 ret_size
, GetLastError());
129 static void test_GetSetEnvironmentVariableW(void)
134 static const WCHAR name
[] = {'S','o','m','e','W','i','l','d','N','a','m','e',0};
135 static const WCHAR value
[] = {'S','o','m','e','W','i','l','d','V','a','l','u','e',0};
136 static const WCHAR name_cased
[] = {'s','O','M','E','w','I','L','D','n','A','M','E',0};
137 static const WCHAR empty_strW
[] = { 0 };
138 static const WCHAR fooW
[] = {'f','o','o',0};
140 ret
= SetEnvironmentVariableW(name
, value
);
141 if (ret
== FALSE
&& GetLastError()==ERROR_CALL_NOT_IMPLEMENTED
)
143 /* Must be Win9x which doesn't support the Unicode functions */
144 skip("SetEnvironmentVariableW is not implemented\n");
148 "unexpected error in SetEnvironmentVariableW, GetLastError=%d\n",
151 /* Try to retrieve the environment variable we just set */
152 ret_size
= GetEnvironmentVariableW(name
, NULL
, 0);
153 ok(ret_size
== lstrlenW(value
) + 1,
154 "should return length with terminating 0 ret_size=%d\n",
158 ret_size
= GetEnvironmentVariableW(name
, buf
, lstrlenW(value
));
159 ok(lstrcmpW(buf
, fooW
) == 0, "should not touch the buffer\n");
161 ok(ret_size
== lstrlenW(value
) + 1,
162 "should return length with terminating 0 ret_size=%d\n", ret_size
);
165 ret_size
= GetEnvironmentVariableW(name
, buf
, lstrlenW(value
) + 1);
166 ok(lstrcmpW(buf
, value
) == 0, "should touch the buffer\n");
167 ok(ret_size
== lstrlenW(value
),
168 "should return length without terminating 0 ret_size=%d\n", ret_size
);
171 ret_size
= GetEnvironmentVariableW(name_cased
, buf
, lstrlenW(value
) + 1);
172 ok(lstrcmpW(buf
, value
) == 0, "should touch the buffer\n");
173 ok(ret_size
== lstrlenW(value
),
174 "should return length without terminating 0 ret_size=%d\n", ret_size
);
176 /* Remove that environment variable */
177 ret
= SetEnvironmentVariableW(name_cased
, NULL
);
178 ok(ret
== TRUE
, "should erase existing variable\n");
181 ret_size
= GetEnvironmentVariableW(name
, buf
, lstrlenW(value
) + 1);
182 ok(lstrcmpW(buf
, fooW
) == 0, "should not touch the buffer\n");
183 ok(ret_size
== 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND
,
184 "should not find variable but ret_size=%d GetLastError=%d\n",
185 ret_size
, GetLastError());
187 /* Check behavior of SetEnvironmentVariableW(name, "") */
188 ret
= SetEnvironmentVariableW(name
, value
);
190 "unexpected error in SetEnvironmentVariableW, GetLastError=%d\n",
194 ret_size
= GetEnvironmentVariableW(name
, buf
, lstrlenW(value
) + 1);
195 ok(lstrcmpW(buf
, value
) == 0, "should touch the buffer\n");
196 ok(ret_size
== lstrlenW(value
),
197 "should return length without terminating 0 ret_size=%d\n", ret_size
);
199 ret
= SetEnvironmentVariableW(name_cased
, empty_strW
);
200 ok(ret
== TRUE
, "should not fail with empty value but GetLastError=%d\n", GetLastError());
203 ret_size
= GetEnvironmentVariableW(name
, buf
, lstrlenW(value
) + 1);
204 ok(ret_size
== 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND
,
205 "should not find variable but ret_size=%d GetLastError=%d\n",
206 ret_size
, GetLastError());
207 ok(lstrcmpW(buf
, empty_strW
) == 0, "should copy an empty string\n");
209 /* Test the limits */
210 ret_size
= GetEnvironmentVariableW(NULL
, NULL
, 0);
211 ok(ret_size
== 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND
,
212 "should not find variable but ret_size=%d GetLastError=%d\n",
213 ret_size
, GetLastError());
215 if (0) /* Both tests crash on Vista */
217 ret_size
= GetEnvironmentVariableW(NULL
, buf
, lstrlenW(value
) + 1);
218 ok(ret_size
== 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND
,
219 "should not find variable but ret_size=%d GetLastError=%d\n",
220 ret_size
, GetLastError());
222 ret
= SetEnvironmentVariableW(NULL
, NULL
);
223 ok(ret
== FALSE
&& (GetLastError() == ERROR_INVALID_PARAMETER
|| GetLastError() == ERROR_ENVVAR_NOT_FOUND
),
224 "should fail with NULL, NULL but ret=%d and GetLastError=%d\n",
225 ret
, GetLastError());
229 static void test_ExpandEnvironmentStringsA(void)
231 const char* value
="Long long value";
232 const char* not_an_env_var
="%NotAnEnvVar%";
233 char buf
[256], buf1
[256], buf2
[0x8000];
234 DWORD ret_size
, ret_size1
;
236 SetEnvironmentVariableA("EnvVar", value
);
238 ret_size
= ExpandEnvironmentStringsA(NULL
, buf1
, sizeof(buf1
));
239 ok(ret_size
== 1 || ret_size
== 0 /* Win9x */,
240 "ExpandEnvironmentStrings returned %d\n", ret_size
);
242 /* Try to get the required buffer size 'the natural way' */
243 strcpy(buf
, "%EnvVar%");
244 ret_size
= ExpandEnvironmentStringsA(buf
, NULL
, 0);
245 ok(ret_size
== strlen(value
)+1 || /* win98 */
246 ret_size
== strlen(value
)+2 || /* win2k, XP, win2k3 */
247 ret_size
== 0 /* Win95 */,
248 "ExpandEnvironmentStrings returned %d instead of %d, %d or %d\n",
249 ret_size
, lstrlenA(value
)+1, lstrlenA(value
)+2, 0);
251 /* Again, side-stepping the Win95 bug */
252 ret_size
= ExpandEnvironmentStringsA(buf
, buf1
, 0);
253 /* v5.1.2600.2945 (XP SP2) returns len + 2 here! */
254 ok(ret_size
== strlen(value
)+1 || ret_size
== strlen(value
)+2,
255 "ExpandEnvironmentStrings returned %d instead of %d\n",
256 ret_size
, lstrlenA(value
)+1);
258 /* Try with a buffer that's too small */
259 ret_size
= ExpandEnvironmentStringsA(buf
, buf1
, 12);
260 /* v5.1.2600.2945 (XP SP2) returns len + 2 here! */
261 ok(ret_size
== strlen(value
)+1 || ret_size
== strlen(value
)+2,
262 "ExpandEnvironmentStrings returned %d instead of %d\n",
263 ret_size
, lstrlenA(value
)+1);
265 /* Try with a buffer of just the right size */
266 /* v5.1.2600.2945 (XP SP2) needs and returns len + 2 here! */
267 ret_size
= ExpandEnvironmentStringsA(buf
, buf1
, ret_size
);
268 ok(ret_size
== strlen(value
)+1 || ret_size
== strlen(value
)+2,
269 "ExpandEnvironmentStrings returned %d instead of %d\n",
270 ret_size
, lstrlenA(value
)+1);
271 ok(!strcmp(buf1
, value
), "ExpandEnvironmentStrings returned [%s]\n", buf1
);
273 /* Try with an unset environment variable */
274 strcpy(buf
, not_an_env_var
);
275 ret_size
= ExpandEnvironmentStringsA(buf
, buf1
, sizeof(buf1
));
276 ok(ret_size
== strlen(not_an_env_var
)+1, "ExpandEnvironmentStrings returned %d instead of %d\n", ret_size
, lstrlenA(value
)+1);
277 ok(!strcmp(buf1
, not_an_env_var
), "ExpandEnvironmentStrings returned [%s]\n", buf1
);
279 /* test a large destination size */
280 strcpy(buf
, "12345");
281 ret_size
= ExpandEnvironmentStringsA(buf
, buf2
, sizeof(buf2
));
282 ok(!strcmp(buf
, buf2
), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %d\n", buf
, buf2
, ret_size
);
284 ret_size1
= GetWindowsDirectoryA(buf1
,256);
285 ok ((ret_size1
>0) && (ret_size1
<256), "GetWindowsDirectory Failed\n");
286 ret_size
= ExpandEnvironmentStringsA("%SystemRoot%",buf
,sizeof(buf
));
287 if (ERROR_ENVVAR_NOT_FOUND
!= GetLastError())
289 ok(!strcmp(buf
, buf1
), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %d\n", buf
, buf1
, ret_size
);
292 /* Try with a variable that references another */
293 SetEnvironmentVariableA("IndirectVar", "Foo%EnvVar%Bar");
294 strcpy(buf
, "Indirect-%IndirectVar%-Indirect");
295 strcpy(buf2
, "Indirect-Foo%EnvVar%Bar-Indirect");
296 ret_size
= ExpandEnvironmentStringsA(buf
, buf1
, sizeof(buf1
));
297 ok(ret_size
== strlen(buf2
)+1, "ExpandEnvironmentStrings returned %d instead of %d\n", ret_size
, lstrlen(buf2
)+1);
298 ok(!strcmp(buf1
, buf2
), "ExpandEnvironmentStrings returned [%s]\n", buf1
);
299 SetEnvironmentVariableA("IndirectVar", NULL
);
301 SetEnvironmentVariableA("EnvVar", NULL
);
304 static void test_GetComputerName(void)
314 ret
= GetComputerNameA((LPSTR
)0xdeadbeef, &size
);
315 error
= GetLastError();
317 ok(!ret
&& error
== ERROR_BUFFER_OVERFLOW
, "GetComputerNameA should have failed with ERROR_BUFFER_OVERFLOW instead of %d\n", error
);
319 /* Only Vista returns the computer name length as documented in the MSDN */
322 size
++; /* nul terminating character */
323 name
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(name
[0]));
324 ok(name
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
325 ret
= GetComputerNameA(name
, &size
);
326 ok(ret
, "GetComputerNameA failed with error %d\n", GetLastError());
327 HeapFree(GetProcessHeap(), 0, name
);
330 size
= MAX_COMPUTERNAME_LENGTH
+ 1;
331 name
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(name
[0]));
332 ok(name
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
333 ret
= GetComputerNameA(name
, &size
);
334 ok(ret
, "GetComputerNameA failed with error %d\n", GetLastError());
335 trace("computer name is \"%s\"\n", name
);
336 name_len
= strlen(name
);
337 ok(size
== name_len
, "size should be same as length, name_len=%d, size=%d\n", name_len
, size
);
338 HeapFree(GetProcessHeap(), 0, name
);
341 SetLastError(0xdeadbeef);
342 ret
= GetComputerNameW((LPWSTR
)0xdeadbeef, &size
);
343 error
= GetLastError();
344 if (error
== ERROR_CALL_NOT_IMPLEMENTED
)
345 skip("GetComputerNameW is not implemented\n");
349 ok(!ret
&& error
== ERROR_BUFFER_OVERFLOW
, "GetComputerNameW should have failed with ERROR_BUFFER_OVERFLOW instead of %d\n", error
);
350 size
++; /* nul terminating character */
351 nameW
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(nameW
[0]));
352 ok(nameW
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
353 ret
= GetComputerNameW(nameW
, &size
);
354 ok(ret
, "GetComputerNameW failed with error %d\n", GetLastError());
355 HeapFree(GetProcessHeap(), 0, nameW
);
359 static void test_GetComputerNameExA(void)
366 static const int MAX_COMP_NAME
= 32767;
368 if (!pGetComputerNameExA
)
370 skip("GetComputerNameExA function not implemented\n");
375 ret
= pGetComputerNameExA(ComputerNameDnsDomain
, (LPSTR
)0xdeadbeef, &size
);
376 error
= GetLastError();
377 ok(ret
== 0, "Expected 0, got %d\n", ret
);
378 ok(error
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", error
);
380 /* size is not set in win2k */
381 size
= MAX_COMP_NAME
;
382 name
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(name
[0]));
383 ok(name
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
384 ret
= pGetComputerNameExA(ComputerNameDnsDomain
, name
, &size
);
385 ok(ret
, "GetComputerNameExA(ComputerNameDnsDomain) failed with error %d\n", GetLastError());
386 trace("domain name is \"%s\"\n", name
);
387 HeapFree(GetProcessHeap(), 0, name
);
390 ret
= pGetComputerNameExA(ComputerNameDnsFullyQualified
, (LPSTR
)0xdeadbeef, &size
);
391 error
= GetLastError();
392 ok(ret
== 0, "Expected 0, got %d\n", ret
);
393 ok(error
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", error
);
395 /* size is not set in win2k */
396 size
= MAX_COMP_NAME
;
397 name
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(name
[0]));
398 ok(name
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
399 ret
= pGetComputerNameExA(ComputerNameDnsFullyQualified
, name
, &size
);
400 ok(ret
, "GetComputerNameExA(ComputerNameDnsFullyQualified) failed with error %d\n", GetLastError());
401 trace("fully qualified hostname is \"%s\"\n", name
);
402 HeapFree(GetProcessHeap(), 0, name
);
405 ret
= pGetComputerNameExA(ComputerNameDnsHostname
, (LPSTR
)0xdeadbeef, &size
);
406 error
= GetLastError();
407 ok(ret
== 0, "Expected 0, got %d\n", ret
);
408 ok(error
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", error
);
410 /* size is not set in win2k */
411 size
= MAX_COMP_NAME
;
412 name
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(name
[0]));
413 ok(name
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
414 ret
= pGetComputerNameExA(ComputerNameDnsHostname
, name
, &size
);
415 ok(ret
, "GetComputerNameExA(ComputerNameDnsHostname) failed with error %d\n", GetLastError());
416 trace("hostname is \"%s\"\n", name
);
417 HeapFree(GetProcessHeap(), 0, name
);
420 ret
= pGetComputerNameExA(ComputerNameNetBIOS
, (LPSTR
)0xdeadbeef, &size
);
421 error
= GetLastError();
422 ok(ret
== 0, "Expected 0, got %d\n", ret
);
423 ok(error
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", error
);
425 /* size is not set in win2k */
426 size
= MAX_COMP_NAME
;
427 name
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(name
[0]));
428 ok(name
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
429 ret
= pGetComputerNameExA(ComputerNameNetBIOS
, name
, &size
);
430 ok(ret
, "GetComputerNameExA(ComputerNameNetBIOS) failed with error %d\n", GetLastError());
431 trace("NetBIOS name is \"%s\"\n", name
);
432 HeapFree(GetProcessHeap(), 0, name
);
435 static void test_GetComputerNameExW(void)
442 if (!pGetComputerNameExW
)
444 skip("GetComputerNameExW function not implemented\n");
449 ret
= pGetComputerNameExW(ComputerNameDnsDomain
, (LPWSTR
)0xdeadbeef, &size
);
450 error
= GetLastError();
451 ok(!ret
&& error
== ERROR_MORE_DATA
, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error
);
452 nameW
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(nameW
[0]));
453 ok(nameW
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
454 ret
= pGetComputerNameExW(ComputerNameDnsDomain
, nameW
, &size
);
455 ok(ret
, "GetComputerNameExW(ComputerNameDnsDomain) failed with error %d\n", GetLastError());
456 HeapFree(GetProcessHeap(), 0, nameW
);
459 ret
= pGetComputerNameExW(ComputerNameDnsFullyQualified
, (LPWSTR
)0xdeadbeef, &size
);
460 error
= GetLastError();
461 ok(!ret
&& error
== ERROR_MORE_DATA
, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error
);
462 nameW
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(nameW
[0]));
463 ok(nameW
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
464 ret
= pGetComputerNameExW(ComputerNameDnsFullyQualified
, nameW
, &size
);
465 ok(ret
, "GetComputerNameExW(ComputerNameDnsFullyQualified) failed with error %d\n", GetLastError());
466 HeapFree(GetProcessHeap(), 0, nameW
);
469 ret
= pGetComputerNameExW(ComputerNameDnsHostname
, (LPWSTR
)0xdeadbeef, &size
);
470 error
= GetLastError();
471 ok(!ret
&& error
== ERROR_MORE_DATA
, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error
);
472 nameW
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(nameW
[0]));
473 ok(nameW
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
474 ret
= pGetComputerNameExW(ComputerNameDnsHostname
, nameW
, &size
);
475 ok(ret
, "GetComputerNameExW(ComputerNameDnsHostname) failed with error %d\n", GetLastError());
476 HeapFree(GetProcessHeap(), 0, nameW
);
479 ret
= pGetComputerNameExW(ComputerNameNetBIOS
, (LPWSTR
)0xdeadbeef, &size
);
480 error
= GetLastError();
481 ok(!ret
&& error
== ERROR_MORE_DATA
, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error
);
482 nameW
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(nameW
[0]));
483 ok(nameW
!= NULL
, "HeapAlloc failed with error %d\n", GetLastError());
484 ret
= pGetComputerNameExW(ComputerNameNetBIOS
, nameW
, &size
);
485 ok(ret
, "GetComputerNameExW(ComputerNameNetBIOS) failed with error %d\n", GetLastError());
486 HeapFree(GetProcessHeap(), 0, nameW
);
491 init_functionpointers();
493 test_GetSetEnvironmentVariableA();
494 test_GetSetEnvironmentVariableW();
495 test_ExpandEnvironmentStringsA();
496 test_GetComputerName();
497 test_GetComputerNameExA();
498 test_GetComputerNameExW();