2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
16 #include "wine/exception.h"
17 #include "debugtools.h"
19 DEFAULT_DEBUG_CHANNEL(win32
);
21 /* filter for page-fault exceptions */
22 static WINE_EXCEPTION_FILTER(page_fault
)
24 if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION
)
25 return EXCEPTION_EXECUTE_HANDLER
;
26 return EXCEPTION_CONTINUE_SEARCH
;
29 /***********************************************************************
30 * GetComputerNameA (KERNEL32.@)
32 BOOL WINAPI
GetComputerNameA(LPSTR name
,LPDWORD size
)
34 /* At least Win95OSR2 survives if size is not a pointer (NT crashes though) */
39 TRACE("*size = %ld\n", *size
);
40 ret
= (gethostname(host_name
, sizeof(host_name
)) != -1);
43 lstrcpynA(name
, host_name
, *size
);
47 WARN("gethostname: %s\n", strerror(errno
));
51 SetLastError( ERROR_INVALID_PARAMETER
);
56 TRACE("returning (%ld) %s\n", *size
, debugstr_a(name
));
60 /***********************************************************************
61 * GetComputerNameW (KERNEL32.@)
63 BOOL WINAPI
GetComputerNameW(LPWSTR name
,LPDWORD size
)
65 LPSTR nameA
= (LPSTR
)HeapAlloc( GetProcessHeap(), 0, *size
);
66 BOOL ret
= GetComputerNameA(nameA
,size
);
67 /* FIXME: should set *size in Unicode chars */
68 if (ret
) MultiByteToWideChar( CP_ACP
, 0, nameA
, -1, name
, *size
+1 );
69 HeapFree( GetProcessHeap(), 0, nameA
);
73 /***********************************************************************
74 * GetComputerNameExA (KERNEL32.@)
76 BOOL WINAPI
GetComputerNameExA(COMPUTER_NAME_FORMAT type
, LPSTR name
, LPDWORD size
)
78 FIXME("(%d, %p, %p) semi-stub!\n", type
, name
, size
);
79 return GetComputerNameA(name
, size
);
82 /***********************************************************************
83 * GetComputerNameExW (KERNEL32.@)
85 BOOL WINAPI
GetComputerNameExW(COMPUTER_NAME_FORMAT type
, LPWSTR name
, LPDWORD size
)
87 FIXME("(%d, %p, %p) semi-stub!\n", type
, name
, size
);
88 return GetComputerNameW(name
, size
);