Ver código fonte

Compatibility 32 / 64 bit (Kernel32)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7436 8c9fc860-2736-0410-a75d-ab315db34111
felixf 7 anos atrás
pai
commit
65116e12c1

+ 67 - 1
source/Builds.Tool

@@ -96,6 +96,7 @@ Compiler.Compile -b=AMD --bits=64 --objectFile=Generic --newObjectFile  --symbol
 	Win32.WinTrace.Mod Pipes.Mod Win32.StdIO.Mod Shell.Mod StdIOShell.Mod 
 	Generic.Reflection.Mod CRC.Mod SystemVersion.Mod Win64.Traps.Mod TrapWriters.Mod
 	ProducerConsumer.Mod 
+	
 	~
 
 StaticLinker.Link --fileFormat=PE64CUI --fileName=A264.exe --extension=GofWw --displacement=401000H  
@@ -115,4 +116,69 @@ FSTools.CloseFiles A264.exe  ~
 ~ BootConsole ~		
 
 
-FoxGenericObjectFile.Show ConsumerProducer.GofWw ~	
+FoxGenericObjectFile.Show ConsumerProducer.GofWw ~	
+
+SystemTools.FreeDownTo Compiler ~
+
+Compiler.Compile -b=AMD --bits=64 --objectFile=Generic --newObjectFile  --symbolFile=Textual  --objectFileExtension=.GofWw --symbolFileExtension=.SymWw 
+	--traceModule=Trace
+
+Disks.Mod
+Locks.Mod 
+ UTF8Strings.Mod Displays.Mod Inputs.Mod Options.Mod Events.Mod EventsUtils.Mod 
+EventsKernelLog.Mod EventsFileLog.Mod EventsMemoryLog.Mod DynamicStrings.Mod XMLObjects.Mod XML.Mod 
+XMLScanner.Mod XMLParser.Mod Configuration.Mod FileHandlers.Mod BootShell.Mod ActiveTimers.Mod 
+Win32.GDI32.Mod Win32.Display.Mod Win32.WSock32.Mod Win32.Network.Mod Win32.IP.Mod Win32.DNS.Mod 
+Win32.UDP.Mod Win32.TCP.Mod Win32.CommandLine.Mod Serials.Mod SoundDevices.Mod Joysticks.Mod 
+TVDriver.Mod VirtualDisks.Mod DisplayNull.Mod Win32.V24.Mod Win32.Beep.Mod Win32.WinDisks.Mod 
+StringPool.Mod Diagnostics.Mod Debugging.Mod BitSets.Mod ObjectFile.Mod GenericLinker.Mod 
+StaticLinker.Mod FoxBasic.Mod FoxProgTools.Mod FoxScanner.Mod FoxCSharpScanner.Mod FoxSyntaxTree.Mod 
+FoxGlobal.Mod FoxActiveCells.Mod FoxHardware.Mod FoxFormats.Mod FoxFingerPrinter.Mod 
+FoxPrintout.Mod FoxParser.Mod FoxCSharpParser.Mod FoxSemanticChecker.Mod FoxBackend.Mod 
+FoxSections.Mod FoxFrontend.Mod FoxCompiler.Mod FoxOberonFrontend.Mod FoxCSharpFrontend.Mod 
+FoxInterfaceComparison.Mod FoxTextualSymbolFile.Mod FoxBinarySymbolFile.Mod FoxBinaryCode.Mod 
+FoxIntermediateCode.Mod FoxIntermediateBackend.Mod FoxCodeGenerators.Mod FoxBinaryObjectFile.Mod 
+FoxGenericObjectFile.Mod FoxAMD64InstructionSet.Mod FoxAMD64Assembler.Mod FoxAMDBackend.Mod FoxAssembler.Mod 
+FoxIntermediateAssembler.Mod FoxDisassembler.Mod FoxARMInstructionSet.Mod FoxARMAssembler.Mod FoxARMBackend.Mod 
+FoxMinosObjectFile.Mod FoxIntermediateParser.Mod FoxIntermediateObjectFile.Mod FoxIntermediateLinker.Mod 
+FoxTRMInstructionSet.Mod FoxTRMAssembler.Mod FoxTRMBackend.Mod FoxInterpreterBackend.Mod 
+FoxTranspilerBackend.Mod FoxDocumentationScanner.Mod FoxDocumentationTree.Mod FoxDocumentationPrinter.Mod 
+FoxDocumentationHtml.Mod FoxDocumentationParser.Mod FoxDocumentationBackend.Mod FoxProfiler.Mod 
+XMM.I386.Math.Mod XMM.I386.MathL.Mod ComplexNumbers.Mod FoxArrayBase.Mod 
+I386.FoxArrayBaseOptimized.Mod Errors.Mod ProcessInfo0.Mod ProcessInfo.Mod SystemTools.Mod Reboot.Mod 
+Win32.WinApplications.Mod XMM.I386.Math.Mod XMM.I386.MathL.Mod Random.Mod Drand48.Mod SerialsVirtual.Mod 
+Autostart.Mod FSTools.Mod UpTime.Mod CLUTs.Mod I386.Raster.Mod Localization.Mod Archives.Mod 
+WMRectangles.Mod WMEvents.Mod Repositories.Mod FP1616.Mod Texts.Mod UndoManager.Mod CRC.Mod Inflate.Mod 
+Unzip.Mod ZipFS.Mod Codecs.Mod UnicodeProperties.Mod ContextualDependency.Mod 
+UnicodeBidirectionality.Mod I386.WMRasterScale.Mod WMGraphics.Mod WMGraphicsSmooth.Mod TextUtilities.Mod 
+Types.Mod Models.Mod WMProperties.Mod WMMessages.Mod WMWindowManager.Mod 
+WMGraphicUtilities.Mod WMDropTarget.Mod WMComponents.Mod KernelLogger.Mod CompilerInterface.Mod 
+FoxTextCompiler.Mod PCDebug.Mod PCM.Mod PCS.Mod PCT.Mod PCBT.Mod PCLIR.Mod PCO.Mod PCG386.Mod PCC.Mod PCV.Mod 
+PCArrays.Mod PCB.Mod PCP.Mod PCA386.Mod PCOM.Mod PCOF.Mod PCOFPE.Mod PC.Mod ArrayBase.Mod 
+I386.ArrayBaseOptimized.Mod PCOARM.Mod PCARMCP.Mod PCARMRegisters.Mod PCAARM.Mod PCGARM.Mod ASMAMD64.Mod 
+PCAAMD64.Mod PCGAMD64.Mod WhitespaceRemover.Mod HostClipboard.Mod Win32.Clipboard.Mod Tar.Mod 
+Zlib.Mod ZlibBuffers.Mod ZlibDeflate.Mod ZlibInflate.Mod ZlibWriters.Mod ZlibReaders.Mod 
+Zip.Mod ZipTool.Mod BIT.Mod PNGDecoder.Mod BMPCodec.Mod GIFCodec.Mod JPEGDecoder.Mod 
+AnimationCodec.Mod PartitionsLib.Mod FATScavenger.Mod Partitions.Mod DiskTests.Mod DiskBenchmark.Mod 
+PartitionEditorTable.Mod Win32.HierarchicalProfiler0.Mod HierarchicalProfiler.Mod FTPClient.Mod XYModem.Mod 
+Shell.Mod ShellSerial.Mod Installer.Mod CryptoBigNumbers.Mod CryptoBase64.Mod CryptoUtils.Mod 
+CryptoCiphers.Mod CryptoARC4.Mod CryptoDES.Mod CryptoDES3.Mod CryptoHashes.Mod CryptoMD5.Mod 
+CryptoSHA1.Mod CryptoSHA256.Mod CryptoKeccakF1600.Mod CryptoKeccakSponge.Mod CryptoSHA3.Mod 
+CryptoCSPRNG.Mod CryptoPrimes.Mod CryptoDSA.Mod CryptoDiffieHellman.Mod CryptoAES.Mod 
+CryptoBlowfish.Mod CryptoTwofish.Mod CryptoCAST.Mod CryptoHMAC.Mod CryptoIDEA.Mod CryptoRSA.Mod 
+Checksum.Mod Fido.Mod I386.CPUID.Mod A2Sequencers.Mod PictImages.Mod V24Tracer.Mod 
+XMLGeneratorSchema.Mod CSS2.Mod CSS2Scanner.Mod CSS2Parser.Mod RAWPrinter.Mod LPR.Mod ASN1.Mod PKCS1.Mod 
+X509.Mod TLS.Mod TCPServices.Mod TestServer.Mod TCPTools.Mod Win32.Performance.Mod Bin2Hex.Mod 
+BinToCode.Mod Base64.Mod DisplayGTF.Mod GZip.Mod ShellCommands.Mod Telnet.Mod Info.Mod TFClasses.Mod 
+Mail.Mod SMTPClient.Mod TFLog.Mod WebHTTP.Mod WebHTTPClient.Mod WebHTTPTools.Mod 
+WebHTTPServer.Mod WebHTTPServerTools.Mod WebSSMPPlugin.Mod WebDefaultSSMP.Mod 
+WebHTTPServerStatistics.Mod POP3Client.Mod RFC865Client.Mod QuoteServer.Mod FTPFS.Mod WebFTPServer.Mod XModem.Mod 
+SearchTools.Mod DiffLib.Mod TextConverter.Mod TaskScheduler.Mod FTP.Mod DES.Mod VNCServer.Mod 
+WAVCodec.Mod MP3Decoder.Mod I386.IDCT.Mod AVI.Mod DivXTypes.Mod I386.DivXHelper.Mod 
+I386.DivXDecoder.Mod MPEGTables.Mod I386.MPEGUtilities.Mod MPEGVideoDecoder.Mod JPEG2000DecoderUtil.Mod 
+JPEG2000DecoderCS.Mod JPEG2000Decoder.Mod MD5.Mod HTTPSupport.Mod HTTPSession.Mod DynamicWebpage.Mod 
+DynamicWebpagePlugin.Mod PrevalenceSystem.Mod WMDropTarget.Mod GenericSort.Mod WebStd.Mod WebComplex.Mod 
+WMCharCodes.Mod HTMLScanner.Mod HTMLParser.Mod NewHTTPClient.Mod UnihanParser.Mod CSV.Mod 
+ColorModels.Mod WMDefaultWindows.Mod WMDefaultFont.Mod WMFontManager.Mod WMOberonFonts.Mod 
+WMCCGFonts.Mod WMBitmapFont.Mod OpenTypeInt.Mod OpenTypeScan.Mod OpenType.Mod OpenTypeFonts.Mod 
+WMOTFonts.Mod WindowManager.Mod  ~

