2 * Copyright 2002 Andriy Palamarchuk
4 * Conformance test of the workstation functions.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "wine/test.h"
30 typedef NET_API_STATUS (WINAPI
*NetpGetComputerName_func
)(LPWSTR
*Buffer
);
32 void run_get_comp_name_tests(void)
34 HANDLE hnetapi32
= GetModuleHandleA("netapi32.dll");
39 NetpGetComputerName_func pNetpGetComputerName
;
40 pNetpGetComputerName
= (NetpGetComputerName_func
)GetProcAddress(hnetapi32
,"NetpGetComputerName");
41 if (pNetpGetComputerName
)
43 ok((*pNetpGetComputerName
)(&ws
) == NERR_Success
, "Computer name is retrieved");
44 ok(ws
[0] != 0, "Some value is populated to the buffer");
50 void run_usergetinfo_tests(void)
52 LPWKSTA_USER_INFO_0 ui0
= NULL
;
53 LPWKSTA_USER_INFO_1 ui1
= NULL
;
54 LPWKSTA_USER_INFO_1101 ui1101
= NULL
;
58 ok(NetWkstaUserGetInfo(NULL
, 0, (LPBYTE
*)&ui0
) == NERR_Success
,
59 "NetWkstaUserGetInfo is successful");
60 ok(lstrlenW(ui0
->wkui0_username
) >= 1, "Buffer is not empty");
61 NetApiBufferSize(ui0
, &dwSize
);
62 ok(dwSize
>= (sizeof(WKSTA_USER_INFO_0
) +
63 lstrlenW(ui0
->wkui0_username
) * sizeof(WCHAR
)),
64 "Is allocated with NetApiBufferAllocate");
67 ok(NetWkstaUserGetInfo(NULL
, 1, (LPBYTE
*)&ui1
) == NERR_Success
,
68 "NetWkstaUserGetInfo is successful");
69 ok(lstrlenW(ui1
->wkui1_username
) >= 1, "Buffer is not empty");
70 ok(lstrcmpW(ui1
->wkui1_username
, ui0
->wkui0_username
) == 0,
71 "the same name as returned for level 0");
72 NetApiBufferSize(ui1
, &dwSize
);
73 ok(dwSize
>= (sizeof(WKSTA_USER_INFO_1
) +
74 (lstrlenW(ui1
->wkui1_username
) +
75 lstrlenW(ui1
->wkui1_logon_domain
) +
76 lstrlenW(ui1
->wkui1_oth_domains
) +
77 lstrlenW(ui1
->wkui1_logon_server
)) * sizeof(WCHAR
)),
78 "Is allocated with NetApiBufferAllocate");
81 ok(NetWkstaUserGetInfo(NULL
, 1101, (LPBYTE
*)&ui1101
) == NERR_Success
,
82 "NetWkstaUserGetInfo is successful");
83 ok(lstrcmpW(ui1101
->wkui1101_oth_domains
, ui1
->wkui1_oth_domains
) == 0,
84 "the same oth_domains as returned for level 1");
85 NetApiBufferSize(ui1101
, &dwSize
);
86 ok(dwSize
>= (sizeof(WKSTA_USER_INFO_1101
) +
87 lstrlenW(ui1101
->wkui1101_oth_domains
) * sizeof(WCHAR
)),
88 "Is allocated with NetApiBufferAllocate");
90 NetApiBufferFree(ui0
);
91 NetApiBufferFree(ui1
);
92 NetApiBufferFree(ui1101
);
95 ok(NetWkstaUserGetInfo(NULL
, 10000, (LPBYTE
*)&ui0
) == ERROR_INVALID_LEVEL
,
101 run_get_comp_name_tests();