Merge branch 'NetHack-3.6'
This commit is contained in:
@@ -1825,7 +1825,6 @@ E int NDECL(dohistory);
|
||||
E void FDECL(chdirx, (char *, BOOLEAN_P));
|
||||
#endif /* CHDIR */
|
||||
E boolean NDECL(authorize_wizard_mode);
|
||||
E boolean NDECL(is_desktop_bridge_application);
|
||||
|
||||
#endif /* MICRO || WIN32 */
|
||||
|
||||
|
||||
@@ -34,6 +34,17 @@ void win10_init()
|
||||
|
||||
FreeLibrary(hUser32);
|
||||
|
||||
HINSTANCE hKernel32 = LoadLibraryA("kernel32.dll");
|
||||
|
||||
if (hKernel32 == NULL)
|
||||
panic("Unable to load user32.dll");
|
||||
|
||||
gWin10.GetCurrentPackageFullName = (GetCurrentPackageFullNameProc) GetProcAddress(hKernel32, "GetCurrentPackageFullName");
|
||||
if (gWin10.GetCurrentPackageFullName == NULL)
|
||||
panic("Unable to get address of GetCurrentPackageFullName");
|
||||
|
||||
FreeLibrary(hKernel32);
|
||||
|
||||
gWin10.Valid = TRUE;
|
||||
}
|
||||
|
||||
@@ -80,4 +91,19 @@ void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo)
|
||||
monitorInfo->left = info.rcMonitor.left;
|
||||
monitorInfo->top = info.rcMonitor.top;
|
||||
}
|
||||
|
||||
BOOL
|
||||
win10_is_desktop_bridge_application()
|
||||
{
|
||||
if (gWin10.Valid) {
|
||||
UINT32 length = 0;
|
||||
LONG rc = gWin10.GetCurrentPackageFullName(&length, NULL);
|
||||
|
||||
return (rc == ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
@@ -11,12 +11,15 @@ typedef DPI_AWARENESS_CONTEXT(WINAPI *GetThreadDpiAwarenessContextProc)(VOID);
|
||||
typedef BOOL(WINAPI *AreDpiAwarenessContextsEqualProc)(
|
||||
DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB);
|
||||
typedef UINT(WINAPI *GetDpiForWindowProc)(HWND hwnd);
|
||||
typedef LONG (WINAPI *GetCurrentPackageFullNameProc)(UINT32 *packageFullNameLength,
|
||||
PWSTR packageFullName);
|
||||
|
||||
typedef struct {
|
||||
BOOL Valid;
|
||||
GetThreadDpiAwarenessContextProc GetThreadDpiAwarenessContext;
|
||||
AreDpiAwarenessContextsEqualProc AreDpiAwarenessContextsEqual;
|
||||
GetDpiForWindowProc GetDpiForWindow;
|
||||
GetCurrentPackageFullNameProc GetCurrentPackageFullName;
|
||||
} Win10;
|
||||
|
||||
typedef struct {
|
||||
@@ -34,6 +37,6 @@ int win10_monitor_dpi(HWND hWnd);
|
||||
double win10_monitor_scale(HWND hWnd);
|
||||
void win10_monitor_size(HWND hWnd, int * width, int * height);
|
||||
void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo);
|
||||
|
||||
BOOL win10_is_desktop_bridge_application(void);
|
||||
|
||||
#endif // WIN10_H
|
||||
|
||||
@@ -13,13 +13,6 @@
|
||||
#include <errno.h>
|
||||
#include <ShlObj.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
extern LONG GetCurrentPackageFullName(UINT32 *packageFullNameLength,
|
||||
PWSTR packageFullName);
|
||||
#else
|
||||
# include <appmodel.h>
|
||||
#endif
|
||||
|
||||
#if !defined(SAFEPROCS)
|
||||
#error You must #define SAFEPROCS to build windmain.c
|
||||
#endif
|
||||
@@ -70,15 +63,6 @@ static struct stat hbuf;
|
||||
|
||||
extern char orgdir[];
|
||||
|
||||
boolean
|
||||
is_desktop_bridge_application()
|
||||
{
|
||||
UINT32 length = 0;
|
||||
LONG rc = GetCurrentPackageFullName(&length, NULL);
|
||||
|
||||
return (rc == ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
|
||||
void
|
||||
get_known_folder_path(
|
||||
const KNOWNFOLDERID * folder_id,
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "win10.h"
|
||||
#include "winos.h"
|
||||
|
||||
#define NEED_VARARGS
|
||||
@@ -189,15 +190,20 @@ int *lan_username_size;
|
||||
{
|
||||
static TCHAR username_buffer[BUFSZ];
|
||||
DWORD i = BUFSZ - 1;
|
||||
BOOL allowUserName = TRUE;
|
||||
|
||||
Strcpy(username_buffer, "NetHack");
|
||||
|
||||
#ifndef WIN32CON
|
||||
/* Our privacy policy for the windows store version of nethack makes
|
||||
* a promise about not collecting any personally identifiable information.
|
||||
* Do not allow getting user name if we being run from windows store
|
||||
* version of nethack. In 3.7, we should remove use of username.
|
||||
*/
|
||||
if (!is_desktop_bridge_application()) {
|
||||
allowUserName = !win10_is_desktop_bridge_application();
|
||||
#endif
|
||||
|
||||
if (allowUserName) {
|
||||
/* i gets updated with actual size */
|
||||
if (GetUserName(username_buffer, &i))
|
||||
username_buffer[i] = '\0';
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;WINVER=0x0601;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
||||
Reference in New Issue
Block a user