+ 35 - 22
source/Generic.Win32.Kernel32.Mod

@@ -163,6 +163,7 @@ TYPE
 	HANDLE* = ADDRESS;  HMODULE* = ADDRESS;
 	HINSTANCE* = ADDRESS;  ATOM* = INTEGER;  HGLOBAL* = HANDLE;
 	LPSTR* = ADDRESS;
+	DWORD* = LONGINT;
 
 	(** The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601. *)
 	FileTime* = RECORD
@@ -171,7 +172,7 @@ TYPE
 
 	(** The FindData structure describes a file found by the FindFirstFile or FindNextFile function. *)
 	FindData* = RECORD
-		dwFileAttributes*: SET;
+		dwFileAttributes*: DWORD;
 		ftCreationTime*, ftLastAccessTime*, ftLastWriteTime*: FileTime;
 		nFileSizeHigh*, nFileSizeLow*: LONGINT;
 		dwReserved0*, dwReserved1*: LONGINT;
@@ -206,7 +207,7 @@ TYPE
 	END;
 
 	Context* = RECORD
-		ContextFlags*: SET;
+		ContextFlags*: DWORD;
 		DR0*, DR1*, DR2*, DR3*, DR6*, DR7*: LONGINT;
 		FloatSave*: FloatingSaveArea;
 		GS*, FS*, ES*, DS*: LONGINT;
@@ -280,7 +281,7 @@ TYPE
 		dwX*, dwY*, dwXSize*, dwYSize*: LONGINT;
 		dwXCountChars*, dwYCountChars*: LONGINT;
 		dwFillAttribute*: LONGINT;
-		dwFlags*: SET;
+		dwFlags*: DWORD;
 		wShowWindow*, cbReserved2*: INTEGER;
 		lpReserved2*: ADDRESS;
 		hStdInput*, hStdOutput*, hStdError*: HANDLE
@@ -303,14 +304,14 @@ TYPE
 
 	DCB* = RECORD
 		DCBlength*, BaudRate*: LONGINT;
-		flags*: SET;
+		flags*: DWORD;
 		wReserved*, XonLim*, XoffLim*: INTEGER;
 		ByteSize*, Parity*, StopBits*, XonChar*, XoffChar*, ErrorChar*, EofChar*, EvtChar*: CHAR;
 		wReserved1*: INTEGER
 	END;
 
 	ComStat* = RECORD
-		status*: SET;
+		status*: DWORD;
 		cbInQue*, cbOutQue*: LONGINT
 	END;
 
@@ -369,7 +370,7 @@ VAR
 	(** The ClearCommBreak function restores character transmission for a specified communications device and places the transmission line in a nonbreak state. *)
 	ClearCommBreak-: PROCEDURE {WINAPI} ( hFile: HANDLE ): BOOL;
 	(** The ClearCommError function retrieves information about a communications error and reports the current status of a communications device. *)
-	ClearCommError-: PROCEDURE {WINAPI} ( hFile: HANDLE;  VAR lpErrors: SET;  VAR lpStat: ComStat ): BOOL;
+	ClearCommError-: PROCEDURE {WINAPI} ( hFile: HANDLE;  VAR lpErrors: DWORD;  VAR lpStat: ComStat ): BOOL;
 	(** The CloseHandle function closes an open object handle. *)
 	CloseHandle-: PROCEDURE {WINAPI} ( hObject: HANDLE ): BOOL;
 	(** The CopyFile function copies an existing file to a new file. *)
@@ -384,10 +385,10 @@ VAR
 	(** The CreateFile function creates or opens the following objects and returns a handle that can be used to access the object:
 		 files, pipes, mailslots, communications resources, disk devices (Windows NT only), consoles, directories (open only) *)
 	CreateFile-: PROCEDURE {WINAPI} ( CONST lpFileName: ARRAY   OF CHAR;
-																dwDesiredAccess, dwShareMode: SET;
+																dwDesiredAccess, dwShareMode: DWORD;
 																lpSecurityAttributes: ANY;
 																dwCreationDistribution: LONGINT;
-																dwFlagsAndAttributes: SET;
+																dwFlagsAndAttributes: DWORD;
 																hTemplateFile: HANDLE ): HANDLE;
 	(** The CreateProcess function creates a new process and its primary thread. The new process executes the specified
 			executable file. *)
@@ -405,7 +406,7 @@ VAR
 	CreateThread-: PROCEDURE {WINAPI} ( lpThreadAttributes: ADDRESS;
 																	  dwStackSize: LONGINT;
 																	  lpStartAddress: ThreadProc;
-																	  lpParameter: ANY;  dwCreationFlags: SET;
+																	  lpParameter: ANY;  dwCreationFlags: DWORD;
 																	  VAR lpThreadId: LONGINT ): HANDLE;
 	(** The DeleteCriticalSection function releases all resources used by an unowned critical section object. *)
 	DeleteCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection );
@@ -417,9 +418,9 @@ VAR
 	(** The DuplicateHandle function duplicates an object handle. *)
 	DuplicateHandle-: PROCEDURE {WINAPI} ( hSourceProcessHandle, hSourceHandle, hTargetProcessHandle: HANDLE;
 																			 VAR lpTargetHandle: HANDLE;
-																			 dwDesiredAccess: SET;
+																			 dwDesiredAccess: DWORD;
 																			 bInheritHandle: BOOL;
-																			 dwOptions: SET ): BOOL;
+																			 dwOptions: DWORD ): BOOL;
 	(** The EnterCriticalSection function waits for ownership of the specified critical section object. *)
 	EnterCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection );
 	
@@ -458,7 +459,7 @@ VAR
 	GetCommandLine-: PROCEDURE {WINAPI} ( ): LPSTR;
 	(** The GetCommModemStatus function retrieves modem control-register values. *)
 	GetCommModemStatus-: PROCEDURE {WINAPI} ( hFile: HANDLE;
-																						VAR lpModemStat: SET ): BOOL;
+																						VAR lpModemStat: DWORD ): BOOL;
 	(** The GetCommState function retrieves the current control settings for a specified communications device. *)
 	GetCommState-: PROCEDURE {WINAPI} ( hFile: HANDLE;
 																		 VAR lpDCB: DCB ): BOOL;
@@ -600,7 +601,7 @@ VAR
 			(an atom) identifying the string. *)
 	GlobalAddAtom-: PROCEDURE {WINAPI} ( VAR lpString: ARRAY   OF CHAR ): ATOM;
 	(** The GlobalAlloc function allocates the specified number of bytes from the heap. *)
-	GlobalAlloc-: PROCEDURE {WINAPI} ( uFlags: SET;  dwBytes: LONGINT ): HGLOBAL;
+	GlobalAlloc-: PROCEDURE {WINAPI} ( uFlags: DWORD;  dwBytes: LONGINT ): HGLOBAL;
 	(** The GlobalDeleteAtom function decrements the reference count of a global string atom. *)
 	GlobalDeleteAtom-: PROCEDURE {WINAPI} ( nAtom: ATOM ): ATOM;
 	(** The GlobalLock function locks a global memory object and returns a pointer to the first byte of the
@@ -612,7 +613,7 @@ VAR
 
 	(** The GlobalReAlloc function changes the size or attributes of a specified global memory object. *)
 	GlobalReAlloc-: PROCEDURE {WINAPI} ( hMem: HGLOBAL;  dwBytes: LONGINT;
-																		uFlags: SET ): HGLOBAL;
+																		uFlags: DWORD ): HGLOBAL;
 	(** The GlobalSize function retrieves the current size, in bytes, of the specified global memory object. *)
 	GlobalSize-: PROCEDURE {WINAPI} ( hMem: HGLOBAL ): LONGINT;
 	(** The GlobalUnlock function decrements the lock count associated with a memory object that was allocated with
@@ -640,7 +641,7 @@ VAR
 																						   VAR lpFileTime: FileTime ): BOOL;
 	(** The MoveFileEx function renames an existing file or directory. *)
 	MoveFileEx-: PROCEDURE {WINAPI} ( VAR lpExistingFileName, lpNewFileName: ARRAY   OF CHAR;
-																    dwFlags: SET ): BOOL;
+																    dwFlags: DWORD ): BOOL;
 	(** The OutputDebugString function sends a string to the debugger for the current application. *)
 	outputDebugString-: PROCEDURE {WINAPI} ( CONST lpOutputString: ARRAY   OF CHAR );
 
@@ -650,7 +651,7 @@ VAR
 
 
 	(** The PurgeComm function discards all characters from the output or input buffer of a specified communications resource. *)
