version.h is now in include/wine directory.
[wine/multimedia.git] / win32 / init.c
blobb65b1fe8c19ef94bc84dba564e0b44c1156c1933
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 <errno.h>
13 #include "winnls.h"
14 #include "winbase.h"
15 #include "winerror.h"
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) */
35 BOOL ret;
36 __TRY
38 char host_name[256];
39 TRACE("*size = %ld\n", *size);
40 ret = (gethostname(host_name, sizeof(host_name)) != -1);
41 if (ret)
43 lstrcpynA(name, host_name, *size);
44 *size = strlen(name);
46 else
47 WARN("gethostname: %s\n", strerror(errno));
49 __EXCEPT(page_fault)
51 SetLastError( ERROR_INVALID_PARAMETER );
52 return FALSE;
54 __ENDTRY
56 TRACE("returning (%ld) %s\n", *size, debugstr_a(name));
57 return ret;
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 );
70 return ret;
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);