Merge branch 'NetHack-3.6.2'
This commit is contained in:
@@ -129,9 +129,13 @@ OBJ = o
|
||||
# (see pcconf.h). Set to nothing if not used.
|
||||
#
|
||||
|
||||
RANDOM = $(OBJ)\random.o
|
||||
RANDOM = $(OBJ)\isaac64.o
|
||||
#RANDOM = $(OBJ)\random.o
|
||||
#RANDOM =
|
||||
|
||||
BCRYPT=
|
||||
! IF ("$(RANDOM)"=="$(OBJ)\isaac64.o")
|
||||
BCRYPT=bcrypt.lib
|
||||
! ENDIF
|
||||
WINPFLAG= -DTILES -DMSWIN_GRAPHICS -DWIN32CON
|
||||
|
||||
# To store all the level files,
|
||||
@@ -460,7 +464,8 @@ CURSESLIB=
|
||||
|
||||
ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \
|
||||
-D"_LIB" -D"_SCL_SECURE_NO_DEPRECATE" -D"_VC80_UPGRADE=0x0600" -D"DLB" -D"_MBCS" \
|
||||
-DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" $(CURSESDEF) \
|
||||
-DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" \
|
||||
-DHAS_STDINT_H -DHAS_INLINE $(CURSESDEF) \
|
||||
-EHsc -fp:precise -Gd -GF -GS -Gy \
|
||||
$(CL_RECENT) -WX- -Zc:forScope -Zc:wchar_t -Zi
|
||||
cdebug= -analyze- -D"_DEBUG" -Gm -MTd -RTC1 -Od
|
||||
@@ -801,7 +806,7 @@ $(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)gu
|
||||
@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
|
||||
@echo Linking $(@:\=/)
|
||||
$(link) $(lflagsBuild) $(conlflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB /MAP:$(O)$(@B).MAP \
|
||||
$(LIBS) $(PDCLIB) $(conlibs) -out:$@ @<<$(@B).lnk
|
||||
$(LIBS) $(PDCLIB) $(conlibs) $(BCRYPT) -out:$@ @<<$(@B).lnk
|
||||
$(GAMEOBJ)
|
||||
$(TTYOBJ)
|
||||
$(O)nttty.o
|
||||
@@ -824,7 +829,7 @@ $(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \
|
||||
@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
|
||||
@echo Linking $(@:\=/)
|
||||
$(link) $(lflagsBuild) $(guilflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB \
|
||||
/MAP:$(O)$(@B).MAP $(LIBS) $(PDCLIB) $(guilibs) $(COMCTRL) -out:$@ @<<$(@B).lnk
|
||||
/MAP:$(O)$(@B).MAP $(LIBS) $(PDCLIB) $(guilibs) $(COMCTRL) $(BCRYPT) -out:$@ @<<$(@B).lnk
|
||||
$(GAMEOBJ)
|
||||
$(GUIOBJ)
|
||||
$(O)tile.o
|
||||
@@ -1514,6 +1519,8 @@ $(O)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h
|
||||
@$(CC) $(cflagsBuild) -Fo$@ ..\sys\atari\tos.c
|
||||
$(O)pctty.o: ..\sys\share\pctty.c $(HACK_H)
|
||||
@$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\pctty.c
|
||||
$(O)isaac64.o: ..\src\isaac64.c $(HACK_H) $(INCL)\isaac64.h $(INCL)\integer.h
|
||||
@$(CC) $(cflagsBuild) -Fo$@ ..\src\isaac64.c
|
||||
$(O)random.o: ..\sys\share\random.c $(HACK_H)
|
||||
@$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\random.c
|
||||
$(O)ioctl.o: ..\sys\share\ioctl.c $(HACK_H) $(INCL)\tcap.h
|
||||
|
||||
@@ -680,6 +680,54 @@ char *name;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#include <bcrypt.h> /* Windows Crypto Next Gen (CNG) */
|
||||
|
||||
#ifndef STATUS_SUCCESS
|
||||
#define STATUS_SUCCESS 0
|
||||
#endif
|
||||
#ifndef STATUS_NOT_FOUND
|
||||
#define STATUS_NOT_FOUND 0xC0000225
|
||||
#endif
|
||||
#ifndef STATUS_UNSUCCESSFUL
|
||||
#define STATUS_UNSUCCESSFUL 0xC0000001
|
||||
#endif
|
||||
|
||||
unsigned long
|
||||
sys_random_seed(VOID_ARGS)
|
||||
{
|
||||
unsigned long ourseed = 0UL;
|
||||
BCRYPT_ALG_HANDLE hRa = (BCRYPT_ALG_HANDLE) 0;
|
||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||
boolean Plan_B = TRUE;
|
||||
|
||||
status = BCryptOpenAlgorithmProvider(&hRa, BCRYPT_RNG_ALGORITHM,
|
||||
(LPCWSTR) 0, 0);
|
||||
if (hRa && status == STATUS_SUCCESS) {
|
||||
status = BCryptGenRandom(hRa, (PUCHAR) &ourseed,
|
||||
(ULONG) sizeof ourseed, 0);
|
||||
if (status == STATUS_SUCCESS) {
|
||||
BCryptCloseAlgorithmProvider(hRa,0);
|
||||
has_strong_rngseed = TRUE;
|
||||
Plan_B = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Plan_B) {
|
||||
time_t datetime = 0;
|
||||
const char *emsg;
|
||||
|
||||
if (status == STATUS_NOT_FOUND)
|
||||
emsg = "BCRYPT_RNG_ALGORITHM not avail, falling back";
|
||||
else
|
||||
emsg = "Other failure than algorithm not avail";
|
||||
paniclog("sys_random_seed", emsg); /* leaves clue, doesn't exit */
|
||||
(void) time(&datetime);
|
||||
ourseed = (unsigned long) datetime;
|
||||
}
|
||||
return ourseed;
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*winnt.c*/
|
||||
|
||||
Reference in New Issue
Block a user