Direct3D header update.
[wine.git] / win32 / init.c
blob3bc1abbeb19cae391af13b471a6ea2b1f772e7ec
1 /*
2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
5 * 1999 Peter Ganten
6 */
8 #include <string.h>
9 #include <unistd.h>
10 #include <stdlib.h>
11 #include "winnls.h"
12 #include "winbase.h"
13 #include "winerror.h"
14 #include "wine/exception.h"
15 #include "debugtools.h"
17 DEFAULT_DEBUG_CHANNEL(win32);
19 /* filter for page-fault exceptions */
20 static WINE_EXCEPTION_FILTER(page_fault)
22 if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
23 return EXCEPTION_EXECUTE_HANDLER;
24 return EXCEPTION_CONTINUE_SEARCH;
27 /***********************************************************************
28 * GetComputerNameA (KERNEL32.@)
30 BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
32 /* At least Win95OSR2 survives if size is not a pointer (NT crashes though) */
33 BOOL ret;
34 __TRY
36 ret = (-1!=gethostname(name,*size));
37 if (ret)
38 *size = strlen(name);
40 __EXCEPT(page_fault)
42 SetLastError( ERROR_INVALID_PARAMETER );
43 return FALSE;
45 __ENDTRY
47 return ret;
50 /***********************************************************************
51 * GetComputerNameW (KERNEL32.@)
53 BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
55 LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
56 BOOL ret = GetComputerNameA(nameA,size);
57 /* FIXME: should set *size in Unicode chars */
58 if (ret) MultiByteToWideChar( CP_ACP, 0, nameA, -1, name, *size+1 );
59 HeapFree( GetProcessHeap(), 0, nameA );
60 return ret;