Hi
Since nobody at the moment can point to any other way of testing DOS, I have chosen to continue with the assembler path.
Included is my first try at creating a 32 bit program which can run a 16 bit program (as .com file) written in assembler.
Notes about about the changes: I have changed configure.ac to look for nasm (the compiler I have chosen to use). If no nasm is found, a notice is output saying what you wont get. I have changed Make.rules.in to include .asm and .com suffixes so the auto rules work. I have added rules to Makefile.in in dlls/kernel32/tests/Makefile.in to compile the assembler. The code is not compiled automatically for now. You need to do make asm in the test directory. The test program will silently ignore missing programs, so if no compiled programs exists, no tests is run.
All in all this change should make no change for people that doesn't have nasm installed.
I have added one simple assembler program which test some basic parts of int 21h.
Things that are missing: The program can't at the moment show unexpected succes in any test. The test will simply pass as working, instead of todo.
How does it work: The .com program is expected to output a file called test.rep. The first letter of the line, tells the outcome of the test: w - Working t - Todo e - Error (It should have worked but failed, regression failure) The rest of line is any message that will be output in case of failure.
Limitations: Since the test program doesn't run the tests directly line numbers from the test program is quite useless. I don't know how Martin (wine-testbot) will have it with these changes. I haven't completely figured out how a cross test is done from the wine enviroment, so things needed for windows might be missing.
I only have an Windows XP, so that is all that has been tested with the program (direct run, not using test framework). This will fail on other platforms until I get all known versions number added to the list of known versions.
Since this is a first try, and Dmitry thinks that it is the wrong direction, I prefer to post it to wine-devel to get some initial comments on this.
BR
Morten Rønne
From c2b8d7a1ce56247f5379348a1aa2dae4313cc70b Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Morten=20R=C3=B8nne?= morten.roenne@tdcadsl.dk Date: Mon, 26 Apr 2010 10:25:23 +0200 Subject: Added a DOS test to kernel32 based on assembler code.
--- dlls/kernel32/tests/dosasm.c | 129 +++++ dlls/kernel32/tests/int21.asm | 1069 +++++++++++++++++++++++++++++++++++++++ dlls/kernel32/tests/rep_dat.inc | 4 + dlls/kernel32/tests/report.inc | 48 ++ 4 files changed, 1250 insertions(+), 0 deletions(-) create mode 100644 dlls/kernel32/tests/dosasm.c create mode 100644 dlls/kernel32/tests/int21.asm create mode 100644 dlls/kernel32/tests/rep_dat.inc create mode 100644 dlls/kernel32/tests/report.inc
diff --git a/dlls/kernel32/tests/dosasm.c b/dlls/kernel32/tests/dosasm.c new file mode 100644 index 0000000..5b1e7f0 --- /dev/null +++ b/dlls/kernel32/tests/dosasm.c @@ -0,0 +1,129 @@ +/* + * Copyright 2010 Morten Rønne + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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 "wine/test.h" +#include <winbase.h> + +static DWORD pos, end; +char buffer[8192]; + +static int read_line (HANDLE *file, char *text) +{ + DWORD o; + + o = 0; + if(pos == end) { + ReadFile(file, buffer, 8192, &end, NULL); + pos = 0; + } + while(pos < end) { + switch(buffer[pos]) { + case '\n': + text[o++] = '\n'; + text[o++] = '\0'; + pos++; + return 1; + case '\r': break; + default: + if(o < 510) + text[o++] = buffer[pos]; + } + pos++; + if(pos == end) { + ReadFile(file, buffer, 8192, &end, NULL); + pos = 0; + } + } + return 0; +} + +static int read_test_file(char *name) { + HANDLE file; + char line[512]; + + file = CreateFileA("test.rep", GENERIC_READ, 0, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed for test.rep: %08x\n", + GetLastError()); + if(file == INVALID_HANDLE_VALUE) + return 0; + + pos = 0; + end = 0; + + /* Read each line and make report */ + while(read_line(file, line)) { + if(line[1] == ':' && line[2] == ' ') { + switch(line[0]) { + case 't': + todo_wine { + ok(FALSE, "%s: %s", name, &line[3]); + } + break; + case 'w': + ok(TRUE, "%s: %s", name, &line[3]); + break; + default: + ok(FALSE, "%s: %s", name, &line[3]); + } + } + } + + CloseHandle(file); + return 1; +} + +static int run_program(LPSTR name) +{ + STARTUPINFOA si; + PROCESS_INFORMATION pi; + + /* The file is not found, then tests are not run, so we return TRUE */ + if(GetFileAttributes(name) == INVALID_FILE_ATTRIBUTES) + return TRUE; + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + if (CreateProcessA(NULL, name, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + { + /* Wait for the process to finish */ + WaitForSingleObject( pi.hProcess, INFINITE ); + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + if(read_test_file(name)) + return TRUE; + } + return FALSE; +} + + +START_TEST(dosasm) +{ + /* + * We are testing DOS functions which requires 16 bit mode. + * But this program runs in 32 bit mode. + * So we load a 16 bit test program to do the actual testing. + * After that reports are gathered and tested based on file created + * by the run program. + * So to affect todo's, change the 16 bit program not this. + */ + + /* First test int 21 which are required by all the others */ + ok(run_program((LPSTR)"int21.com") == TRUE, + "Failed to run int 21 tests. Last Error: 0x%04x", GetLastError()); +} + diff --git a/dlls/kernel32/tests/int21.asm b/dlls/kernel32/tests/int21.asm new file mode 100644 index 0000000..57450b6 --- /dev/null +++ b/dlls/kernel32/tests/int21.asm @@ -0,0 +1,1069 @@ +; +; Copyright 2010 Morten Rønne +; +; This library is free software; you can redistribute it and/or +; modify it under the terms of the GNU Lesser General Public +; License as published by the Free Software Foundation; either +; version 2.1 of the License, or (at your option) any later version. +; +; This library is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +; Lesser General Public License for more details. +; +; You should have received a copy of the GNU Lesser General Public +; License along with this library; if not, write to the Free Software +; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +; +; Test of selected int21 functions +; +; File open/write/close functions are expected to work in order +; to write the report file. +; But more extensive tests will be done. +; + +section .text + org 100h; + +_start: + + call open_report + + call test_version_number + + call test_stdin + + call test_curr_drive + + call test_free_spc + + call test_sys_time + + ;call test_country + + call test_mem_alloc + + ;=============================================================== + ; + ; Test file FCB functions + ; Should we do this? + ; Also Get/Set Disk Transfer Area + ; + ;=============================================================== + + ;=============================================================== + ; + ; Get/Set interrupt vector + ; + ;=============================================================== + + ; 25/35 + + ;=============================================================== + ; + ; Create New program segment prefix + ; + ;=============================================================== + + ; 26h, DX = segment at which to create PSP + + + ;=============================================================== + ; + ; Close report file + ; + ;=============================================================== + + call close_report + + ; Exit the program + + mov ax,4C00h + int 21h + retn + + ;=============================================================== + ; + ; Test version number + ; + ;=============================================================== + +test_version_number: + + ; Get version number + mov ax,3000h + int 21h + + ; AL = Major, AH = Minor, BH = flag, BL:CX = Serial number + or bl,bl + jnz .ser_err + or cx,cx + jnz .ser_err + mov byte [serial_err_str],'w' +.ser_err: + push ax + mov dx,serial_err_str + mov cx,serial_err_len + call report + pop ax + +check_version: + mov bp,known_versions +.loop: + mov dx,[bp] + add bp,2 + cmp dx,0 + jz .version_error + + cmp ax,dx + jz .dos_version_ok + jmp .loop + +.dos_version_ok: + mov byte [version_err_str],'w' + +.version_error: + mov di,version_output + call ax_as_hex + + mov dx,version_err_str + mov cx,version_err_len + call report + +test_oem: + ; Get OEM version number + mov ax,3001h + int 21h + +.check_version: + mov bp,known_oem_versions +.loop: + mov dx,[bp] + add bp,2 + cmp dx,0 + jz .version_error + + cmp ax,dx + jz .oem_version_ok + jmp .loop + +.oem_version_ok: + mov byte [vers_oem_err_str],'w' + +.version_error: + mov di,vers_oem_err_out + call ax_as_hex + + mov dx,vers_oem_err_str + mov cx,vers_oem_err_len + call report + retn + + ;=============================================================== + ; + ; Test system date/time + ; + ;=============================================================== + +test_sys_time: + mov cx,0ffffh + mov dx,0ffffh + mov al,0ffh + + ; Get system date + mov ah,2ah + int 21h + ; CX = Year, DH = Month, DL = Day, AL = Day of Week + + mov byte [sysdate_check],'1' + cmp cx,2009 + jc .sys_date_fail + + mov byte [sysdate_check],'2' + cmp cx,2050 + jnc .sys_date_fail + + mov byte [sysdate_check],'3' + cmp al,7 + jnc .sys_date_fail + + mov byte [sysdate_check],'4' + cmp dh,13 + jnc .sys_date_fail + + mov byte [sysdate_check],'5' + cmp dl,32 + jnc .sys_date_fail + + mov byte [sysdate_str],'w' +.sys_date_fail: + + mov dx,sysdate_str + mov cx,sysdate_len + call report + +test_systime: + + mov cx,0ffffh + mov dx,0ffffh + + ; Get System time + mov ah,2ch + int 21h + ; CH = Hour, CL = Min, DH = sec, DL = millisec + + mov byte [systime_check],'1' + cmp ch,24 + jnc .sys_time_fail + + mov byte [systime_check],'2' + cmp cl,60 + jnc .sys_time_fail + + mov byte [systime_check],'3' + cmp dh,60 + jnc .sys_time_fail + + mov byte [systime_str],'w' + +.sys_time_fail: + mov dx,systime_str + mov cx,systime_len + call report + retn + + ;=============================================================== + ; + ; Test stdin status + ; Should return no character available + ; + ;=============================================================== + +test_stdin: + mov ah,0bh + mov al,20h + int 21h + cmp al,00h + jz .ok_status + cmp al,0ffh + jnz .err_status +.ok_status: + mov byte [stdin_err_str],'w' + +.err_status: + mov di,stdin_status + call al_as_hex + + mov dx,stdin_err_str + mov cx,stdin_err_len + call report + retn + + ;=============================================================== + ; + ; Test current drive + ; + ;=============================================================== + +test_curr_drive: + mov ax,19ffh + int 21h + mov [current_drive],al + + cmp al,26 + jnc .drive_err + + mov byte [curr_drive_str],'w' + +.drive_err: + mov di,curr_drive_hex + call al_as_hex + + mov dx,curr_drive_str + mov cx,curr_drive_len + call report + + ; TODO: 0eh - Set current drive + + retn + + ;=============================================================== + ; + ; Test free space of C: + ; + ;=============================================================== + +test_free_spc: + mov ah,36h + mov dl,[current_drive] + inc dl + cmp dl,25 + jnz .notz + mov dl,3 ; If run from wine Z: use disk C: instead +.notz: + int 21h + cmp ax,0ffffh + jz .free_err + + mov byte [freespace_str],'w' + +.free_err: + mov di,freespace_sector + call ax_as_hex + + mov di,freespace_free + mov ax,bx + call ax_as_hex + + mov di,freespace_bytes + mov ax,cx + call ax_as_hex + + mov di,freespace_total + mov dx,ax + call ax_as_hex + + mov dx,freespace_str + mov cx,freespace_len + call report + retn + + ;=============================================================== + ; + ; Check country information + ; + ;=============================================================== + +test_country: + ; Get default country + mov ax,3800h + mov dx,country_default + int 21h + jc country_error + + ; Check all the known languages + mov dx,0ffffh + mov bp,country_known +.country_loop: + mov ax,[bp] + cmp ax,0ffffh + jz country_error + + cmp ax,0ffh + jc .lowval + mov bx,ax + mov al,0ffh +.lowval: + mov ah,38h + mov dx,country_buffer + int 21h + jnc country_ok + inc bp + inc bp + jmp .country_loop + +country_ok: + mov byte [country_err],'w' + +country_error: + mov dx,country_err + mov cx,country_len + call report + retn + + ;=============================================================== + ; + ; Test memory functions + ; + ;=============================================================== + +test_mem_alloc: + + ; Get segment of first byte after from PSP + mov ax,[2] + + ; Do some size calculation based on PSP values. + mov bx,es + sub ax,bx + mov [psp_mem_size],ax ; Size of largest block + + mov ax,[2] + call dump_mcb + + ; Check that it points to valid end MCB + + ; As .COM program we should have all low memory + ; So we resize to 64K first + mov ah,4ah + mov bx,4096 + int 21h + jc .cant_decrease1 + + mov ax,bx + + mov di,resize_out + call ax_as_hex + + mov dx,resize_str + mov ah,9 + int 21h + + ; Resize to max should reallocate all memory again + mov ah,4ah + mov bx,0ffffh + int 21h + jnc .unexpected_succes + + cmp bx,[psp_mem_size] + jnz .resize_wrong + + ; And resize to 64K again, so we can check memory alloc + + mov ah,4ah + mov bx,4096 + int 21h + jc .cant_decrease2 + + mov ax,bx + + mov di,resize_out + call ax_as_hex + + mov dx,resize_str + mov ah,9 + int 21h + + ; + ; Allocate 1M. This should fail + mov bx,0ffffh + mov ah,48h + int 21h + jnc .unexpected_succes + + mov [largest],bx + + mov ax,bx + + mov di,large + call ax_as_hex + + mov dx,large_str + mov ah,9 + int 21h + + ; Calculate the size we should have gotten + mov ax,[psp_mem_size] + sub ax,1001h + cmp ax,[largest] + jnz .memory_failed + + ; Allocate a fresh 4K block + mov ah,48h + mov bx,100h + int 21h + jc .memory_failed + mov [new_memory],ax + mov es,ax + + ; Try resize above possible + mov ah,4ah + mov bx,0ffffh + int 21h + jnc .unexpected_succes + + ; BX should be largest + cmp bx,[largest] + jnz .resize_failed + + ; Now we should have all normal memory + + ; We should get a upper memory block now + mov ah,4ah + mov bx,100h + int 21h + jc .upper_failed + + cmp ax,0a000h + jnc .upper_failed + + jmp .memory_ok + + ; Now lets resize the original memory (which can't expand) + mov ax,ds + mov es,ax + + mov ah,48h + mov bx,2000h + int 21h + jnc .resize_didnt_fail + + cmp bx,1000h + jnz .resize_size_err + mov byte [resize_no_out],'w' +.resize_size_err: + + mov ax,bx + mov di,resize_no_out + call ax_as_hex + + mov dx,resize_no_str + mov cx,resize_no_len + call report + +.unexpected_succes: + ; This may succed if run in protected mode + mov dx,memory_ok_err + mov cx,memory_ok_len + call report + + jmp .memory_ok + +.resize_wrong: + mov ax,bx + mov di,resize_up1_got + call ax_as_hex + + mov ax,[psp_mem_size] + mov di,resize_up1_expect + call ax_as_hex + + mov dx,resize_up1_err + mov cx,resize_up1_len + call report + + jmp .memory_ok + +.cant_decrease1: + mov dx,decrease1_err + mov cx,decrease1_len + call report + jmp .memory_ok + +.cant_decrease2: + mov dx,decrease2_err + mov cx,decrease2_len + call report + jmp .memory_ok + +.resize_failed: + mov dx,resize_fail_err + mov cx,resize_fail_len + call report + jmp .memory_ok + +.resize_didnt_fail: + mov dx,no_resize_err + mov cx,no_resize_len + call report + jmp .memory_ok + +.upper_failed: + mov dx,upper_fail_err + mov cx,upper_fail_len + call report + jmp .memory_ok + +.memory_failed: + mov dx,memory_fail_err + mov cx,memory_fail_len + call report + +.memory_ok: + ; Cleanup + mov ax,[new_memory] + or ax,ax + jz .free_upper + mov es,ax + ; We clear new_memory now, to avoid trying freeing it again + xor ax,ax + mov [new_memory],ax + + mov ah,49h + int 21h + jc .memory_failed + +.free_upper: + mov ax,[upper_mem] + or ax,ax + jz .free_done + + mov es,ax + ; We clear uper_mem now, to avoid trying freeing it again + xor ax,ax + mov [upper_mem],ax + + mov ah,49h + int 21h + jc .upper_failed + +.free_done: + mov ax,ds + mov es,ax + retn + +dump_mcb: + + mov si,0 + mov di,mcb_dump + mov bx,ax + +.loop: + push ds + mov ds,bx + mov al,[si] + pop ds + call al_as_hex + inc di + inc si + cmp si,16 + jnz .loop + + mov dx,mcb_str + mov ah,09h + int 21h + retn + + ;=============================================================== + ; + ; Test file handle functions + ; + ;=============================================================== + +test_file_handle: + ; 3ch create or truncate file + ; 3dh open file + ; 3eh close file + ; 3fh read from file + ; 40h write to file + ; 41h delete file + ; 42h Set current file position + ; 43h Get file attributes + ; 43h Set file attributes + ; 3bh Set current directory + ; 39h Create directory + ; 3ah Delete directory + ; 47h Get current directory + ; 56h Rename file + ; 57h Get last-written date and time + ; 57h Set last-written date and time + + ; Open file for writing + ; Write a string to file + ; Close file + + ; Open file for reading + ; Read string from file + ; Close file + + ; Compare to stored string + ; Create directory + ; Change to directory + ; Repeat file test above + ; Delete file + ; Change to old current directory + ; Delete directory + + ; Position checking + + ; Get verify flag + ; Set verify flag + retn + +move_string: + push si +.loop: + mov al,[si] + cmp al,0 + jz .clear + inc si + mov [di],al + inc di + dec cx + jz .exit + jmp .loop + +.clear: + mov byte [di],' ' + inc di + dec cx + jnz .clear +.exit: + pop si + retn + +ax_as_hex: + push ax + mov al,ah + call al_as_hex + pop ax +al_as_hex: + push ax + ror al,4 + call .digit + pop ax +.digit: + and al,0fh + add al,48 + cmp al,58 + jc .nothex + add al,7 +.nothex: + mov [di],al + inc di + retn + +%include "report.inc" + +section .data + +output_handle dw 0 +largest dw 0 +avail dw 0 +new_memory dw 0 +upper_mem dw 0 + +psp_mem_size dw 0 +resize_mem_size dw 0 + +current_drive db 0 + + +country_known dw 001h ; (1) United States + dw 002h ; (2) Canadian-French + dw 003h ; (3) Latin America + dw 004h ; (4) Canada (English) + dw 007h ; (7) Russia + dw 014h ; (20) Egypt + dw 01Bh ; (27) South Africa + dw 01Eh ; (30) Greece + dw 01Fh ; (31) Netherlands + dw 020h ; (32) Belgium + dw 021h ; (33) France + dw 022h ; (34) Spain + dw 023h ; (35) Bulgaria??? + dw 024h ; (36) Hungary (not supported by DR DOS 5.0) + dw 026h ; (38) Yugoslavia (not supported by DR DOS 5.0) -- obsolete + dw 027h ; (39) Italy / San Marino / Vatican City + dw 028h ; (40) Romania + dw 029h ; (41) Switzerland / Liechtenstein + dw 02Ah ; (42) Czechoslovakia / Tjekia / Slovakia (not supported by DR DOS 5.0) + dw 02Bh ; (43) Austria (DR DOS 5.0) + dw 02Ch ; (44) United Kingdom + dw 02Dh ; (45) Denmark + dw 02Eh ; (46) Sweden + dw 02Fh ; (47) Norway + dw 030h ; (48) Poland (not supported by DR DOS 5.0) + dw 031h ; (49) Germany + dw 033h ; (51) Peru + dw 034h ; (52) Mexico + dw 035h ; (53) Cuba + dw 036h ; (54) Argentina + dw 037h ; (55) Brazil (not supported by DR DOS 5.0) + dw 038h ; (56) Chile + dw 039h ; (57) Columbia + dw 03Ah ; (58) Venezuela + dw 03Ch ; (60) Malaysia + dw 03Dh ; (61) International English / Australia + dw 03Eh ; (62) Indonesia / East Timor + dw 03Fh ; (63) Philippines + dw 040h ; (64) New Zealand + dw 041h ; (65) Singapore + dw 042h ; (66) Thailand (or Taiwan???) + dw 051h ; (81) Japan (DR DOS 5.0, MS-DOS 5.0+) + dw 052h ; (82) South Korea (DR DOS 5.0) + dw 054h ; (84) Vietnam + dw 056h ; (86) China (MS-DOS 5.0+) + dw 058h ; (88) Taiwan (MS-DOS 5.0+) + dw 05Ah ; (90) Turkey (MS-DOS 5.0+) + dw 05Bh ; (91) India + dw 05Ch ; (92) Pakistan + dw 05Dh ; (93) Afghanistan + dw 05Eh ; (94) Sri Lanka + dw 062h ; (98) Iran + dw 063h ; (99) Asia (English) + dw 066h ; (102) ??? (Hebrew MS-DOS 5.0) + dw 070h ; (112) Belarus + dw 0C8h ; (200) Thailand (PC DOS 6.1+) + ; (reported as 01h due to a bug in PC DOS COUNTRY.SYS) + dw 0D4h ; (212) Morocco + dw 0D5h ; (213) Algeria + dw 0D8h ; (216) Tunisia + dw 0DAh ; (218) Libya + dw 0DCh ; (220) Gambia + dw 0DDh ; (221) Senegal + dw 0DEh ; (222) Maruitania + dw 0DFh ; (223) Mali + dw 0E0h ; (224) African Guinea + dw 0E1h ; (225) Ivory Coast + dw 0E2h ; (226) Burkina Faso + dw 0E3h ; (227) Niger + dw 0E4h ; (228) Togo + dw 0E5h ; (229) Benin + dw 0E6h ; (230) Mauritius + dw 0E7h ; (231) Liberia + dw 0E8h ; (232) Sierra Leone + dw 0E9h ; (233) Ghana + dw 0EAh ; (234) Nigeria + dw 0EBh ; (235) Chad + dw 0ECh ; (236) Centra African Republic + dw 0EDh ; (237) Cameroon + dw 0EEh ; (238) Cape Verde Islands + dw 0EFh ; (239) Sao Tome and Principe + dw 0F0h ; (240) Equatorial Guinea + dw 0F1h ; (241) Gabon + dw 0F2h ; (242) Congo + dw 0F3h ; (243) Zaire + dw 0F4h ; (244) Angola + dw 0F5h ; (245) Guinea-Bissau + dw 0F6h ; (246) Diego Garcia + dw 0F7h ; (247) Ascension Isle + dw 0F8h ; (248) Seychelles + dw 0F9h ; (249) Sudan + dw 0FAh ; (250) Rwhanda + dw 0FBh ; (251) Ethiopia + dw 0FCh ; (252) Somalia + dw 0FDh ; (253) Djibouti + dw 0FEh ; (254) Kenya + dw 0FFh ; (255) Tanzania + dw 100h ; (256) Uganda + dw 101h ; (257) Burundi + dw 103h ; (259) Mozambique + dw 104h ; (260) Zambia + dw 105h ; (261) Madagascar + dw 106h ; (262) Reunion Island + dw 107h ; (263) Zimbabwe + dw 108h ; (264) Namibia + dw 109h ; (265) Malawi + dw 10Ah ; (266) Lesotho + dw 10Bh ; (267) Botswana + dw 10Ch ; (268) Swaziland + dw 10Dh ; (269) Comoros + dw 10Eh ; (270) Mayotte + dw 122h ; (290) St. Helena + dw 129h ; (297) Aruba + dw 12Ah ; (298) Faroe Islands + dw 12Bh ; (299) Greenland + dw 15Eh ; (350) Gibraltar + dw 15Fh ; (351) Portugal + dw 160h ; (352) Luxembourg + dw 161h ; (353) Ireland + dw 162h ; (354) Iceland + dw 163h ; (355) Albania + dw 164h ; (356) Malta + dw 165h ; (357) Cyprus + dw 166h ; (358) Finland + dw 167h ; (359) Bulgaria + dw 172h ; (370) Lithuania (reported as 372 due to a bug in MS-DOS COUNTRY.SYS) + dw 173h ; (371) Latvia (reported as 372 due to a bug in MS-DOS COUNTRY.SYS) + dw 174h ; (372) Estonia + dw 175h ; (373) Moldova + dw 177h ; (375) ??? (MS-DOS 7.10 / Windows98) + dw 17Ch ; (380) Ukraine + dw 17Dh ; (381) Serbia / Montenegro + dw 180h ; (384) Croatia + dw 181h ; (385) Croatia (PC DOS 7+) + dw 182h ; (386) Slovenia + dw 183h ; (387) Bosnia-Herzegovina (Latin) + dw 184h ; (388) Bosnia-Herzegovina (Cyrillic) (PC DOS 7+) + ; (reported as 381 due to a bug in PC DOS COUNTRY.SYS) + dw 185h ; (389) FYR Macedonia + dw 1A5h ; (421) Czech Republic / Tjekia (PC DOS 7+) + dw 1A6h ; (422) Slovakia + ; (reported as 421 due to a bug in COUNTRY.SYS) + dw 1F4h ; (500) Falkland Islands + dw 1F5h ; (501) Belize + dw 1F6h ; (502) Guatemala + dw 1F7h ; (503) El Salvador + dw 1F8h ; (504) Honduras + dw 1F9h ; (505) Nicraragua + dw 1FAh ; (506) Costa Rica + dw 1FBh ; (507) Panama + dw 1FCh ; (508) St. Pierre and Miquelon + dw 1FDh ; (509) Haiti + dw 24Eh ; (590) Guadeloupe + dw 24Fh ; (591) Bolivia + dw 250h ; (592) Guyana + dw 251h ; (593) Ecuador + dw 252h ; (594) rench Guiana + dw 253h ; (595) Paraguay + dw 254h ; (596) Martinique / French Antilles + dw 255h ; (597) Suriname + dw 256h ; (598) Uruguay + dw 257h ; (599) Netherland Antilles + dw 29Ah ; (666) Russia??? (PTS-DOS 6.51 KEYB) + dw 29Bh ; (667) Poland??? (PTS-DOS 6.51 KEYB) + dw 29Ch ; (668) Poland??? (Slavic???) (PTS-DOS 6.51 KEYB) + dw 29Eh ; (670) Saipan / N. Mariana Island + dw 29Fh ; (671) Guam + dw 2A0h ; (672) Norfolk Island (Australia) / Christmas Island/Cocos Islands / Antartica + dw 2A1h ; (673) Brunei Darussalam + dw 2A2h ; (674) Nauru + dw 2A3h ; (675) Papua New Guinea + dw 2A4h ; (676) Tonga Islands + dw 2A5h ; (677) Solomon Islands + dw 2A6h ; (678) Vanuatu + dw 2A7h ; (679) Fiji + dw 2A8h ; (680) Palau + dw 2A9h ; (681) Wallis & Futuna + dw 2AAh ; (682) Cook Islands + dw 2ABh ; (683) Niue + dw 2ACh ; (684) American Samoa + dw 2ADh ; (685) Western Samoa + dw 2AEh ; (686) Kiribati + dw 2AFh ; (687) New Caledonia + dw 2B0h ; (688) Tuvalu + dw 2B1h ; (689) French Polynesia + dw 2B2h ; (690) Tokealu + dw 2B3h ; (691) Micronesia + dw 2B4h ; (692) Marshall Islands + dw 2C7h ; (711) ??? (currency = EA$, code pages 437,737,850,852,855,857) + dw 311h ; (785) Arabic (Middle East/Saudi Arabia/etc.) + dw 324h ; (804) Ukraine + dw 329h ; (809) Antigua and Barbuda and more + dw 352h ; (850) North Korea + dw 354h ; (852) Hong Kong + dw 355h ; (853) Macao + dw 357h ; (855) Cambodia + dw 358h ; (856) Laos + dw 370h ; (880) Bangladesh + dw 376h ; (886) Taiwan (MS-DOS 6.22+) + dw 3C0h ; (960) Maldives + dw 3C1h ; (961) Lebanon + dw 3C2h ; (962) Jordan + dw 3C3h ; (963) Syria / Syrian Arab Republic + dw 3C4h ; (964) Iraq + dw 3C5h ; (965) Kuwait + dw 3C6h ; (966) Saudi Arabia + dw 3C7h ; (967) Yemen + dw 3C8h ; (968) Oman + dw 3C9h ; (969) Yemen??? (Arabic MS-DOS 5.0) + dw 3CBh ; (971) United Arab Emirates + dw 3CCh ; (972) Israel (Hebrew) (DR DOS 5.0,MS-DOS 5.0+) + dw 3CDh ; (973) Bahrain + dw 3CEh ; (974) Qatar + dw 3CFh ; (975) Bhutan + dw 3D0h ; (976) Mongolia + dw 3D1h ; (977) Nepal + dw 3E3h ; (995) Myanmar (Burma) + dw 0ffffh ; End marker + +; +; Each known version takes 2 words +; The order is minor/major with 2 hexdigits for each +; This is due to way the value is returned +; +known_versions: + dw 0005h + dw 0006h + dw 0007h + dw 0 ; end marker + +known_oem_versions: + dw 0005h + dw 0006h + dw 0007h + dw 0 ; end marker + +%include "rep_dat.inc" + +serial_err_str db "t: Serial number is zero",13,10 +serial_err_len equ $ - serial_err_str + +version_err_str db "t: DOS version match known list: " +version_output db '????' + db 13,10 +version_err_len equ $ - version_err_str + +vers_oem_err_str db "t: OEM Version match known list: " +vers_oem_err_out db '????' + db 13,10 +vers_oem_err_len equ $ - vers_oem_err_str + +stdin_err_str db 'e: Stdin status 00 or FFh, Got ' +stdin_status db '??' + db 13,10 +stdin_err_len equ $- stdin_err_str + +curr_drive_str db 'e: Current drive in expected range 0x00-0x19.' + db ' Return: ' +curr_drive_hex db '??h.' + db 13,10 +curr_drive_len equ $- curr_drive_str + +sysdate_str db 'e: System date ok. Check no ' +sysdate_check db '?',13,10 +sysdate_len equ $- sysdate_str + +systime_str db 'e: System time ok. Check no ' +systime_check db '?',13,10 +systime_len equ $- systime_str + +freespace_str db 'e: Free disk space check. Sectors pr. Cluster: ' +freespace_sector db '????h. Bytes pr. sector: ' +freespace_bytes db '????h. Free clusters: ' +freespace_free db '????h. Total clusters: ' +freespace_total db '????h.' + db 13,10 +freespace_len equ $- freespace_str + +country_err db 't: No specific country returned information.',13,10 +country_len equ $ - country_err + +upper_fail_err db 't: Failed to allocate upper memory block.',13,10 +upper_fail_len equ $ - upper_fail_err + +resize_fail_err db "t: Resize failure. Didn't return correct size",13,10 +resize_fail_len equ $ - resize_fail_err + +no_resize_err db "e: Resize didn',39,'t fail as it should.",13,10 +no_resize_len equ $ - no_resize_err + +memory_fail_err db 'e: Memory allocation failed',13,10 +memory_fail_len equ $ - memory_fail_err + +memory_ok_err db 'e: Unexpect succes of memory allocation.',13,10 +memory_ok_len equ $ - memory_ok_err + +decrease1_err db 'e: Couldn',39,'t decrease size to 64K first time.',13,10 +decrease1_len equ $ - decrease1_err + +decrease2_err db 'e: Couldn',39,'t decrease size to 64K second time.',13,10 +decrease2_len equ $ - decrease2_err + +resize_up1_err db 't: Couldn',39,'t resize original size to max. Expected ' +resize_up1_expect db '????. Got ' +resize_up1_got db '????.',13,10 +resize_up1_len equ $ - resize_up1_err + +resize_no_str db 't: Resize to 128K and no memory available.' + db ' Expected 1000h, BX=' +resize_no_out db '????h.',13,10 +resize_no_len equ $ - resize_no_str + +avail_str db 'Available ' +avail_out db '????',13,10,'$' + +psp_str db 'PSP size ' +psp_out db '????',13,10,'$' + +resize_str db 'Resize to 64K, BX=' +resize_out db '????',13,10,'$' + +maxsize_str db 'Resize to max alloc, BX=' +maxsize_out db '????',13,10,'$' + +large_str db 'Largest ' +large db '????',13,10,'$' + +mcb_str db 'MCB: ' +mcb_dump db '?? ?? ?? ?? ?? ?? ?? ?? ' + db '?? ?? ?? ?? ?? ?? ?? ??' + db 13,10,'$' +section .bss + + ; Buffer for country information +country_buffer resb 64 +country_default resb 64 + +stack resb 1024 diff --git a/dlls/kernel32/tests/rep_dat.inc b/dlls/kernel32/tests/rep_dat.inc new file mode 100644 index 0000000..3dd741b --- /dev/null +++ b/dlls/kernel32/tests/rep_dat.inc @@ -0,0 +1,4 @@ +output_filename db 'test.rep',0 + +failed_output db "Can't create report file test.rep",13,10,'$' +failed_write db "Can't write to report file test.rep",13,10,'$' diff --git a/dlls/kernel32/tests/report.inc b/dlls/kernel32/tests/report.inc new file mode 100644 index 0000000..44dbe16 --- /dev/null +++ b/dlls/kernel32/tests/report.inc @@ -0,0 +1,48 @@ + +open_report: + ; Open test output report file + mov ah,3ch + mov cx,0000h + mov dx,output_filename + int 21h + jnc test_go + + ; Can't write to output file + mov ah,09h + mov dx,failed_output + int 21h + + mov ax,4c01h + int 21h + +test_go: + + mov [output_handle],ax + retn + + ; Report the string pointer at dx, length cx + ; String is written to report file + +report: + mov ah,40h + mov bx,[output_handle] + int 21h + jc .err + retn + +.err: + mov dx,failed_write + mov ah,9 + int 21h + + ; Terminate + mov ax,4c01h + int 21h + retn + +close_report: + mov ah,2eh + mov bx,[output_handle] + int 21h + retn +