In search of meaningful error messages and some housekeeping on the stubs file.
[reactos.git] / reactos / lib / kernel32 / misc / getname.c
1 /* $Id: getname.c,v 1.1 2002/12/06 13:14:14 robd Exp $
2 *
3 */
4 #include <windows.h>
5
6
7 WINBOOL
8 STDCALL
9 GetComputerNameW(LPWSTR lpBuffer, LPDWORD nSize)
10 {
11 WCHAR Name[MAX_COMPUTERNAME_LENGTH + 1];
12 DWORD Size = 0;
13
14 /*
15 * FIXME: get the computer's name from the registry.
16 */
17 lstrcpyW(Name, L"ROSHost"); /* <-- FIXME -- */
18 Size = lstrlenW(Name) + 1;
19 if (Size > *nSize) {
20 *nSize = Size;
21 SetLastError(ERROR_BUFFER_OVERFLOW);
22 return FALSE;
23 }
24 lstrcpyW(lpBuffer, Name);
25 return TRUE;
26 }
27
28
29 WINBOOL
30 STDCALL
31 GetComputerNameA(LPSTR lpBuffer, LPDWORD nSize)
32 {
33 WCHAR Name[MAX_COMPUTERNAME_LENGTH + 1];
34 int i;
35
36 if (FALSE == GetComputerNameW(Name, nSize)) {
37 return FALSE;
38 }
39
40 /* FIXME --> */
41 /* Use UNICODE to ANSI */
42 for (i = 0; Name[i]; ++i) {
43 lpBuffer[i] = (CHAR)Name[i];
44 }
45 lpBuffer[i] = '\0';
46 /* FIXME <-- */
47
48 return TRUE;
49 }