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