-	PurgeComm-: PROCEDURE {WINAPI} ( hFile: HANDLE;  dwFlags: SET ): BOOL;
+	PurgeComm-: PROCEDURE {WINAPI} ( hFile: HANDLE;  dwFlags: DWORD ): BOOL;
 	(** The QueryDosDevice function retrieves information about MS-DOS device names. *)
 	QueryDosDevice-: PROCEDURE {WINAPI} ( lpDeviceName: ARRAY   OF CHAR;
 																		   VAR lpTargetPath: ARRAY   OF CHAR;
@@ -693,7 +694,7 @@ VAR
 	(** The SetCommBreak function suspends character transmission for a specified communications device and places the transmission line in a break state until the ClearCommBreak function is called. *)
 	SetCommBreak-: PROCEDURE {WINAPI} ( hFile: HANDLE ): BOOL;
 	(** The SetCommMask function specifies a set of events to be monitored for a communications device. *)
-	SetCommMask-: PROCEDURE {WINAPI} ( hFile: HANDLE;  dwEvtMask: SET ): BOOL;
+	SetCommMask-: PROCEDURE {WINAPI} ( hFile: HANDLE;  dwEvtMask: DWORD ): BOOL;
 	(** The SetCommState function configures a communications device according to the specifications in a device-control block (a DCB structure)*)
 	SetCommState-: PROCEDURE {WINAPI} ( hFile: HANDLE;
 																	    VAR lpDCB: DCB ): BOOL;
@@ -717,14 +718,14 @@ VAR
 	SetCurrentDirectory-: PROCEDURE {WINAPI} ( VAR lpPathName: ARRAY   OF CHAR ): BOOL;
 	(** The SetErrorMode function controls whether the system will handle the specified types of serious errors,
 			or whether the process will handle them. *)
-	SetErrorMode-: PROCEDURE {WINAPI} ( uMode: SET ): LONGINT;
+	SetErrorMode-: PROCEDURE {WINAPI} ( uMode: DWORD ): LONGINT;
 	(** The SetEndOfFile function moves the end-of-file (EOF) position for the specified file to the current position of the file pointer. *)
 	SetEndOfFile-: PROCEDURE {WINAPI} ( hFile: HANDLE ): BOOL;
 	(** The SetEvent function sets the state of the specified event object to signaled. *)
 	SetEvent-: PROCEDURE {WINAPI} ( hEvent: HANDLE ): BOOL;
 	(** The SetFileAttributes function sets a file's attributes. *)
 	SetFileAttributes-: PROCEDURE {WINAPI} ( VAR lpFileName: ARRAY   OF CHAR;
-																			dwFileAttributes: SET ): BOOL;
+																			dwFileAttributes: DWORD ): BOOL;
 	(** The SetFilePointer function moves the file pointer of an open file. *)
 	SetFilePointer-: PROCEDURE {WINAPI} ( hFile: HANDLE;  lDistanceToMove: LONGINT;
 																	    VAR lpDistanceToMoveHigh: LONGINT;
@@ -738,7 +739,7 @@ VAR
 	(** The SetLocalTime function sets the current local time and date. *)
 	SetLocalTime-: PROCEDURE {WINAPI} ( VAR lpSystemTime: SystemTime ): BOOL;
 	(** The SetThreadAffinityMask function sets a processor affinity mask for the specified thread. *)
-	SetThreadAffinityMask-: PROCEDURE {WINAPI} ( hThread: HANDLE; dwThreadAffinityMask: SET): LONGINT;
+	SetThreadAffinityMask-: PROCEDURE {WINAPI} ( hThread: HANDLE; dwThreadAffinityMask: DWORD): LONGINT;
 	(** The SetThreadContext function sets the context in the specified thread. *)
 	SetThreadContext-: PROCEDURE {WINAPI} ( hThread: HANDLE;
 																			  VAR lpContext: Context ): BOOL;
@@ -768,11 +769,11 @@ VAR
 	TryEnterCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection ): BOOL;
 	(** The VirtualAlloc function reserves or commits a region of pages in the virtual address space of the calling process. *)
 	VirtualAlloc-: PROCEDURE {WINAPI} ( lpAddress: ADDRESS;  dwSize: LONGINT;
-																    flAllocationType, flProtect: SET ): ADDRESS;
+																    flAllocationType, flProtect: DWORD ): ADDRESS;
 	(** The VirtualFree function releases or decommits (or both) a region of pages within the virtual address space of the
 			calling process. *)
 	VirtualFree-: PROCEDURE {WINAPI} ( lpAddress: ADDRESS;  dwSize: LONGINT;
-																  dwFreeType: SET ): BOOL;
+																  dwFreeType: DWORD ): BOOL;
 	(** The WaitForSingleObject function returns when one of the following occurs:
 			The specified object is in the signaled state.
 			The time-out interval elapses. *)
@@ -794,6 +795,18 @@ VAR
 	(* OutputString*: OutputStringProc; *)
 	Shutdown*: PROCEDURE ( code: LONGINT );
 
+	PROCEDURE SetToDW*(s: SET): DWORD;
+	BEGIN
+		RETURN SYSTEM.VAL(DWORD, s); 
+	END SetToDW;
+
+	PROCEDURE DWToSet*(d: DWORD): SET;
+	VAR a: ADDRESS;
+	BEGIN
+		a := d;
+		RETURN SYSTEM.VAL(SET, a); 
+	END DWToSet;
+	
 	(** Wrapper for getProcAddress. *)
 	PROCEDURE GetProcAddress*( hModule: HMODULE; CONST procName: ARRAY OF CHAR; VAR adr: ADDRESS );
 	BEGIN

+ 1 - 1
source/I386.Raster.Mod

@@ -635,7 +635,7 @@ MODULE Raster; (** non-portable *)	(* eos, TF  **)
 		END;
 		img.adr := adr;
 		img.mem := mem;
-		adr := a1;
+		adr := LONGINT(a1);
 	END CreateWithBuffer;
 
 	(**--- Transfer Modes ---**)

+ 1 - 1
source/Win32.Clipboard.Mod

@@ -55,7 +55,7 @@ BEGIN
 			IF chBuff^[ind] = LF THEN INC(requiredSize); END; (* transform LF into CRLF *)
 			INC(ind);
 		END;
-		hMem := Kernel32.GlobalAlloc({Kernel32.GMemMoveable, Kernel32.GMemDDEShare}, requiredSize);
+		hMem := Kernel32.GlobalAlloc(Kernel32.SetToDW({Kernel32.GMemMoveable, Kernel32.GMemDDEShare}), requiredSize);
 		adr := Kernel32.GlobalLock(hMem);
 		ind := 0;
 		WHILE ind < size  DO

+ 4 - 4
source/Win32.DNS.Mod

@@ -18,16 +18,16 @@ VAR
 
 	(* Find the IP address of the specified host. *)
 	PROCEDURE HostByName*( hostname: ARRAY OF CHAR;  VAR adr: IP.Adr;  VAR res: LONGINT );
-	VAR hostent: WSock32.PHostent; str: ARRAY 64 OF CHAR;
+	VAR hostent: WSock32.PHostent; str: ARRAY 64 OF CHAR; addr: ADDRESS;
 	BEGIN
 		hostent := WSock32.gethostbyname(hostname);
 		IF hostent = NIL THEN
 			WSock32.DispError()
 		ELSE
 			adr.usedProtocol := IP.IPv4;
