GetLongPathName rewrite.
[wine.git] / win32 / init.c
blob25dc05e1fd6395b06eeeb8da70ccfe10adeb4a93
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 "winerror.h"
12 #include "wine/winestring.h"
13 #include "heap.h"
14 #include "task.h"
15 #include "debugtools.h"
16 #include "process.h"
18 DEFAULT_DEBUG_CHANNEL(win32)
20 /***********************************************************************
21 * GetStartupInfoA (KERNEL32.273)
23 VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
26 LPSTARTUPINFOA startup;
28 startup = ((LPSTARTUPINFOA )PROCESS_Current()->env_db->startup_info);
29 memcpy ( lpStartupInfo, startup, sizeof (STARTUPINFOA) );
31 TRACE("size: %ld\n"
32 "\tlpReserverd: %s, lpDesktop: %s, lpTitle: %s\n"
33 "\tdwX: %ld, dwY: %ld, dwXSize: %ld, dwYSize: %ld\n"
34 "\tdwFlags: %lx, wShowWindow: %x\n", lpStartupInfo->cb,
35 lpStartupInfo->lpReserved, lpStartupInfo->lpDesktop,
36 lpStartupInfo->lpTitle, lpStartupInfo->dwX,
37 lpStartupInfo->dwY, lpStartupInfo->dwXSize,
38 lpStartupInfo->dwYSize, lpStartupInfo->dwFlags,
39 lpStartupInfo->wShowWindow );
42 /***********************************************************************
43 * GetStartupInfoW (KERNEL32.274)
45 VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
48 STARTUPINFOA startup;
49 GetStartupInfoA ( &startup );
51 lpStartupInfo->cb = sizeof(STARTUPINFOW);
52 lpStartupInfo->lpReserved =
53 HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpReserved );
54 lpStartupInfo->lpDesktop =
55 HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpDesktop );
56 lpStartupInfo->lpTitle =
57 HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpTitle );
58 lpStartupInfo->dwX = startup.dwX;
59 lpStartupInfo->dwY = startup.dwY;
60 lpStartupInfo->dwXSize = startup.dwXSize;
61 lpStartupInfo->dwXCountChars = startup.dwXCountChars;
62 lpStartupInfo->dwYCountChars = startup.dwYCountChars;
63 lpStartupInfo->dwFillAttribute = startup.dwFillAttribute;
64 lpStartupInfo->dwFlags = startup.dwFlags;
65 lpStartupInfo->wShowWindow = startup.wShowWindow;
66 lpStartupInfo->cbReserved2 = startup.cbReserved2;
67 lpStartupInfo->lpReserved2 = startup.lpReserved2;
68 lpStartupInfo->hStdInput = startup.hStdInput;
69 lpStartupInfo->hStdOutput = startup.hStdOutput;
70 lpStartupInfo->hStdError = startup.hStdError;
73 /***********************************************************************
74 * GetComputerNameA (KERNEL32.165)
76 BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
78 if (-1==gethostname(name,*size))
79 return FALSE;
80 *size = lstrlenA(name);
81 return TRUE;
84 /***********************************************************************
85 * GetComputerNameW (KERNEL32.166)
87 BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
89 LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
90 BOOL ret = GetComputerNameA(nameA,size);
91 if (ret) lstrcpynAtoW(name,nameA,*size+1);
92 HeapFree( GetProcessHeap(), 0, nameA );
93 return ret;