Sweden-Number/win32/init.c

75 lines
2.3 KiB
C

/*
* Win32 kernel functions
*
* Copyright 1995 Martin von Loewis and Cameron Heide
*/
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include "winerror.h"
#include "wine/winestring.h"
#include "except.h"
#include "heap.h"
#include "task.h"
#include "debug.h"
/***********************************************************************
* GetStartupInfoA (KERNEL32.273)
*/
VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
{
lpStartupInfo->cb = sizeof(STARTUPINFOA);
lpStartupInfo->lpReserved = "<Reserved>";
lpStartupInfo->lpDesktop = "Desktop";
lpStartupInfo->lpTitle = "Title";
lpStartupInfo->cbReserved2 = 0;
lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
lpStartupInfo->dwFlags = STARTF_USESTDHANDLES;
lpStartupInfo->hStdInput = (HANDLE)0;
lpStartupInfo->hStdOutput = (HANDLE)1;
lpStartupInfo->hStdError = (HANDLE)2;
}
/***********************************************************************
* GetStartupInfoW (KERNEL32.274)
*/
VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
{
lpStartupInfo->cb = sizeof(STARTUPINFOW);
lpStartupInfo->lpReserved = HEAP_strdupAtoW(GetProcessHeap(),0,"<Reserved>");
lpStartupInfo->lpDesktop = HEAP_strdupAtoW(GetProcessHeap(), 0, "Desktop");
lpStartupInfo->lpTitle = HEAP_strdupAtoW(GetProcessHeap(), 0, "Title");
lpStartupInfo->cbReserved2 = 0;
lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
lpStartupInfo->hStdInput = (HANDLE)0;
lpStartupInfo->hStdOutput = (HANDLE)1;
lpStartupInfo->hStdError = (HANDLE)2;
}
/***********************************************************************
* GetComputerNameA (KERNEL32.165)
*/
BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size)
{
if (-1==gethostname(name,*size))
return FALSE;
*size = lstrlenA(name);
return TRUE;
}
/***********************************************************************
* GetComputerNameW (KERNEL32.166)
*/
BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
{
LPSTR nameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *size);
BOOL ret = GetComputerNameA(nameA,size);
if (ret) lstrcpynAtoW(name,nameA,*size+1);
HeapFree( GetProcessHeap(), 0, nameA );
return ret;
}