-			adr.ipv4Adr := hostent.hName;
-			SYSTEM.GET(hostent.hAddrList, adr.ipv4Adr);
-			IF adr.ipv4Adr # 0 THEN SYSTEM.GET(adr.ipv4Adr, adr.ipv4Adr); END;
+			(*adr.ipv4Adr := hostent.hName;*)
+			SYSTEM.GET(hostent.hAddrList, addr(*adr.ipv4Adr*));
+			IF addr # NIL (*adr.ipv4Adr # 0*) THEN SYSTEM.GET(addr (*adr.ipv4Adr*), adr.ipv4Adr); END;
 
 			(*
 			IP.AdrToStr(adr,str); KernelLog.String(str); KernelLog.Ln;

+ 7 - 7
source/Win32.Display.Mod

@@ -239,7 +239,7 @@ VAR
 	BEGIN
 		str := "";
 		create.win.hWnd :=
-			User32.CreateWindowEx( 0, create.className, str, create.style, create.x, create.y, create.w, create.h,
+			User32.CreateWindowEx( 0, create.className, str, Kernel32.SetToDW(create.style), create.x, create.y, create.w, create.h,
 													   create.win.hWndParent, create.hMenu, Kernel32.hInstance,
 													   SYSTEM.VAL( User32.LParam, create ) );
 		IF User32.WSMaximize IN create.style THEN
@@ -424,7 +424,7 @@ VAR
 	END DummyProc;
 
 	PROCEDURE ChangeCursor;
-	VAR point: User32.Point;  ret: Kernel32.BOOL;
+	VAR point: User32.Point;  ret: Kernel32.HANDLE;
 	BEGIN
 		ret := User32.GetCursorPos( point );  ret := User32.SetCursor( hCurrentCursor );
 		IF hCurrentCursor = Kernel32.NULL THEN
@@ -447,7 +447,7 @@ VAR
 	END Min;
 
 	PROCEDURE HandleMouse( win: Window;  uMsg: LONGINT;  wParam: User32.WParam;  lParam: User32.LParam );
-	VAR m: AosInputs.AbsMouseMsg;  oldx, oldy: LONGINT;  keys: SET; ret: Kernel32.BOOL;
+	VAR m: AosInputs.AbsMouseMsg;  oldx, oldy: LONGINT;  keys: SET; ret: Kernel32.HANDLE;
 	BEGIN
 		(* User32.SetCursor(hCurrentCursor);*)
 		oldx := win.track.X;  oldy := win.track.Y;  
@@ -748,7 +748,7 @@ VAR
 	VAR pos: User32.WindowPos;
 	BEGIN
 		SYSTEM.MOVE( lParam, ADDRESSOF( pos ), SIZEOF( User32.WindowPos ) );
-		IF ~(User32.SWPNoMove IN pos.flags) THEN
+		IF ~(User32.SWPNoMove IN Kernel32.DWToSet(pos.flags)) THEN
 			IF (pos.x < -disp.width) & (pos.y < -disp.height) THEN Minimize( win )
 			ELSIF (pos.x >= 0) & (pos.y >= 0) THEN Restore( win )
 			END
@@ -760,7 +760,7 @@ VAR
 	PROCEDURE WindowHandler( win: Window;  uMsg: LONGINT;  wParam: User32.WParam;
 													  lParam: User32.LParam ): User32.LResult;
 
-	VAR handled: BOOLEAN; ret: Kernel32.BOOL;
+	VAR handled: BOOLEAN; ret: Kernel32.HANDLE;
 
 		closer: OBJECT (* to call a close request in an A2 thread, otherwise finalization does not work etc. *)
 		BEGIN{ACTIVE}
@@ -918,7 +918,7 @@ VAR
 	VAR str: ARRAY 32 OF CHAR;
 		ret: Kernel32.ATOM;
 	BEGIN
-		dummyClass.cbSize := SIZEOF( User32.WndClassEx );  dummyClass.style := {};  dummyClass.lpfnWndProc := DummyProc;
+		dummyClass.cbSize := SIZEOF( User32.WndClassEx );  dummyClass.style := Kernel32.SetToDW({});  dummyClass.lpfnWndProc := DummyProc;
 		dummyClass.cbClsExtra := 0;  dummyClass.cbWndExtra := 4;  dummyClass.hInstance := Kernel32.hInstance;
 		dummyClass.hIcon := Kernel32.NULL;  dummyClass.hIconSm := Kernel32.NULL;  dummyClass.hCursor := Kernel32.NULL;
 		dummyClass.hbrBackground := Kernel32.NULL;  dummyClass.lpszMenuName := Kernel32.NULL;
@@ -926,7 +926,7 @@ VAR
 		ret := User32.RegisterClassEx( dummyClass );
 
 		windowClass.cbSize := SIZEOF( User32.WndClassEx );
-		windowClass.style := {7};   (* Cs_parentdc: INTEGER is 128  = 2^7 *)
+		windowClass.style := Kernel32.SetToDW({7});   (* Cs_parentdc: INTEGER is 128  = 2^7 *)
 		windowClass.lpfnWndProc := WindowProc;  windowClass.cbClsExtra := 0;  windowClass.cbWndExtra := 4;
 		windowClass.hInstance := Kernel32.hInstance;  str := "Console";  windowClass.hIcon := User32.LoadIcon( Kernel32.hInstance, str );
 		str := "Console.Small";  windowClass.hIconSm := User32.LoadIcon( Kernel32.hInstance, str );  windowClass.hCursor := Kernel32.NULL;

+ 4 - 3
source/Win32.GDI32.Mod

@@ -5,6 +5,7 @@ IMPORT SYSTEM, Kernel32, User32;
 
 	(** This module defines all the Win32 GDI32 APIs used by Oberon.
 	Note this module is part of the Oberon inner-core and must be linked with PELinker. *)
+TYPE DWORD = Kernel32.DWORD;
 
 CONST
 	(** SetBkMode iBkMode values *)
@@ -85,11 +86,11 @@ TYPE
 
 	(** The EnumFontFamProc function is an application definedßcallback function used with the EnumFontFamilies
 			function. *)
-	EnumFontFamProc* = PROCEDURE {WINAPI} (VAR lpelf: EnumLogFont;  VAR lpntm: TextMetric;  FontType: SET;  lParam: User32.LParam): LONGINT;
+	EnumFontFamProc* = PROCEDURE {WINAPI} (VAR lpelf: EnumLogFont;  VAR lpntm: TextMetric;  FontType: DWORD;  lParam: User32.LParam): LONGINT;
 
 	(** The EnumFontsProc function is an application definedßcallback function that processes font data from the EnumFonts
 			function. *)
-	EnumFontsProc* = PROCEDURE {WINAPI} (VAR lplf: LogFont;  VAR lptm: TextMetric;  dwType: SET;  lpData: User32.LParam): LONGINT;
+	EnumFontsProc* = PROCEDURE {WINAPI} (VAR lplf: LogFont;  VAR lptm: TextMetric;  dwType: DWORD;  lpData: User32.LParam): LONGINT;
 
 	(** The ABC structure contains the width of a character in a TrueType font. *)
 	ABC* = RECORD
@@ -305,7 +306,7 @@ dwOffset: LONGINT):HBitmap;
 	(** The SetROP2 function sets the current foreground mix mode. *)
 	SetROP2-: PROCEDURE {WINAPI} (hdc: User32.HDC;  fnDrawMode: LONGINT): LONGINT;
 	(** The SetTextAlign function sets the text-alignment flags for the specified device context. *)
-	SetTextAlign-: PROCEDURE {WINAPI} (hdc: User32.HDC;  fMode: SET): LONGINT;
+	SetTextAlign-: PROCEDURE {WINAPI} (hdc: User32.HDC;  fMode: DWORD): LONGINT;
 	(** The SetTextColor function sets the text color for the specified device context to the specified color. *)
 	SetTextColor-: PROCEDURE {WINAPI} (hdc: User32.HDC;  crColor: ColorRef): ColorRef;
 	(** The SetWindowExtEx function sets the horizontal and vertical extents of the window for a device context by using

+ 1 - 1
source/Win32.HierarchicalProfiler0.Mod

@@ -108,7 +108,7 @@ BEGIN
 	IF (handle # Kernel32.NULL) & (handle # Kernel32.InvalidHandleValue) THEN
 		res := Kernel32.SuspendThread(handle);
 		IF (res >= 0) THEN
-			context.ContextFlags := Kernel32.ContextControl+Kernel32.ContextInteger;
+			context.ContextFlags := Kernel32.SetToDW(Kernel32.ContextControl+Kernel32.ContextInteger);
 			res := Kernel32.GetThreadContext(handle, context);
 			IF (res = Kernel32.True) THEN
 				IF (context.PC # 0) THEN

+ 6 - 4
source/Win32.IP.Mod

@@ -411,6 +411,7 @@ PROCEDURE InitInterfaces( hostname: ARRAY OF CHAR; VAR res: LONGINT );
 	VAR hostent: WSock32.PHostent; str: ARRAY 64 OF CHAR;
 		adr, adr2: Adr;
 		int0, int:Interface; i:LONGINT;
+		addr: ADDRESS;
 	BEGIN
 		hostent := WSock32.gethostbyname(hostname);
 		IF hostent = NIL THEN
@@ -418,10 +419,11 @@ PROCEDURE InitInterfaces( hostname: ARRAY OF CHAR; VAR res: LONGINT );
 		ELSE
 			WHILE hostent.hLength>0 DO
 				adr.usedProtocol := IPv4;
-				adr.ipv4Adr := hostent.hName;
-				SYSTEM.GET(hostent.hAddrList+i*4, adr.ipv4Adr);
-				IF adr.ipv4Adr # 0 THEN 
-					SYSTEM.GET(adr.ipv4Adr, adr.ipv4Adr); 
+				(*adr := hostent.hName;
+				adr.ipv4Adr := hostent.hName;*)
+				SYSTEM.GET(hostent.hAddrList+i*SIZEOF(ADDRESS), addr (*adr.ipv4Adr*));
+				IF addr # NIL (*adr.ipv4Adr # 0*) THEN 
+					SYSTEM.GET(addr (*adr.ipv4Adr*), adr.ipv4Adr); 
 					NEW(int); int.localAdr:=adr;
 					IF int0=NIL THEN 
 						int0:=int; interfaces:=int0; default:=int0;

+ 8 - 0
source/Win32.Kernel.Mod

@@ -225,11 +225,19 @@ VAR
 		RETURN (t.target - Kernel32.GetTickCount()) * (1000 DIV Machine.Second)
 	END Left;
 	
+	PROCEDURE Nothing;
+	BEGIN
+		
+	END Nothing;
+	
 
 BEGIN
 	ASSERT (1000 MOD Machine.Second = 0);   (* for Elapsed *)
 	second := Machine.Second;
 	Heaps.GC := Heaps.InvokeGC; (* must be done after all processors have started *)
+	(*
+	Heaps.GC := Nothing;
+	*)
 END Kernel.
 
 (**

+ 8 - 8
source/Win32.Machine.Mod

@@ -433,7 +433,7 @@ END TraceChar;
 PROCEDURE SetTraceFile(VAR filename: ARRAY OF CHAR);
 BEGIN
 	Trace.String("trace -> file "); Trace.String(filename); Trace.Ln;
-	hout := Kernel32.CreateFile(filename, {Kernel32.GenericWrite}, {Kernel32.FileShareRead}, NIL, Kernel32.CreateAlways, {Kernel32.FileAttributeNormal}, Kernel32.NULL);
+	hout := Kernel32.CreateFile(filename, Kernel32.SetToDW({Kernel32.GenericWrite}), Kernel32.SetToDW({Kernel32.FileShareRead}), NIL, Kernel32.CreateAlways, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), Kernel32.NULL);
 	Kernel32.GetFullPathName(filename, LEN(filename), filename, NIL);
 	Trace.Char := TraceChar;
 END SetTraceFile;
@@ -569,7 +569,7 @@ BEGIN
 		ToExecutablePath(DefaultConfigFile, defaultConfigFile);
 	END;
 	COPY(UserConfigFile, userConfigFile);
-	hfile := Kernel32.CreateFile( userConfigFile, {Kernel32.GenericRead}, {Kernel32.FileShareRead}, NIL , Kernel32.OpenExisting, {Kernel32.FileAttributeNormal}, 0 );
+	hfile := Kernel32.CreateFile( userConfigFile, Kernel32.SetToDW({Kernel32.GenericRead}), Kernel32.SetToDW({Kernel32.FileShareRead}), NIL , Kernel32.OpenExisting, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), 0 );
 	IF hfile = Kernel32.InvalidHandleValue THEN
 		ToExecutablePath(UserConfigFile, userConfigFile);
 	ELSE
@@ -703,9 +703,9 @@ BEGIN
 	IF memBlkSize < MemBlockSize THEN memBlkSize := MemBlockSize END; 	(* MemBlockSize implicitly multiple of StaticBlockSize *)
 
 	initVal := 8*1024*1024;
-	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, {Kernel32.MEMCommit, Kernel32.MEMReserve}, {Kernel32.PageExecuteReadWrite});
+	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, Kernel32.SetToDW({Kernel32.MEMCommit, Kernel32.MEMReserve}), Kernel32.SetToDW({Kernel32.PageExecuteReadWrite}));
 	IF adr = NilVal THEN (* allocation failed *)
-		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, {Kernel32.MEMCommit}, {Kernel32.PageExecuteReadWrite});
+		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, Kernel32.SetToDW({Kernel32.MEMCommit}), Kernel32.SetToDW({Kernel32.PageExecuteReadWrite}));
 	END;
 	Trace.String("first heap block intVal "); Trace.Int(initVal,1); Trace.Ln;
 	Trace.String("first heap block memBlkSize "); Trace.Int(memBlkSize,1); Trace.Ln;
@@ -849,9 +849,9 @@ BEGIN
 	memBlkSize := memDescSize + size + StaticBlockSize; 		(* add StaticBlockSize to account for alignments different from multiples of StaticBlockSize *)
 	INC(memBlkSize, (-memBlkSize) MOD MemBlockSize);
 	initVal := memBlockTail.startAdr + memBlockTail.size;
-	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, {Kernel32.MEMCommit, Kernel32.MEMReserve}, {Kernel32.PageExecuteReadWrite});
+	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, Kernel32.SetToDW({Kernel32.MEMCommit, Kernel32.MEMReserve}), Kernel32.SetToDW({Kernel32.PageExecuteReadWrite}));
 	IF adr = NilVal THEN (* allocation failed *)
-		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, {Kernel32.MEMCommit}, {Kernel32.PageExecuteReadWrite});
+		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, Kernel32.SetToDW({Kernel32.MEMCommit}), Kernel32.SetToDW({Kernel32.PageExecuteReadWrite}));
 	END;
 	continue := adr = initVal;
 	Trace.String("expand heap block intVal "); Trace.Int(initVal,1); Trace.Ln;
@@ -935,8 +935,8 @@ BEGIN
 		END;
 		memBlock.next := NIL;
 		startAdr := memBlock.startAdr; (* this value must be cached for the second call of Kernel32.VirtualFree *)
-		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, memBlock.startAdr), memBlock.size, {Kernel32.MEMDecommit});
-		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, startAdr ), 0, {Kernel32.MEMRelease});
+		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, memBlock.startAdr), memBlock.size, Kernel32.SetToDW({Kernel32.MEMDecommit}));
+		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, startAdr ), 0, Kernel32.SetToDW({Kernel32.MEMRelease}));
 	ELSE
 		HALT(535)	(* error in memory block management *)
 	END;

BIN
source/Win32.Oberon.Clipboard.Mod


BIN
source/Win32.Oberon.Directories.Mod


+ 5 - 5
source/Win32.Objects.Mod

