mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
Windows: GetUserNameExA(NameSamCompatible), correct test
This commit is contained in:
parent
83744f17bb
commit
d7d18dcb64
@ -87,13 +87,11 @@ pkg_search_module(TERMINFO REQUIRED tinfo>=6.1 ncursesw>=6.1)
|
||||
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND terminfo)
|
||||
set_package_properties(terminfo PROPERTIES TYPE REQUIRED)
|
||||
set(PKGCONF_REQ_PRIV "${TERMINFO_LIBRARIES}")
|
||||
if(NOT WIN32)
|
||||
if(${USE_READLINE})
|
||||
pkg_search_module(READLINE REQUIRED readline>=8.0)
|
||||
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND readline)
|
||||
set_package_properties(readline PROPERTIES TYPE REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
if(${USE_FFMPEG})
|
||||
pkg_check_modules(AVCODEC REQUIRED libavcodec>=57.0)
|
||||
pkg_check_modules(AVFORMAT REQUIRED libavformat>=57.0)
|
||||
@ -119,7 +117,7 @@ find_package(ZLIB)
|
||||
set_package_properties(ZLIB PROPERTIES TYPE REQUIRED)
|
||||
# platform-specific logics
|
||||
if(WIN32)
|
||||
set(LIBRT_LIBRARIES wsock32 ws2_32)
|
||||
set(LIBRT_LIBRARIES wsock32 ws2_32 Secur32)
|
||||
elseif(NOT APPLE)
|
||||
find_library(LIBM m REQUIRED)
|
||||
find_library(LIBRT rt REQUIRED)
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#define SECURITY_WIN32
|
||||
#include <secext.h>
|
||||
#endif
|
||||
#include "internal.h"
|
||||
|
||||
@ -24,7 +26,8 @@ char* notcurses_accountname(void){
|
||||
if(un == NULL){
|
||||
return NULL;
|
||||
}
|
||||
if(GetUserName(un, &unlen)){ // FIXME probably want GetUserNameEx
|
||||
if(!GetUserNameExA(NameSamCompatible, un, &unlen)){
|
||||
logerror("couldn't get user name\n");
|
||||
free(un);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user