From 000b180a11c3b97014709f5d268d9966b6b6f7d2 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 29 Jan 2002 18:15:11 +0000 Subject: [PATCH] Added GetComputerNameEx[AW] semi-stub. --- dlls/kernel/kernel32.spec | 3 +++ include/winbase.h | 23 ++++++++++++++++++++--- win32/init.c | 29 +++++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/dlls/kernel/kernel32.spec b/dlls/kernel/kernel32.spec index ab61bd66b39..301737ee973 100644 --- a/dlls/kernel/kernel32.spec +++ b/dlls/kernel/kernel32.spec @@ -226,6 +226,7 @@ debug_channels (comm console debugstr dll int resource stress thunk toolhelp @ stdcall DebugBreak() DebugBreak @ stdcall DefineDosDeviceA(long str str) DefineDosDeviceA @ stub DefineDosDeviceW +@ stub DelayLoadFailureHook @ stdcall DeleteAtom(long) DeleteAtom @ forward DeleteCriticalSection ntdll.RtlDeleteCriticalSection @ stdcall DeleteFileA(str) DeleteFileA @@ -336,6 +337,8 @@ debug_channels (comm console debugstr dll int resource stress thunk toolhelp @ stdcall GetCompressedFileSizeA(long ptr) GetCompressedFileSizeA @ stdcall GetCompressedFileSizeW(long ptr) GetCompressedFileSizeW @ stdcall GetComputerNameA(ptr ptr) GetComputerNameA +@ stdcall GetComputerNameExA(long ptr ptr) GetComputerNameExA +@ stdcall GetComputerNameExW(long ptr ptr) GetComputerNameExW @ stdcall GetComputerNameW(ptr ptr) GetComputerNameW @ stdcall GetConsoleCP() GetConsoleCP @ stdcall GetConsoleCursorInfo(long ptr) GetConsoleCursorInfo diff --git a/include/winbase.h b/include/winbase.h index 934a1e7de11..c7fd6ba333c 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -977,7 +977,20 @@ typedef struct tagCOMMTIMEOUTS { typedef void CALLBACK (*PAPCFUNC)(ULONG_PTR); typedef void CALLBACK (*PTIMERAPCROUTINE)(LPVOID,DWORD,DWORD); - + +typedef enum _COMPUTER_NAME_FORMAT +{ + ComputerNameNetBIOS, + ComputerNameDnsHostname, + ComputerNameDnsDomain, + ComputerNameDnsFullyQualified, + ComputerNamePhysicalNetBIOS, + ComputerNamePhysicalDnsHostname, + ComputerNamePhysicalDnsDomain, + ComputerNamePhysicalDnsFullyQualified, + ComputerNameMax +} COMPUTER_NAME_FORMAT; + /*DWORD WINAPI GetVersion( void );*/ BOOL WINAPI GetVersionExA(OSVERSIONINFOA*); BOOL WINAPI GetVersionExW(OSVERSIONINFOW*); @@ -1063,6 +1076,7 @@ BOOL WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR,LPDCB,LPCOMMTIMEOUTS); #define BuildCommDCBAndTimeouts WINELIB_NAME_AW(BuildCommDCBAndTimeouts) BOOL WINAPI CancelIo(HANDLE); BOOL WINAPI CancelWaitableTimer(HANDLE); +BOOL WINAPI CheckTokenMembership(HANDLE,PSID,PBOOL); BOOL WINAPI ClearCommBreak(HANDLE); BOOL WINAPI ClearCommError(HANDLE,LPDWORD,LPCOMSTAT); BOOL WINAPI ClearEventLogA(HANDLE,LPCSTR); @@ -1179,9 +1193,12 @@ BOOL WINAPI GetCommTimeouts(HANDLE,LPCOMMTIMEOUTS); LPSTR WINAPI GetCommandLineA(void); LPWSTR WINAPI GetCommandLineW(void); #define GetCommandLine WINELIB_NAME_AW(GetCommandLine) -BOOL WINAPI GetComputerNameA(LPSTR,LPDWORD); -BOOL WINAPI GetComputerNameW(LPWSTR,LPDWORD); +BOOL WINAPI GetComputerNameA(LPSTR,LPDWORD); +BOOL WINAPI GetComputerNameW(LPWSTR,LPDWORD); #define GetComputerName WINELIB_NAME_AW(GetComputerName) +BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT,LPSTR,LPDWORD); +BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT,LPWSTR,LPDWORD); +#define GetComputerNameEx WINELIB_NAME_AW(GetComputerNameEx) HANDLE WINAPI GetCurrentProcess(void); HANDLE WINAPI GetCurrentThread(void); BOOL WINAPI GetDefaultCommConfigA(LPCSTR,LPCOMMCONFIG,LPDWORD); diff --git a/win32/init.c b/win32/init.c index 3bc1abbeb19..43a080548b5 100644 --- a/win32/init.c +++ b/win32/init.c @@ -8,6 +8,8 @@ #include #include #include +#include + #include "winnls.h" #include "winbase.h" #include "winerror.h" @@ -33,9 +35,16 @@ BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size) BOOL ret; __TRY { - ret = (-1!=gethostname(name,*size)); - if (ret) - *size = strlen(name); + char host_name[256]; + TRACE("*size = %ld\n", *size); + ret = (gethostname(host_name, sizeof(host_name)) != -1); + if (ret) + { + lstrcpynA(name, host_name, *size); + *size = strlen(name); + } + else + WARN("gethostname: %s\n", strerror(errno)); } __EXCEPT(page_fault) { @@ -43,7 +52,8 @@ BOOL WINAPI GetComputerNameA(LPSTR name,LPDWORD size) return FALSE; } __ENDTRY - + + TRACE("returning (%ld) %s\n", *size, debugstr_a(name)); return ret; } @@ -60,3 +70,14 @@ BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size) return ret; } +BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD size) +{ + FIXME("(%d, %p, %p) semi-stub!\n", type, name, size); + return GetComputerNameA(name, size); +} + +BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT type, LPWSTR name, LPDWORD size) +{ + FIXME("(%d, %p, %p) semi-stub!\n", type, name, size); + return GetComputerNameW(name, size); +} -- 2.11.4.GIT