ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2013
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
14 participants
325 discussions
Start a n
N
ew thread
[hbelusca] 60791: Fix a comment.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Tue Oct 29 21:46:47 2013 New Revision: 60791 URL:
http://svn.reactos.org/svn/reactos?rev=60791&view=rev
Log: Fix a comment. Modified: branches/ntvdm/subsystems/ntvdm/dos.c Modified: branches/ntvdm/subsystems/ntvdm/dos.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Tue Oct 29 21:46:47 2013 @@ -803,7 +803,7 @@ * FlushConsoleInputBuffer() for us. */ // if (IsConsoleHandle(Handle)) - // return (BOOLEAN)FlushConsoleInputBuffer(hFile); + // return (BOOLEAN)FlushConsoleInputBuffer(Handle); // else return (BOOLEAN)FlushFileBuffers(Handle); }
11 years, 1 month
1
0
0
0
[hbelusca] 60790: [NTVDM]: DOS: - The DosErrorLevel is stored as a WORD: its LOWORD is the return code and the HIWORD is the termination code. - When copying CurrentDirectories[...], be sure that w...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Tue Oct 29 01:55:54 2013 New Revision: 60790 URL:
http://svn.reactos.org/svn/reactos?rev=60790&view=rev
Log: [NTVDM]: DOS: - The DosErrorLevel is stored as a WORD: its LOWORD is the return code and the HIWORD is the termination code. - When copying CurrentDirectories[...], be sure that we copy maximum DOS_DIR_LENGTH chars. - Implement (or stubplement) bunch of INT 21h functions: 0x03, 0x04, 0x05, 0x0C, 0x0D, 0x26, 0x37, 0x47, 0x4D and 0x50. Functions 0x18, 0x1D, 0x1E and 0x20 are NULL functions present in DOS for CP/M compatibility only. - Fix DOS version querying. - Use set/getAX() instead of EmulatorSet/GetRegister, and use setCF instead of EmulatorSetFlag. Modified: branches/ntvdm/subsystems/ntvdm/dos.c branches/ntvdm/subsystems/ntvdm/dos.h Modified: branches/ntvdm/subsystems/ntvdm/dos.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Tue Oct 29 01:55:54 2013 @@ -28,7 +28,7 @@ static WORD DosSftRefCount[DOS_SFT_SIZE]; static BYTE DosAllocStrategy = DOS_ALLOC_BEST_FIT; static BOOLEAN DosUmbLinked = FALSE; -static BYTE DosErrorLevel = 0; +static WORD DosErrorLevel = 0x0000; /* PRIVATE FUNCTIONS **********************************************************/ @@ -790,6 +790,24 @@ return ERROR_SUCCESS; } +BOOLEAN DosFlushFileBuffers(WORD FileHandle) +{ + HANDLE Handle = DosGetRealHandle(FileHandle); + + /* Make sure the handle is valid */ + if (Handle == INVALID_HANDLE_VALUE) return FALSE; + + /* + * No need to check whether the handle is a console handle since + * FlushFileBuffers() automatically does this check and calls + * FlushConsoleInputBuffer() for us. + */ + // if (IsConsoleHandle(Handle)) + // return (BOOLEAN)FlushConsoleInputBuffer(hFile); + // else + return (BOOLEAN)FlushFileBuffers(Handle); +} + BOOLEAN DosDuplicateHandle(WORD OldHandle, WORD NewHandle) { BYTE SftIndex; @@ -940,9 +958,15 @@ } /* Set the directory for the drive */ - if (Path != NULL) strcpy(CurrentDirectories[DriveNumber], Path); - else strcpy(CurrentDirectories[DriveNumber], ""); - + if (Path != NULL) + { + strncpy(CurrentDirectories[DriveNumber], Path, DOS_DIR_LENGTH); + } + else + { + CurrentDirectories[DriveNumber][0] = '\0'; + } + /* Return success */ return TRUE; } @@ -963,8 +987,8 @@ /* Save the interrupt vectors */ PspBlock->TerminateAddress = IntVecTable[0x22]; - PspBlock->BreakAddress = IntVecTable[0x23]; - PspBlock->CriticalAddress = IntVecTable[0x24]; + PspBlock->BreakAddress = IntVecTable[0x23]; + PspBlock->CriticalAddress = IntVecTable[0x24]; /* Set the parent PSP */ PspBlock->ParentPsp = CurrentPsp; @@ -1260,8 +1284,8 @@ if (CurrentPsp == SYSTEM_PSP) VdmRunning = FALSE; } - /* Save the return code */ - DosErrorLevel = ReturnCode; + /* Save the return code - Normal termination */ + DosErrorLevel = MAKEWORD(ReturnCode, 0x00); /* Return control to the parent process */ EmulatorExecute(HIWORD(PspBlock->TerminateAddress), @@ -1371,7 +1395,7 @@ VOID DosInt21h(LPWORD Stack) { - CHAR Character; + BYTE Character; SYSTEMTIME SystemTime; PCHAR String; PDOS_INPUT_BUFFER InputBuffer; @@ -1386,38 +1410,68 @@ break; } - /* Read Character And Echo */ + /* Read Character from STDIN with Echo */ case 0x01: { Character = DosReadCharacter(); DosPrintCharacter(Character); /* Let the BOP repeat if needed */ - if (EmulatorGetFlag(EMULATOR_FLAG_CF)) break; + if (getCF()) break; setAL(Character); break; } - /* Print Character */ + /* Write Character to STDOUT */ case 0x02: { - BYTE Character = getDL(); + Character = getDL(); DosPrintCharacter(Character); /* - * We return the output character (DOS 2.1+), see: - *
http://www.delorie.com/djgpp/doc/rbinter/id/65/25.html
+ * We return the output character (DOS 2.1+). + * Also, if we're going to output a TAB, then + * don't return a TAB but a SPACE instead. + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2554.htm
* for more information. */ - setAL(Character); + setAL(Character == '\t' ? ' ' : Character); + break; + } + + /* Read Character from STDAUX */ + case 0x03: + { + // FIXME: Really read it from STDAUX! + DPRINT1("INT 16h, 03h: Read character from STDAUX is HALFPLEMENTED\n"); + setAL(DosReadCharacter()); + break; + } + + /* Write Character to STDAUX */ + case 0x04: + { + // FIXME: Really write it to STDAUX! + DPRINT1("INT 16h, 04h: Write character to STDAUX is HALFPLEMENTED\n"); + DosPrintCharacter(getDL()); + break; + } + + /* Write Character to Printer */ + case 0x05: + { + // FIXME: Really write it to printer! + DPRINT1("INT 16h, 05h: Write character to printer is HALFPLEMENTED -\n\n"); + DPRINT1("0x%p\n", getDL()); + DPRINT1("\n\n-----------\n\n"); break; } /* Direct Console I/O */ case 0x06: { - BYTE Character = getDL(); + Character = getDL(); if (Character != 0xFF) { @@ -1425,8 +1479,8 @@ DosPrintCharacter(Character); /* - * We return the output character (DOS 2.1+), see: - *
http://www.delorie.com/djgpp/doc/rbinter/id/69/25.html
+ * We return the output character (DOS 2.1+). + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2558.htm
* for more information. */ setAL(Character); @@ -1443,27 +1497,27 @@ { /* No character available */ Stack[STACK_FLAGS] |= EMULATOR_FLAG_ZF; - setAL(0); + setAL(0x00); } } break; } - /* Read Character Without Echo */ + /* Character Input without Echo */ case 0x07: case 0x08: { Character = DosReadCharacter(); /* Let the BOP repeat if needed */ - if (EmulatorGetFlag(EMULATOR_FLAG_CF)) break; + if (getCF()) break; setAL(Character); break; } - /* Print String */ + /* Write string to STDOUT */ case 0x09: { String = (PCHAR)SEG_OFF_TO_PTR(getDS(), getDX()); @@ -1475,8 +1529,8 @@ } /* - * We return the output character (DOS 2.1+), see: - *
http://www.delorie.com/djgpp/doc/rbinter/id/73/25.html
+ * We return the terminating character (DOS 2.1+). + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2562.htm
* for more information. */ setAL('$'); @@ -1494,7 +1548,7 @@ Character = DosReadCharacter(); /* If it's not ready yet, let the BOP repeat */ - if (EmulatorGetFlag(EMULATOR_FLAG_CF)) break; + if (getCF()) break; /* Echo the character and append it to the buffer */ DosPrintCharacter(Character); @@ -1516,6 +1570,49 @@ break; } + /* Flush Buffer and Read STDIN */ + case 0x0C: + { + BYTE InputFunction = getAL(); + + /* Flush STDIN buffer */ + DosFlushFileBuffers(DOS_INPUT_HANDLE); // Maybe just create a DosFlushInputBuffer... + + /* + * If the input function number contained in AL is valid, i.e. + * AL == 0x01 or 0x06 or 0x07 or 0x08 or 0x0A, call ourselves + * recursively with AL == AH. + */ + if (InputFunction == 0x01 || InputFunction == 0x06 || + InputFunction == 0x07 || InputFunction == 0x08 || + InputFunction == 0x0A) + { + setAH(InputFunction); + /* + * Instead of calling ourselves really recursively as in: + * DosInt21h(Stack); + * prefer resetting the CF flag to let the BOP repeat. + */ + setCF(1); + } + break; + } + + /* Disk Reset */ + case 0x0D: + { + PDOS_PSP PspBlock = SEGMENT_TO_PSP(CurrentPsp); + + // TODO: Flush what's needed. + DPRINT1("INT 21h, 0Dh is UNIMPLEMENTED\n"); + + /* Clear CF in DOS 6 only */ + if (PspBlock->DosVersion == 0x0006) + Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; + + break; + } + /* Set Default Drive */ case 0x0E: { @@ -1524,6 +1621,22 @@ break; } + /* NULL Function for CP/M Compatibility */ + case 0x18: + { + /* + * This function corresponds to the CP/M BDOS function + * "get bit map of logged drives", which is meaningless + * under MS-DOS. + * + * For: PTS-DOS 6.51 & S/DOS 1.0 - EXTENDED RENAME FILE USING FCB + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2584.htm
+ * for more information. + */ + setAL(0x00); + break; + } + /* Get Default Drive */ case 0x19: { @@ -1538,6 +1651,42 @@ break; } + /* NULL Function for CP/M Compatibility */ + case 0x1D: + case 0x1E: + { + /* + * Function 0x1D corresponds to the CP/M BDOS function + * "get bit map of read-only drives", which is meaningless + * under MS-DOS. + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2592.htm
+ * for more information. + * + * Function 0x1E corresponds to the CP/M BDOS function + * "set file attributes", which was meaningless under MS-DOS 1.x. + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2593.htm
+ * for more information. + */ + setAL(0x00); + break; + } + + /* NULL Function for CP/M Compatibility */ + case 0x20: + { + /* + * This function corresponds to the CP/M BDOS function + * "get/set default user (sublibrary) number", which is meaningless + * under MS-DOS. + * + * For: S/DOS 1.0+ & PTS-DOS 6.51+ - GET OEM REVISION + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2596.htm
+ * for more information. + */ + setAL(0x00); + break; + } + /* Set Interrupt Vector */ case 0x25: { @@ -1545,11 +1694,17 @@ /* Write the new far pointer to the IDT */ ((PDWORD)BaseAddress)[getAL()] = FarPointer; - - break; - } - - /* Get system date */ + break; + } + + /* Create New PSP */ + case 0x26: + { + DPRINT1("INT 21h, 26h - Create New PSP is UNIMPLEMENTED\n"); + break; + } + + /* Get System Date */ case 0x2A: { GetLocalTime(&SystemTime); @@ -1559,7 +1714,7 @@ break; } - /* Set system date */ + /* Set System Date */ case 0x2B: { GetLocalTime(&SystemTime); @@ -1572,7 +1727,7 @@ break; } - /* Get system time */ + /* Get System Time */ case 0x2C: { GetLocalTime(&SystemTime); @@ -1581,7 +1736,7 @@ break; } - /* Set system time */ + /* Set System Time */ case 0x2D: { GetLocalTime(&SystemTime); @@ -1608,22 +1763,34 @@ { PDOS_PSP PspBlock = SEGMENT_TO_PSP(CurrentPsp); - if (LOBYTE(PspBlock->DosVersion) < 5 || getAL() == 0) - { - /* Return DOS 24-bit user serial number in BL:CX */ - setBL(0x00); - setCX(0x0000); - } - - if (LOBYTE(PspBlock->DosVersion) >= 5 && getAL() == 1) + /* + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2711.htm
+ * for more information. + */ + + if (LOBYTE(PspBlock->DosVersion) < 5 || getAL() == 0x00) { /* * Return DOS OEM number: * 0x00 for IBM PC-DOS - * 0xFF for MS-DOS + * 0x02 for packaged MS-DOS */ - setBH(0xFF); - } + setBH(0x02); + } + + if (LOBYTE(PspBlock->DosVersion) >= 5 && getAL() == 0x01) + { + /* + * Return version flag: + * 1 << 3 if DOS is in ROM, + * 0 (reserved) if not. + */ + setBH(0x00); + } + + /* Return DOS 24-bit user serial number in BL:CX */ + setBL(0x00); + setCX(0x0000); /* Return DOS version: Minor:Major in AH:AL */ setAX(PspBlock->DosVersion); @@ -1640,6 +1807,60 @@ setES(HIWORD(FarPointer)); setBX(LOWORD(FarPointer)); break; + } + + /* SWITCH character - AVAILDEV */ + case 0x37: + { + if (getAL() == 0x00) + { + /* + * DOS 2+ - "SWITCHAR" - GET SWITCH CHARACTER + * This setting is ignored by MS-DOS 4.0+. + * MS-DOS 5+ always return AL=00h/DL=2Fh. + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2752.htm
+ * for more information. + */ + setDL('/'); + setAL(0x00); + } + else if (getAL() == 0x01) + { + /* + * DOS 2+ - "SWITCHAR" - SET SWITCH CHARACTER + * This setting is ignored by MS-DOS 5+. + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2753.htm
+ * for more information. + */ + // getDL(); + setAL(0xFF); + } + else if (getAL() == 0x02) + { + /* + * DOS 2.x and 3.3+ only - "AVAILDEV" - SPECIFY \DEV\ PREFIX USE + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2754.htm
+ * for more information. + */ + // setDL(); + setAL(0xFF); + } + else if (getAL() == 0x03) + { + /* + * DOS 2.x and 3.3+ only - "AVAILDEV" - SPECIFY \DEV\ PREFIX USE + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2754.htm
+ * for more information. + */ + // getDL(); + setAL(0xFF); + } + else + { + setAL(0xFF); + } + + break; } /* Create Directory */ @@ -1756,7 +1977,7 @@ break; } - /* Read File */ + /* Read from File or Device */ case 0x3F: { WORD Handle = getBX(); @@ -1770,17 +1991,20 @@ while (Stack[STACK_COUNTER] < Count) { /* Read a character from the BIOS */ - Buffer[Stack[STACK_COUNTER]] = LOBYTE(BiosGetCharacter()); // FIXME: Security checks! + // FIXME: Security checks! + Buffer[Stack[STACK_COUNTER]] = LOBYTE(BiosGetCharacter()); /* Stop if the BOP needs to be repeated */ - if (EmulatorGetFlag(EMULATOR_FLAG_CF)) break; + if (getCF()) break; /* Increment the counter */ Stack[STACK_COUNTER]++; } - if (Stack[STACK_COUNTER] < Count) ErrorCode = ERROR_NOT_READY; - else BytesRead = Count; + if (Stack[STACK_COUNTER] < Count) + ErrorCode = ERROR_NOT_READY; + else + BytesRead = Count; } else { @@ -1788,7 +2012,7 @@ ErrorCode = DosReadFile(Handle, Buffer, Count, &BytesRead); } - if (ErrorCode == 0) + if (ErrorCode == ERROR_SUCCESS) { Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; setAX(BytesRead); @@ -1801,7 +2025,7 @@ break; } - /* Write File */ + /* Write to File or Device */ case 0x40: { WORD BytesWritten = 0; @@ -1810,7 +2034,7 @@ getCX(), &BytesWritten); - if (ErrorCode == 0) + if (ErrorCode == ERROR_SUCCESS) { Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; setAX(BytesWritten); @@ -1833,6 +2057,11 @@ if (DeleteFileA(FileName)) { Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; + /* + * See Ralf Brown:
http://www.ctyme.com/intr/rb-2797.htm
+ * "AX destroyed (DOS 3.3) AL seems to be drive of deleted file." + */ + setAL(FileName[0] - 'A'); } else { @@ -1852,7 +2081,7 @@ getAL(), &NewLocation); - if (ErrorCode == 0) + if (ErrorCode == ERROR_SUCCESS) { Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; @@ -1885,12 +2114,13 @@ { Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF; setAX(GetLastError()); - break; } - - /* Return the attributes that DOS can understand */ - Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; - setCL(LOBYTE(Attributes)); + else + { + /* Return the attributes that DOS can understand */ + Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; + setCX(Attributes & 0x00FF); + } } else if (getAL() == 0x01) { @@ -1977,6 +2207,42 @@ break; } + /* Get Current Directory */ + case 0x47: + { + BYTE DriveNumber = getDL(); + String = (PCHAR)SEG_OFF_TO_PTR(getDS(), getSI()); + + /* Get the real drive number */ + if (DriveNumber == 0) + { + DriveNumber = CurrentDrive; + } + else + { + /* Decrement DriveNumber since it was 1-based */ + DriveNumber--; + } + + if (DriveNumber <= LastDrive - 'A') + { + /* + * Copy the current directory into the target buffer. + * It doesn't contain the drive letter and the backslash. + */ + strncpy(String, CurrentDirectories[DriveNumber], DOS_DIR_LENGTH); + Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; + setAX(0x0100); // Undocumented, see Ralf Brown:
http://www.ctyme.com/intr/rb-2933.htm
+ } + else + { + Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF; + setAX(ERROR_INVALID_DRIVE); + } + + break; + } + /* Allocate Memory */ case 0x48: { @@ -2040,7 +2306,28 @@ break; } - /* Get Current Process */ + /* Get Return Code (ERRORLEVEL) */ + case 0x4D: + { + /* + * According to Ralf Brown:
http://www.ctyme.com/intr/rb-2976.htm
+ * DosErrorLevel is cleared after being read by this function. + */ + Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; + setAX(DosErrorLevel); + DosErrorLevel = 0x0000; // Clear it + break; + } + + /* Internal - Set Current Process ID (Set PSP Address) */ + case 0x50: + { + // FIXME: Is it really what it's done ?? + CurrentPsp = getBX(); + break; + } + + /* Get Current Process ID (Get PSP Address) */ case 0x51: { setBX(CurrentPsp); @@ -2221,7 +2508,7 @@ /* Set the drive */ CurrentDrive = DosDirectory[0] - 'A'; - /* Get the path */ + /* Get the directory part of the path */ Path = strchr(DosDirectory, '\\'); if (Path != NULL) { @@ -2230,7 +2517,10 @@ } /* Set the directory */ - if (Path != NULL) strcpy(CurrentDirectories[CurrentDrive], Path); + if (Path != NULL) + { + strncpy(CurrentDirectories[CurrentDrive], Path, DOS_DIR_LENGTH); + } /* Read CONFIG.SYS */ Stream = _wfopen(DOS_CONFIG_PATH, L"r"); Modified: branches/ntvdm/subsystems/ntvdm/dos.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.h?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/dos.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/dos.h [iso-8859-1] Tue Oct 29 01:55:54 2013 @@ -102,7 +102,8 @@ typedef struct _DOS_INPUT_BUFFER { - BYTE MaxLength, Length; + BYTE MaxLength; + BYTE Length; CHAR Buffer[ANYSIZE_ARRAY]; } DOS_INPUT_BUFFER, *PDOS_INPUT_BUFFER;
11 years, 1 month
1
0
0
0
[aandrejevic] 60789: [NTVDM] Save the error code returned by applications.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Tue Oct 29 00:10:14 2013 New Revision: 60789 URL:
http://svn.reactos.org/svn/reactos?rev=60789&view=rev
Log: [NTVDM] Save the error code returned by applications. Modified: branches/ntvdm/subsystems/ntvdm/dos.c Modified: branches/ntvdm/subsystems/ntvdm/dos.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Tue Oct 29 00:10:14 2013 @@ -28,6 +28,7 @@ static WORD DosSftRefCount[DOS_SFT_SIZE]; static BYTE DosAllocStrategy = DOS_ALLOC_BEST_FIT; static BOOLEAN DosUmbLinked = FALSE; +static BYTE DosErrorLevel = 0; /* PRIVATE FUNCTIONS **********************************************************/ @@ -1259,6 +1260,9 @@ if (CurrentPsp == SYSTEM_PSP) VdmRunning = FALSE; } + /* Save the return code */ + DosErrorLevel = ReturnCode; + /* Return control to the parent process */ EmulatorExecute(HIWORD(PspBlock->TerminateAddress), LOWORD(PspBlock->TerminateAddress));
11 years, 1 month
1
0
0
0
[tkreuzer] 60788: [WIN32K] Several fixes and improvements to NtGdiSetDIBitsToDeviceInternal and GreCreateDIBitmapInternal [GDI32] "Fix" behavior of SetDIBitsToDevice, based on how (broken) Windows ...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Oct 28 20:59:54 2013 New Revision: 60788 URL:
http://svn.reactos.org/svn/reactos?rev=60788&view=rev
Log: [WIN32K] Several fixes and improvements to NtGdiSetDIBitsToDeviceInternal and GreCreateDIBitmapInternal [GDI32] "Fix" behavior of SetDIBitsToDevice, based on how (broken) Windows actually behaves All tests for SetDIBitsToDevice now pass, except one, but this seems to be an Mm problem (looks like we commit ridiculously large user mode stacks instead of growing them on demand) Modified: branches/dib_rewrite/win32ss/gdi/gdi32/objects/bitmap.c branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c Modified: branches/dib_rewrite/win32ss/gdi/gdi32/objects/bitmap.c URL:
http://svn.reactos.org/svn/reactos/branches/dib_rewrite/win32ss/gdi/gdi32/o…
============================================================================== --- branches/dib_rewrite/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] (original) +++ branches/dib_rewrite/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] Mon Oct 28 20:59:54 2013 @@ -505,8 +505,9 @@ PBITMAPINFO pConvertedInfo; UINT ConvertedInfoSize; INT LinesCopied = 0; - UINT cjBmpScanSize = 0; + UINT cMaxScans, cjBmpScanSize = 0; BOOL Hit = FALSE; + LONG yMax; PVOID pvAlignedBits = (PVOID)pvBits; if ( !cScanLines || !lpbmi || !pvBits ) @@ -519,6 +520,16 @@ &ConvertedInfoSize, FALSE); if (!pConvertedInfo) return 0; + + /* Calculate the max y coordinate that will be used */ + yMax = YSrc + Height; + + /* Calculate the maximum scan lines. NOTE: Yes, this is broken, since + biHeight can be negative, but Windows actually seems to do this! */ + cMaxScans = min(yMax, lpbmi->bmiHeader.biHeight); + + /* Limit the scan lines to the maximum we calculated, even if it's wrong */ + cScanLines = min(cScanLines, cMaxScans - uStartScan); #if 0 // Handle something other than a normal dc object. @@ -592,7 +603,7 @@ if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr)) { - SetLastError(ERROR_INVALID_PARAMETER); + SetLastError(ERROR_INVALID_HANDLE); goto cleanup; } Modified: branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c URL:
http://svn.reactos.org/svn/reactos/branches/dib_rewrite/win32ss/gdi/ntgdi/d…
============================================================================== --- branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c [iso-8859-1] (original) +++ branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c [iso-8859-1] Mon Oct 28 20:59:54 2013 @@ -647,24 +647,59 @@ if (fInit & CBM_CREATDIB) { if (iUsage == 2) goto cleanup; + if (!pbmi) goto cleanup; if (!psurfDIB) goto cleanup; /* Need a DC for DIB_PAL_COLORS */ if ((iUsage == DIB_PAL_COLORS) && !pdc) goto cleanup; - - iFormat = psurfDIB->SurfObj.iBitmapFormat; +#if 0 + /* Create an empty DIB bitmap */ + psurfBmp = DibCreateDIBSurface(pbmi, pdc, iUsage, 0, NULL, 0); + if (psurfBmp == NULL) + { + goto cleanup; + } + + iFormat = psurfBmp->SurfObj.iBitmapFormat; if (iFormat > BMF_32BPP) goto cleanup; - +#else if (psurfDIB) { ppalBmp = psurfDIB->ppal; GDIOBJ_vReferenceObjectByPointer(&ppalBmp->BaseObject); + iFormat = psurfDIB->SurfObj.iBitmapFormat; + if (iFormat > BMF_32BPP) goto cleanup; } else { + ULONG cBitsPixel; ppalBmp = CreateDIBPalette(pbmi, pdc, iUsage); + if (pbmi->bmiHeader.biSize < sizeof(BITMAPINFOHEADER)) + { + PBITMAPCOREHEADER pbch = (PBITMAPCOREHEADER)pbmi; + cBitsPixel = pbch->bcBitCount * pbch->bcPlanes; } + else + { + cBitsPixel = pbmi->bmiHeader.biBitCount * pbmi->bmiHeader.biPlanes; + if (pbmi->bmiHeader.biCompression != BI_RGB) goto cleanup; } + + iFormat = BitmapFormat(cBitsPixel, BI_RGB); + } + + /* Allocate a surface for the bitmap */ + psurfBmp = SURFACE_AllocSurface(STYPE_BITMAP, cx, cy, iFormat, 0, 0, NULL); + if (psurfBmp == NULL) + { + goto cleanup; + } + + /* Set new palette for the bitmap */ + SURFACE_vSetPalette(psurfBmp, ppalBmp); + ppalBmp = NULL; +#endif + } else { if (psurfDC) @@ -681,15 +716,21 @@ } GDIOBJ_vReferenceObjectByPointer(&ppalBmp->BaseObject); - } /* Allocate a surface for the bitmap */ psurfBmp = SURFACE_AllocSurface(STYPE_BITMAP, cx, cy, iFormat, 0, 0, NULL); - if (psurfBmp) - { + if (psurfBmp == NULL) + { + goto cleanup; + } + /* Set new palette for the bitmap */ SURFACE_vSetPalette(psurfBmp, ppalBmp); ppalBmp = NULL; + } + + if (psurfBmp) + { if (pjInit) { @@ -1294,6 +1335,7 @@ * to. A value of 0 refers to the pixel row in the dib with the highest * y coordinate. * + * */ INT APIENTRY @@ -1305,11 +1347,11 @@ _In_ DWORD cy, _In_ INT xSrc, _In_ INT ySrc, - _In_ DWORD iStartScan, + _In_ DWORD uStartScan, _In_ DWORD cNumScan, _In_ LPBYTE pjBits, _In_ LPBITMAPINFO pbmiUser, - _In_ DWORD iUsage, + _In_ DWORD uUsage, _In_ UINT cjMaxBits, _In_ UINT cjMaxInfo, _In_ BOOL bTransformCoordinates, @@ -1317,8 +1359,8 @@ { PBITMAPINFO pbmi; HANDLE hSecure; - ULONG cyDIB; - INT yTop, iResult; + ULONG cyFullDIB, cyBand; + INT yDIB, iResult; //__debugbreak(); /* Check if parameters are valid */ if ((cNumScan == 0) || (cx >= INT_MAX) || (cy >= INT_MAX)) @@ -1333,7 +1375,7 @@ } /* Capture a safe copy of the bitmap info */ - pbmi = DibProbeAndCaptureBitmapInfo(pbmiUser, iUsage, &cjMaxInfo); + pbmi = DibProbeAndCaptureBitmapInfo(pbmiUser, uUsage, &cjMaxInfo); if (!pbmi) { /* Could not get bitmapinfo, fail. */ @@ -1344,51 +1386,54 @@ hSecure = EngSecureMemForRead(pjBits, cjMaxBits); if (!hSecure) { - iResult = 0; + cNumScan = 0; goto leave; } - /* Even when nothing is copied, the function returns the scanlines */ - iResult = cNumScan; - /* Get the absolute height of the DIB */ - cyDIB = abs(pbmi->bmiHeader.biHeight); + cyFullDIB = abs(pbmi->bmiHeader.biHeight); /* Bail out if the scanlines are outside of the DIB */ - if (iStartScan >= cyDIB) goto leave; + if (uStartScan >= cyFullDIB) goto leave; + NT_ASSERT(cyFullDIB != 0); /* Limit the number of scanlines to the DIB size */ - cNumScan = min(cNumScan, cyDIB - iStartScan); + cyBand = min(cNumScan, cyFullDIB - uStartScan); + NT_ASSERT(cyBand != 0); /* Calculate the y-origin of the given DIB data */ - yTop = cyDIB - (iStartScan + cNumScan); + yDIB = cyFullDIB - (uStartScan + cyBand); /* Bail out if the intersecion between scanlines and copy area is empty */ - if ((ySrc > yTop + (INT)cNumScan) || (ySrc + (INT)cy < yTop)) goto leave; - - /* Check if the copy area starts below or at the topmost scanline */ - if (ySrc >= yTop) - { - /* Compensate the source y-origin for the scanline offset */ - ySrc -= yTop; - } - else + if ((ySrc >= yDIB + (INT)cyBand) || (ySrc + (INT)cy <= yDIB)) goto leave; + + /* Check if the copy area starts below the y origin of the DIB */ + if (ySrc < yDIB) { /* Start at the top-most scanline in the buffer, adjust the destination coordinates and crop the size accordingly. */ - yDst += (yTop - ySrc); - cy -= (yTop - ySrc); + yDst += (yDIB - ySrc); + cy -= (yDIB - ySrc); ySrc = 0; + } + else + { + /* Compensate the source y-origin for the scanline offset */ + ySrc -= yDIB; } /* Check if the DIB is top-down */ if (pbmi->bmiHeader.biHeight < 0) { - pbmi->bmiHeader.biHeight = -(LONG)cNumScan; - } - else - { - pbmi->bmiHeader.biHeight = cNumScan; + /* Set negative band height */ + pbmi->bmiHeader.biHeight = -(LONG)cyBand; + NT_ASSERT(pbmi->bmiHeader.biHeight < 0); + } + else + { + /* Set positive band height */ + pbmi->bmiHeader.biHeight = cyBand; + NT_ASSERT(pbmi->bmiHeader.biHeight > 0); } /* Call the internal function with the secure pointers */ @@ -1403,12 +1448,14 @@ cy, pjBits, pbmi, - iUsage, + uUsage, MAKEROP4(SRCCOPY, SRCCOPY), cjMaxInfo, cjMaxBits, bTransformCoordinates, hcmXform); + if (iResult == 0) + cNumScan = 0; /* Unsecure the memory */ EngUnsecureMem(hSecure); @@ -1418,7 +1465,7 @@ DibFreeBitmapInfo(pbmi); /* Return the result */ - return iResult; + return cNumScan; }
11 years, 1 month
1
0
0
0
[tkreuzer] 60787: [GDI32_APITEST] - Add more tests for CreateDIBitmap and SetDIBitsToDevice
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Oct 28 20:39:26 2013 New Revision: 60787 URL:
http://svn.reactos.org/svn/reactos?rev=60787&view=rev
Log: [GDI32_APITEST] - Add more tests for CreateDIBitmap and SetDIBitsToDevice Modified: trunk/rostests/apitests/gdi32/CreateDIBitmap.c trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c Modified: trunk/rostests/apitests/gdi32/CreateDIBitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CreateDIBi…
============================================================================== --- trunk/rostests/apitests/gdi32/CreateDIBitmap.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/CreateDIBitmap.c [iso-8859-1] Mon Oct 28 20:39:26 2013 @@ -65,7 +65,7 @@ return FALSE; } - if ((fdwInit & CBM_INIT)) + if (fdwInit & CBM_INIT) { if (!lpbInit || (lpbInit == (PVOID)0xC0000000)) return FALSE; } @@ -74,26 +74,26 @@ { return FALSE; } - - return TRUE; - } - - if ((lpbmih == NULL) || - (lpbmih == (PVOID)0xC0000000) || - (lpbmih->biSize == 0)) - { - return FALSE; - } - - if (hdc == (HDC)-1) - { - *pdwError = ERROR_INVALID_PARAMETER; - return FALSE; - } - - - if (lpbmi == (PVOID)0xc0000000) return FALSE; - + } + else + { + + if ((lpbmih == NULL) || + (lpbmih == (PVOID)0xC0000000) || + (lpbmih->biSize == 0)) + { + return FALSE; + } + + if (hdc == (HDC)-1) + { + *pdwError = ERROR_INVALID_PARAMETER; + return FALSE; + } + + + if (lpbmi == (PVOID)0xc0000000) return FALSE; + } return TRUE; } @@ -400,7 +400,7 @@ PackedDIB.bmiHeader.biSizeImage = 0; hbmp = CreateDIBitmap(hdc, &PackedDIB.bmiHeader, CBM_INIT, &PackedDIB.ajBuffer, (PVOID)&PackedDIB, DIB_PAL_COLORS); - ok(hbmp == 0, "CreateDIBitmap succeeded, expeted failure\n"); + ok(hbmp == 0, "CreateDIBitmap succeeded, expected failure\n"); ok_err(0xbadbad00); /* Test a line that is too long */ @@ -420,14 +420,33 @@ HBITMAP hbmp, hbmpOld; HDC hdc; BITMAPINFO bmi = - {{sizeof(BITMAPINFOHEADER), 4, 4, 1, 8, BI_RGB, 0, 1, 1, 1, 0}, {{0,0,0,0}}}; - BYTE ajBits[10]; + {{sizeof(BITMAPINFOHEADER), 4, 4, 1, 8, BI_RGB, 0, 1, 1, 1, 0}, {{0,1,2,3}}}; + BYTE ajBits[10] = {0,1,2,3,4,5,6,7,8,9}; BITMAP bitmap; + struct + { + BITMAPINFOHEADER bmiHeader; + WORD wColors[4]; + } bmiRLE = + { + {sizeof(BITMAPINFOHEADER), 8, 2, 1, 8, BI_RLE8, 20, 1, 1, 4, 0}, + {0, 1, 2, 7} + }; + BYTE ajBitsRLE[] = {4,0, 0,2,0,1,0,2,3,1, 2,1, 2,2, 1,3,1,0,1,2, }; hdc = CreateCompatibleDC(0); - ok(hdc != 0, "failed\n"); - - hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_CREATDIB, ajBits, &bmi, DIB_PAL_COLORS); + if (hdc == NULL) + { + ok(0, "CreateCompatibleDC failed. Skipping tests!\n"); + return; + } + + SetLastError(0xbadbad00); + hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB, ajBits, NULL, DIB_RGB_COLORS); + ok(hbmp == 0, "CreateDIBitmap should fail.\n"); + ok_int(GetLastError(), 0xbadbad00); + + hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB, ajBits, &bmi, DIB_RGB_COLORS); ok(hbmp != 0, "CreateDIBitmap failed.\n"); ok_long(GetObject(hbmp, sizeof(DIBSECTION), &bitmap), sizeof(BITMAP)); @@ -441,8 +460,72 @@ hbmpOld = SelectObject(hdc, hbmp); ok(hbmpOld != NULL, "Couldn't select the bitmap.\n"); + + /* Copy it on a dib section */ + memset(pulDIB32Bits, 0x77, 64); + ok_long(BitBlt(ghdcDIB32, 0, 0, 4, 4, hdc, 0, 0, SRCCOPY), 1); + ok_long(pulDIB32Bits[0], 0x20100); + ok_long(pulDIB32Bits[1], 0x20100); + ok_long(pulDIB32Bits[2], 0x20100); + ok_long(pulDIB32Bits[3], 0x20100); + SelectObject(hdc, hbmpOld); DeleteObject(hbmp); + + hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB | CBM_INIT, ajBits, &bmi, DIB_PAL_COLORS); + ok(hbmp != 0, "CreateDIBitmap failed.\n"); + + ok_long(GetObject(hbmp, sizeof(DIBSECTION), &bitmap), sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 4); + ok_int(bitmap.bmHeight, 4); + ok_int(bitmap.bmWidthBytes, 4); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 8); + ok_ptr(bitmap.bmBits, 0); + + /* Even with CBM_INIT and lpbmih != 0, pbmi is used for the dimensions */ + hbmp = CreateDIBitmap(hdc, &bmiRLE.bmiHeader, CBM_CREATDIB | CBM_INIT, ajBits, &bmi, DIB_PAL_COLORS); + ok(hbmp != 0, "CreateDIBitmap failed.\n"); + + ok_long(GetObject(hbmp, sizeof(DIBSECTION), &bitmap), sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 4); + ok_int(bitmap.bmHeight, 4); + ok_int(bitmap.bmWidthBytes, 4); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 8); + ok_ptr(bitmap.bmBits, 0); + + hbmpOld = SelectObject(hdc, hbmp); + ok(hbmpOld != NULL, "Couldn't select the bitmap.\n"); + + /* Copy it on a dib section */ + memset(pulDIB32Bits, 0x77, 64); + ok_long(BitBlt(ghdcDIB32, 0, 0, 4, 4, hdc, 0, 0, SRCCOPY), 1); + ok_long(pulDIB32Bits[0], 0); + ok_long(pulDIB32Bits[1], 0); + ok_long(pulDIB32Bits[2], 0); + ok_long(pulDIB32Bits[3], 0); + + SelectObject(hdc, hbmpOld); + DeleteObject(hbmp); + + hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB, ajBitsRLE, (PVOID)&bmiRLE, DIB_PAL_COLORS); + ok(hbmp == 0, "CreateDIBitmap should fail.\n"); + hbmp = CreateDIBitmap(hdc, NULL, CBM_INIT | CBM_CREATDIB, ajBitsRLE, (PVOID)&bmiRLE, DIB_PAL_COLORS); + ok(hbmp == 0, "CreateDIBitmap should fail.\n"); + + /* Check if a 0 pixel bitmap results in the DEFAULT_BITMAP being returned */ + bmi.bmiHeader.biWidth = 0; + bmi.bmiHeader.biHeight = 4; + hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_CREATDIB, ajBits, &bmi, DIB_PAL_COLORS); + ok(hbmp == GetStockObject(21), "CreateDIBitmap didn't return the default bitmap.\n"); + bmi.bmiHeader.biWidth = 23; + bmi.bmiHeader.biHeight = 0; + hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_CREATDIB, ajBits, &bmi, DIB_PAL_COLORS); + ok(hbmp == GetStockObject(21), "CreateDIBitmap didn't return the default bitmap.\n"); + DeleteDC(hdc); } Modified: trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/SetDIBitsT…
============================================================================== --- trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c [iso-8859-1] Mon Oct 28 20:39:26 2013 @@ -12,6 +12,444 @@ static void Test_SetDIBitsToDevice_Params() +{ + UCHAR ajBmiBuffer[sizeof(BITMAPINFO) + 4]; + PBITMAPINFO pbmi = (PBITMAPINFO)ajBmiBuffer; + ULONG aulBits[16]; + INT ret; + + /* Setup the bitmap info */ + pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + pbmi->bmiHeader.biWidth = 2; + pbmi->bmiHeader.biHeight = -4; + pbmi->bmiHeader.biPlanes = 1; + pbmi->bmiHeader.biBitCount = 32; + pbmi->bmiHeader.biCompression = BI_RGB; + pbmi->bmiHeader.biSizeImage = 0; + pbmi->bmiHeader.biXPelsPerMeter = 0; + pbmi->bmiHeader.biYPelsPerMeter = 0; + pbmi->bmiHeader.biClrUsed = 0; + pbmi->bmiHeader.biClrImportant = 0; + + /* Test a normal operation */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 2); + ok_err(0xdeadc0de); + + /* Test hdc == NULL */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(NULL, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 0); + ok_err(ERROR_INVALID_HANDLE); + + /* Test truncated hdc */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice((HDC)((ULONG_PTR)ghdcDIB32 & 0xFFFF), + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 0); + ok_err(ERROR_INVALID_HANDLE); + + /* Test invalid ColorUse */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + 7); + ok_dec(ret, 0); + ok_err(0xdeadc0de); + + /* test unaligned buffer */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + (BYTE*)aulBits + 1, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 2); + ok_err(0xdeadc0de); + + /* test unaligned and huge scanline buffer */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 20000000, // cScanLines, + (BYTE*)aulBits + 1, // lpvBits, + pbmi, + DIB_RGB_COLORS); + todo_ros ok_dec(ret, 0); + ok_err(0xdeadc0de); + + /* test unaligned illegal buffer */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + (BYTE*)0x7fffffff, // lpvBits, + pbmi, + DIB_RGB_COLORS); + todo_ros ok_dec(ret, 0); + ok_err(0xdeadc0de); + + /* Test negative XDest */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + -100, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 2); + ok_err(0xdeadc0de); + + /* Test huge XDest */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + LONG_MAX, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 2); + ok_err(0xdeadc0de); + + /* Test XSrc outside of the DIB */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 100, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 2); + ok_err(0xdeadc0de); + + /* Test YSrc outside of the DIB */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 100, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 2); + ok_err(0xdeadc0de); + + /* Test uStartScan outside of the DIB */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 100, // uStartScan, + 5, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 5); + ok_err(0xdeadc0de); + + /* Test cScanLines larger than the DIB */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 7, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + todo_ros ok_dec(ret, 7); + ok_err(0xdeadc0de); + + /* Test large cScanlines */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2000, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + todo_ros ok_dec(ret, 0); + ok_err(0xdeadc0de); + + /* Test uStartScan and cScanLines larger than the DIB */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 100, // uStartScan, + 7, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 7); + ok_err(0xdeadc0de); + + /* Test lpvBits == NULL */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + NULL, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 0); + ok_err(0xdeadc0de); + + /* Test pbmi == NULL */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + NULL, + DIB_RGB_COLORS); + ok_dec(ret, 0); + ok_err(0xdeadc0de); + + /* Test huge positive DIB height, result is limited to dwHeight */ + pbmi->bmiHeader.biHeight = 10000; + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 1, // YDest, + 2, // dwWidth, + 3, // dwHeight, + 0, // XSrc, + 1, // YSrc, + 0, // uStartScan, + 7, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 4); + ok_err(0xdeadc0de); + + /* Test huge negative DIB height */ + pbmi->bmiHeader.biHeight = -10000; + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 7, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 7); + ok_err(0xdeadc0de); + + /* Test what happens when we cause an integer overflow */ + pbmi->bmiHeader.biHeight = LONG_MIN; + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 2); + ok_err(0xdeadc0de); + + /* Now also test a huge value of uStartScan */ + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + abs(pbmi->bmiHeader.biHeight) - 3, // uStartScan, + 9, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 3); + ok_err(0xdeadc0de); + + /* Now also test a huge value of uStartScan */ + pbmi->bmiHeader.biHeight = LONG_MIN + 1; + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + abs(pbmi->bmiHeader.biHeight) - 3, // uStartScan, + 9, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 5); + ok_err(0xdeadc0de); + + /* Now also test a huge value of uStartScan */ + pbmi->bmiHeader.biHeight = LONG_MIN + 7; + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + abs(pbmi->bmiHeader.biHeight) - 3, // uStartScan, + 32, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 17); + ok_err(0xdeadc0de); + + /* Test invalid bitmap info header */ + pbmi->bmiHeader.biSize = 0; + SetLastError(0xdeadc0de); + ret = SetDIBitsToDevice(ghdcDIB32, + 0, // XDest, + 0, // YDest, + 2, // dwWidth, + 2, // dwHeight, + 0, // XSrc, + 0, // YSrc, + 0, // uStartScan, + 2, // cScanLines, + aulBits, // lpvBits, + pbmi, + DIB_RGB_COLORS); + ok_dec(ret, 0); + ok_err(0xdeadc0de); + +} + + +static void +Test_SetDIBitsToDevice() { UCHAR ajBmiBuffer[sizeof(BITMAPINFO) + 4]; PBITMAPINFO pbmi = (PBITMAPINFO)ajBmiBuffer; @@ -31,260 +469,6 @@ pbmi->bmiHeader.biClrUsed = 0; pbmi->bmiHeader.biClrImportant = 0; - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 2); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - NULL, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 0); - ok_err(0xdeadc0de); - - /* test unaligned buffer */ - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - (BYTE*)aulBits + 1, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 2); - ok_err(0xdeadc0de); - - /* test unaligned and huge scanline buffer */ - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2000000, // cScanLines, - (BYTE*)aulBits + 1, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 0); - ok_err(0xdeadc0de); - - /* test unaligned illegal buffer */ - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - (BYTE*)0x7fffffff, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 0); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - -100, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 2); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - LONG_MAX, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 2); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 100, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 2); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 100, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 2); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 66, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 66); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 200, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 0); - ok_err(0xdeadc0de); - - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 2000, // uStartScan, - 66, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 66); - ok_err(0xdeadc0de); - - /* Test pbmi == NULL */ - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - aulBits, // lpvBits, - NULL, - DIB_RGB_COLORS); - ok_dec(ret, 0); - ok_err(0xdeadc0de); - - /* Test illegal bitmap info */ - pbmi->bmiHeader.biSize = 0; - SetLastError(0xdeadc0de); - ret = SetDIBitsToDevice(ghdcDIB32, - 0, // XDest, - 0, // YDest, - 2, // dwWidth, - 2, // dwHeight, - 0, // XSrc, - 0, // YSrc, - 0, // uStartScan, - 2, // cScanLines, - aulBits, // lpvBits, - pbmi, - DIB_RGB_COLORS); - ok_dec(ret, 0); - ok_err(0xdeadc0de); - -} - - -static void -Test_SetDIBitsToDevice() -{ - UCHAR ajBmiBuffer[sizeof(BITMAPINFO) + 4]; - PBITMAPINFO pbmi = (PBITMAPINFO)ajBmiBuffer; - ULONG aulBits[16]; - INT ret; - - /* Setup the bitmap info */ - pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biWidth = 2; - pbmi->bmiHeader.biHeight = -2; - pbmi->bmiHeader.biPlanes = 1; - pbmi->bmiHeader.biBitCount = 32; - pbmi->bmiHeader.biCompression = BI_RGB; - pbmi->bmiHeader.biSizeImage = 0; - pbmi->bmiHeader.biXPelsPerMeter = 0; - pbmi->bmiHeader.biYPelsPerMeter = 0; - pbmi->bmiHeader.biClrUsed = 0; - pbmi->bmiHeader.biClrImportant = 0; - /* Set pixels */ aulBits[0] = 0x11000000; aulBits[1] = 0x00000011; @@ -359,12 +543,12 @@ DIB_RGB_COLORS); ok_dec(ret, 1); - ok_hex(pulDIB32Bits[0], 0x00000000); - ok_hex(pulDIB32Bits[1], 0x00000000); - ok_hex(pulDIB32Bits[2], 0x00000000); - ok_hex(pulDIB32Bits[3], 0x00000000); - ok_hex(pulDIB32Bits[4], 0x11000000); - ok_hex(pulDIB32Bits[5], 0x00000011); + todo_ros ok_hex(pulDIB32Bits[0], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[1], 0x00000000); + ok_hex(pulDIB32Bits[2], 0x00000000); + ok_hex(pulDIB32Bits[3], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[4], 0x11000000); + todo_ros ok_hex(pulDIB32Bits[5], 0x00000011); ok_hex(pulDIB32Bits[6], 0x00000000); ok_hex(pulDIB32Bits[7], 0x00000000); @@ -384,12 +568,12 @@ DIB_RGB_COLORS); ok_dec(ret, 1); - ok_hex(pulDIB32Bits[0], 0x11000000); - ok_hex(pulDIB32Bits[1], 0x00000011); - ok_hex(pulDIB32Bits[2], 0x00000000); - ok_hex(pulDIB32Bits[3], 0x00000000); - ok_hex(pulDIB32Bits[4], 0x00000000); - ok_hex(pulDIB32Bits[5], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[0], 0x11000000); + todo_ros ok_hex(pulDIB32Bits[1], 0x00000011); + ok_hex(pulDIB32Bits[2], 0x00000000); + ok_hex(pulDIB32Bits[3], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[4], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[5], 0x00000000); ok_hex(pulDIB32Bits[6], 0x00000000); ok_hex(pulDIB32Bits[7], 0x00000000); @@ -465,12 +649,12 @@ DIB_RGB_COLORS); ok_dec(ret, 1); - ok_hex(pulDIB32Bits[0], 0x00000000); - ok_hex(pulDIB32Bits[1], 0x00000000); - ok_hex(pulDIB32Bits[2], 0x00000000); - ok_hex(pulDIB32Bits[3], 0x00000000); - ok_hex(pulDIB32Bits[4], 0x11000000); - ok_hex(pulDIB32Bits[5], 0x00000011); + todo_ros ok_hex(pulDIB32Bits[0], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[1], 0x00000000); + ok_hex(pulDIB32Bits[2], 0x00000000); + ok_hex(pulDIB32Bits[3], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[4], 0x11000000); + todo_ros ok_hex(pulDIB32Bits[5], 0x00000011); ok_hex(pulDIB32Bits[6], 0x00000000); ok_hex(pulDIB32Bits[7], 0x00000000); @@ -490,12 +674,12 @@ DIB_RGB_COLORS); ok_dec(ret, 1); - ok_hex(pulDIB32Bits[0], 0x11000000); - ok_hex(pulDIB32Bits[1], 0x00000011); - ok_hex(pulDIB32Bits[2], 0x00000000); - ok_hex(pulDIB32Bits[3], 0x00000000); - ok_hex(pulDIB32Bits[4], 0x00000000); - ok_hex(pulDIB32Bits[5], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[0], 0x11000000); + todo_ros ok_hex(pulDIB32Bits[1], 0x00000011); + ok_hex(pulDIB32Bits[2], 0x00000000); + ok_hex(pulDIB32Bits[3], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[4], 0x00000000); + todo_ros ok_hex(pulDIB32Bits[5], 0x00000000); ok_hex(pulDIB32Bits[6], 0x00000000); ok_hex(pulDIB32Bits[7], 0x00000000);
11 years, 1 month
1
0
0
0
[tkreuzer] 60786: [WIN32K] - Add missing DC_vPrepareDCsForBlit / DC_vFinishBlit - Save and restore floating point state in some functions
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Oct 28 20:26:08 2013 New Revision: 60786 URL:
http://svn.reactos.org/svn/reactos?rev=60786&view=rev
Log: [WIN32K] - Add missing DC_vPrepareDCsForBlit / DC_vFinishBlit - Save and restore floating point state in some functions Modified: trunk/reactos/win32ss/gdi/ntgdi/arc.c trunk/reactos/win32ss/gdi/ntgdi/fillshap.c Modified: trunk/reactos/win32ss/gdi/ntgdi/arc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/arc.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] Mon Oct 28 20:26:08 2013 @@ -316,6 +316,7 @@ DC *pDC; BOOL Ret = FALSE; gxf_long worker, worker1; + KFLOATING_SAVE FloatSave; pDC = DC_LockDc (hDC); if(!pDC) @@ -329,6 +330,9 @@ /* Yes, Windows really returns TRUE in this case */ return TRUE; } + + KeSaveFloatingPointState(&FloatSave); + worker.l = dwStartAngle; worker1.l = dwSweepAngle; DC_vPrepareDCsForBlit(pDC, pDC->rosdc.CombinedClip->rclBounds, @@ -340,6 +344,9 @@ Ret = IntGdiAngleArc( pDC, x, y, dwRadius, worker.f, worker1.f); DC_vFinishBlit(pDC, NULL); DC_UnlockDc( pDC ); + + KeRestoreFloatingPointState(&FloatSave); + return Ret; } @@ -359,6 +366,7 @@ { DC *dc; BOOL Ret; + KFLOATING_SAVE FloatSave; dc = DC_LockDc (hDC); if(!dc) @@ -381,6 +389,8 @@ if (dc->pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) DC_vUpdateLineBrush(dc); + + KeSaveFloatingPointState(&FloatSave); Ret = IntGdiArcInternal( arctype, @@ -394,6 +404,7 @@ XEndArc, YEndArc); + KeRestoreFloatingPointState(&FloatSave); DC_vFinishBlit(dc, NULL); DC_UnlockDc( dc ); return Ret; Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/fillshap…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] Mon Oct 28 20:26:08 2013 @@ -306,6 +306,9 @@ //tmpFillBrushObj.ptOrigin.y += RectBounds.top - Top; tmpFillBrushObj.ptOrigin.x += dc->ptlDCOrig.x; tmpFillBrushObj.ptOrigin.y += dc->ptlDCOrig.y; + + DC_vPrepareDCsForBlit(dc, RectBounds, NULL, RectBounds); + ret = IntFillEllipse( dc, CenterX - RadiusX, CenterY - RadiusY, @@ -313,15 +316,19 @@ RadiusY*2, // Height &tmpFillBrushObj); BRUSH_ShareUnlockBrush(pFillBrushObj); - } - - if (ret) - ret = IntDrawEllipse( dc, - CenterX - RadiusX, - CenterY - RadiusY, - RadiusX*2, // Width - RadiusY*2, // Height - pbrush); + + if (ret) + { + ret = IntDrawEllipse( dc, + CenterX - RadiusX, + CenterY - RadiusY, + RadiusX*2, // Width + RadiusY*2, // Height + pbrush); + } + + DC_vFinishBlit(dc, NULL); + } pbrush->ptPenWidth.x = PenOrigWidth; PEN_ShareUnlockPen(pbrush); @@ -788,6 +795,9 @@ } else { + + DC_vPrepareDCsForBlit(dc, RectBounds, NULL, RectBounds); + RtlCopyMemory(&brushTemp, pbrFill, sizeof(brushTemp)); brushTemp.ptOrigin.x += RectBounds.left - Left; brushTemp.ptOrigin.y += RectBounds.top - Top; @@ -800,17 +810,22 @@ yCurveDiameter, &brushTemp); BRUSH_ShareUnlockBrush(pbrFill); - } - - if (ret) - ret = IntDrawRoundRect( dc, - RectBounds.left, - RectBounds.top, - RectBounds.right, - RectBounds.bottom, - xCurveDiameter, - yCurveDiameter, - pbrLine); + + if (ret) + { + ret = IntDrawRoundRect( dc, + RectBounds.left, + RectBounds.top, + RectBounds.right, + RectBounds.bottom, + xCurveDiameter, + yCurveDiameter, + pbrLine); + } + + DC_vFinishBlit(dc, NULL); + } + pbrLine->ptPenWidth.x = PenOrigWidth; PEN_ShareUnlockPen(pbrLine); @@ -1094,6 +1109,8 @@ else goto cleanup; + DC_vPrepareDCsForBlit(dc, DestRect, NULL, DestRect); + psurf = dc->dclevel.pSurface; if (!psurf) { @@ -1113,6 +1130,7 @@ EXLATEOBJ_vCleanup(&exlo); cleanup: + DC_vFinishBlit(dc, NULL); DC_UnlockDc(dc); return Ret; }
11 years, 1 month
1
0
0
0
[jimtabor] 60785: - Sync wine to 1.7.5.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Oct 28 05:12:48 2013 New Revision: 60785 URL:
http://svn.reactos.org/svn/reactos?rev=60785&view=rev
Log: - Sync wine to 1.7.5. Modified: trunk/rostests/winetests/user32/sysparams.c Modified: trunk/rostests/winetests/user32/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/sysparam…
============================================================================== --- trunk/rostests/winetests/user32/sysparams.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/sysparams.c [iso-8859-1] Mon Oct 28 05:12:48 2013 @@ -16,17 +16,16 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include <assert.h> -#include <stdlib.h> -#include <stdarg.h> -#include <stdio.h> - #undef _WIN32_WINNT #define _WIN32_WINNT 0x0600 /* For SPI_GETMOUSEHOVERWIDTH and more */ //#define _WIN32_IE 0x0700 #undef WINVER #define WINVER 0x0600 /* For COLOR_MENUBAR, NONCLIENTMETRICS with padding */ + +#include <assert.h> +#include <stdlib.h> +#include <stdarg.h> +#include <stdio.h> #include "wine/test.h" #include "windef.h" @@ -729,8 +728,8 @@ INT frame; NONCLIENTMETRICSA ncm; - ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth); - rc=SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth); + rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError()); if( usesetborder) { rc=SystemParametersInfoA( SPI_SETBORDER, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); @@ -754,7 +753,7 @@ /* minimum border width is 1 */ if (curr_val == 0) curr_val = 1; /* should be the same as the non client metrics */ - rc=SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError()); eq( (UINT)ncm.iBorderWidth, curr_val, "NonClientMetric.iBorderWidth", "%d"); /* and from SPI_GETBORDER */ @@ -774,12 +773,12 @@ { BOOL rc; UINT old_border; - NONCLIENTMETRICS ncmsave; + NONCLIENTMETRICSA ncmsave; INT CaptionWidth, PaddedBorderWidth; - ncmsave.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth); - rc=SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncmsave, 0); + ncmsave.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth); + rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, 0, &ncmsave, 0); if( !rc) { win_skip("SPI_GETNONCLIENTMETRICS is not available\n"); return; @@ -1470,7 +1469,7 @@ trace("testing SPI_{GET,SET}NONCLIENTMETRICS\n"); change_counter = 0; SetLastError(0xdeadbeef); - rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &Ncmorig, FALSE ); + rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &Ncmorig, FALSE ); if (!test_error_msg(rc,"SPI_{GET,SET}NONCLIENTMETRICS")) return; Ncmstart = Ncmorig; @@ -1518,7 +1517,7 @@ ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError()); test_change_message( SPI_SETNONCLIENTMETRICS, 1 ); /* get them back */ - rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &Ncmcur, FALSE ); + rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &Ncmcur, FALSE ); ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError()); /* test registry entries */ TEST_NONCLIENTMETRICS_REG( Ncmcur) @@ -1543,7 +1542,7 @@ /* raw values are in registry */ TEST_NONCLIENTMETRICS_REG( Ncmnew) /* get them back */ - rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &Ncmcur, FALSE ); + rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &Ncmcur, FALSE ); ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError()); /* cooked values are returned */ expect = max( Ncmnew.iMenuHeight, 2 + get_tmheight( &Ncmnew.lfMenuFont, 1)); @@ -1567,7 +1566,7 @@ /* test the system metrics with these settings */ test_GetSystemMetrics(); /* restore */ - rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), + rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &Ncmorig, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); test_change_message( SPI_SETNONCLIENTMETRICS, 0 ); ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%d\n",rc,GetLastError()); @@ -2449,7 +2448,7 @@ static void test_WM_DISPLAYCHANGE(void) { - DEVMODE mode, startmode; + DEVMODEA mode, startmode; int start_bpp, last_set_bpp = 0; int test_bpps[] = {8, 16, 24, 32}, i; LONG change_ret; @@ -2465,10 +2464,10 @@ memset(&startmode, 0, sizeof(startmode)); startmode.dmSize = sizeof(startmode); - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &startmode); + EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &startmode); start_bpp = startmode.dmBitsPerPel; - displaychange_sem = CreateSemaphore(NULL, 0, 1, NULL); + displaychange_sem = CreateSemaphoreW(NULL, 0, 1, NULL); for(i = 0; i < sizeof(test_bpps)/sizeof(test_bpps[0]); i++) { last_bpp = -1; @@ -2660,37 +2659,37 @@ UINT IconSpacing, IconVerticalSpacing; BOOL rc; - HDC hdc = CreateIC( "Display", 0, 0, 0); + HDC hdc = CreateICA( "Display", 0, 0, 0); UINT avcwCaption; INT CaptionWidthfromreg; MINIMIZEDMETRICS minim; - NONCLIENTMETRICS ncm; + NONCLIENTMETRICSA ncm; SIZE screen; assert(sizeof(ncm) == 344); - ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth); - rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth); + rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); ok(rc, "SystemParametersInfoA failed\n"); - ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth) - 1; - rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth) - 1; + rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); ok(!rc, "SystemParametersInfoA should fail\n"); - ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth) + 1; - SetLastError(0xdeadbeef); - rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth) + 1; + SetLastError(0xdeadbeef); + rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); ok(!rc, "SystemParametersInfoA should fail\n"); ncm.cbSize = sizeof(ncm); /* Vista added padding */ SetLastError(0xdeadbeef); - rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); ok(rc || broken(!rc) /* before Vista */, "SystemParametersInfoA failed\n"); minim.cbSize = sizeof( minim); - ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth); - SystemParametersInfo( SPI_GETMINIMIZEDMETRICS, 0, &minim, 0); - rc = SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth); + SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, 0, &minim, 0); + rc = SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); if( !rc) { win_skip("SPI_GETNONCLIENTMETRICS is not available\n"); return; @@ -2839,14 +2838,14 @@ static void test_EnumDisplaySettings(void) { - DEVMODE devmode; + DEVMODEA devmode; DWORD val; HDC hdc; DWORD num; memset(&devmode, 0, sizeof(devmode)); /* Win95 doesn't handle ENUM_CURRENT_SETTINGS correctly */ - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode); + EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &devmode); hdc = GetDC(0); val = GetDeviceCaps(hdc, BITSPIXEL); @@ -2867,7 +2866,7 @@ num = 1; while (1) { SetLastError (0xdeadbeef); - if (!EnumDisplaySettings(NULL, num++, &devmode)) { + if (!EnumDisplaySettingsA(NULL, num++, &devmode)) { DWORD le = GetLastError(); ok(le == ERROR_NO_MORE_FILES || le == 0xdeadbeef, /* XP, 2003 */ @@ -2937,8 +2936,8 @@ wc.lpfnWndProc = SysParamsTestWndProc; wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW; wc.hInstance = hInstance; - wc.hIcon = LoadIconA( 0, IDI_APPLICATION ); - wc.hCursor = LoadCursorA( 0, IDC_ARROW ); + wc.hIcon = LoadIconA( 0, (LPCSTR)IDI_APPLICATION ); + wc.hCursor = LoadCursorA( 0, (LPCSTR)IDC_ARROW ); wc.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 ); wc.lpszMenuName = 0; wc.cbClsExtra = 0;
11 years, 1 month
1
0
0
0
[jimtabor] 60784: - Fis SysParams WM_SETTINGCHANGE.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Oct 28 05:00:16 2013 New Revision: 60784 URL:
http://svn.reactos.org/svn/reactos?rev=60784&view=rev
Log: - Fis SysParams WM_SETTINGCHANGE. Modified: trunk/reactos/win32ss/user/ntuser/message.c Modified: trunk/reactos/win32ss/user/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/messag…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Mon Oct 28 05:00:16 2013 @@ -128,6 +128,7 @@ { WM_SETTEXT, MMS_SIZE_LPARAMSZ, MMS_FLAG_READ }, { WM_STYLECHANGED, sizeof(STYLESTRUCT), MMS_FLAG_READ }, { WM_STYLECHANGING, sizeof(STYLESTRUCT), MMS_FLAG_READWRITE }, + { WM_SETTINGCHANGE, MMS_SIZE_LPARAMSZ, MMS_FLAG_READWRITE }, { WM_COPYDATA, MMS_SIZE_SPECIAL, MMS_FLAG_READ }, { WM_COPYGLOBALDATA, MMS_SIZE_WPARAM, MMS_FLAG_READ }, { WM_WINDOWPOSCHANGED, sizeof(WINDOWPOS), MMS_FLAG_READ },
11 years, 1 month
1
0
0
0
[aandrejevic] 60783: [NTVDM] Improve performance by computing the resolution required by the PIT, and then using the standard tick count instead of performance counters when that resolution is low.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Mon Oct 28 02:25:54 2013 New Revision: 60783 URL:
http://svn.reactos.org/svn/reactos?rev=60783&view=rev
Log: [NTVDM] Improve performance by computing the resolution required by the PIT, and then using the standard tick count instead of performance counters when that resolution is low. Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c branches/ntvdm/subsystems/ntvdm/timer.c branches/ntvdm/subsystems/ntvdm/timer.h Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Mon Oct 28 02:25:54 2013 @@ -151,19 +151,37 @@ /* Main loop */ while (VdmRunning) { + /* Get the resolution of the system timer */ + DWORD TimerResolution = PitGetResolution(); + /* Get the current number of ticks */ CurrentTickCount = GetTickCount(); - /* Get the current performance counter value */ - QueryPerformanceCounter(&Counter); - - /* Get the number of PIT ticks that have passed */ - TimerTicks = ((Counter.QuadPart - LastTimerTick.QuadPart) - * PIT_BASE_FREQUENCY) / Frequency.QuadPart; + if (TimerResolution > 1000) + { + /* Get the current performance counter value */ + QueryPerformanceCounter(&Counter); + + /* Get the number of PIT ticks that have passed */ + TimerTicks = ((Counter.QuadPart - LastTimerTick.QuadPart) + * PIT_BASE_FREQUENCY) / Frequency.QuadPart; + } + else + { + /* Use the standard tick count */ + Counter.QuadPart = CurrentTickCount; + + /* Get the number of PIT ticks that have passed */ + TimerTicks = ((Counter.QuadPart - LastTimerTick.QuadPart) + * PIT_BASE_FREQUENCY) / 1000; + } /* Update the PIT */ - for (i = 0; i < TimerTicks; i++) PitDecrementCount(); - LastTimerTick = Counter; + if (TimerTicks > 0) + { + for (i = 0; i < TimerTicks; i++) PitDecrementCount(); + LastTimerTick = Counter; + } /* Check for vertical retrace */ if ((CurrentTickCount - LastVerticalRefresh) >= 16) Modified: branches/ntvdm/subsystems/ntvdm/timer.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/timer.c?…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/timer.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/timer.c [iso-8859-1] Mon Oct 28 02:25:54 2013 @@ -233,4 +233,23 @@ } } +DWORD PitGetResolution(VOID) +{ + INT i; + DWORD MinReloadValue = 65536; + + for (i = 0; i < PIT_CHANNELS; i++) + { + DWORD ReloadValue = PitChannels[i].ReloadValue; + + /* 0 means 65536 */ + if (ReloadValue == 0) ReloadValue = 65536; + + if (ReloadValue < MinReloadValue) MinReloadValue = ReloadValue; + } + + /* Return the frequency resolution */ + return PIT_BASE_FREQUENCY / MinReloadValue; +} + /* EOF */ Modified: branches/ntvdm/subsystems/ntvdm/timer.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/timer.h?…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/timer.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/timer.h [iso-8859-1] Mon Oct 28 02:25:54 2013 @@ -49,6 +49,7 @@ BYTE PitReadData(BYTE Channel); VOID PitWriteData(BYTE Channel, BYTE Value); VOID PitDecrementCount(); +DWORD PitGetResolution(VOID); #endif // _TIMER_H_
11 years, 1 month
1
0
0
0
[hbelusca] 60782: Code formatting only.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Oct 27 23:42:16 2013 New Revision: 60782 URL:
http://svn.reactos.org/svn/reactos?rev=60782&view=rev
Log: Code formatting only. Modified: branches/ntvdm/subsystems/ntvdm/bios.c Modified: branches/ntvdm/subsystems/ntvdm/bios.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?r…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Sun Oct 27 23:42:16 2013 @@ -1148,22 +1148,22 @@ Bda->KeybdShiftFlags = 0; /* Set the appropriate flags based on the state */ - if (BiosKeyboardMap[VK_RSHIFT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_RSHIFT; - if (BiosKeyboardMap[VK_LSHIFT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_LSHIFT; - if (BiosKeyboardMap[VK_CONTROL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CTRL; - if (BiosKeyboardMap[VK_MENU] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_ALT; - if (BiosKeyboardMap[VK_SCROLL] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_SCROLL_ON; - if (BiosKeyboardMap[VK_NUMLOCK] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_NUMLOCK_ON; - if (BiosKeyboardMap[VK_CAPITAL] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CAPSLOCK_ON; - if (BiosKeyboardMap[VK_INSERT] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_INSERT_ON; - if (BiosKeyboardMap[VK_RMENU] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_RALT; - if (BiosKeyboardMap[VK_LMENU] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_LALT; + if (BiosKeyboardMap[VK_RSHIFT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_RSHIFT; + if (BiosKeyboardMap[VK_LSHIFT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_LSHIFT; + if (BiosKeyboardMap[VK_CONTROL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CTRL; + if (BiosKeyboardMap[VK_MENU] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_ALT; + if (BiosKeyboardMap[VK_SCROLL] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_SCROLL_ON; + if (BiosKeyboardMap[VK_NUMLOCK] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_NUMLOCK_ON; + if (BiosKeyboardMap[VK_CAPITAL] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CAPSLOCK_ON; + if (BiosKeyboardMap[VK_INSERT] & (1 << 0)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_INSERT_ON; + if (BiosKeyboardMap[VK_RMENU] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_RALT; + if (BiosKeyboardMap[VK_LMENU] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_LALT; if (BiosKeyboardMap[VK_SNAPSHOT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_SYSRQ; - if (BiosKeyboardMap[VK_PAUSE] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_PAUSE; - if (BiosKeyboardMap[VK_SCROLL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_SCROLL; - if (BiosKeyboardMap[VK_NUMLOCK] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_NUMLOCK; - if (BiosKeyboardMap[VK_CAPITAL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CAPSLOCK; - if (BiosKeyboardMap[VK_INSERT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_INSERT; + if (BiosKeyboardMap[VK_PAUSE] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_PAUSE; + if (BiosKeyboardMap[VK_SCROLL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_SCROLL; + if (BiosKeyboardMap[VK_NUMLOCK] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_NUMLOCK; + if (BiosKeyboardMap[VK_CAPITAL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CAPSLOCK; + if (BiosKeyboardMap[VK_INSERT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_INSERT; break; }
11 years, 1 month
1
0
0
0
← Newer
1
2
3
4
5
6
...
33
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Results per page:
10
25
50
100
200