@@ -189,10 +189,10 @@ TYPE
 					ASSERT(res # -1);
 				END;
 
-				state.ContextFlags := Kernel32.ContextControl + Kernel32.ContextInteger;
+				state.ContextFlags := Kernel32.SetToDW(Kernel32.ContextControl + Kernel32.ContextInteger);
 				res := Kernel32.GetThreadContext( handle, state );
 				
-				context.ContextFlags := Kernel32.ContextControl + Kernel32.ContextInteger;
+				context.ContextFlags := Kernel32.SetToDW(Kernel32.ContextControl + Kernel32.ContextInteger);;
 				IF isWow64 THEN 
 					res := Kernel32.Wow64GetThreadContext( handle, context );
 				ELSE
@@ -841,7 +841,7 @@ BEGIN
 		t.restartPC := SYSTEM.VAL(ADDRESS, terminateProc);
 	END;
 
-	t.handle := Kernel32.CreateThread(0, defaultStackSize, Wrapper, t, {}, t.id);
+	t.handle := Kernel32.CreateThread(0, defaultStackSize, Wrapper, t, Kernel32.SetToDW({}), t.id);
 
 	IF TraceVerbose OR TraceOpenClose THEN
 		Machine.Acquire(Machine.TraceOutput);
@@ -1061,7 +1061,7 @@ END Await;
 				ELSE
 					retBOOL := Kernel32.SuspendThread( t.handle );
 				END;
-				t.state.ContextFlags := Kernel32.ContextControl;
+				t.state.ContextFlags := Kernel32.SetToDW(Kernel32.ContextControl);
 				retBOOL := Kernel32.GetThreadContext( t.handle, t.state );
 				mod := Modules.ThisModuleByAdr( t.state.PC );  Trace.String( "Objects Break at adr: " );
 				Trace.Int( t.state.PC, 5 );  Trace.Ln;
@@ -1133,7 +1133,7 @@ BEGIN
 	t.handle := Kernel32.GetCurrentThread();
 	t.id := Kernel32.GetCurrentThreadId();
 	proc := Kernel32.GetCurrentProcess();
-	res := Kernel32.DuplicateHandle(proc, t.handle, proc, t.handle, {}, 0, {Kernel32.DuplicateSameAccess});
+	res := Kernel32.DuplicateHandle(proc, t.handle, proc, t.handle, Kernel32.SetToDW({}), 0, Kernel32.SetToDW({Kernel32.DuplicateSameAccess}));
 	ASSERT(res # 0);
 	res := Kernel32.TlsSetValue(tlsIndex, SYSTEM.VAL(LONGINT, t));
 	ASSERT(res # 0);

+ 6 - 6
source/Win32.SVNAdmin.Mod

@@ -996,9 +996,9 @@ END CheckChecksum;
 			Files.JoinPath ( path, name, dest );
 			Strings.Append ( dest, ".svn-base" );
 
-			Kernel32.SetFileAttributes ( dest, {} );
+			Kernel32.SetFileAttributes ( dest, Kernel32.SetToDW({}) );
 			Files.CopyFile ( file, dest, overwrite, res );
-			Kernel32.SetFileAttributes ( dest, {Files.ReadOnly} );
+			Kernel32.SetFileAttributes ( dest, Kernel32.SetToDW({Files.ReadOnly}) );
 			ASSERT ( res = Files.Ok );
 		END;
 	END CopyToBaseFile;
@@ -1007,24 +1007,24 @@ END CheckChecksum;
 
 	PROCEDURE SetFileAttribute* ( file : ARRAY OF CHAR );
 	BEGIN
-		Kernel32.SetFileAttributes ( file, {Files.ReadOnly} );
+		Kernel32.SetFileAttributes ( file, Kernel32.SetToDW({Files.ReadOnly}) );
 	END SetFileAttribute;
 
 	PROCEDURE RemoveFileAttribute* ( file : ARRAY OF CHAR );
 	BEGIN
-		Kernel32.SetFileAttributes ( file, {} );
+		Kernel32.SetFileAttributes ( file, Kernel32.SetToDW({}) );
 	END RemoveFileAttribute;
 
 
 	PROCEDURE SetFileAttribute2* ( file : ARRAY OF CHAR; f : Files.File );
 	BEGIN
-		Kernel32.SetFileAttributes ( file, {Files.ReadOnly} );
+		Kernel32.SetFileAttributes ( file, Kernel32.SetToDW({Files.ReadOnly}) );
 		INCL ( f.flags, Files.ReadOnly );
 	END SetFileAttribute2;
 
 	PROCEDURE RemoveFileAttribute2* ( file : ARRAY OF CHAR; f : Files.File );
 	BEGIN
-		Kernel32.SetFileAttributes ( file, {} );
+		Kernel32.SetFileAttributes ( file, Kernel32.SetToDW({}) );
 		EXCL ( f.flags, Files.ReadOnly );
 	END RemoveFileAttribute2;
 

+ 12 - 10
source/Win32.User32.Mod

@@ -6,6 +6,8 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 (** This module defines all the Win32 User32 APIs used by Oberon.
 	Note this module is part of the Oberon inner-core and must be linked with PELinker. *)
 
+	TYPE 
+		DWORD = Kernel32.DWORD;
 	CONST
 		(** window messages *)
 		WMCreate* = 01H; WMDestroy* = 02H; WMMove* = 03H; WMSize* = 05H; WMActivate* = 06H; WMSetFocus* = 07H;
@@ -204,7 +206,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 			GetClassInfoEx functions. *)
 		WndClassEx* = RECORD
 			cbSize*: LONGINT;
-			style*: SET;
+			style*: DWORD;
 			lpfnWndProc*: WndProc;
 			cbClsExtra*, cbWndExtra*: LONGINT;
 			hInstance*: Kernel32.HINSTANCE;
@@ -221,13 +223,13 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 		(** The WINDOWPOS structure contains information about the size and position of a window. *)
 		WindowPos* = RECORD  			hwnd*, hwndInsertAfter*: HWND;
 			x*, y*, cx*, cy*: LONGINT;
-			flags*: SET
+			flags*: DWORD;
 		END;
 
 		(** The WINDOWPLACEMENT structure contains information about the placement of a window on the screen. *)
 		WindowPlacement* = RECORD
 			length*: LONGINT;
-			flags*: SET;
+			flags*: DWORD;
 			showCmd*: LONGINT;
 			ptMinPosition*, ptMaxPosition*: Point;
 			rcNormalPosition*: Rect
@@ -235,7 +237,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 
 		(** The MENUITEMINFO structure contains information about a menu item. *)
 		MenuItemInfo* = RECORD  			cbSize*: LONGINT;
-			fMask*, fType*, fState*: SET;
+			fMask*, fType*, fState*: DWORD;
 			wID*: LONGINT;
 			hSubMenu*: HMenu;
 			hbmpChecked*, hbmpUnchecked*: HBitmap;
@@ -275,7 +277,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 		(** The CreateMenu function creates a menu. *)
 		CreateMenu-: PROCEDURE {WINAPI} (): HMenu;
 		(** The CreateWindow function creates an overlapped, pop-up, or child window. *)
-		CreateWindowEx-: PROCEDURE {WINAPI} (dwExStyle: LONGINT; VAR lpClassName, lpWindowName: ARRAY   OF CHAR; dwStyle: SET; x, y, nWidth, nHeight: LONGINT; hWndParent: HWND; hMenu: HMenu; hInstance: Kernel32.HINSTANCE; lpParam: LONGINT): HWND;
+		CreateWindowEx-: PROCEDURE {WINAPI} (dwExStyle: LONGINT; VAR lpClassName, lpWindowName: ARRAY   OF CHAR; dwStyle: DWORD; x, y, nWidth, nHeight: LONGINT; hWndParent: HWND; hMenu: HMenu; hInstance: Kernel32.HINSTANCE; lpParam: LONGINT): HWND;
 		(** The DefWindowProc function calls the default window procedure to provide default processing for any window
 			messages that an application does not process. *)
 		DefWindowProc-: WndProc;
@@ -331,7 +333,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 		(** The GetMenuItemInfo function retrieves information about a menu item. *)
 		GetMenuItemInfo-: PROCEDURE {WINAPI} (hMenu: HMenu; uItem: LONGINT; fyByPosition: Kernel32.BOOL; VAR lpmii: MenuItemInfo): Kernel32.BOOL;
 		(** The GetMenuString function copies the text string of the specified menu item into the specified buffer. *)
-		GetMenuString-: PROCEDURE {WINAPI} (hMenu: HMenu; uIDItem: LONGINT; VAR lpString: ARRAY   OF CHAR; nMaxCount: LONGINT; uFlag: SET): Kernel32.BOOL;
+		GetMenuString-: PROCEDURE {WINAPI} (hMenu: HMenu; uIDItem: LONGINT; VAR lpString: ARRAY   OF CHAR; nMaxCount: LONGINT; uFlag: DWORD): Kernel32.BOOL;
 		(** The GetMessage function retrieves a message from the calling thread's message queue and places it in the
 			specified structure. *)
 		GetMessage-: PROCEDURE {WINAPI} (VAR lpMsg: Msg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax: LONGINT): LONGINT;
@@ -364,7 +366,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 			region. *)
 		GetUpdateRgn-: PROCEDURE {WINAPI} (hWnd: HWND; VAR hRgn: HRgn; bErase: Kernel32.BOOL): LONGINT;
 		(** The InsertMenu function inserts a new menu item into a menu, moving other items down the menu. *)
-		InsertMenu-: PROCEDURE {WINAPI} (hMenu: HMenu; uPosition: LONGINT; uFlags: SET; uIDNewItem: LONGINT; VAR lpNewItem: ARRAY   OF CHAR): Kernel32.BOOL;
+		InsertMenu-: PROCEDURE {WINAPI} (hMenu: HMenu; uPosition: LONGINT; uFlags: DWORD; uIDNewItem: LONGINT; VAR lpNewItem: ARRAY   OF CHAR): Kernel32.BOOL;
 		(** The IntersectRect function calculates the intersection of two source rectangles and places the coordinates of the
 			intersection rectangle into the destination rectangle. *)
 		IntersectRect-: PROCEDURE {WINAPI} (VAR lprcDst: Rect; lprcSrc1, lprcSrc2: Rect): Kernel32.BOOL;
@@ -383,7 +385,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 		(** The MessageBeep function plays a waveform sound. *)
 		MessageBeep-: PROCEDURE {WINAPI} (uType: LONGINT): Kernel32.BOOL;
 		(** The MessageBox function creates, displays, and operates a message box. *)
-		MessageBox-: PROCEDURE {WINAPI} (hWnd: HWND; VAR lpText, lpCaption: ARRAY   OF CHAR; uType: SET): LONGINT;
+		MessageBox-: PROCEDURE {WINAPI} (hWnd: HWND; VAR lpText, lpCaption: ARRAY   OF CHAR; uType: DWORD): LONGINT;
 		(** The MoveWindow function changes the position and dimensions of the specified window. *)
 		MoveWindow-: PROCEDURE {WINAPI} (hWnd: HWND; X, Y, nWidth, nHeight: LONGINT; bRepaint: Kernel32.BOOL): Kernel32.BOOL;
 		(** The OffsetRect function moves the specified rectangle by the specified offsets. *)
@@ -443,7 +445,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 		(** The SetWindowLong function changes an attribute of the specified window. *)
 		SetWindowLong-: PROCEDURE {WINAPI} (hWnd: HWND; nIndex, dwNewLong: LONGINT): LONGINT;
 		(** The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. *)
-		SetWindowPos-: PROCEDURE {WINAPI} (hWnd, hWndInsertAfter: HWND; X, Y, cx, cy: LONGINT; uFlags: SET): Kernel32.BOOL;
+		SetWindowPos-: PROCEDURE {WINAPI} (hWnd, hWndInsertAfter: HWND; X, Y, cx, cy: LONGINT; uFlags: DWORD): Kernel32.BOOL;
 		(** The SetWindowRgn function sets the window region of a window. *)
 		SetWindowRgn-: PROCEDURE {WINAPI} (hWnd: HWND; hRgn: HRgn; bRedraw: Kernel32.BOOL): LONGINT;
 		(** The SetWindowText function changes the text of the specified window's title bar (if it has one). *)
@@ -456,7 +458,7 @@ MODULE User32; (** non-portable / source: Win32.User32.Mod *)	(* ejz  *)
 		ShowWindowAsync-: PROCEDURE {WINAPI} (hWnd: HWND; nCmdShow: LONGINT): Kernel32.BOOL;
 		(** The TrackPopupMenu function displays a shortcut menu at the specified location and tracks the selection of
 			items on the menu. *)
-		TrackPopupMenu-: PROCEDURE {WINAPI} (hMenu: HMenu; uFlags: SET; x, y, nReserved: LONGINT; hWnd: HWND; VAR prcRect: Rect): Kernel32.BOOL;
+		TrackPopupMenu-: PROCEDURE {WINAPI} (hMenu: HMenu; uFlags: DWORD; x, y, nReserved: LONGINT; hWnd: HWND; VAR prcRect: Rect): Kernel32.BOOL;
 		(** The TranslateAccelerator function processes accelerator keys for menu commands. *)
 		TranslateAccelerator-: PROCEDURE {WINAPI} (hWnd: HWND; hAccTable: HAccel; VAR lpMsg: Msg): LONGINT;
 		(** The TranslateMessage function translates virtual-key messages into character messages. *)

+ 9 - 9
source/Win32.V24.Mod

@@ -224,7 +224,7 @@ TYPE
 		END ReceiveChar;
 
 		PROCEDURE Available*( ): LONGINT;
-		VAR errors: SET;  stat: Kernel32.ComStat;  res: Kernel32.BOOL;
+		VAR errors: Kernel32.DWORD;  stat: Kernel32.ComStat;  res: Kernel32.BOOL;
 		BEGIN
 			IF handle # Kernel32.InvalidHandleValue THEN
 				res := Kernel32.ClearCommError( handle, errors, stat );
@@ -249,8 +249,8 @@ TYPE
 			Strings.Append(windowsComName, portname);
 
 			hFile := 	Kernel32.CreateFile( windowsComName,
-												  {Kernel32.GenericRead, Kernel32.GenericWrite}, {},
-												  NIL , Kernel32.OpenExisting, {}, Kernel32.NULL );
+												  Kernel32.SetToDW({Kernel32.GenericRead, Kernel32.GenericWrite}), Kernel32.SetToDW({}),
+												  NIL , Kernel32.OpenExisting, Kernel32.SetToDW({}), Kernel32.NULL );
 			IF hFile # Kernel32.InvalidHandleValue THEN
 				ret := Kernel32.GetCommState( hFile, dcb );
 				IF ret # Kernel32.False THEN
@@ -285,7 +285,7 @@ TYPE
 					IF res = Serials.Ok THEN
 						ret := Kernel32.SetCommState( hFile, dcb );
 						IF ret # Kernel32.False THEN
-							ret := Kernel32.PurgeComm( hFile, {Kernel32.PurgeTXClear, Kernel32.PurgeRXClear} );
+							ret := Kernel32.PurgeComm( hFile, Kernel32.SetToDW({Kernel32.PurgeTXClear, Kernel32.PurgeRXClear}) );
 							ret := Kernel32.SetupComm( hFile, 800H, 800H );
 							handle := hFile;
 							RETURN
@@ -374,15 +374,15 @@ TYPE
 	(** GetMC - Return the state of the specified modem control lines.  s contains
 			the current state of DSR, CTS, RI, DCD & Break Interrupt. *)
 		PROCEDURE GetMC*( VAR s: SET );
-		VAR state: SET;  res: LONGINT;
+		VAR state: Kernel32.DWORD;  res: LONGINT;
 		BEGIN {EXCLUSIVE}
 			s := {};
 			IF handle # Kernel32.InvalidHandleValue THEN
 				res := Kernel32.GetCommModemStatus( handle, state );
-				IF Kernel32.MSCTSOn IN state THEN INCL( s, Serials.CTS ) END;
-				IF Kernel32.MSDSROn IN state THEN INCL( s, Serials.DSR ) END;
-				IF Kernel32.MSRingOn IN state THEN INCL( s, Serials.RI ) END;
-				IF Kernel32.MSRLSDOn IN state THEN INCL( s, Serials.DCD ) END
+				IF Kernel32.MSCTSOn IN Kernel32.DWToSet(state) THEN INCL( s, Serials.CTS ) END;
+				IF Kernel32.MSDSROn IN Kernel32.DWToSet(state) THEN INCL( s, Serials.DSR ) END;
+				IF Kernel32.MSRingOn IN Kernel32.DWToSet(state) THEN INCL( s, Serials.RI ) END;
+				IF Kernel32.MSRLSDOn IN Kernel32.DWToSet(state) THEN INCL( s, Serials.DCD ) END
 			END
 		END GetMC;
 

+ 1 - 1
source/Win32.WSock32.Mod

@@ -87,7 +87,7 @@ MODULE WSock32; (* AUTHOR "ejz, additions Alex Popescu"; PURPOSE " Win32 WSock32
 
 		FDSet*=RECORD
 			fdcount*: LONGINT;
-			socket*: ARRAY 64 OF LONGINT;
+			socket*: ARRAY 64 OF Socket (*LONGINT*);
 		END;
 
 		(** The Windows Sockets WSAPROTOCOL_INFO structure is used to store or retrieve complete information for

+ 1 - 1
source/Win32.WinApplications.Mod

@@ -9,7 +9,7 @@ IMPORT Kernel32, KernelLog, Commands, Strings, SYSTEM, Options;
 	BEGIN
 		result := -1;
 		start.cb := SIZEOF( Kernel32.StartupInfo );
-		start.dwFlags := {Kernel32.StartFUseShowWindow};
+		start.dwFlags := Kernel32.SetToDW({Kernel32.StartFUseShowWindow});
 		IF visible THEN start.wShowWindow := 1; ELSE start.wShowWindow := 0; END;
 
 		KernelLog.String( "Calling Windows Application: " );  KernelLog.String( par );  KernelLog.Ln;

+ 1 - 1
source/Win32.WinDisks.Mod

@@ -265,7 +265,7 @@ VAR
 	BEGIN
 		Strings.Concat( "\\.\", name, devname );
 		IF Disks.ReadOnly IN flags THEN tflags := {Kernel32.GenericRead} ELSE tflags := {(*2 (* Kernel32.GenericDelete *), *)Kernel32.GenericWrite,Kernel32.GenericRead} END;
-		handle := Kernel32.CreateFile( devname, tflags, {Kernel32.FileShareRead, Kernel32.FileShareWrite}, NIL , Kernel32.OpenExisting, {}, Kernel32.NULL );
+		handle := Kernel32.CreateFile( devname, Kernel32.SetToDW(tflags), Kernel32.SetToDW({Kernel32.FileShareRead, Kernel32.FileShareWrite}), NIL , Kernel32.OpenExisting, Kernel32.SetToDW({}), Kernel32.NULL );
 		IF (handle = Kernel32.InvalidHandleValue) THEN
 			errorcode := Kernel32.GetLastError();
 			context.error.String("Could not open '"); context.error.String(devname); context.error.String("' : ");

+ 15 - 15
source/Win32.WinFS.Mod

@@ -237,7 +237,7 @@ TYPE
 			IF TraceFileSystem IN Trace THEN KernelLog.String( "Old0 " );  KernelLog.String( name );  KernelLog.Ln;  END;
 
 			IF (name # "") & FindFile( name, fname ) THEN
-				hfile := Kernel32.CreateFile( fname, {Kernel32.GenericRead}, {Kernel32.FileShareRead, Kernel32.FileShareWrite}, NIL , Kernel32.OpenExisting, {Kernel32.FileAttributeNormal}, 0 );
+				hfile := Kernel32.CreateFile( fname, Kernel32.SetToDW({Kernel32.GenericRead}), Kernel32.SetToDW({Kernel32.FileShareRead, Kernel32.FileShareWrite}), NIL , Kernel32.OpenExisting, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), 0 );
 				IF hfile # Kernel32.InvalidHandleValue THEN NEW( F, fname, hfile, collection.GetNextFileKey() , SELF);    collection.AddOld( F );  RETURN F END
 			END;
 			IF TraceFileSystem IN Trace THEN KernelLog.String( "failed" );  KernelLog.Ln;  END;
@@ -274,7 +274,7 @@ TYPE
 					Fo := fold( File );
 					IF ~Fo.ToTemp() THEN RETURN END;
 					ret := Kernel32.CopyFile( Fo.tfname^, fnnew, 0 )
-				ELSE ret := Kernel32.MoveFileEx( fnold, fnnew, {Kernel32.MoveFileReplaceExisting, Kernel32.MoveFileCopyAllowed} )
+				ELSE ret := Kernel32.MoveFileEx( fnold, fnnew, Kernel32.SetToDW({Kernel32.MoveFileReplaceExisting, Kernel32.MoveFileCopyAllowed}) )
 				END;
 				IF ret # 0 THEN res := 0 END
 			ELSIF TraceFileSystem IN Trace THEN KernelLog.String( "Rename failed :" );  KernelLog.String( fnold );  KernelLog.String( " => " );  KernelLog.String( fnnew );  KernelLog.Ln;
@@ -306,7 +306,7 @@ TYPE
 							d := LONG( st.wYear - 1900 ) * 200H + LONG( st.wMonth ) * 20H + LONG( st.wDay );  t := LONG( st.wHour ) * 1000H + LONG( st.wMinute ) * 40H + LONG( st.wSecond );
 						END;
 						Join( curPath, "/", FD.cFileName, longname );
-						IF ~(Kernel32.FileAttributeDirectory IN FD.dwFileAttributes) THEN
+						IF ~(Kernel32.FileAttributeDirectory IN Kernel32.DWToSet(FD.dwFileAttributes)) THEN
 							enum.PutEntry( longname, {}, t, d, FD.nFileSizeLow )
 						ELSIF (FD.cFileName # ".") & ((FD.cFileName # "..")) THEN
 							enum.PutEntry( longname, {Files.Directory}, t, d, FD.nFileSizeLow )
@@ -449,8 +449,8 @@ TYPE
 			IF TraceFile IN Trace THEN KernelLog.String( "Init: " );  KernelLog.String( name );  KernelLog.String( " (" );  KernelLog.Int( key, 1 );  KernelLog.String( ")" );  KernelLog.Ln;  END;
 			SELF.key := key;  fpos := 0;  SELF.hfile := hfile;  COPY( name, SELF.fname );  tfname := NIL;
 			IF hfile # Kernel32.InvalidHandleValue THEN
-				fsize := Kernel32.GetFileSize( hfile, NIL );  ASSERT( fsize >= 0 );  s := Kernel32.GetFileAttributes( name );
-				IF Kernel32.FileAttributeTemporary IN s THEN EXCL( s, Kernel32.FileAttributeTemporary );  res := Kernel32.SetFileAttributes( name, s );  ASSERT( res # 0 );  s := Kernel32.GetFileAttributes( name ) END;
+				fsize := Kernel32.GetFileSize( hfile, NIL );  ASSERT( fsize >= 0 );  s := ToSet(Kernel32.GetFileAttributes( name ));
+				IF Kernel32.FileAttributeTemporary IN s THEN EXCL( s, Kernel32.FileAttributeTemporary );  res := Kernel32.SetFileAttributes( name, Kernel32.SetToDW(s) );  ASSERT( res # 0 );  s := ToSet(Kernel32.GetFileAttributes( name )) END;
 				flags := FileFlags( s )
 			ELSE flags := {Temporary};  fsize := 0
 			END;
@@ -484,7 +484,7 @@ TYPE
 			ASSERT( buffer.dirty );  ASSERT( buffer.len > 0 );  pos := buffer.apos * BufferSize;
 			IF hfile = Kernel32.InvalidHandleValue THEN
 				ASSERT( Temporary IN flags );  NEW( tfname );  TempName( tfname^ );
-				hfile := Kernel32.CreateFile( tfname^, {Kernel32.GenericRead, Kernel32.GenericWrite}, {Kernel32.FileShareRead}, NIL , Kernel32.CreateAlways, {Kernel32.FileAttributeTemporary}, 0 );
+				hfile := Kernel32.CreateFile( tfname^, Kernel32.SetToDW({Kernel32.GenericRead, Kernel32.GenericWrite}), Kernel32.SetToDW({Kernel32.FileShareRead}), NIL , Kernel32.CreateAlways, Kernel32.SetToDW({Kernel32.FileAttributeTemporary}), 0 );
 				ASSERT( hfile # Kernel32.InvalidHandleValue );  fpos := 0
 			END;
 			IF fpos # pos THEN fpos := Kernel32.SetFilePointer( hfile, pos, NIL , Kernel32.FileBegin );  ASSERT( fpos = pos ) END;
@@ -493,7 +493,7 @@ TYPE
 				res := Kernel32.CloseHandle( hfile );
 				IF TraceFile IN Trace THEN KernelLog.String( "closed handle of " );  KernelLog.String( fname );  KernelLog.Ln;  END;
 				hfile :=
-					Kernel32.CreateFile( fname, {Kernel32.GenericRead, Kernel32.GenericWrite}, {Kernel32.FileShareRead, Kernel32.FileShareWrite}, NIL , Kernel32.OpenExisting, {Kernel32.FileAttributeNormal}, 0 );
+					Kernel32.CreateFile( fname, Kernel32.SetToDW({Kernel32.GenericRead, Kernel32.GenericWrite}), Kernel32.SetToDW({Kernel32.FileShareRead, Kernel32.FileShareWrite}), NIL , Kernel32.OpenExisting, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), 0 );
 				ASSERT( hfile # Kernel32.InvalidHandleValue );  fpos := Kernel32.SetFilePointer( hfile, pos, NIL , Kernel32.FileBegin );  ASSERT( fpos = pos );
 				res := Kernel32.WriteFile( hfile, buffer.data, buffer.len, n, NIL )
 			END;
@@ -634,10 +634,10 @@ TYPE
 			ASSERT( ~(Temporary IN flags) );
 			(*ALEX 2005.12.08*)
 			IF hfile = Kernel32.InvalidHandleValue THEN
-				hfile := Kernel32.CreateFile( fname, {Kernel32.GenericRead}, {Kernel32.FileShareRead, Kernel32.FileShareWrite}, NIL , Kernel32.CreateAlways, {Kernel32.FileAttributeNormal}, 0 );
+				hfile := Kernel32.CreateFile( fname, Kernel32.SetToDW({Kernel32.GenericRead}), Kernel32.SetToDW({Kernel32.FileShareRead, Kernel32.FileShareWrite}), NIL , Kernel32.CreateAlways, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), 0 );
 			END;
 			IF hfile = Kernel32.InvalidHandleValue THEN
-				hfile := Kernel32.CreateFile( fname, {Kernel32.GenericRead}, {Kernel32.FileShareRead, Kernel32.FileShareWrite}, NIL , Kernel32.OpenExisting, {Kernel32.FileAttributeNormal}, 0 );
+				hfile := Kernel32.CreateFile( fname, Kernel32.SetToDW({Kernel32.GenericRead}), Kernel32.SetToDW({Kernel32.FileShareRead, Kernel32.FileShareWrite}), NIL , Kernel32.OpenExisting, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), 0 );
 			END;
 			IF buffer.dirty THEN WriteBuffer() END;
 			(*
@@ -651,7 +651,7 @@ TYPE
 			IF TraceFile IN Trace THEN KernelLog.String( "toTemp: " );  KernelLog.String( fname );  KernelLog.String( " => " );  KernelLog.String( tfname^ );  KernelLog.Ln;  END;
 			IF ~MoveFile( fname, tfname^ ) THEN HALT( 1241 ) (* RETURN FALSE *) END;
 			winFS.collection.Unregister( SELF );
-			hfile := Kernel32.CreateFile( tfname^, {Kernel32.GenericRead, Kernel32.GenericWrite}, {Kernel32.FileShareRead}, NIL , Kernel32.OpenExisting, {Kernel32.FileAttributeTemporary}, 0 );
+			hfile := Kernel32.CreateFile( tfname^, Kernel32.SetToDW({Kernel32.GenericRead, Kernel32.GenericWrite}), Kernel32.SetToDW({Kernel32.FileShareRead}), NIL , Kernel32.OpenExisting, Kernel32.SetToDW({Kernel32.FileAttributeTemporary}), 0 );
 			(* IF hfile = Kernel32.InvalidHandleValue THEN RETURN FALSE END; *)
 			ASSERT( hfile # Kernel32.InvalidHandleValue );  fsize := Kernel32.GetFileSize( hfile, NIL );  ASSERT( fsize >= 0 );  SELF.tfname := tfname;  COPY( tfname^, fname );  RETURN TRUE;
 		END ToTemp;
@@ -677,8 +677,8 @@ TYPE
 					res := 1;  RETURN;
 					(* HALT( 1242 )*)
 				END;
-				hfile := Kernel32.CreateFile( fname, {Kernel32.GenericRead, Kernel32.GenericWrite}, {Kernel32.FileShareRead, Kernel32.FileShareWrite}, NIL , Kernel32.OpenExisting, {Kernel32.FileAttributeNormal}, 0 )
-			ELSE hfile := Kernel32.CreateFile( fname, {Kernel32.GenericRead, Kernel32.GenericWrite}, {Kernel32.FileShareRead, Kernel32.FileShareWrite}, NIL , Kernel32.CreateAlways, {Kernel32.FileAttributeNormal}, 0 )
+				hfile := Kernel32.CreateFile( fname, Kernel32.SetToDW({Kernel32.GenericRead, Kernel32.GenericWrite}), Kernel32.SetToDW({Kernel32.FileShareRead, Kernel32.FileShareWrite}), NIL , Kernel32.OpenExisting, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), 0 )
+			ELSE hfile := Kernel32.CreateFile( fname, Kernel32.SetToDW({Kernel32.GenericRead, Kernel32.GenericWrite}),Kernel32.SetToDW({Kernel32.FileShareRead, Kernel32.FileShareWrite}), NIL , Kernel32.CreateAlways, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), 0 )
 			END;
 			IF hfile = Kernel32.InvalidHandleValue THEN res := 1;  RETURN END;
 			ASSERT( hfile # Kernel32.InvalidHandleValue );  winFS.collection.Register( SELF );  res := 0
@@ -756,7 +756,7 @@ VAR
 
 	PROCEDURE MoveFile( VAR from, to: ARRAY OF CHAR ): BOOLEAN;
 	BEGIN
-		IF Kernel32.MoveFileEx( from, to, {Kernel32.MoveFileReplaceExisting, Kernel32.MoveFileCopyAllowed} ) = Kernel32.False THEN
+		IF Kernel32.MoveFileEx( from, to, Kernel32.SetToDW({Kernel32.MoveFileReplaceExisting, Kernel32.MoveFileCopyAllowed}) ) = Kernel32.False THEN
 			IF Kernel32.CopyFile( from, to, Kernel32.False ) = Kernel32.False THEN
 				IF TraceFile IN Trace THEN KernelLog.String( "could not copy" );  KernelLog.Ln;  END;
 				RETURN FALSE
@@ -1097,12 +1097,12 @@ VAR
 
 	PROCEDURE SetAttributes*( file: ARRAY OF CHAR;  attrs: SET );   (** non-portable *)
 	BEGIN
-		ConvertChar( file, Files.PathDelimiter, PathDelimiter );  Kernel32.SetFileAttributes( file, attrs )
+		ConvertChar( file, Files.PathDelimiter, PathDelimiter );  Kernel32.SetFileAttributes( file, Kernel32.SetToDW(attrs) )
 	END SetAttributes;
 
 	PROCEDURE SetFileAttributes*( file: ARRAY OF CHAR;  attrs: SET );   (** non-portable *)
 	BEGIN
-		ConvertChar( file, Files.PathDelimiter, PathDelimiter );  Kernel32.SetFileAttributes( file, attrs )
+		ConvertChar( file, Files.PathDelimiter, PathDelimiter );  Kernel32.SetFileAttributes( file, Kernel32.SetToDW(attrs) )
 	END SetFileAttributes;
 
 

+ 1 - 1
source/Win32.WinTrace.Mod

@@ -90,7 +90,7 @@ VAR filename: ARRAY 256 OF CHAR;
 BEGIN
 	Close;
 	IF ~context.arg.GetString(filename) THEN filename := "WinTrace.Text" END;
-	hout := Kernel32.CreateFile(filename, {Kernel32.GenericWrite}, {Kernel32.FileShareRead}, NIL, Kernel32.CreateAlways, {Kernel32.FileAttributeNormal}, Kernel32.NULL);
+	hout := Kernel32.CreateFile(filename, Kernel32.SetToDW({Kernel32.GenericWrite}), Kernel32.SetToDW({Kernel32.FileShareRead}), NIL, Kernel32.CreateAlways, Kernel32.SetToDW({Kernel32.FileAttributeNormal}), Kernel32.NULL);
 	ASSERT ((hout) # (Kernel32.InvalidHandleValue));
 	herr := hout;
 	Trace.Char := Char;

+ 14 - 8
source/Win64.Machine.Mod

@@ -466,7 +466,7 @@ END TraceChar;
 PROCEDURE SetTraceFile(VAR filename: ARRAY OF CHAR);
 BEGIN
 	Trace.String("trace -> file "); Trace.String(filename); Trace.Ln;
-	hout := Kernel32.CreateFile(filename, {Kernel32.GenericWrite}, {Kernel32.FileShareRead}, NIL, Kernel32.CreateAlways, {Kernel32.FileAttributeNormal}, Kernel32.NULL);
+	hout := Kernel32.CreateFile(filename, SetToDW({Kernel32.GenericWrite}), SetToDW({Kernel32.FileShareRead}), NIL, Kernel32.CreateAlways, SetToDW({Kernel32.FileAttributeNormal}), Kernel32.NULL);
 	Kernel32.GetFullPathName(filename, LEN(filename), filename, NIL);
 	Trace.Char := TraceChar;
 END SetTraceFile;
@@ -605,7 +605,7 @@ BEGIN
 		ToExecutablePath(DefaultConfigFile, defaultConfigFile);
 	END;
 	COPY(UserConfigFile, userConfigFile);
-	hfile := Kernel32.CreateFile( userConfigFile, {Kernel32.GenericRead}, {Kernel32.FileShareRead}, NIL , Kernel32.OpenExisting, {Kernel32.FileAttributeNormal}, 0 );
+	hfile := Kernel32.CreateFile( userConfigFile, SetToDW({Kernel32.GenericRead}), SetToDW({Kernel32.FileShareRead}), NIL , Kernel32.OpenExisting, SetToDW({Kernel32.FileAttributeNormal}), 0 );
 	IF hfile = Kernel32.InvalidHandleValue THEN
 		ToExecutablePath(UserConfigFile, userConfigFile);
 	ELSE
@@ -745,9 +745,9 @@ BEGIN
 	IF memBlkSize < MemBlockSize THEN memBlkSize := MemBlockSize END; 	(* MemBlockSize implicitly multiple of StaticBlockSize *)
 
 	initVal := 8*1024*1024;
-	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, {Kernel32.MEMCommit, Kernel32.MEMReserve}, {Kernel32.PageExecuteReadWrite});
+	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, SetToDW({Kernel32.MEMCommit, Kernel32.MEMReserve}), SetToDW({Kernel32.PageExecuteReadWrite}));
 	IF adr = NilVal THEN (* allocation failed *)
-		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, {Kernel32.MEMCommit}, {Kernel32.PageExecuteReadWrite});
+		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, SetToDW({Kernel32.MEMCommit}), SetToDW({Kernel32.PageExecuteReadWrite}));
 	END;
 	Trace.String("first heap block intVal "); Trace.Int(initVal,1); Trace.Ln;
 	Trace.String("first heap block memBlkSize "); Trace.Int(memBlkSize,1); Trace.Ln;
@@ -875,6 +875,12 @@ BEGIN
 	END
 END InsertMemoryBlock;
 
+PROCEDURE SetToDW(set: SET): Kernel32.DWORD;
+BEGIN
+	RETURN SYSTEM.VAL(Kernel32.DWORD,set);
+END SetToDW;
+
+
 (* expand heap by allocating a new memory block - called during GC *)
 PROCEDURE ExpandHeap*(dummy: LONGINT; size: SIZE; VAR memoryBlock: MemoryBlock; VAR beginBlockAdr, endBlockAdr: ADDRESS);
 CONST MemBlockHeaderSize = BlockHeaderSize + RecordDescSize + BlockHeaderSize;
@@ -891,9 +897,9 @@ BEGIN
 	memBlkSize := memDescSize + size + StaticBlockSize; 		(* add StaticBlockSize to account for alignments different from multiples of StaticBlockSize *)
 	INC(memBlkSize, (-memBlkSize) MOD MemBlockSize);
 	initVal := memBlockTail.startAdr + memBlockTail.size;
-	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, {Kernel32.MEMCommit, Kernel32.MEMReserve}, {Kernel32.PageExecuteReadWrite});
+	adr := Kernel32.VirtualAlloc(initVal, memBlkSize, SetToDW({Kernel32.MEMCommit, Kernel32.MEMReserve}), SetToDW({Kernel32.PageExecuteReadWrite}));
 	IF adr = NilVal THEN (* allocation failed *)
-		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, {Kernel32.MEMCommit}, {Kernel32.PageExecuteReadWrite});
+		adr := Kernel32.VirtualAlloc(NilVal, memBlkSize, SetToDW({Kernel32.MEMCommit}), SetToDW({Kernel32.PageExecuteReadWrite}));
 	END;
 	continue := adr = initVal;
 	Trace.String("expand heap block intVal "); Trace.Int(initVal,1); Trace.Ln;
@@ -977,8 +983,8 @@ BEGIN
 		END;
 		memBlock.next := NIL;
 		startAdr := memBlock.startAdr; (* this value must be cached for the second call of Kernel32.VirtualFree *)
-		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, memBlock.startAdr), memBlock.size, {Kernel32.MEMDecommit});
-		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, startAdr ), 0, {Kernel32.MEMRelease});
+		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, memBlock.startAdr), memBlock.size, SetToDW({Kernel32.MEMDecommit}));
+		Kernel32.VirtualFree(SYSTEM.VAL(LONGINT, startAdr ), 0, SetToDW({Kernel32.MEMRelease}));
 	ELSE
 		HALT(535)	(* error in memory block management *)
 	END;

