Change GetStartupInfoA/W to return the real StartupInfo.
[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 "except.h"
14 #include "heap.h"
15 #include "task.h"
16 #include "debug.h"
17 #include "process.h"
18   
19 /***********************************************************************
20  *              GetStartupInfoA         (KERNEL32.273)
21  */
22 VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
23 {
24   
25   LPSTARTUPINFOA  startup;
26
27   startup = ((LPSTARTUPINFOA )PROCESS_Current()->env_db->startup_info);
28   memcpy ( lpStartupInfo, startup, sizeof (STARTUPINFOA) );
29
30   TRACE ( win32, "size: %ld\n"
31           "\tlpReserverd: %s, lpDesktop: %s, lpTitle: %s\n"
32           "\tdwX: %ld, dwY: %ld, dwXSize: %ld, dwYSize: %ld\n"
33           "\tdwFlags: %lx, wShowWindow: %x\n", lpStartupInfo->cb, 
34           lpStartupInfo->lpReserved, lpStartupInfo->lpDesktop, 
35           lpStartupInfo->lpTitle, lpStartupInfo->dwX, 
36           lpStartupInfo->dwY, lpStartupInfo->dwXSize, 
37           lpStartupInfo->dwYSize, lpStartupInfo->dwFlags, 
38           lpStartupInfo->wShowWindow );
39 }
40
41 /***********************************************************************
42  *              GetStartupInfoW         (KERNEL32.274)
43  */
44 VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
45 {
46
47   STARTUPINFOA startup;
48   GetStartupInfoA ( &startup );
49
50   lpStartupInfo->cb = sizeof(STARTUPINFOW);
51   lpStartupInfo->lpReserved = 
52     HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpReserved );
53   lpStartupInfo->lpDesktop = 
54     HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpDesktop );
55   lpStartupInfo->lpTitle = 
56     HEAP_strdupAtoW (GetProcessHeap(), 0, startup.lpTitle );
57   lpStartupInfo->dwX = startup.dwX;
58   lpStartupInfo->dwY = startup.dwY;
59   lpStartupInfo->dwXSize = startup.dwXSize;
60   lpStartupInfo->dwXCountChars = startup.dwXCountChars;
61   lpStartupInfo->dwYCountChars = startup.dwYCountChars;
62   lpStartupInfo->dwFillAttribute = startup.dwFillAttribute;
63   lpStartupInfo->dwFlags = startup.dwFlags;
64   lpStartupInfo->wShowWindow = startup.wShowWindow;
65   lpStartupInfo->cbReserved2 = startup.cbReserved2;
66   lpStartupInfo->lpReserved2 = startup.lpReserved2;
67   lpStartupInfo->hStdInput = startup.hStdInput;
68   lpStartupInfo->hStdOutput = startup.hStdOutput;
69   lpStartupInfo->hStdError = startup.hStdError;
70 }
71
72 /***********************************************************************
73  *              GetComputerNameA         (KERNEL32.165)
74  */
75 BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
76 {
77         if (-1==gethostname(name,*size))
78                 return FALSE;
79         *size = lstrlenA(name);
80         return TRUE;
81 }
82
83 /***********************************************************************
84  *              GetComputerNameW         (KERNEL32.166)
85  */
86 BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
87 {
88     LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
89     BOOL ret = GetComputerNameA(nameA,size);
90     if (ret) lstrcpynAtoW(name,nameA,*size+1);
91     HeapFree( GetProcessHeap(), 0, nameA );
92     return ret;
93 }
94