Release 980104
[wine/multimedia.git] / win32 / init.c
blob50a44cd07a1e782e4edcf21e79163e8af262b39c
1 /*
2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
5 */
7 #include <string.h>
8 #include <stdio.h>
9 #include <unistd.h>
10 #include <stdlib.h>
11 #include "windows.h"
12 #include "winerror.h"
13 #include "except.h"
14 #include "heap.h"
15 #include "task.h"
16 #include "stddebug.h"
17 #include "debug.h"
19 /***********************************************************************
20 * GetStartupInfoA (KERNEL32.273)
22 VOID WINAPI GetStartupInfo32A(LPSTARTUPINFO32A lpStartupInfo)
24 lpStartupInfo->cb = sizeof(STARTUPINFO32A);
25 lpStartupInfo->lpReserved = "<Reserved>";
26 lpStartupInfo->lpDesktop = "Desktop";
27 lpStartupInfo->lpTitle = "Title";
29 lpStartupInfo->cbReserved2 = 0;
30 lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
31 lpStartupInfo->hStdInput = (HANDLE32)0;
32 lpStartupInfo->hStdOutput = (HANDLE32)1;
33 lpStartupInfo->hStdError = (HANDLE32)2;
36 /***********************************************************************
37 * GetStartupInfoW (KERNEL32.274)
39 VOID WINAPI GetStartupInfo32W(LPSTARTUPINFO32W lpStartupInfo)
41 lpStartupInfo->cb = sizeof(STARTUPINFO32W);
42 lpStartupInfo->lpReserved = HEAP_strdupAtoW(GetProcessHeap(),0,"<Reserved>");
43 lpStartupInfo->lpDesktop = HEAP_strdupAtoW(GetProcessHeap(), 0, "Desktop");
44 lpStartupInfo->lpTitle = HEAP_strdupAtoW(GetProcessHeap(), 0, "Title");
46 lpStartupInfo->cbReserved2 = 0;
47 lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
48 lpStartupInfo->hStdInput = (HANDLE32)0;
49 lpStartupInfo->hStdOutput = (HANDLE32)1;
50 lpStartupInfo->hStdError = (HANDLE32)2;
53 /***********************************************************************
54 * GetComputerNameA (KERNEL32.165)
56 BOOL32 WINAPI GetComputerName32A(LPSTR name,LPDWORD size)
58 if (-1==gethostname(name,*size))
59 return FALSE;
60 *size = lstrlen32A(name);
61 return TRUE;
64 /***********************************************************************
65 * GetComputerNameW (KERNEL32.166)
67 BOOL32 WINAPI GetComputerName32W(LPWSTR name,LPDWORD size)
69 LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
70 BOOL32 ret = GetComputerName32A(nameA,size);
71 if (ret) lstrcpynAtoW(name,nameA,*size);
72 HeapFree( GetProcessHeap(), 0, nameA );
73 /* FIXME : size correct? */
74 return ret;
77 /***********************************************************************
78 * GetUserNameA [ADVAPI32.67]
80 BOOL32 WINAPI GetUserName32A(LPSTR lpszName, LPDWORD lpSize)
82 size_t len;
83 char *name;
85 name=getlogin();
86 len = name ? strlen(name) : 0;
87 if (!len || !lpSize || len > *lpSize) {
88 if (lpszName) *lpszName = 0;
89 return 0;
91 *lpSize=len;
92 strcpy(lpszName, name);
93 return 1;
96 /***********************************************************************
97 * GetUserNameW [ADVAPI32.68]
99 BOOL32 WINAPI GetUserName32W(LPWSTR lpszName, LPDWORD lpSize)
101 LPSTR name = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *lpSize );
102 DWORD size = *lpSize;
103 BOOL32 res = GetUserName32A(name,lpSize);
105 lstrcpynAtoW(lpszName,name,size);
106 HeapFree( GetProcessHeap(), 0, name );
107 return res;