+ 3 - 7
source/Win64.Objects.Mod

@@ -6,7 +6,7 @@ IMPORT SYSTEM, Trace, Kernel32, Machine, Modules, Heaps;
 
 CONST
 	HandleExcp = TRUE;   (* FALSE -> we asume that it is done correctly by Traps *)
-	TraceVerbose = TRUE;
+	TraceVerbose = FALSE;
 	StrongChecks = FALSE;  defaultStackSize = 0;
 	TraceOpenClose = FALSE;
 
@@ -518,7 +518,6 @@ END StackBottom;
 PROCEDURE {WINAPI} ExcpFrmHandler( CONST exceptionPointers: Kernel32.ExceptionPointers): Kernel32.DWORD ;
 VAR m: Modules.Module;  eip, ebp, stack: ADDRESS;  pc, handler, fp, sp: ADDRESS;  handled: BOOLEAN;  t: Process;
 BEGIN
-	TRACE("TRAP"); 
 	handled := FALSE;
 
 	Kernel32.EnterCriticalSection( excplock );
@@ -614,7 +613,6 @@ BEGIN
 		END
 	ELSE exceptionhandler(exceptionPointers.context^, exceptionPointers.exception^,handled );
 	END;
-	TRACE(handled); 
 	IF ~handled THEN 
 		exceptionPointers.context.PC := (*TerminateProc*)  t.restartPC ; 
 		exceptionPointers.context.SP := t.restartSP;
