Fixed some incorrect format strings.
[wine/multimedia.git] / win32 / init.c
blob11ee01fc18a572611ed26d49a0d2af8c1c962eaa
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 "winerror.h"
13 #include "wine/exception.h"
14 #include "heap.h"
15 #include "task.h"
16 #include "debugtools.h"
18 DEFAULT_DEBUG_CHANNEL(win32);
20 /* filter for page-fault exceptions */
21 static WINE_EXCEPTION_FILTER(page_fault)
23 if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
24 return EXCEPTION_EXECUTE_HANDLER;
25 return EXCEPTION_CONTINUE_SEARCH;
28 /***********************************************************************
29 * GetComputerNameA (KERNEL32.165)
31 BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
33 /* At least Win95OSR2 survives if size is not a pointer (NT crashes though) */
34 BOOL ret;
35 __TRY
37 ret = (-1!=gethostname(name,*size));
38 if (ret)
39 *size = strlen(name);
41 __EXCEPT(page_fault)
43 SetLastError( ERROR_INVALID_PARAMETER );
44 return FALSE;
46 __ENDTRY
48 return ret;
51 /***********************************************************************
52 * GetComputerNameW (KERNEL32.166)
54 BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
56 LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
57 BOOL ret = GetComputerNameA(nameA,size);
58 /* FIXME: should set *size in Unicode chars */
59 if (ret) MultiByteToWideChar( CP_ACP, 0, nameA, -1, name, *size+1 );
60 HeapFree( GetProcessHeap(), 0, nameA );
61 return ret;