2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
16 #include "wine/exception.h"
17 #include "msvcrt/excpt.h"
18 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(win32);
22 /* filter for page-fault exceptions */
23 static WINE_EXCEPTION_FILTER(page_fault)
25 if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
26 return EXCEPTION_EXECUTE_HANDLER;
27 return EXCEPTION_CONTINUE_SEARCH;
30 /***********************************************************************
31 * GetComputerNameA (KERNEL32.@)
33 BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
35 /* At least Win95OSR2 survives if size is not a pointer (NT crashes though) */
40 TRACE("*size = %ld\n", *size);
41 ret = (gethostname(host_name, sizeof(host_name)) != -1);
44 lstrcpynA(name, host_name, *size);
48 WARN("gethostname: %s\n", strerror(errno));
52 SetLastError( ERROR_INVALID_PARAMETER );
57 TRACE("returning (%ld) %s\n", *size, debugstr_a(name));
61 /***********************************************************************
62 * GetComputerNameW (KERNEL32.@)
64 BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
66 LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
67 BOOL ret = GetComputerNameA(nameA,size);
68 /* FIXME: should set *size in Unicode chars */
69 if (ret) MultiByteToWideChar( CP_ACP, 0, nameA, -1, name, *size+1 );
70 HeapFree( GetProcessHeap(), 0, nameA );
74 /***********************************************************************
75 * GetComputerNameExA (KERNEL32.@)
77 BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD size)
79 FIXME("(%d, %p, %p) semi-stub!\n", type, name, size);
80 return GetComputerNameA(name, size);
83 /***********************************************************************
84 * GetComputerNameExW (KERNEL32.@)
86 BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT type, LPWSTR name, LPDWORD size)
88 FIXME("(%d, %p, %p) semi-stub!\n", type, name, size);
89 return GetComputerNameW(name, size);