@@ -738,7 +736,6 @@ END WriteType;
 PROCEDURE terminate( t: Process );
 VAR hdr {UNTRACED}: Heaps.ProtRecBlock; res: Kernel32.BOOL; shutdown: BOOLEAN;
 BEGIN
-	TRACE("terminate"); 
 	IF t = NIL THEN RETURN END;
 	(* see Objects.TerminateThis *)
 	Machine.Acquire( Machine.Objects );
@@ -854,7 +851,6 @@ END FinalizeProcess;
 
 PROCEDURE TerminateProc;
 BEGIN
-	TRACE("TerminateProc");
 	terminate(CurrentProcess());
 	Kernel32.ExitThread(0);
 	Kernel32.Sleep(999999);   (* wait until dependent threads terminated *)
@@ -891,7 +887,7 @@ BEGIN
 
 		(* t.restartPC := SYSTEM.VAL(ADDRESS, terminateProc);*) 
 	
-	t.handle := Kernel32.CreateThread(0, defaultStackSize, Wrapper, t, {}, t.id);
+	t.handle := Kernel32.CreateThread(0, defaultStackSize, Wrapper, t, Kernel32.SetToDW({}), t.id);
 
 	IF TraceVerbose OR TraceOpenClose THEN
 		Machine.Acquire(Machine.TraceOutput);
@@ -1187,7 +1183,7 @@ BEGIN
 	t.handle := Kernel32.GetCurrentThread();
 	t.id := Kernel32.GetCurrentThreadId();
 	proc := Kernel32.GetCurrentProcess();
-	res := Kernel32.DuplicateHandle(proc, t.handle, proc, t.handle, {}, 0, {Kernel32.DuplicateSameAccess});
+	res := Kernel32.DuplicateHandle(proc, t.handle, proc, t.handle, Kernel32.SetToDW({}), 0, Kernel32.SetToDW({Kernel32.DuplicateSameAccess}));
 	ASSERT(res # 0);
 	res := Kernel32.TlsSetValue(tlsIndex, SYSTEM.VAL(LONGINT, t));
 	ASSERT(res # 0);