2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
12 #include "wine/winestring.h"
13 #include "wine/exception.h"
16 #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 * GetStartupInfoA (KERNEL32.273)
32 VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
35 LPSTARTUPINFOA startup;
37 startup = ((LPSTARTUPINFOA )PROCESS_Current()->env_db->startup_info);
38 memcpy ( lpStartupInfo, startup, sizeof (STARTUPINFOA) );
41 "\tlpReserverd: %s, lpDesktop: %s, lpTitle: %s\n"
42 "\tdwX: %ld, dwY: %ld, dwXSize: %ld, dwYSize: %ld\n"
43 "\tdwFlags: %lx, wShowWindow: %x\n", lpStartupInfo->cb,
44 debugstr_a(lpStartupInfo->lpReserved),
45 debugstr_a(lpStartupInfo->lpDesktop),
46 debugstr_a(lpStartupInfo->lpTitle),
47 lpStartupInfo->dwX, lpStartupInfo->dwY,
48 lpStartupInfo->dwXSize, lpStartupInfo->dwYSize,
49 lpStartupInfo->dwFlags, lpStartupInfo->wShowWindow );
52 /***********************************************************************
53 * GetStartupInfoW (KERNEL32.274)
55 VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
59 GetStartupInfoA ( &startup );
61 lpStartupInfo->cb = sizeof(STARTUPINFOW);
62 lpStartupInfo->lpReserved =
63 HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpReserved );
64 lpStartupInfo->lpDesktop =
65 HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpDesktop );
66 lpStartupInfo->lpTitle =
67 HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpTitle );
68 lpStartupInfo->dwX = startup.dwX;
69 lpStartupInfo->dwY = startup.dwY;
70 lpStartupInfo->dwXSize = startup.dwXSize;
71 lpStartupInfo->dwXCountChars = startup.dwXCountChars;
72 lpStartupInfo->dwYCountChars = startup.dwYCountChars;
73 lpStartupInfo->dwFillAttribute = startup.dwFillAttribute;
74 lpStartupInfo->dwFlags = startup.dwFlags;
75 lpStartupInfo->wShowWindow = startup.wShowWindow;
76 lpStartupInfo->cbReserved2 = startup.cbReserved2;
77 lpStartupInfo->lpReserved2 = startup.lpReserved2;
78 lpStartupInfo->hStdInput = startup.hStdInput;
79 lpStartupInfo->hStdOutput = startup.hStdOutput;
80 lpStartupInfo->hStdError = startup.hStdError;
83 /***********************************************************************
84 * GetComputerNameA (KERNEL32.165)
86 BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
88 /* At least Win95OSR2 survives if size is not a pointer (NT crashes though) */
92 ret = (-1!=gethostname(name,*size));
94 *size = lstrlenA(name);
98 SetLastError( ERROR_INVALID_PARAMETER );
106 /***********************************************************************
107 * GetComputerNameW (KERNEL32.166)
109 BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
111 LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
112 BOOL ret = GetComputerNameA(nameA,size);
113 if (ret) lstrcpynAtoW(name,nameA,*size+1);
114 HeapFree( GetProcessHeap(), 0, nameA );