Added missing/wrong includes.
[wine] / win32 / init.c
1 /*
2  * Win32 kernel functions
3  *
4  * Copyright 1995 Martin von Loewis and Cameron Heide
5  * 1999 Peter Ganten
6  */
7
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"
17
18 DEFAULT_DEBUG_CHANNEL(win32)
19   
20 /***********************************************************************
21  *              GetStartupInfoA         (KERNEL32.273)
22  */
23 VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
24 {
25   
26   LPSTARTUPINFOA  startup;
27
28   startup = ((LPSTARTUPINFOA )PROCESS_Current()->env_db->startup_info);
29   memcpy ( lpStartupInfo, startup, sizeof (STARTUPINFOA) );
30
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 );
40 }
41
42 /***********************************************************************
43  *              GetStartupInfoW         (KERNEL32.274)
44  */
45 VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
46 {
47
48   STARTUPINFOA startup;
49   GetStartupInfoA ( &startup );
50
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;
71 }
72
73 /***********************************************************************
74  *              GetComputerNameA         (KERNEL32.165)
75  */
76 BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
77 {
78         if (-1==gethostname(name,*size))
79                 return FALSE;
80         *size = lstrlenA(name);
81         return TRUE;
82 }
83
84 /***********************************************************************
85  *              GetComputerNameW         (KERNEL32.166)
86  */
87 BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
88 {
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;
94 }
95