diff --git a/reactos/apps/utils/net/finger/net.c b/reactos/apps/utils/net/finger/net.c index f007a79ccf2..bb9c2c6107d 100644 --- a/reactos/apps/utils/net/finger/net.c +++ b/reactos/apps/utils/net/finger/net.c @@ -33,7 +33,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - #include #include #include "unistd.h" @@ -52,14 +51,14 @@ netfinger(char *name) struct hostent *hp, def; struct servent *sp; struct sockaddr_in sin; - int s; + SOCKET s; char *alist[1], *host; /* If this is a local request */ if (!(host = rindex(name, '@'))) return; - *host++ = 0; + *host++ = '\0'; if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) { def.h_name = host; def.h_addr_list = alist; @@ -80,7 +79,7 @@ netfinger(char *name) sin.sin_family = hp->h_addrtype; bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); sin.sin_port = sp->s_port; - if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { + if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) { perror("finger: socket"); return; } diff --git a/reactos/apps/utils/net/ftp/fake.c b/reactos/apps/utils/net/ftp/fake.c index 24f549f25a3..baedf7fa8dd 100644 --- a/reactos/apps/utils/net/ftp/fake.c +++ b/reactos/apps/utils/net/ftp/fake.c @@ -235,7 +235,7 @@ char *getpass (const char * prompt) static char input[256]; HANDLE in; HANDLE err; - int count; + DWORD count; in = GetStdHandle (STD_INPUT_HANDLE); err = GetStdHandle (STD_ERROR_HANDLE); diff --git a/reactos/apps/utils/net/ftp/ftp.c b/reactos/apps/utils/net/ftp/ftp.c index 34d443be6a5..264dd91e578 100644 --- a/reactos/apps/utils/net/ftp/ftp.c +++ b/reactos/apps/utils/net/ftp/ftp.c @@ -97,7 +97,7 @@ uid_t getuid(); sig_t lostpeer(); off_t restart_point = 0; -int cin, cout; +SOCKET cin, cout; int dataconn(char *mode); int command(char *fmt, ...); @@ -113,7 +113,8 @@ void psabort(int sig); char *hookup(char *host, int port) { register struct hostent *hp = 0; - int s,len; + int len; + SOCKET s; static char hostnamebuf[80]; bzero((char *)&hisctladdr, sizeof (hisctladdr)); @@ -136,7 +137,7 @@ char *hookup(char *host, int port) } hostname = hostnamebuf; s = socket(hisctladdr.sin_family, SOCK_STREAM, 0); - if (s < 0) { + if (s == INVALID_SOCKET) { perror("ftp: socket"); code = -1; return (0); @@ -1327,8 +1328,8 @@ void pswitch(int flag) char name[MAXHOSTNAMELEN]; struct sockaddr_in mctl; struct sockaddr_in hctl; - FILE *in; - FILE *out; + SOCKET in; + SOCKET out; int tpe; int cpnd; int sunqe; @@ -1371,10 +1372,10 @@ void pswitch(int flag) hisctladdr = op->hctl; ip->mctl = myctladdr; myctladdr = op->mctl; - (int) ip->in = cin; // What the hell am I looking at...? - cin = (int) op->in; - (int) ip->out = cout; // Same again... - cout = (int) op->out; + ip->in = cin; + cin = op->in; + ip->out = cout; + cout = op->out; ip->tpe = type; type = op->tpe; if (!type) diff --git a/reactos/apps/utils/ps/ps.c b/reactos/apps/utils/ps/ps.c index 72cb948d44c..881431a0f2a 100644 --- a/reactos/apps/utils/ps/ps.c +++ b/reactos/apps/utils/ps/ps.c @@ -110,8 +110,8 @@ int main() DWORD r; ANSI_STRING astring; HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE); - PSYSTEM_PROCESSES SystemProcesses = NULL; - PSYSTEM_PROCESSES CurrentProcess; + PSYSTEM_PROCESS_INFORMATION SystemProcesses = NULL; + PSYSTEM_PROCESS_INFORMATION CurrentProcess; ULONG BufferSize, ReturnSize; NTSTATUS Status; char buf[256]; @@ -140,7 +140,7 @@ int main() /* For every process print the information. */ CurrentProcess = SystemProcesses; - while (CurrentProcess->NextEntryDelta != 0) + while (CurrentProcess->NextEntryOffset != 0) { int hour, hour1, thour, thour1; unsigned char minute, minute1, tmin, tmin1; @@ -159,53 +159,53 @@ int main() minute1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL; seconds1 = (ptime.QuadPart / 10000000LL) % 60LL; - RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ProcessName, TRUE); + RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ImageName, TRUE); wsprintf(buf,"P%8d %8d %3d:%02d:%02d %3d:%02d:%02d ProcName: %s\n", - CurrentProcess->ProcessId, CurrentProcess->InheritedFromProcessId, + CurrentProcess->UniqueProcessId, CurrentProcess->InheritedFromUniqueProcessId, hour, minute, seconds, hour1, minute1, seconds1, astring.Buffer); WriteFile(stdout, buf, lstrlen(buf), &r, NULL); RtlFreeAnsiString(&astring); - for (ti = 0; ti < CurrentProcess->ThreadCount; ti++) + for (ti = 0; ti < CurrentProcess->NumberOfThreads; ti++) { struct status *statt; struct waitres *waitt; char szWindowName[30] = {" "}; - ptime = CurrentProcess->Threads[ti].KernelTime; + ptime = CurrentProcess->TH[ti].KernelTime; thour = (ptime.QuadPart / (10000000LL * 3600LL)); tmin = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL; tsec = (ptime.QuadPart / 10000000LL) % 60LL; - ptime = CurrentProcess->Threads[ti].UserTime; + ptime = CurrentProcess->TH[ti].UserTime; thour1 = (ptime.QuadPart / (10000000LL * 3600LL)); tmin1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL; tsec1 = (ptime.QuadPart / 10000000LL) % 60LL; statt = thread_stat; - while (statt->state != CurrentProcess->Threads[ti].State && statt->state >= 0) + while (statt->state != CurrentProcess->TH[ti].ThreadState && statt->state >= 0) statt++; waitt = waitreason; - while (waitt->state != CurrentProcess->Threads[ti].WaitReason && waitt->state >= 0) + while (waitt->state != CurrentProcess->TH[ti].WaitReason && waitt->state >= 0) waitt++; wsprintf (buf1, "t% %8d %3d:%02d:%02d %3d:%02d:%02d %s %s\n", - CurrentProcess->Threads[ti].ClientId.UniqueThread, + CurrentProcess->TH[ti].ClientId.UniqueThread, thour, tmin, tsec, thour1, tmin1, tsec1, statt->desc , waitt->desc); WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL); - EnumThreadWindows((DWORD)CurrentProcess->Threads[ti].ClientId.UniqueThread, + EnumThreadWindows((DWORD)CurrentProcess->TH[ti].ClientId.UniqueThread, (ENUMWINDOWSPROC) EnumThreadProc, (LPARAM)(LPTSTR) szWindowName ); } - CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess + - CurrentProcess->NextEntryDelta); + CurrentProcess = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess + + CurrentProcess->NextEntryOffset); } return (0); } diff --git a/reactos/boot/freeldr/FREELDR.INI b/reactos/boot/freeldr/FREELDR.INI index 0cea87af0eb..c829b87da4e 100644 --- a/reactos/boot/freeldr/FREELDR.INI +++ b/reactos/boot/freeldr/FREELDR.INI @@ -51,8 +51,7 @@ ; [OS-General] Section Commands: ; ; BootType - sets the boot type: ReactOS, Linux, BootSector, Partition, Drive -; BootDrive - sets the boot drive: 0 - first floppy, 1 - second floppy, 0x80 - first hard disk, 0x81 - second hard disk -; BootPartition - sets the boot partition +; BootPath - ARC path e.g. multi(0)disk(0)rdisk(x)partition(y) ; DriveMap - maps a BIOS drive number to another (i.e. DriveMap=hd1,hd0 maps harddisk1 to harddisk0 or DriveMap=fd1,fd0) ; [BootSector OSType] Section Commands: @@ -134,8 +133,7 @@ Hal=\reactos\HAL.DLL [Linux] BootType=Linux -BootDrive=hd1 -BootPartition=1 +BootPath=multi(0)disk(0)rdisk(1)partition(1) Kernel=/vmlinuz Initrd=/initrd.img CommandLine="root=/dev/sdb1" @@ -146,13 +144,11 @@ BootDrive=fd0 [MSWinders] BootType=Partition -BootDrive=hd0 -BootPartition=1 +BootPath=multi(0)disk(0)rdisk(0)partition(1) ;DriveMap=hd1,hd0 ;DriveMap=hd2,hd0 ;DriveMap=hd3,hd0 [DriveD] BootType=Partition -BootDrive=hd1 -BootPartition=1 +BootPath=multi(0)disk(0)rdisk(1)partition(1) diff --git a/reactos/boot/freeldr/Makefile b/reactos/boot/freeldr/Makefile index 00eae1a6439..820757a5575 100644 --- a/reactos/boot/freeldr/Makefile +++ b/reactos/boot/freeldr/Makefile @@ -20,6 +20,7 @@ PATH_TO_TOP = ../.. include rules.mak +include $(PATH_TO_TOP)/config all: $(MAKE) -C tools diff --git a/reactos/boot/freeldr/bootsect/Makefile.powerpc b/reactos/boot/freeldr/bootsect/Makefile.powerpc index ebbf8474f49..053822fbc56 100644 --- a/reactos/boot/freeldr/bootsect/Makefile.powerpc +++ b/reactos/boot/freeldr/bootsect/Makefile.powerpc @@ -27,8 +27,8 @@ freeldr.o: $(FREELDR) rm freeldr.tmp ofwldr: $(OBJS) - mppcw32-ld --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf - mppcw32-objcopy $(SECTIONS) -O aixcoff-rs6000 $@.elf $@ + $(LD) -melf32ppc --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf + $(OBJCOPY) $(SECTIONS) -O aixcoff-rs6000 $@.elf $@ $(TOOLS)/hack-coff $@ clean: diff --git a/reactos/boot/freeldr/bootsect/fat.asm b/reactos/boot/freeldr/bootsect/fat.asm index 16196230c56..36e7091df64 100644 --- a/reactos/boot/freeldr/bootsect/fat.asm +++ b/reactos/boot/freeldr/bootsect/fat.asm @@ -89,9 +89,6 @@ main: mov es,ax ; Make ES correct - cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it - jne GetDriveParameters - mov [BYTE bp+BootDrive],dl ; Save the boot drive diff --git a/reactos/boot/freeldr/freeldr/arch/i386/arch.S b/reactos/boot/freeldr/freeldr/arch/i386/arch.S index bc334ef8004..9b93f899d0e 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/arch.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/arch.S @@ -47,10 +47,10 @@ EXTERN(RealEntryPoint) .code32 /* Store the boot drive */ - movb %dl,(_BootDrive) + movb %dl,(_i386BootDrive) /* Store the boot partition */ - movb %dh,(_BootPartition) + movb %dh,(_i386BootPartition) /* GO! */ xorl %eax,%eax @@ -275,9 +275,11 @@ EXTERN(_DisableA20) * other boot loaders like Grub */ +#define MB_INFO_SIZE 90 #define MB_INFO_FLAGS_OFFSET 0 #define MB_INFO_BOOT_DEVICE_OFFSET 12 #define MB_INFO_COMMAND_LINE_OFFSET 16 +#define CMDLINE_SIZE 256 /* * We want to execute at 0x8000 (to be compatible with bootsector @@ -285,7 +287,6 @@ EXTERN(_DisableA20) * above 1MB. So we let Grub load us there and then relocate * ourself to 0x8000 */ -#define CMDLINE_BASE 0x7000 #define FREELDR_BASE 0x8000 #define INITIAL_BASE 0x200000 @@ -328,6 +329,31 @@ mb1: movw %dx,%ds movw %dx,%es + /* Check for valid multiboot signature */ + cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax + jne mbfail + + /* Store multiboot info in a safe place */ + movl %ebx,%esi + movl $(mb_info + INITIAL_BASE - FREELDR_BASE),%edi + movl $MB_INFO_SIZE,%ecx + rep movsb + + /* Save commandline */ + movl MB_INFO_FLAGS_OFFSET(%ebx),%edx + testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx) + jz mb3 + movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi + movl $(cmdline + INITIAL_BASE - FREELDR_BASE),%edi + movl $CMDLINE_SIZE,%ecx +mb2: lodsb + stosb + testb %al,%al + jz mb3 + dec %ecx + jnz mb2 +mb3: + /* Copy to low mem */ movl $INITIAL_BASE,%esi movl $FREELDR_BASE,%edi @@ -342,8 +368,8 @@ mb1: /* Clear prefetch queue & correct CS, * jump to low mem */ - ljmp $PMODE_CS, $mb2 -mb2: + ljmp $PMODE_CS, $mb4 +mb4: /* Reload segment selectors */ movw $PMODE_DS,%dx movw %dx,%ds @@ -353,39 +379,28 @@ mb2: movw %dx,%ss movl $STACK32ADDR,%esp - /* Check for valid multiboot signature */ - cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax - jne mbfail - + movl $mb_info,%ebx /* See if the boot device was passed in */ movl MB_INFO_FLAGS_OFFSET(%ebx),%edx testl $MB_INFO_FLAG_BOOT_DEVICE,%edx - jz mb3 + jz mb5 /* Retrieve boot device info */ movl MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax shrl $16,%eax incb %al - movb %al,_BootPartition - movb %ah,_BootDrive - jmp mb4 -mb3: /* No boot device known, assume first partition of first harddisk */ - movb $0x80,_BootDrive - movb $1,_BootPartition -mb4: - - /* Check for a command line */ - xorl %eax,%eax - testl $MB_INFO_FLAG_COMMAND_LINE,%edx - jz mb6 - /* Copy command line to low mem*/ - movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi - movl $CMDLINE_BASE,%edi -mb5: lodsb - stosb - testb %al,%al - jnz mb5 - movl $CMDLINE_BASE,%eax + movb %al,_i386BootPartition + movb %ah,_i386BootDrive + jmp mb6 +mb5: /* No boot device known, assume first partition of first harddisk */ + movb $0x80,_i386BootDrive + movb $1,_i386BootPartition mb6: + /* Check for command line */ + mov $cmdline,%eax + testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx) + jnz mb7 + xorl %eax,%eax +mb7: /* GO! */ pushl %eax @@ -462,8 +477,14 @@ rmode_idtptr: .word 0x3ff /* Limit */ .long 0 /* Base Address */ -EXTERN(_BootDrive) +EXTERN(_i386BootDrive) .long 0 -EXTERN(_BootPartition) +EXTERN(_i386BootPartition) .long 0 + +mb_info: + .fill MB_INFO_SIZE, 1, 0 + +cmdline: + .fill CMDLINE_SIZE, 1, 0 diff --git a/reactos/boot/freeldr/freeldr/arch/i386/archmach.c b/reactos/boot/freeldr/freeldr/arch/i386/archmach.c index 347d8f56e22..c8171b0208c 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/archmach.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/archmach.c @@ -27,7 +27,7 @@ #include "rtl.h" VOID -MachInit(VOID) +MachInit(char *CmdLine) { ULONG PciId; @@ -39,11 +39,11 @@ MachInit(VOID) PciId = READ_PORT_ULONG((ULONG*) 0xcfc); if (0x02a510de == PciId) { - XboxMachInit(); + XboxMachInit(CmdLine); } else { - PcMachInit(); + PcMachInit(CmdLine); } HalpCalibrateStallExecution(); diff --git a/reactos/boot/freeldr/freeldr/arch/i386/boot.S b/reactos/boot/freeldr/freeldr/arch/i386/boot.S index ef465851862..3fb9bbb3a41 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/boot.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/boot.S @@ -31,7 +31,7 @@ EXTERN(_ChainLoadBiosBootSectorCode) .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_i386BootDrive),%dl /* Load segment registers */ cli diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c index 71876f10abf..c70b6de1443 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c @@ -101,9 +101,9 @@ typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA typedef struct _CM_PNP_BIOS_DEVICE_NODE { USHORT Size; - UCHAR Node; + CHAR Node; ULONG ProductId; - UCHAR DeviceType[3]; + CHAR DeviceType[3]; USHORT DeviceAttributes; } __attribute__((packed)) CM_PNP_BIOS_DEVICE_NODE, *PCM_PNP_BIOS_DEVICE_NODE; @@ -258,7 +258,7 @@ SetComponentInformation(FRLDRHKEY ComponentKey, Error = RegSetValue(ComponentKey, "Component Information", REG_BINARY, - (PUCHAR)&CompInfo, + (PCHAR)&CompInfo, sizeof(CM_COMPONENT_INFORMATION)); if (Error != ERROR_SUCCESS) { @@ -287,7 +287,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber) LONG Error; InstData = (PCM_PNP_BIOS_INSTALLATION_CHECK)PnpBiosSupported(); - if (InstData == NULL || strncmp(InstData->Signature, "$PnP", 4)) + if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4)) { DbgPrint((DPRINT_HWDETECT, "PnP-BIOS not supported\n")); return; @@ -335,7 +335,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BusKey, "Identifier", REG_SZ, - (PUCHAR)"PNP BIOS", + "PNP BIOS", 9); if (Error != ERROR_SUCCESS) { @@ -413,7 +413,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BusKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -495,7 +495,7 @@ SetHarddiskConfigurationData(FRLDRHKEY DiskKey, Error = RegSetValue(DiskKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -516,7 +516,7 @@ SetHarddiskIdentifier(FRLDRHKEY DiskKey, ULONG i; ULONG Checksum; ULONG Signature; - char Identifier[20]; + CHAR Identifier[20]; LONG Error; /* Read the MBR */ @@ -568,7 +568,7 @@ SetHarddiskIdentifier(FRLDRHKEY DiskKey, Error = RegSetValue(DiskKey, "Identifier", REG_SZ, - (PUCHAR) Identifier, + Identifier, 20); if (Error != ERROR_SUCCESS) { @@ -673,7 +673,7 @@ DetectBiosDisks(FRLDRHKEY SystemKey, Error = RegSetValue(SystemKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -829,7 +829,7 @@ DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey) Error = RegSetValue(PeripheralKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -845,7 +845,7 @@ DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey) Error = RegSetValue(PeripheralKey, "Identifier", REG_SZ, - (PUCHAR)Identifier, + (PCHAR)Identifier, strlen(Identifier) + 1); if (Error != ERROR_SUCCESS) { @@ -939,7 +939,7 @@ DetectBiosFloppyController(FRLDRHKEY SystemKey, Error = RegSetValue(ControllerKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -1280,7 +1280,7 @@ DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey, Error = RegSetValue(PeripheralKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR)&FullResourceDescriptor, + (PCHAR)&FullResourceDescriptor, sizeof(CM_FULL_RESOURCE_DESCRIPTOR) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)); if (Error != ERROR_SUCCESS) @@ -1294,7 +1294,7 @@ DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey, Error = RegSetValue(PeripheralKey, "Identifier", REG_SZ, - (PUCHAR)Identifier, + Identifier, strlen(Identifier) + 1); if (Error != ERROR_SUCCESS) { @@ -1409,7 +1409,7 @@ DetectSerialPorts(FRLDRHKEY BusKey) Error = RegSetValue(ControllerKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -1426,7 +1426,7 @@ DetectSerialPorts(FRLDRHKEY BusKey) Error = RegSetValue(ControllerKey, "Identifier", REG_SZ, - (PUCHAR)Buffer, + Buffer, strlen(Buffer) + 1); if (Error != ERROR_SUCCESS) { @@ -1542,7 +1542,7 @@ DetectParallelPorts(FRLDRHKEY BusKey) Error = RegSetValue(ControllerKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -1559,7 +1559,7 @@ DetectParallelPorts(FRLDRHKEY BusKey) Error = RegSetValue(ControllerKey, "Identifier", REG_SZ, - (PUCHAR)Buffer, + Buffer, strlen(Buffer) + 1); if (Error != ERROR_SUCCESS) { @@ -1702,7 +1702,7 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey) Error = RegSetValue(PeripheralKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR)FullResourceDescriptor, + (PCHAR)FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -1718,7 +1718,7 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey) Error = RegSetValue(ControllerKey, "Identifier", REG_SZ, - (PUCHAR)Buffer, + Buffer, strlen(Buffer) + 1); if (Error != ERROR_SUCCESS) { @@ -1804,7 +1804,7 @@ DetectKeyboardController(FRLDRHKEY BusKey) Error = RegSetValue(ControllerKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR)FullResourceDescriptor, + (PCHAR)FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -1972,7 +1972,7 @@ DetectPS2Mouse(FRLDRHKEY BusKey) Error = RegSetValue(ControllerKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR)&FullResourceDescriptor, + (PCHAR)&FullResourceDescriptor, sizeof(CM_FULL_RESOURCE_DESCRIPTOR)); if (Error != ERROR_SUCCESS) { @@ -2014,7 +2014,7 @@ DetectPS2Mouse(FRLDRHKEY BusKey) Error = RegSetValue(PeripheralKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR)&FullResourceDescriptor, + (PCHAR)&FullResourceDescriptor, sizeof(CM_FULL_RESOURCE_DESCRIPTOR) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)); if (Error != ERROR_SUCCESS) @@ -2029,7 +2029,7 @@ DetectPS2Mouse(FRLDRHKEY BusKey) Error = RegSetValue(PeripheralKey, "Identifier", REG_SZ, - (PUCHAR)"MICROSOFT PS2 MOUSE", + "MICROSOFT PS2 MOUSE", 20); if (Error != ERROR_SUCCESS) { @@ -2098,7 +2098,7 @@ DetectDisplayController(FRLDRHKEY BusKey) Error = RegSetValue(ControllerKey, "Identifier", REG_SZ, - (PUCHAR)Buffer, + Buffer, strlen(Buffer) + 1); if (Error != ERROR_SUCCESS) { @@ -2146,7 +2146,7 @@ DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BusKey, "Identifier", REG_SZ, - (PUCHAR)"ISA", + "ISA", 4); if (Error != ERROR_SUCCESS) { @@ -2175,7 +2175,7 @@ DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BusKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c b/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c index f7c7fd8513b..ce935c082c5 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c @@ -92,7 +92,7 @@ DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BiosKey, "Identifier", REG_SZ, - (PUCHAR)"ACPI BIOS", + "ACPI BIOS", 10); if (Error != ERROR_SUCCESS) { diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c b/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c index a4c43b18247..ccb17bdbd61 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c @@ -95,7 +95,7 @@ DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BiosKey, "Identifier", REG_SZ, - (PUCHAR)"APM", + "APM", 4); if (Error != ERROR_SUCCESS) { diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c b/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c index 072d60d7b7d..c3a3f908d88 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c @@ -111,8 +111,8 @@ static VOID DetectCPU(FRLDRHKEY CpuKey, FRLDRHKEY FpuKey) { - char VendorIdentifier[13]; - char Identifier[64]; + CHAR VendorIdentifier[13]; + CHAR Identifier[64]; ULONG FeatureSet; FRLDRHKEY CpuInstKey; FRLDRHKEY FpuInstKey; @@ -195,7 +195,7 @@ DetectCPU(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "FeatureSet", REG_DWORD, - (PUCHAR)&FeatureSet, + (PCHAR)&FeatureSet, sizeof(ULONG)); if (Error != ERROR_SUCCESS) { @@ -208,7 +208,7 @@ DetectCPU(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "Identifier", REG_SZ, - (PUCHAR)Identifier, + Identifier, strlen(Identifier) + 1); if (Error != ERROR_SUCCESS) { @@ -218,7 +218,7 @@ DetectCPU(FRLDRHKEY CpuKey, Error = RegSetValue(FpuInstKey, "Identifier", REG_SZ, - (PUCHAR)Identifier, + Identifier, strlen(Identifier) + 1); if (Error != ERROR_SUCCESS) { @@ -231,7 +231,7 @@ DetectCPU(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "VendorIdentifier", REG_SZ, - (PUCHAR)VendorIdentifier, + VendorIdentifier, strlen(VendorIdentifier) + 1); if (Error != ERROR_SUCCESS) { @@ -250,7 +250,7 @@ DetectCPU(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "~MHz", REG_DWORD, - (PUCHAR)&CpuSpeed, + (PCHAR)&CpuSpeed, sizeof(ULONG)); if (Error != ERROR_SUCCESS) { @@ -339,7 +339,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "FeatureSet", REG_DWORD, - (PUCHAR)&FeatureSet, + (PCHAR)&FeatureSet, sizeof(ULONG)); if (Error != ERROR_SUCCESS) { @@ -352,7 +352,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "Identifier", REG_SZ, - (PUCHAR)Identifier, + Identifier, strlen(Identifier) + 1); if (Error != ERROR_SUCCESS) { @@ -362,7 +362,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey, Error = RegSetValue(FpuInstKey, "Identifier", REG_SZ, - (PUCHAR)Identifier, + Identifier, strlen(Identifier) + 1); if (Error != ERROR_SUCCESS) { @@ -375,7 +375,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "VendorIdentifier", REG_SZ, - (PUCHAR)VendorIdentifier, + VendorIdentifier, strlen(VendorIdentifier) + 1); if (Error != ERROR_SUCCESS) { @@ -394,7 +394,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey, Error = RegSetValue(CpuInstKey, "~MHz", REG_DWORD, - (PUCHAR)&CpuSpeed, + (PCHAR)&CpuSpeed, sizeof(ULONG)); if (Error != ERROR_SUCCESS) { diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c index c4cba0ad12c..066a65a4560 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c @@ -178,7 +178,7 @@ DetectPciIrqRoutingTable(FRLDRHKEY BusKey) Error = RegSetValue(TableKey, "Identifier", REG_SZ, - (PUCHAR)"PCI Real-mode IRQ Routing Table", + "PCI Real-mode IRQ Routing Table", 32); if (Error != ERROR_SUCCESS) { @@ -216,7 +216,7 @@ DetectPciIrqRoutingTable(FRLDRHKEY BusKey) Error = RegSetValue(TableKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) @@ -272,7 +272,7 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BiosKey, "Identifier", REG_SZ, - (PUCHAR)"PCI BIOS", + "PCI BIOS", 9); if (Error != ERROR_SUCCESS) { @@ -301,7 +301,7 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber) Error = RegSetValue(BiosKey, "Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, - (PUCHAR) FullResourceDescriptor, + (PCHAR) FullResourceDescriptor, Size); MmFreeMemory(FullResourceDescriptor); if (Error != ERROR_SUCCESS) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386.h b/reactos/boot/freeldr/freeldr/arch/i386/i386.h new file mode 100644 index 00000000000..cb76edaf0f5 --- /dev/null +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386.h @@ -0,0 +1,40 @@ +/* + * FreeLoader + * + * Copyright (C) 2003 Eric Kohl + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __I386_I386_H_ +#define __I386_I386_H_ + + +extern ULONG i386BootDrive; +extern ULONG i386BootPartition; + +extern BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, + PULONGLONG SectorCount, int *FsType); +extern BOOL i386DiskGetSystemVolume(char *SystemPath, char *RemainingPath, + PULONG Device, PULONG DriveNumber, + PULONGLONG StartSector, + PULONGLONG SectorCount, int *FsType); +extern BOOL i386DiskGetBootPath(char *BootPath, unsigned Size); +extern VOID i386DiskGetBootDevice(PULONG BootDevice); +extern BOOL i386DiskBootingFromFloppy(VOID); + +#endif /* __I386_I386_H_ */ + +/* EOF */ diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c index cc0bdb3ffc7..b7b3a50587a 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c @@ -19,6 +19,8 @@ #include "freeldr.h" #include "debug.h" +#include "i386.h" +#include "fsrec.h" ///////////////////////////////////////////////////////////////////////////////////////////// // FUNCTIONS @@ -166,4 +168,244 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff return TRUE; } -#endif // defined __i386__ +BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType) +{ + PARTITION_TABLE_ENTRY PartitionTableEntry; + UCHAR VolumeType; + + DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", i386BootDrive, i386BootPartition)); + + // Check and see if it is a floppy drive + // If so then just assume FAT12 file system type + if (DiskIsDriveRemovable(i386BootDrive)) + { + DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n")); + + *DriveNumber = i386BootDrive; + *StartSector = 0; + *SectorCount = 2 * 80 * 18; /* FIXME hardcoded for 1.44 Mb */ + *FsType = FS_FAT; + return TRUE; + } + + // Check for ISO9660 file system type + if (i386BootDrive >= 0x80 && FsRecIsIso9660(i386BootDrive)) + { + DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n")); + + *DriveNumber = i386BootDrive; + *StartSector = 0; + *SectorCount = 0; + *FsType = FS_ISO9660; + return TRUE; + } + + // Get the requested partition entry + if (i386BootPartition == 0) + { + // Partition requested was zero which means the boot partition + if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry)) + { + return FALSE; + } + } + else + { + // Get requested partition + if (! MachDiskGetPartitionEntry(i386BootDrive, i386BootPartition, &PartitionTableEntry)) + { + return FALSE; + } + } + + // Check for valid partition + if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) + { + return FALSE; + } + + // Try to recognize the file system + if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType)) + { + return FALSE; + } + + *DriveNumber = i386BootDrive; + *StartSector = PartitionTableEntry.SectorCountBeforePartition; + *SectorCount = PartitionTableEntry.PartitionSectorCount; + + //switch (PartitionTableEntry.SystemIndicator) + switch (VolumeType) + { + case PARTITION_FAT_12: + case PARTITION_FAT_16: + case PARTITION_HUGE: + case PARTITION_XINT13: + case PARTITION_FAT32: + case PARTITION_FAT32_XINT13: + *FsType = FS_FAT; + return TRUE; + case PARTITION_EXT2: + *FsType = FS_EXT2; + return TRUE; + case PARTITION_NTFS: + *FsType = FS_NTFS; + return TRUE; + default: + *FsType = 0; + return FALSE; + } + + return TRUE; +} + +VOID +i386DiskGetBootDevice(PULONG BootDevice) +{ + ((char *)BootDevice)[0] = (char)i386BootDrive; + ((char *)BootDevice)[1] = (char)i386BootPartition; +} + +BOOL +i386DiskBootingFromFloppy(VOID) +{ + return i386BootDrive < 0x80; +} + +#define IsRecognizedPartition(P) \ + ((P) == PARTITION_FAT_12 || \ + (P) == PARTITION_FAT_16 || \ + (P) == PARTITION_HUGE || \ + (P) == PARTITION_IFS || \ + (P) == PARTITION_EXT2 || \ + (P) == PARTITION_FAT32 || \ + (P) == PARTITION_FAT32_XINT13 || \ + (P) == PARTITION_XINT13) + +BOOL i386DiskGetSystemVolume(char *SystemPath, + char *RemainingPath, + PULONG Device, + PULONG DriveNumber, + PULONGLONG StartSector, + PULONGLONG SectorCount, + int *FsType) +{ + ULONG PartitionNumber; + PARTITION_TABLE_ENTRY PartitionTableEntry; + UCHAR VolumeType; + CHAR BootPath[256]; + unsigned i, RosPartition; + + /* + * Verify system path + */ + if (!DissectArcPath(SystemPath, BootPath, DriveNumber, &PartitionNumber)) + { + return FALSE; + } + if (NULL != RemainingPath) + { + strcpy(RemainingPath, BootPath); + } + + /* 0xff -> no partition table present, use whole device */ + if (0xff == PartitionNumber) + { + PartitionTableEntry.SectorCountBeforePartition = 0; + i = 0xff; + } + else + { + /* recalculate the boot partition for freeldr */ + i = 0; + RosPartition = 0; + while (1) + { + if (!MachDiskGetPartitionEntry(*DriveNumber, ++i, &PartitionTableEntry)) + { + return FALSE; + } + if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator)) + { + if (++RosPartition == PartitionNumber) + { + break; + } + } + } + } + + /* Check for ISO9660 file system type */ + if (*DriveNumber >= 0x80 && FsRecIsIso9660(*DriveNumber)) + { + DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n")); + + if (NULL != Device) + { + ((char *)Device)[0] = (char)(*DriveNumber); + ((char *)Device)[1] = (char)i; + } + *StartSector = 0; + *SectorCount = 0; + *FsType = FS_ISO9660; + return TRUE; + } + + if (!FsRecognizeVolume(*DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType)) + { + return FALSE; + } + + if (NULL != Device) + { + ((char *)Device)[0] = (char)(*DriveNumber); + ((char *)Device)[1] = (char)i; + } + *StartSector = PartitionTableEntry.SectorCountBeforePartition; + *SectorCount = PartitionTableEntry.PartitionSectorCount; + + switch (VolumeType) + { + case PARTITION_FAT_12: + case PARTITION_FAT_16: + case PARTITION_HUGE: + case PARTITION_XINT13: + case PARTITION_FAT32: + case PARTITION_FAT32_XINT13: + *FsType = FS_FAT; + return TRUE; + case PARTITION_EXT2: + *FsType = FS_EXT2; + return TRUE; + case PARTITION_NTFS: + *FsType = FS_NTFS; + return TRUE; + default: + *FsType = 0; + return FALSE; + } + + return FALSE; +} + +BOOL +i386DiskGetBootPath(char *BootPath, unsigned Size) +{ + static char Path[] = "multi(0)disk(0)"; + char Device[4]; + + itoa(i386BootDrive, Device, 10); + if (Size <= sizeof(Path) + 6 + strlen(Device)) + { + return FALSE; + } + strcpy(BootPath, Path); + strcat(BootPath, MachDiskBootingFromFloppy() ? "fdisk" : "cdrom"); + strcat(strcat(strcat(BootPath, "("), Device), ")"); + + return TRUE; +} + +#endif /* defined __i386__ */ + +/* EOF */ diff --git a/reactos/boot/freeldr/freeldr/arch/i386/linux.S b/reactos/boot/freeldr/freeldr/arch/i386/linux.S index 16a5a001f2d..43c1c201fa2 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/linux.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/linux.S @@ -30,7 +30,7 @@ EXTERN(_BootNewLinuxKernel) .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_i386BootDrive),%dl /* Load segment registers */ cli @@ -66,7 +66,7 @@ EXTERN(_BootOldLinuxKernel) .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_i386BootDrive),%dl /* Load segment registers */ cli diff --git a/reactos/boot/freeldr/freeldr/arch/i386/machpc.c b/reactos/boot/freeldr/freeldr/arch/i386/machpc.c index 0a6fa2840ed..8bbe0cadbc8 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/machpc.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/machpc.c @@ -23,9 +23,10 @@ #include "machine.h" #include "machpc.h" #include "rtl.h" +#include "i386.h" VOID -PcMachInit(VOID) +PcMachInit(char *CmdLine) { EnableA20(); @@ -48,6 +49,11 @@ PcMachInit(VOID) MachVtbl.VideoSync = PcVideoSync; MachVtbl.VideoPrepareForReactOS = PcVideoPrepareForReactOS; MachVtbl.GetMemoryMap = PcMemGetMemoryMap; + MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume; + MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume; + MachVtbl.DiskGetBootPath = i386DiskGetBootPath; + MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice; + MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy; MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors; MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry; MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry; diff --git a/reactos/boot/freeldr/freeldr/arch/i386/machpc.h b/reactos/boot/freeldr/freeldr/arch/i386/machpc.h index 5462a10effa..7a2a6eb58b8 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/machpc.h +++ b/reactos/boot/freeldr/freeldr/arch/i386/machpc.h @@ -26,7 +26,7 @@ #include "mm.h" #endif -VOID PcMachInit(VOID); +VOID PcMachInit(char *CmdLine); VOID PcConsPutChar(int Ch); BOOL PcConsKbHit(); diff --git a/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c b/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c index dd44d36ab73..bbb3ca86f44 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c @@ -21,9 +21,10 @@ #include "mm.h" #include "machine.h" #include "machxbox.h" +#include "i386.h" VOID -XboxMachInit(VOID) +XboxMachInit(char *CmdLine) { /* Initialize our stuff */ XboxMemInit(); @@ -46,6 +47,11 @@ XboxMachInit(VOID) MachVtbl.VideoSync = XboxVideoSync; MachVtbl.VideoPrepareForReactOS = XboxVideoPrepareForReactOS; MachVtbl.GetMemoryMap = XboxMemGetMemoryMap; + MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume; + MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume; + MachVtbl.DiskGetBootPath = i386DiskGetBootPath; + MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice; + MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy; MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors; MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry; MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry; diff --git a/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h b/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h index 845f242e8b0..d82cdc8f246 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h +++ b/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h @@ -26,7 +26,7 @@ UCHAR XboxFont8x16[256 * 16]; -VOID XboxMachInit(VOID); +VOID XboxMachInit(char *CmdLine); VOID XboxConsPutChar(int Ch); BOOL XboxConsKbHit(); diff --git a/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c b/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c index b5405cc2864..071ec9ebe17 100644 --- a/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c +++ b/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c @@ -279,7 +279,7 @@ void PpcInit( of_proxy the_ofproxy ) { BootMain("freeldr-ppc"); } -void MachInit() { +void MachInit(char *CmdLine) { int len; printf( "Determining boot device:\n" ); len = ofw_getprop(chosen_package, "bootpath", diff --git a/reactos/boot/freeldr/freeldr/bootmgr.c b/reactos/boot/freeldr/freeldr/bootmgr.c index 01cd5212462..fad99cc42af 100644 --- a/reactos/boot/freeldr/freeldr/bootmgr.c +++ b/reactos/boot/freeldr/freeldr/bootmgr.c @@ -39,16 +39,23 @@ VOID RunLoader(VOID) { - UCHAR SettingName[80]; - UCHAR SettingValue[80]; + CHAR SettingName[80]; + CHAR SettingValue[80]; ULONG SectionId; ULONG OperatingSystemCount; - PUCHAR *OperatingSystemSectionNames; - PUCHAR *OperatingSystemDisplayNames; + PCHAR *OperatingSystemSectionNames; + PCHAR *OperatingSystemDisplayNames; ULONG DefaultOperatingSystem; LONG TimeOut; ULONG SelectedOperatingSystem; + if (!FsOpenBootVolume()) + { + printf("Error opening boot partition for file access.\n"); + MachConsGetCh(); + return; + } + if (!IniFileInitialize()) { printf("Press any key to reboot.\n"); @@ -159,10 +166,10 @@ reboot: return; } -ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount) +ULONG GetDefaultOperatingSystem(PCHAR OperatingSystemList[], ULONG OperatingSystemCount) { - UCHAR DefaultOSText[80]; - char* DefaultOSName; + CHAR DefaultOSText[80]; + PCHAR DefaultOSName; ULONG SectionId; ULONG DefaultOS = 0; ULONG Idx; @@ -198,7 +205,7 @@ ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingS LONG GetTimeOut(VOID) { - UCHAR TimeOutText[20]; + CHAR TimeOutText[20]; LONG TimeOut; ULONG SectionId; diff --git a/reactos/boot/freeldr/freeldr/custom.c b/reactos/boot/freeldr/freeldr/custom.c index da0da4198d8..a3f0da02d8b 100644 --- a/reactos/boot/freeldr/freeldr/custom.c +++ b/reactos/boot/freeldr/freeldr/custom.c @@ -32,20 +32,20 @@ #include -UCHAR BootDrivePrompt[] = "Enter the boot drive.\n\nExamples:\nfd0 - first floppy drive\nhd0 - first hard drive\nhd1 - second hard drive\ncd0 - first CD-ROM drive.\n\nBIOS drive numbers may also be used:\n0 - first floppy drive\n0x80 - first hard drive\n0x81 - second hard drive"; -UCHAR BootPartitionPrompt[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition."; -UCHAR BootSectorFilePrompt[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos"; -UCHAR LinuxKernelPrompt[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18"; -UCHAR LinuxInitrdPrompt[] = "Enter the initrd image path.\n\nExamples:\n/initrd.gz\n/boot/root.img.gz\n\nLeave blank for no initial ram disk."; -UCHAR LinuxCommandLinePrompt[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init"; -UCHAR ReactOSSystemPathPrompt[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS"; -UCHAR ReactOSOptionsPrompt[] = "Enter the options you want passed to the kernel.\n\nExamples:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200\n/FASTDETECT /SOS /NOGUIBOOT\n/BASEVIDEO /MAXMEM=64\n/KERNEL=NTKRNLMP.EXE /HAL=HALMPS.DLL"; +CHAR BootDrivePrompt[] = "Enter the boot drive.\n\nExamples:\nfd0 - first floppy drive\nhd0 - first hard drive\nhd1 - second hard drive\ncd0 - first CD-ROM drive.\n\nBIOS drive numbers may also be used:\n0 - first floppy drive\n0x80 - first hard drive\n0x81 - second hard drive"; +CHAR BootPartitionPrompt[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition."; +CHAR BootSectorFilePrompt[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos"; +CHAR LinuxKernelPrompt[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18"; +CHAR LinuxInitrdPrompt[] = "Enter the initrd image path.\n\nExamples:\n/initrd.gz\n/boot/root.img.gz\n\nLeave blank for no initial ram disk."; +CHAR LinuxCommandLinePrompt[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init"; +CHAR ReactOSSystemPathPrompt[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS"; +CHAR ReactOSOptionsPrompt[] = "Enter the options you want passed to the kernel.\n\nExamples:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200\n/FASTDETECT /SOS /NOGUIBOOT\n/BASEVIDEO /MAXMEM=64\n/KERNEL=NTKRNLMP.EXE /HAL=HALMPS.DLL"; -UCHAR CustomBootPrompt[] = "Press ENTER to boot your custom boot setup."; +CHAR CustomBootPrompt[] = "Press ENTER to boot your custom boot setup."; VOID OptionMenuCustomBoot(VOID) { - PUCHAR CustomBootMenuList[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" }; + PCHAR CustomBootMenuList[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" }; ULONG CustomBootMenuCount = sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]); ULONG SelectedMenuItem; @@ -77,8 +77,8 @@ VOID OptionMenuCustomBoot(VOID) VOID OptionMenuCustomBootDisk(VOID) { - UCHAR SectionName[100]; - UCHAR BootDriveString[20]; + CHAR SectionName[100]; + CHAR BootDriveString[20]; ULONG SectionId; ULONG Year, Month, Day, Hour, Minute, Second; @@ -119,9 +119,9 @@ VOID OptionMenuCustomBootDisk(VOID) VOID OptionMenuCustomBootPartition(VOID) { - UCHAR SectionName[100]; - UCHAR BootDriveString[20]; - UCHAR BootPartitionString[20]; + CHAR SectionName[100]; + CHAR BootDriveString[20]; + CHAR BootPartitionString[20]; ULONG SectionId; ULONG Year, Month, Day, Hour, Minute, Second; @@ -174,10 +174,10 @@ VOID OptionMenuCustomBootPartition(VOID) VOID OptionMenuCustomBootBootSectorFile(VOID) { - UCHAR SectionName[100]; - UCHAR BootDriveString[20]; - UCHAR BootPartitionString[20]; - UCHAR BootSectorFileString[200]; + CHAR SectionName[100]; + CHAR BootDriveString[20]; + CHAR BootPartitionString[20]; + CHAR BootSectorFileString[200]; ULONG SectionId; ULONG Year, Month, Day, Hour, Minute, Second; @@ -242,12 +242,12 @@ VOID OptionMenuCustomBootBootSectorFile(VOID) VOID OptionMenuCustomBootReactOS(VOID) { - UCHAR SectionName[100]; - UCHAR BootDriveString[20]; - UCHAR BootPartitionString[20]; - UCHAR ReactOSSystemPath[200]; - UCHAR ReactOSARCPath[200]; - UCHAR ReactOSOptions[200]; + CHAR SectionName[100]; + CHAR BootDriveString[20]; + CHAR BootPartitionString[20]; + CHAR ReactOSSystemPath[200]; + CHAR ReactOSARCPath[200]; + CHAR ReactOSOptions[200]; ULONG SectionId; ULONG Year, Month, Day, Hour, Minute, Second; @@ -315,12 +315,12 @@ VOID OptionMenuCustomBootReactOS(VOID) VOID OptionMenuCustomBootLinux(VOID) { - UCHAR SectionName[100]; - UCHAR BootDriveString[20]; - UCHAR BootPartitionString[20]; - UCHAR LinuxKernelString[200]; - UCHAR LinuxInitrdString[200]; - UCHAR LinuxCommandLineString[200]; + CHAR SectionName[100]; + CHAR BootDriveString[20]; + CHAR BootPartitionString[20]; + CHAR LinuxKernelString[200]; + CHAR LinuxInitrdString[200]; + CHAR LinuxCommandLineString[200]; ULONG SectionId; ULONG Year, Month, Day, Hour, Minute, Second; diff --git a/reactos/boot/freeldr/freeldr/disk/disk.c b/reactos/boot/freeldr/freeldr/disk/disk.c index 9a3e6835096..600cff3e73c 100644 --- a/reactos/boot/freeldr/freeldr/disk/disk.c +++ b/reactos/boot/freeldr/freeldr/disk/disk.c @@ -39,9 +39,9 @@ VOID DiskReportError (BOOL bError) bReportError = bError; } -VOID DiskError(PUCHAR ErrorString, ULONG ErrorCode) +VOID DiskError(PCHAR ErrorString, ULONG ErrorCode) { - UCHAR ErrorCodeString[200]; + CHAR ErrorCodeString[200]; if (bReportError == FALSE) return; @@ -53,7 +53,7 @@ VOID DiskError(PUCHAR ErrorString, ULONG ErrorCode) UiMessageBox(ErrorCodeString); } -PUCHAR DiskGetErrorCodeString(ULONG ErrorCode) +PCHAR DiskGetErrorCodeString(ULONG ErrorCode) { switch (ErrorCode) { diff --git a/reactos/boot/freeldr/freeldr/disk/partition.c b/reactos/boot/freeldr/freeldr/disk/partition.c index 4c1aa01c035..42d1f0ab6de 100644 --- a/reactos/boot/freeldr/freeldr/disk/partition.c +++ b/reactos/boot/freeldr/freeldr/disk/partition.c @@ -28,7 +28,8 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) { - ULONG BootablePartitionCount = 0; + ULONG BootablePartitionCount = 0; + ULONG ActivePartition = 0; MASTER_BOOT_RECORD MasterBootRecord; // Read master boot record @@ -41,22 +42,22 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti if (MasterBootRecord.PartitionTable[0].BootIndicator == 0x80) { BootablePartitionCount++; - BootPartition = 0; + ActivePartition = 0; } if (MasterBootRecord.PartitionTable[1].BootIndicator == 0x80) { BootablePartitionCount++; - BootPartition = 1; + ActivePartition = 1; } if (MasterBootRecord.PartitionTable[2].BootIndicator == 0x80) { BootablePartitionCount++; - BootPartition = 2; + ActivePartition = 2; } if (MasterBootRecord.PartitionTable[3].BootIndicator == 0x80) { BootablePartitionCount++; - BootPartition = 3; + ActivePartition = 3; } // Make sure there was only one bootable partition @@ -72,7 +73,7 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti } // Copy the partition table entry - RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[BootPartition], sizeof(PARTITION_TABLE_ENTRY)); + RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[ActivePartition], sizeof(PARTITION_TABLE_ENTRY)); return TRUE; } diff --git a/reactos/boot/freeldr/freeldr/drivemap.c b/reactos/boot/freeldr/freeldr/drivemap.c index 5a5ff3d0d0e..f7b4266a463 100644 --- a/reactos/boot/freeldr/freeldr/drivemap.c +++ b/reactos/boot/freeldr/freeldr/drivemap.c @@ -30,13 +30,13 @@ ULONG OldInt13HandlerAddress = 0; // Address of BIOS int 13h handler ULONG DriveMapHandlerAddress = 0; // Linear address of our drive map handler ULONG DriveMapHandlerSegOff = 0; // Segment:offset style address of our drive map handler -VOID DriveMapMapDrivesInSection(PUCHAR SectionName) +VOID DriveMapMapDrivesInSection(PCHAR SectionName) { - UCHAR SettingName[80]; - UCHAR SettingValue[80]; - UCHAR ErrorText[260]; - UCHAR Drive1[80]; - UCHAR Drive2[80]; + CHAR SettingName[80]; + CHAR SettingValue[80]; + CHAR ErrorText[260]; + CHAR Drive1[80]; + CHAR Drive2[80]; ULONG SectionId; ULONG SectionItemCount; ULONG Index; @@ -117,7 +117,7 @@ VOID DriveMapMapDrivesInSection(PUCHAR SectionName) } } -BOOL DriveMapIsValidDriveString(PUCHAR DriveString) +BOOL DriveMapIsValidDriveString(PCHAR DriveString) { ULONG Index; @@ -147,7 +147,7 @@ BOOL DriveMapIsValidDriveString(PUCHAR DriveString) return TRUE; } -ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName) +ULONG DriveMapGetBiosDriveNumber(PCHAR DeviceName) { ULONG BiosDriveNumber = 0; diff --git a/reactos/boot/freeldr/freeldr/freeldr.c b/reactos/boot/freeldr/freeldr/freeldr.c index d1a6b5675de..0a2259a67c9 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.c +++ b/reactos/boot/freeldr/freeldr/freeldr.c @@ -31,7 +31,7 @@ VOID BootMain(char *CmdLine) { CmdLineParse(CmdLine); - MachInit(); + MachInit(CmdLine); DebugInit(); diff --git a/reactos/boot/freeldr/freeldr/fs/ext2.c b/reactos/boot/freeldr/freeldr/fs/ext2.c index 8825c87f471..7f5cffaeb2f 100644 --- a/reactos/boot/freeldr/freeldr/fs/ext2.c +++ b/reactos/boot/freeldr/freeldr/fs/ext2.c @@ -87,12 +87,12 @@ BOOL Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector) * Tries to open the file 'name' and returns true or false * for success and failure respectively */ -FILE* Ext2OpenFile(PUCHAR FileName) +FILE* Ext2OpenFile(PCHAR FileName) { EXT2_FILE_INFO TempExt2FileInfo; PEXT2_FILE_INFO FileHandle; - UCHAR SymLinkPath[EXT3_NAME_LEN]; - UCHAR FullPath[EXT3_NAME_LEN * 2]; + CHAR SymLinkPath[EXT3_NAME_LEN]; + CHAR FullPath[EXT3_NAME_LEN * 2]; ULONG Index; DbgPrint((DPRINT_FILESYSTEM, "Ext2OpenFile() FileName = %s\n", FileName)); @@ -190,11 +190,11 @@ FILE* Ext2OpenFile(PUCHAR FileName) * with info describing the file, etc. returns true * if the file exists or false otherwise */ -BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer) +BOOL Ext2LookupFile(PCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer) { int i; ULONG NumberOfPathParts; - UCHAR PathPart[261]; + CHAR PathPart[261]; PVOID DirectoryBuffer; ULONG DirectoryInode = EXT3_ROOT_INO; EXT2_INODE InodeData; @@ -289,7 +289,7 @@ BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer) return TRUE; } -BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry) +BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry) { ULONG CurrentOffset; PEXT2_DIR_ENTRY CurrentDirectoryEntry; @@ -839,7 +839,7 @@ BOOL Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePoi BOOL Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer) { - UCHAR ErrorString[80]; + CHAR ErrorString[80]; DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadBlock() BlockNumber = %d Buffer = 0x%x\n", BlockNumber, Buffer)); @@ -913,7 +913,7 @@ BOOL Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer) ULONG InodeGroupNumber; ULONG InodeBlockNumber; ULONG InodeOffsetInBlock; - UCHAR ErrorString[80]; + CHAR ErrorString[80]; EXT2_GROUP_DESC GroupDescriptor; DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadInode() Inode = %d\n", Inode)); diff --git a/reactos/boot/freeldr/freeldr/fs/ext2.h b/reactos/boot/freeldr/freeldr/fs/ext2.h index 5f3f02d6eed..84d1a21818a 100644 --- a/reactos/boot/freeldr/freeldr/fs/ext2.h +++ b/reactos/boot/freeldr/freeldr/fs/ext2.h @@ -558,7 +558,7 @@ struct ext3_dir_entry { ULONG inode; /* Inode number */ USHORT rec_len; /* Directory entry length */ USHORT name_len; /* Name length */ - char name[EXT3_NAME_LEN]; /* File name */ + CHAR name[EXT3_NAME_LEN]; /* File name */ }; /* @@ -572,7 +572,7 @@ struct ext3_dir_entry_2 { USHORT rec_len; /* Directory entry length */ UCHAR name_len; /* Name length */ UCHAR file_type; - char name[EXT3_NAME_LEN]; /* File name */ + CHAR name[EXT3_NAME_LEN]; /* File name */ }; /* @@ -667,9 +667,9 @@ typedef struct BOOL Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector); -FILE* Ext2OpenFile(PUCHAR FileName); -BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); -BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry); +FILE* Ext2OpenFile(PCHAR FileName); +BOOL Ext2LookupFile(PCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); +BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry); BOOL Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer); ULONGLONG Ext2GetFileSize(FILE *FileHandle); VOID Ext2SetFilePointer(FILE *FileHandle, ULONGLONG NewFilePointer); diff --git a/reactos/boot/freeldr/freeldr/fs/fat.c b/reactos/boot/freeldr/freeldr/fs/fat.c index 973cf55383c..53aa9766173 100644 --- a/reactos/boot/freeldr/freeldr/fs/fat.c +++ b/reactos/boot/freeldr/freeldr/fs/fat.c @@ -405,22 +405,22 @@ PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG *DirectorySize, BOOL return DirectoryBuffer; } -BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) +BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) { ULONG EntryCount; ULONG CurrentEntry; PDIRENTRY DirEntry; PLFN_DIRENTRY LfnDirEntry; - UCHAR LfnNameBuffer[265]; - UCHAR ShortNameBuffer[20]; + CHAR LfnNameBuffer[265]; + CHAR ShortNameBuffer[20]; ULONG StartCluster; EntryCount = DirectorySize / sizeof(DIRENTRY); DbgPrint((DPRINT_FILESYSTEM, "FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName)); - memset(ShortNameBuffer, 0, 13 * sizeof(UCHAR)); - memset(LfnNameBuffer, 0, 261 * sizeof(UCHAR)); + memset(ShortNameBuffer, 0, 13 * sizeof(CHAR)); + memset(LfnNameBuffer, 0, 261 * sizeof(CHAR)); DirEntry = (PDIRENTRY) DirectoryBuffer; for (CurrentEntry=0; CurrentEntryFileName[0] == 0x00) + if (DirEntry->FileName[0] == '\0') { return FALSE; } @@ -444,10 +444,10 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, // // Check if this is a deleted entry or not // - if (DirEntry->FileName[0] == 0xE5) + if (DirEntry->FileName[0] == '\xE5') { - memset(ShortNameBuffer, 0, 13 * sizeof(UCHAR)); - memset(LfnNameBuffer, 0, 261 * sizeof(UCHAR)); + memset(ShortNameBuffer, 0, 13 * sizeof(CHAR)); + memset(LfnNameBuffer, 0, 261 * sizeof(CHAR)); continue; } @@ -616,7 +616,7 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, return FALSE; } -BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) +BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) { ULONG EntryCount; ULONG CurrentEntry; @@ -687,11 +687,11 @@ BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize * with info describing the file, etc. returns true * if the file exists or false otherwise */ -BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) +BOOL FatLookupFile(PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) { int i; ULONG NumberOfPathParts; - UCHAR PathPart[261]; + CHAR PathPart[261]; PVOID DirectoryBuffer; ULONG DirectoryStartCluster = 0; ULONG DirectorySize; @@ -777,7 +777,7 @@ BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) * is in the form of "FILE EXT" and puts it in Buffer * in the form of "file.ext" */ -void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry) +void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry) { ULONG Idx; @@ -915,7 +915,7 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer) * Tries to open the file 'name' and returns true or false * for success and failure respectively */ -FILE* FatOpenFile(PUCHAR FileName) +FILE* FatOpenFile(PCHAR FileName) { FAT_FILE_INFO TempFatFileInfo; PFAT_FILE_INFO FileHandle; diff --git a/reactos/boot/freeldr/freeldr/fs/fat.h b/reactos/boot/freeldr/freeldr/fs/fat.h index d697e4840f7..96af6891077 100644 --- a/reactos/boot/freeldr/freeldr/fs/fat.h +++ b/reactos/boot/freeldr/freeldr/fs/fat.h @@ -23,7 +23,7 @@ typedef struct _FAT_BOOTSECTOR { UCHAR JumpBoot[3]; // Jump instruction to boot code - UCHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes + CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes USHORT BytesPerSector; // Bytes per sector UCHAR SectorsPerCluster; // Number of sectors in a cluster USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector) @@ -40,8 +40,8 @@ typedef struct _FAT_BOOTSECTOR UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0. UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present. ULONG VolumeSerialNumber; // Volume serial number - UCHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory - UCHAR FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT " + CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory + CHAR FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT " UCHAR BootCodeAndData[448]; // The remainder of the boot sector @@ -52,7 +52,7 @@ typedef struct _FAT_BOOTSECTOR typedef struct _FAT32_BOOTSECTOR { UCHAR JumpBoot[3]; // Jump instruction to boot code - UCHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes + CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes USHORT BytesPerSector; // Bytes per sector UCHAR SectorsPerCluster; // Number of sectors in a cluster USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector) @@ -76,8 +76,8 @@ typedef struct _FAT32_BOOTSECTOR UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0. UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present. ULONG VolumeSerialNumber; // Volume serial number - UCHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory - UCHAR FileSystemType[8]; // Always set to the string "FAT32 " + CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory + CHAR FileSystemType[8]; // Always set to the string "FAT32 " UCHAR BootCodeAndData[420]; // The remainder of the boot sector @@ -87,7 +87,7 @@ typedef struct _FAT32_BOOTSECTOR typedef struct _FATX_BOOTSECTOR { - UCHAR FileSystemType[4]; /* String "FATX" */ + CHAR FileSystemType[4]; /* String "FATX" */ ULONG VolumeSerialNumber; /* Volume serial number */ ULONG SectorsPerCluster; /* Number of sectors in a cluster */ USHORT NumberOfFats; /* Number of FAT tables */ @@ -101,7 +101,7 @@ typedef struct _FATX_BOOTSECTOR */ typedef struct //_DIRENTRY { - UCHAR FileName[11]; /* Filename + extension */ + CHAR FileName[11]; /* Filename + extension */ UCHAR Attr; /* File attributes */ UCHAR ReservedNT; /* Reserved for use by Windows NT */ UCHAR TimeInTenths; /* Millisecond stamp at file creation */ @@ -131,7 +131,7 @@ typedef struct { UCHAR FileNameSize; /* Size of filename (max 42) */ UCHAR Attr; /* File attributes */ - UCHAR FileName[42]; /* Filename in ASCII, padded with 0xff (not zero-terminated) */ + CHAR FileName[42]; /* Filename in ASCII, padded with 0xff (not zero-terminated) */ ULONG StartCluster; /* Starting cluster number */ ULONG Size; /* File size */ USHORT Time; /* Time last modified */ @@ -155,11 +155,11 @@ typedef struct BOOL FatOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector, ULONG PartitionSectorCount); ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount); PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOL RootDirectory); -BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); -BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); -void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry); +BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); +BOOL FatLookupFile(PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); +void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry); BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer); -FILE* FatOpenFile(PUCHAR FileName); +FILE* FatOpenFile(PCHAR FileName); ULONG FatCountClustersInChain(ULONG StartCluster); ULONG* FatGetClusterChainArray(ULONG StartCluster); BOOL FatReadCluster(ULONG ClusterNumber, PVOID Buffer); diff --git a/reactos/boot/freeldr/freeldr/fs/fs.c b/reactos/boot/freeldr/freeldr/fs/fs.c index c91813f95d6..fedf30e3bb2 100644 --- a/reactos/boot/freeldr/freeldr/fs/fs.c +++ b/reactos/boot/freeldr/freeldr/fs/fs.c @@ -42,7 +42,7 @@ ULONG FsType = 0; // Type of filesystem on boot device, set by FsOpenVolume() // FUNCTIONS ///////////////////////////////////////////////////////////////////////////////////////////// -VOID FileSystemError(PUCHAR ErrorString) +VOID FileSystemError(PCHAR ErrorString) { DbgPrint((DPRINT_FILESYSTEM, "%s\n", ErrorString)); @@ -51,111 +51,79 @@ VOID FileSystemError(PUCHAR ErrorString) /* * - * BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber); + * BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type); * * This function is called to open a disk volume for file access. * It must be called before any of the file functions will work. - * It takes two parameters: - * - * Drive: The BIOS drive number of the disk to open - * Partition: This is zero for floppy drives. - * If the disk is a hard disk then this specifies - * The partition number to open (1 - 4) - * If it is zero then it opens the active (bootable) partition * */ -BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber) +static BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type) { - PARTITION_TABLE_ENTRY PartitionTableEntry; - UCHAR ErrorText[80]; - UCHAR VolumeType; + CHAR ErrorText[80]; - DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", DriveNumber, PartitionNumber)); + FsType = Type; - // Check and see if it is a floppy drive - // If so then just assume FAT12 file system type - if (DiskIsDriveRemovable(DriveNumber)) + switch (FsType) { - DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n")); - - FsType = FS_FAT; - return FatOpenVolume(DriveNumber, 0, 0); - } - - // Check for ISO9660 file system type - if (DriveNumber >= 0x80 && FsRecIsIso9660(DriveNumber)) - { - DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n")); - - FsType = FS_ISO9660; + case FS_FAT: + return FatOpenVolume(DriveNumber, StartSector, SectorCount); + case FS_EXT2: + return Ext2OpenVolume(DriveNumber, StartSector); + case FS_NTFS: + return NtfsOpenVolume(DriveNumber, StartSector); + case FS_ISO9660: return IsoOpenVolume(DriveNumber); - } - - // Set the boot partition - BootPartition = PartitionNumber; - - // Get the requested partition entry - if (PartitionNumber == 0) - { - // Partition requested was zero which means the boot partition - if (DiskGetActivePartitionEntry(DriveNumber, &PartitionTableEntry) == FALSE) - { - FileSystemError("No active partition."); - return FALSE; - } - } - else - { - // Get requested partition - if (MachDiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE) - { - FileSystemError("Partition not found."); - return FALSE; - } - } - - // Check for valid partition - if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) - { - FileSystemError("Invalid partition."); - return FALSE; - } - - // Try to recognize the file system - if (!FsRecognizeVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType)) - { - FileSystemError("Unrecognized file system."); - return FALSE; - } - - //switch (PartitionTableEntry.SystemIndicator) - switch (VolumeType) - { - case PARTITION_FAT_12: - case PARTITION_FAT_16: - case PARTITION_HUGE: - case PARTITION_XINT13: - case PARTITION_FAT32: - case PARTITION_FAT32_XINT13: - FsType = FS_FAT; - return FatOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, PartitionTableEntry.PartitionSectorCount); - case PARTITION_EXT2: - FsType = FS_EXT2; - return Ext2OpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition); - case PARTITION_NTFS: - FsType = FS_NTFS; - return NtfsOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition); default: FsType = 0; - sprintf(ErrorText, "Unsupported file system. Type: 0x%x", VolumeType); + sprintf(ErrorText, "Unsupported file system. Type: 0x%x", Type); FileSystemError(ErrorText); + } + + return FALSE; +} +/* + * + * BOOL FsOpenBootVolume() + * + * This function is called to open the boot disk volume for file access. + * It must be called before any of the file functions will work. + */ +BOOL FsOpenBootVolume() +{ + ULONG DriveNumber; + ULONGLONG StartSector; + ULONGLONG SectorCount; + int Type; + + if (! MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type)) + { + FileSystemError("Unable to locate boot partition\n"); return FALSE; } - return TRUE; + return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type); } -PFILE FsOpenFile(PUCHAR FileName) +BOOL FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG Device) +{ + ULONG DriveNumber; + ULONGLONG StartSector; + ULONGLONG SectorCount; + int Type; + + if (! MachDiskGetSystemVolume(SystemPath, RemainingPath, Device, + &DriveNumber, &StartSector, &SectorCount, + &Type)) + { + FileSystemError("Unable to locate system partition\n"); + return FALSE; + } + + return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type); +} + + +PFILE FsOpenFile(PCHAR FileName) { PFILE FileHandle = NULL; @@ -369,7 +337,7 @@ BOOL FsIsEndOfFile(PFILE FileHandle) * This function parses a path in the form of dir1\dir2\file1.ext * and returns the number of parts it has (i.e. 3 - dir1,dir2,file1.ext) */ -ULONG FsGetNumPathParts(PUCHAR Path) +ULONG FsGetNumPathParts(PCHAR Path) { ULONG i; ULONG num; @@ -394,7 +362,7 @@ ULONG FsGetNumPathParts(PUCHAR Path) * and puts the first name of the path (e.g. "dir1") in buffer * compatible with the MSDOS directory structure */ -VOID FsGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path) +VOID FsGetFirstNameFromPath(PCHAR Buffer, PCHAR Path) { ULONG i; diff --git a/reactos/boot/freeldr/freeldr/fs/iso.c b/reactos/boot/freeldr/freeldr/fs/iso.c index 58e881bff74..e02af6c368b 100644 --- a/reactos/boot/freeldr/freeldr/fs/iso.c +++ b/reactos/boot/freeldr/freeldr/fs/iso.c @@ -65,12 +65,12 @@ BOOL IsoOpenVolume(ULONG DriveNumber) } -static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryLength, PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer) +static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryLength, PCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer) { PDIR_RECORD Record; ULONG Offset; ULONG i; - UCHAR Name[32]; + CHAR Name[32]; DbgPrint((DPRINT_FILESYSTEM, "IsoSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectoryLength = %d FileName = %s\n", DirectoryBuffer, DirectoryLength, FileName)); @@ -180,11 +180,11 @@ static PVOID IsoBufferDirectory(ULONG DirectoryStartSector, ULONG DirectoryLengt * with info describing the file, etc. returns true * if the file exists or false otherwise */ -static BOOL IsoLookupFile(PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer) +static BOOL IsoLookupFile(PCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer) { int i; ULONG NumberOfPathParts; - UCHAR PathPart[261]; + CHAR PathPart[261]; PVOID DirectoryBuffer; ULONG DirectorySector; ULONG DirectoryLength; @@ -263,7 +263,7 @@ static BOOL IsoLookupFile(PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer) * Tries to open the file 'name' and returns true or false * for success and failure respectively */ -FILE* IsoOpenFile(PUCHAR FileName) +FILE* IsoOpenFile(PCHAR FileName) { ISO_FILE_INFO TempFileInfo; PISO_FILE_INFO FileHandle; diff --git a/reactos/boot/freeldr/freeldr/fs/iso.h b/reactos/boot/freeldr/freeldr/fs/iso.h index db549a40b37..e0be69bcaad 100644 --- a/reactos/boot/freeldr/freeldr/fs/iso.h +++ b/reactos/boot/freeldr/freeldr/fs/iso.h @@ -65,11 +65,11 @@ typedef struct _VD_HEADER VD_HEADER, *PVD_HEADER; struct _PVD { UCHAR VdType; // 1 - UCHAR StandardId[5]; // 2-6 + CHAR StandardId[5]; // 2-6 UCHAR VdVersion; // 7 UCHAR unused0; // 8 - UCHAR SystemId[32]; // 9-40 - UCHAR VolumeId[32]; // 41-72 + CHAR SystemId[32]; // 9-40 + CHAR VolumeId[32]; // 41-72 UCHAR unused1[8]; // 73-80 ULONG VolumeSpaceSizeL; // 81-84 ULONG VolumeSpaceSizeM; // 85-88 @@ -84,8 +84,8 @@ struct _PVD ULONG MPathTablePos; // 149-152 ULONG MOptPathTablePos; // 153-156 DIR_RECORD RootDirRecord; // 157-190 - UCHAR VolumeSetIdentifier[128]; // 191-318 - UCHAR PublisherIdentifier[128]; // 319-446 + CHAR VolumeSetIdentifier[128]; // 191-318 + CHAR PublisherIdentifier[128]; // 319-446 /* more data ... */ @@ -106,7 +106,7 @@ typedef struct BOOL IsoOpenVolume(ULONG DriveNumber); -FILE* IsoOpenFile(PUCHAR FileName); +FILE* IsoOpenFile(PCHAR FileName); BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); ULONG IsoGetFileSize(FILE *FileHandle); VOID IsoSetFilePointer(FILE *FileHandle, ULONG NewFilePointer); diff --git a/reactos/boot/freeldr/freeldr/fs/ntfs.c b/reactos/boot/freeldr/freeldr/fs/ntfs.c index fc8505ae645..992865ca151 100644 --- a/reactos/boot/freeldr/freeldr/fs/ntfs.c +++ b/reactos/boot/freeldr/freeldr/fs/ntfs.c @@ -563,10 +563,10 @@ BOOL NtfsFindMftRecord(ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex) return FALSE; } -BOOL NtfsLookupFile(PUCHAR FileName, PNTFS_MFT_RECORD MftRecord, PNTFS_ATTR_CONTEXT DataContext) +BOOL NtfsLookupFile(PCHAR FileName, PNTFS_MFT_RECORD MftRecord, PNTFS_ATTR_CONTEXT DataContext) { ULONG NumberOfPathParts; - UCHAR PathPart[261]; + CHAR PathPart[261]; ULONG CurrentMFTIndex; UCHAR i; @@ -680,7 +680,7 @@ BOOL NtfsOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector) return TRUE; } -FILE* NtfsOpenFile(PUCHAR FileName) +FILE* NtfsOpenFile(PCHAR FileName) { PNTFS_FILE_HANDLE FileHandle; PNTFS_MFT_RECORD MftRecord; diff --git a/reactos/boot/freeldr/freeldr/fs/ntfs.h b/reactos/boot/freeldr/freeldr/fs/ntfs.h index 5c99fb9c638..ae64c378500 100644 --- a/reactos/boot/freeldr/freeldr/fs/ntfs.h +++ b/reactos/boot/freeldr/freeldr/fs/ntfs.h @@ -62,7 +62,7 @@ typedef struct { UCHAR JumpBoot[3]; // Jump to the boot loader routine - UCHAR SystemId[8]; // System Id ("NTFS ") + CHAR SystemId[8]; // System Id ("NTFS ") USHORT BytesPerSector; // Bytes per sector UCHAR SectorsPerCluster; // Number of sectors in a cluster UCHAR Unused1[7]; @@ -219,7 +219,7 @@ typedef struct } PACKED NTFS_FILE_HANDLE, *PNTFS_FILE_HANDLE; BOOL NtfsOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector); -FILE* NtfsOpenFile(PUCHAR FileName); +FILE* NtfsOpenFile(PCHAR FileName); BOOL NtfsReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); ULONG NtfsGetFileSize(FILE *FileHandle); VOID NtfsSetFilePointer(FILE *FileHandle, ULONG NewFilePointer); diff --git a/reactos/boot/freeldr/freeldr/include/bootmgr.h b/reactos/boot/freeldr/freeldr/include/bootmgr.h index 9d61a176eeb..2a3e3e9a7b7 100644 --- a/reactos/boot/freeldr/freeldr/include/bootmgr.h +++ b/reactos/boot/freeldr/freeldr/include/bootmgr.h @@ -21,7 +21,7 @@ #define __BOOTMGR_H -ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount); +ULONG GetDefaultOperatingSystem(PCHAR OperatingSystemList[], ULONG OperatingSystemCount); LONG GetTimeOut(VOID); BOOL MainBootMenuKeyPressFilter(ULONG KeyPress); diff --git a/reactos/boot/freeldr/freeldr/include/disk.h b/reactos/boot/freeldr/freeldr/include/disk.h index dc5abcb4f73..120289a54aa 100644 --- a/reactos/boot/freeldr/freeldr/include/disk.h +++ b/reactos/boot/freeldr/freeldr/include/disk.h @@ -119,8 +119,8 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff // /////////////////////////////////////////////////////////////////////////////////////// VOID DiskReportError (BOOL bError); -VOID DiskError(PUCHAR ErrorString, ULONG ErrorCode); -PUCHAR DiskGetErrorCodeString(ULONG ErrorCode); +VOID DiskError(PCHAR ErrorString, ULONG ErrorCode); +PCHAR DiskGetErrorCodeString(ULONG ErrorCode); BOOL DiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c BOOL DiskIsDriveRemovable(ULONG DriveNumber); VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c diff --git a/reactos/boot/freeldr/freeldr/include/drivemap.h b/reactos/boot/freeldr/freeldr/include/drivemap.h index 2aeaf662089..e2d19cbad75 100644 --- a/reactos/boot/freeldr/freeldr/include/drivemap.h +++ b/reactos/boot/freeldr/freeldr/include/drivemap.h @@ -25,13 +25,13 @@ typedef struct { UCHAR DriveMapCount; // Count of drives currently mapped - UCHAR DriveMap[8]; // Map of BIOS drives + CHAR DriveMap[8]; // Map of BIOS drives } PACKED DRIVE_MAP_LIST, *PDRIVE_MAP_LIST; -VOID DriveMapMapDrivesInSection(PUCHAR SectionName); -BOOL DriveMapIsValidDriveString(PUCHAR DriveString); // Checks the drive string ("hd0") for validity -ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0') +VOID DriveMapMapDrivesInSection(PCHAR SectionName); +BOOL DriveMapIsValidDriveString(PCHAR DriveString); // Checks the drive string ("hd0") for validity +ULONG DriveMapGetBiosDriveNumber(PCHAR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0') VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap); // Installs the int 13h handler for the drive mapper VOID DriveMapRemoveInt13Handler(VOID); // Removes a previously installed int 13h drive map handler diff --git a/reactos/boot/freeldr/freeldr/include/freeldr.h b/reactos/boot/freeldr/freeldr/include/freeldr.h index 3b41ac30190..c9082ae75ae 100644 --- a/reactos/boot/freeldr/freeldr/include/freeldr.h +++ b/reactos/boot/freeldr/freeldr/include/freeldr.h @@ -38,8 +38,6 @@ #define ROUND_DOWN(N, S) ((N) & ~((S) - 1)) #define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n") -extern ULONG BootDrive; /* BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. */ -extern ULONG BootPartition; /* Boot Partition, 1-4 */ extern BOOL UserInterfaceUp; /* Tells us if the user interface is displayed */ VOID BootMain(LPSTR CmdLine); diff --git a/reactos/boot/freeldr/freeldr/include/fs.h b/reactos/boot/freeldr/freeldr/include/fs.h index 6b2d57d774a..4b2bb6ee37c 100644 --- a/reactos/boot/freeldr/freeldr/include/fs.h +++ b/reactos/boot/freeldr/freeldr/include/fs.h @@ -32,16 +32,17 @@ #define FILE VOID #define PFILE FILE * -VOID FileSystemError(PUCHAR ErrorString); -BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber); -PFILE FsOpenFile(PUCHAR FileName); +VOID FileSystemError(PCHAR ErrorString); +BOOL FsOpenBootVolume(); +BOOL FsOpenSystemVolume(PCHAR SystemPath, PCHAR RemainingPath, PULONG BootDevice); +PFILE FsOpenFile(PCHAR FileName); VOID FsCloseFile(PFILE FileHandle); BOOL FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); ULONG FsGetFileSize(PFILE FileHandle); VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer); ULONG FsGetFilePointer(PFILE FileHandle); BOOL FsIsEndOfFile(PFILE FileHandle); -ULONG FsGetNumPathParts(PUCHAR Path); -VOID FsGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path); +ULONG FsGetNumPathParts(PCHAR Path); +VOID FsGetFirstNameFromPath(PCHAR Buffer, PCHAR Path); #endif // #defined __FS_H diff --git a/reactos/boot/freeldr/freeldr/fs/fsrec.h b/reactos/boot/freeldr/freeldr/include/fsrec.h similarity index 100% rename from reactos/boot/freeldr/freeldr/fs/fsrec.h rename to reactos/boot/freeldr/freeldr/include/fsrec.h diff --git a/reactos/boot/freeldr/freeldr/include/inifile.h b/reactos/boot/freeldr/freeldr/include/inifile.h index 4b218363eb2..6c03574737b 100644 --- a/reactos/boot/freeldr/freeldr/include/inifile.h +++ b/reactos/boot/freeldr/freeldr/include/inifile.h @@ -22,14 +22,14 @@ BOOL IniFileInitialize(VOID); -BOOL IniOpenSection(PUCHAR SectionName, ULONG* SectionId); +BOOL IniOpenSection(PCHAR SectionName, ULONG* SectionId); ULONG IniGetNumSectionItems(ULONG SectionId); ULONG IniGetSectionSettingNameSize(ULONG SectionId, ULONG SettingIndex); ULONG IniGetSectionSettingValueSize(ULONG SectionId, ULONG SettingIndex); -BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR SettingName, ULONG NameSize, PUCHAR SettingValue, ULONG ValueSize); -BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, ULONG BufferSize); -BOOL IniAddSection(PUCHAR SectionName, ULONG* SectionId); -BOOL IniAddSettingValueToSection(ULONG SectionId, PUCHAR SettingName, PUCHAR SettingValue); +BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize); +BOOL IniReadSettingByName(ULONG SectionId, PCHAR SettingName, PCHAR Buffer, ULONG BufferSize); +BOOL IniAddSection(PCHAR SectionName, ULONG* SectionId); +BOOL IniAddSettingValueToSection(ULONG SectionId, PCHAR SettingName, PCHAR SettingValue); #endif // defined __PARSEINI_H diff --git a/reactos/boot/freeldr/freeldr/include/linux.h b/reactos/boot/freeldr/freeldr/include/linux.h index dc19f971b76..6de9e6d2acf 100644 --- a/reactos/boot/freeldr/freeldr/include/linux.h +++ b/reactos/boot/freeldr/freeldr/include/linux.h @@ -127,9 +127,9 @@ typedef struct VOID BootNewLinuxKernel(VOID); // Implemented in linux.S VOID BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S -VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description); +VOID LoadAndBootLinux(PCHAR OperatingSystemName, PCHAR Description); -BOOL LinuxParseIniSection(PUCHAR OperatingSystemName); +BOOL LinuxParseIniSection(PCHAR OperatingSystemName); BOOL LinuxReadBootSector(PFILE LinuxKernelFile); BOOL LinuxReadSetupSector(PFILE LinuxKernelFile); BOOL LinuxReadKernel(PFILE LinuxKernelFile); diff --git a/reactos/boot/freeldr/freeldr/include/machine.h b/reactos/boot/freeldr/freeldr/include/machine.h index 2642ed57f8e..5879d2ef466 100644 --- a/reactos/boot/freeldr/freeldr/include/machine.h +++ b/reactos/boot/freeldr/freeldr/include/machine.h @@ -56,6 +56,11 @@ typedef struct tagMACHVTBL ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); + BOOL (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType); + BOOL (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device, PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType); + BOOL (*DiskGetBootPath)(char *BootPath, unsigned Size); + VOID (*DiskGetBootDevice)(PULONG BootDevice); + BOOL (*DiskBootingFromFloppy)(VOID); BOOL (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOL (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOL (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry); @@ -66,7 +71,7 @@ typedef struct tagMACHVTBL VOID (*HwDetect)(VOID); } MACHVTBL, *PMACHVTBL; -VOID MachInit(VOID); +VOID MachInit(char *CmdLine); extern MACHVTBL MachVtbl; @@ -87,6 +92,11 @@ extern MACHVTBL MachVtbl; #define MachVideoSync() MachVtbl.VideoSync() #define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS() #define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size)) +#define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType)) +#define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType)) +#define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size)) +#define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice) +#define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy() #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf)) #define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry)) #define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom)) diff --git a/reactos/boot/freeldr/freeldr/include/miscboot.h b/reactos/boot/freeldr/freeldr/include/miscboot.h index bbd4110a85a..51eb9ed3562 100644 --- a/reactos/boot/freeldr/freeldr/include/miscboot.h +++ b/reactos/boot/freeldr/freeldr/include/miscboot.h @@ -20,8 +20,8 @@ #ifndef __BOOT_H #define __BOOT_H -VOID LoadAndBootBootSector(PUCHAR OperatingSystemName); -VOID LoadAndBootPartition(PUCHAR OperatingSystemName); -VOID LoadAndBootDrive(PUCHAR OperatingSystemName); +VOID LoadAndBootBootSector(PCHAR OperatingSystemName); +VOID LoadAndBootPartition(PCHAR OperatingSystemName); +VOID LoadAndBootDrive(PCHAR OperatingSystemName); #endif // defined __BOOT_H diff --git a/reactos/boot/freeldr/freeldr/include/multiboot.h b/reactos/boot/freeldr/freeldr/include/multiboot.h index 0e50e08f4d2..30af11d1a21 100644 --- a/reactos/boot/freeldr/freeldr/include/multiboot.h +++ b/reactos/boot/freeldr/freeldr/include/multiboot.h @@ -210,7 +210,7 @@ FASTCALL FrLdrSetupPageDirectory(VOID); VOID -LoadAndBootReactOS(PUCHAR OperatingSystemName); +LoadAndBootReactOS(PCHAR OperatingSystemName); VOID FASTCALL AsmCode(VOID); typedef VOID (FASTCALL *ASMCODE)(ULONG Magic, diff --git a/reactos/boot/freeldr/freeldr/include/oslist.h b/reactos/boot/freeldr/freeldr/include/oslist.h index 3376df9e74d..ea67c672e13 100644 --- a/reactos/boot/freeldr/freeldr/include/oslist.h +++ b/reactos/boot/freeldr/freeldr/include/oslist.h @@ -20,9 +20,9 @@ #ifndef __OSLIST_H #define __OSLIST_H -BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer); +BOOL InitOperatingSystemList(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer); ULONG CountOperatingSystems(ULONG SectionId); -BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG OperatingSystemCount); -BOOL RemoveQuotes(PUCHAR QuotedString); +BOOL AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG OperatingSystemCount); +BOOL RemoveQuotes(PCHAR QuotedString); #endif // #defined __OSLIST_H diff --git a/reactos/boot/freeldr/freeldr/include/reactos.h b/reactos/boot/freeldr/freeldr/include/reactos.h index c553754b2e6..b64c8236f3f 100644 --- a/reactos/boot/freeldr/freeldr/include/reactos.h +++ b/reactos/boot/freeldr/freeldr/include/reactos.h @@ -26,7 +26,7 @@ // ReactOS Loading Functions // /////////////////////////////////////////////////////////////////////////////////////// -VOID LoadAndBootReactOS(PUCHAR OperatingSystemName); +VOID LoadAndBootReactOS(PCHAR OperatingSystemName); /////////////////////////////////////////////////////////////////////////////////////// // @@ -40,9 +40,9 @@ VOID ReactOSRunSetupLoader(VOID); // ARC Path Functions // /////////////////////////////////////////////////////////////////////////////////////// -BOOL DissectArcPath(LPSTR ArcPath, LPSTR BootPath, PULONG BootDrive, PULONG BootPartition); -VOID ConstructArcPath(PUCHAR ArcPath, PUCHAR SystemFolder, ULONG Disk, ULONG Partition); -ULONG ConvertArcNameToBiosDriveNumber(PUCHAR ArcPath); +BOOL DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition); +VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition); +ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); #endif // defined __REACTOS_H diff --git a/reactos/boot/freeldr/freeldr/include/ui.h b/reactos/boot/freeldr/freeldr/include/ui.h index 997b1e6e824..fcae9571faa 100644 --- a/reactos/boot/freeldr/freeldr/include/ui.h +++ b/reactos/boot/freeldr/freeldr/include/ui.h @@ -41,13 +41,13 @@ extern UCHAR UiSelectedTextBgColor; // Selected text background color extern UCHAR UiEditBoxTextColor; // Edit box text color extern UCHAR UiEditBoxBgColor; // Edit box text background color -extern UCHAR UiTitleBoxTitleText[260]; // Title box's title text +extern CHAR UiTitleBoxTitleText[260]; // Title box's title text extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed extern BOOL UiUseSpecialEffects; // Tells us if we should use fade effects -extern UCHAR UiMonthNames[12][15]; +extern CHAR UiMonthNames[12][15]; /////////////////////////////////////////////////////////////////////////////////////// // @@ -55,28 +55,28 @@ extern UCHAR UiMonthNames[12][15]; // /////////////////////////////////////////////////////////////////////////////////////// BOOL UiInitialize(BOOLEAN ShowGui); // Initialize User-Interface -VOID UiUnInitialize(PUCHAR BootText); // Un-initialize User-Interface +VOID UiUnInitialize(PCHAR BootText); // Un-initialize User-Interface VOID UiDrawBackdrop(VOID); // Fills the entire screen with a backdrop -VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr +VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr VOID UiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified -VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified -VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges -VOID UiDrawStatusText(PUCHAR StatusText); // Draws text at the very bottom line on the screen +VOID UiDrawText(ULONG X, ULONG Y, PCHAR Text, UCHAR Attr); // Draws text at coordinates specified +VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges +VOID UiDrawStatusText(PCHAR StatusText); // Draws text at the very bottom line on the screen VOID UiUpdateDateTime(VOID); // Updates the date and time -VOID UiInfoBox(PUCHAR MessageText); // Displays a info box on the screen -VOID UiMessageBox(PUCHAR MessageText); // Displays a message box on the screen with an ok button -VOID UiMessageBoxCritical(PUCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources -VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText); // Draws the progress bar showing nPos percent filled -VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PUCHAR ProgressText); // Draws the progress bar showing nPos percent filled -VOID UiShowMessageBoxesInSection(PUCHAR SectionName); // Displays all the message boxes in a given section -VOID UiEscapeString(PUCHAR String); // Processes a string and changes all occurances of "\n" to '\n' -BOOL UiEditBox(PUCHAR MessageText, PUCHAR EditTextBuffer, ULONG Length); +VOID UiInfoBox(PCHAR MessageText); // Displays a info box on the screen +VOID UiMessageBox(PCHAR MessageText); // Displays a message box on the screen with an ok button +VOID UiMessageBoxCritical(PCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources +VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled +VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled +VOID UiShowMessageBoxesInSection(PCHAR SectionName); // Displays all the message boxes in a given section +VOID UiEscapeString(PCHAR String); // Processes a string and changes all occurances of "\n" to '\n' +BOOL UiEditBox(PCHAR MessageText, PCHAR EditTextBuffer, ULONG Length); -UCHAR UiTextToColor(PUCHAR ColorText); // Converts the text color into it's equivalent color value -UCHAR UiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill into it's equivalent fill value +UCHAR UiTextToColor(PCHAR ColorText); // Converts the text color into it's equivalent color value +UCHAR UiTextToFillStyle(PCHAR FillStyleText); // Converts the text fill into it's equivalent fill value -VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars); // Truncates a string to MaxChars by adding an ellipsis on the end '...' +VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars); // Truncates a string to MaxChars by adding an ellipsis on the end '...' VOID UiFadeInBackdrop(VOID); // Draws the backdrop and fades the screen in VOID UiFadeOut(VOID); // Fades the screen out @@ -88,7 +88,7 @@ VOID UiFadeOut(VOID); // Fades the screen out /////////////////////////////////////////////////////////////////////////////////////// typedef BOOL (*UiMenuKeyPressFilterCallback)(ULONG KeyPress); -BOOL UiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +BOOL UiDisplayMenu(PCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); diff --git a/reactos/boot/freeldr/freeldr/include/version.h b/reactos/boot/freeldr/freeldr/include/version.h index b51df4ada21..7f7873321b9 100644 --- a/reactos/boot/freeldr/freeldr/include/version.h +++ b/reactos/boot/freeldr/freeldr/include/version.h @@ -41,7 +41,7 @@ #ifndef ASM -PUCHAR GetFreeLoaderVersionString(VOID); +PCHAR GetFreeLoaderVersionString(VOID); #endif // ASM diff --git a/reactos/boot/freeldr/freeldr/inifile/ini.h b/reactos/boot/freeldr/freeldr/inifile/ini.h index 98a74967d33..c80930a337a 100644 --- a/reactos/boot/freeldr/freeldr/inifile/ini.h +++ b/reactos/boot/freeldr/freeldr/inifile/ini.h @@ -34,8 +34,8 @@ typedef struct { LIST_ITEM ListEntry; - PUCHAR ItemName; - PUCHAR ItemValue; + PCHAR ItemName; + PCHAR ItemValue; } INI_SECTION_ITEM, *PINI_SECTION_ITEM; @@ -47,7 +47,7 @@ typedef struct typedef struct { LIST_ITEM ListEntry; - PUCHAR SectionName; + PCHAR SectionName; ULONG SectionItemCount; PINI_SECTION_ITEM SectionItemList; @@ -57,20 +57,20 @@ extern PINI_SECTION IniFileSectionListHead; extern ULONG IniFileSectionCount; extern ULONG IniFileSettingCount; -PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber); +PFILE IniOpenIniFile(); -BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize); -ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset); -ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset); -BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength); -BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength); -BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength); -ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength); -VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG LineLength); -BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength); -ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength); -ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength); -VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG LineLength); -VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, ULONG LineLength); +BOOL IniParseFile(PCHAR IniFileData, ULONG IniFileSize); +ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset); +ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset); +BOOL IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength); +BOOL IniIsCommentLine(PCHAR LineOfText, ULONG TextLength); +BOOL IniIsSectionName(PCHAR LineOfText, ULONG TextLength); +ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength); +VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength); +BOOL IniIsSetting(PCHAR LineOfText, ULONG TextLength); +ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength); +ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength); +VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength); +VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength); #endif // defined __INI_H diff --git a/reactos/boot/freeldr/freeldr/inifile/ini_init.c b/reactos/boot/freeldr/freeldr/inifile/ini_init.c index 046133e4c1b..84ba9edf3bd 100644 --- a/reactos/boot/freeldr/freeldr/inifile/ini_init.c +++ b/reactos/boot/freeldr/freeldr/inifile/ini_init.c @@ -28,27 +28,12 @@ BOOL IniFileInitialize(VOID) { PFILE Freeldr_Ini; // File handle for freeldr.ini - PUCHAR FreeLoaderIniFileData; + PCHAR FreeLoaderIniFileData; ULONG FreeLoaderIniFileSize; BOOL Success; // Open freeldr.ini - // BootDrive & BootPartition are passed - // in from the boot sector code in the - // DL & DH registers. - Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition); - - // If we couldn't open freeldr.ini on the partition - // they specified in the boot sector then try - // opening the active (boot) partition. - if ((Freeldr_Ini == NULL) && (BootPartition != 0)) - { - BootPartition = 0; - - Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition); - - return FALSE; - } + Freeldr_Ini = IniOpenIniFile(); if (Freeldr_Ini == NULL) { @@ -87,24 +72,10 @@ BOOL IniFileInitialize(VOID) return Success; } -PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber) +PFILE IniOpenIniFile() { PFILE IniFileHandle; // File handle for freeldr.ini - if (!FsOpenVolume(BootDriveNumber, BootPartitionNumber)) - { - if (BootPartitionNumber == 0) - { - printf("Error opening active (bootable) partition on boot drive 0x%x for file access.\n", BootDriveNumber); - } - else - { - printf("Error opening partition %d on boot drive 0x%x for file access.\n", BootPartitionNumber, BootDriveNumber); - } - - return NULL; - } - // Try to open freeldr.ini IniFileHandle = FsOpenFile("freeldr.ini"); diff --git a/reactos/boot/freeldr/freeldr/inifile/inifile.c b/reactos/boot/freeldr/freeldr/inifile/inifile.c index 9f8c19b8e5b..feb05bcd9ea 100644 --- a/reactos/boot/freeldr/freeldr/inifile/inifile.c +++ b/reactos/boot/freeldr/freeldr/inifile/inifile.c @@ -24,7 +24,7 @@ #include #include -BOOL IniOpenSection(PUCHAR SectionName, ULONG* SectionId) +BOOL IniOpenSection(PCHAR SectionName, ULONG* SectionId) { PINI_SECTION Section; @@ -81,7 +81,7 @@ ULONG IniGetSectionSettingValueSize(ULONG SectionId, ULONG SettingIndex) return (strlen(Section->SectionItemList[SettingIndex].ItemValue) + 1); } -BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR SettingName, ULONG NameSize, PUCHAR SettingValue, ULONG ValueSize) +BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize) { PINI_SECTION Section = (PINI_SECTION)SectionId; PINI_SECTION_ITEM SectionItem; @@ -131,7 +131,7 @@ BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR Setting return FALSE; } -BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, ULONG BufferSize) +BOOL IniReadSettingByName(ULONG SectionId, PCHAR SettingName, PCHAR Buffer, ULONG BufferSize) { PINI_SECTION Section = (PINI_SECTION)SectionId; PINI_SECTION_ITEM SectionItem; @@ -163,7 +163,7 @@ BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, UL return FALSE; } -BOOL IniAddSection(PUCHAR SectionName, ULONG* SectionId) +BOOL IniAddSection(PCHAR SectionName, ULONG* SectionId) { PINI_SECTION Section; @@ -203,7 +203,7 @@ BOOL IniAddSection(PUCHAR SectionName, ULONG* SectionId) return TRUE; } -BOOL IniAddSettingValueToSection(ULONG SectionId, PUCHAR SettingName, PUCHAR SettingValue) +BOOL IniAddSettingValueToSection(ULONG SectionId, PCHAR SettingName, PCHAR SettingValue) { PINI_SECTION Section = (PINI_SECTION)SectionId; PINI_SECTION_ITEM SectionItem; diff --git a/reactos/boot/freeldr/freeldr/inifile/parse.c b/reactos/boot/freeldr/freeldr/inifile/parse.c index 87f6bbd1035..48ce81c7a53 100644 --- a/reactos/boot/freeldr/freeldr/inifile/parse.c +++ b/reactos/boot/freeldr/freeldr/inifile/parse.c @@ -30,11 +30,11 @@ ULONG IniFileSectionCount = 0; ULONG IniFileSettingCount = 0; -BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize) +BOOL IniParseFile(PCHAR IniFileData, ULONG IniFileSize) { ULONG CurrentOffset; ULONG CurrentLineNumber; - PUCHAR IniFileLine; + PCHAR IniFileLine; ULONG IniFileLineSize; ULONG LineLength; PINI_SECTION CurrentSection = NULL; @@ -189,7 +189,7 @@ BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize) return TRUE; } -ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset) +ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset) { ULONG Idx; ULONG LineCharCount = 0; @@ -216,7 +216,7 @@ ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOff return LineCharCount; } -ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset) +ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset) { ULONG Idx; @@ -252,7 +252,7 @@ ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG return CurrentOffset; } -BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength) +BOOL IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength) { ULONG Idx; @@ -275,7 +275,7 @@ BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength) return TRUE; } -BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength) +BOOL IniIsCommentLine(PCHAR LineOfText, ULONG TextLength) { ULONG Idx; @@ -301,7 +301,7 @@ BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength) return FALSE; } -BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength) +BOOL IniIsSectionName(PCHAR LineOfText, ULONG TextLength) { ULONG Idx; @@ -327,7 +327,7 @@ BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength) return FALSE; } -ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength) +ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength) { ULONG Idx; ULONG NameSize; @@ -368,7 +368,7 @@ ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength) return NameSize; } -VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG LineLength) +VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength) { ULONG Idx; ULONG DestIdx; @@ -408,7 +408,7 @@ VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG Lin SectionName[DestIdx] = '\0'; } -BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength) +BOOL IniIsSetting(PCHAR LineOfText, ULONG TextLength) { ULONG Idx; @@ -424,7 +424,7 @@ BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength) return FALSE; } -ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength) +ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength) { ULONG Idx; ULONG NameSize; @@ -462,7 +462,7 @@ ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength) return NameSize; } -ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength) +ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength) { ULONG Idx; ULONG ValueSize; @@ -515,7 +515,7 @@ ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength) return ValueSize; } -VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG LineLength) +VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength) { ULONG Idx; ULONG DestIdx; @@ -552,7 +552,7 @@ VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG Lin SettingName[DestIdx] = '\0'; } -VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, ULONG LineLength) +VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength) { ULONG Idx; ULONG DestIdx; diff --git a/reactos/boot/freeldr/freeldr/linuxboot.c b/reactos/boot/freeldr/freeldr/linuxboot.c index fa1df78f337..1f1ab1b2961 100644 --- a/reactos/boot/freeldr/freeldr/linuxboot.c +++ b/reactos/boot/freeldr/freeldr/linuxboot.c @@ -40,24 +40,25 @@ PLINUX_BOOTSECTOR LinuxBootSector = NULL; PLINUX_SETUPSECTOR LinuxSetupSector = NULL; -ULONG SetupSectorSize = 0; -BOOL NewStyleLinuxKernel = FALSE; -ULONG LinuxKernelSize = 0; -ULONG LinuxInitrdSize = 0; -UCHAR LinuxKernelName[260]; -UCHAR LinuxInitrdName[260]; -BOOL LinuxHasInitrd = FALSE; -UCHAR LinuxCommandLine[260] = ""; -ULONG LinuxCommandLineSize = 0; -PVOID LinuxKernelLoadAddress = NULL; -PVOID LinuxInitrdLoadAddress = NULL; -UCHAR LinuxBootDescription[80]; +ULONG SetupSectorSize = 0; +BOOL NewStyleLinuxKernel = FALSE; +ULONG LinuxKernelSize = 0; +ULONG LinuxInitrdSize = 0; +CHAR LinuxKernelName[260]; +CHAR LinuxInitrdName[260]; +BOOL LinuxHasInitrd = FALSE; +CHAR LinuxCommandLine[260] = ""; +ULONG LinuxCommandLineSize = 0; +PVOID LinuxKernelLoadAddress = NULL; +PVOID LinuxInitrdLoadAddress = NULL; +CHAR LinuxBootDescription[80]; +CHAR LinuxBootPath[260] = ""; -VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description) +VOID LoadAndBootLinux(PCHAR OperatingSystemName, PCHAR Description) { PFILE LinuxKernel = NULL; PFILE LinuxInitrdFile = NULL; - UCHAR TempString[260]; + CHAR TempString[260]; UiDrawBackdrop(); @@ -80,7 +81,7 @@ VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description) } // Open the boot volume - if (!FsOpenVolume(BootDrive, BootPartition)) + if (!FsOpenSystemVolume(LinuxBootPath, NULL, NULL)) { UiMessageBox("Failed to open boot drive."); goto LinuxBootFailed; @@ -223,11 +224,10 @@ LinuxBootFailed: LinuxCommandLineSize = 0; } -BOOL LinuxParseIniSection(PUCHAR OperatingSystemName) +BOOL LinuxParseIniSection(PCHAR OperatingSystemName) { - UCHAR SettingName[260]; - UCHAR SettingValue[260]; - ULONG SectionId; + CHAR SettingName[260]; + ULONG SectionId; // Find all the message box settings and run them UiShowMessageBoxesInSection(OperatingSystemName); @@ -240,20 +240,12 @@ BOOL LinuxParseIniSection(PUCHAR OperatingSystemName) return FALSE; } - if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 260)) + if (!IniReadSettingByName(SectionId, "BootPath", LinuxBootPath, 260)) { - UiMessageBox("Boot drive not specified for selected OS!"); + UiMessageBox("Boot path not specified for selected OS!"); return FALSE; } - BootDrive = DriveMapGetBiosDriveNumber(SettingValue); - - BootPartition = 0; - if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 260)) - { - BootPartition = atoi(SettingValue); - } - // Get the kernel name if (!IniReadSettingByName(SectionId, "Kernel", LinuxKernelName, 260)) { @@ -383,7 +375,7 @@ BOOL LinuxReadSetupSector(PFILE LinuxKernelFile) BOOL LinuxReadKernel(PFILE LinuxKernelFile) { ULONG BytesLoaded; - UCHAR StatusText[260]; + CHAR StatusText[260]; PVOID LoadAddress; sprintf(StatusText, "Loading %s", LinuxKernelName); @@ -456,7 +448,7 @@ BOOL LinuxCheckKernelVersion(VOID) BOOL LinuxReadInitrd(PFILE LinuxInitrdFile) { ULONG BytesLoaded; - UCHAR StatusText[260]; + CHAR StatusText[260]; sprintf(StatusText, "Loading %s", LinuxInitrdName); UiDrawStatusText(StatusText); diff --git a/reactos/boot/freeldr/freeldr/machine.c b/reactos/boot/freeldr/freeldr/machine.c index 520769e3b06..99146d6c249 100644 --- a/reactos/boot/freeldr/freeldr/machine.c +++ b/reactos/boot/freeldr/freeldr/machine.c @@ -37,6 +37,11 @@ #undef MachVideoSync #undef MachVideoPrepareForReactOS #undef MachGetMemoryMap +#undef MachDiskGetBootVolume +#undef MachDiskGetSystemVolume +#undef MachDiskGetBootPath +#undef MachDiskGetBootDevice +#undef MachDiskBootingFromFloppy #undef MachDiskReadLogicalSectors #undef MachDiskGetPartitionEntry #undef MachDiskGetDriveGeometry @@ -148,6 +153,44 @@ MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize) return MachVtbl.GetMemoryMap(BiosMemoryMap, MaxMemoryMapSize); } +BOOL +MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType) +{ + return MachVtbl.DiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType); +} + +BOOL +MachDiskGetSystemVolume(char *SystemPath, + char *RemainingPath, + PULONG Device, + PULONG DriveNumber, + PULONGLONG StartSector, + PULONGLONG SectorCount, + int *FsType) +{ + return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device, + DriveNumber, StartSector, SectorCount, + FsType); +} + +BOOL +MachDiskGetBootPath(char *BootPath, unsigned Size) +{ + return MachVtbl.DiskGetBootPath(BootPath, Size); +} + +VOID +MachDiskGetBootDevice(PULONG BootDevice) +{ + MachVtbl.DiskGetBootDevice(BootDevice); +} + +BOOL +MachDiskBootingFromFloppy() +{ + return MachVtbl.DiskBootingFromFloppy(); +} + BOOL MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { diff --git a/reactos/boot/freeldr/freeldr/miscboot.c b/reactos/boot/freeldr/freeldr/miscboot.c index 3531fe254f0..0df75e3996d 100644 --- a/reactos/boot/freeldr/freeldr/miscboot.c +++ b/reactos/boot/freeldr/freeldr/miscboot.c @@ -29,14 +29,13 @@ #include #include -VOID LoadAndBootBootSector(PUCHAR OperatingSystemName) +VOID LoadAndBootBootSector(PCHAR OperatingSystemName) { PFILE FilePointer; - UCHAR SettingName[80]; - UCHAR SettingValue[80]; - ULONG SectionId; - UCHAR FileName[260]; - ULONG BytesRead; + CHAR SettingName[80]; + ULONG SectionId; + CHAR FileName[260]; + ULONG BytesRead; // Find all the message box settings and run them UiShowMessageBoxesInSection(OperatingSystemName); @@ -49,27 +48,13 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName) return; } - if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 80)) - { - UiMessageBox("Boot drive not specified for selected OS!"); - return; - } - - BootDrive = DriveMapGetBiosDriveNumber(SettingValue); - - BootPartition = 0; - if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80)) - { - BootPartition = atoi(SettingValue); - } - if (!IniReadSettingByName(SectionId, "BootSectorFile", FileName, 260)) { UiMessageBox("Boot sector file not specified for selected OS!"); return; } - if (!FsOpenVolume(BootDrive, BootPartition)) + if (!FsOpenSystemVolume(FileName, FileName, NULL)) { UiMessageBox("Failed to open boot drive."); return; @@ -109,12 +94,14 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName) ChainLoadBiosBootSectorCode(); } -VOID LoadAndBootPartition(PUCHAR OperatingSystemName) +VOID LoadAndBootPartition(PCHAR OperatingSystemName) { - UCHAR SettingName[80]; - UCHAR SettingValue[80]; - ULONG SectionId; + CHAR SettingName[80]; + CHAR SettingValue[80]; + ULONG SectionId; PARTITION_TABLE_ENTRY PartitionTableEntry; + ULONG DriveNumber; + ULONG PartitionNumber; // Find all the message box settings and run them UiShowMessageBoxesInSection(OperatingSystemName); @@ -134,7 +121,7 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName) return; } - BootDrive = DriveMapGetBiosDriveNumber(SettingValue); + DriveNumber = DriveMapGetBiosDriveNumber(SettingValue); // Read the boot partition if (!IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80)) @@ -143,17 +130,17 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName) return; } - BootPartition = atoi(SettingValue); + PartitionNumber = atoi(SettingValue); // Get the partition table entry - if (!DiskGetPartitionEntry(BootDrive, BootPartition, &PartitionTableEntry)) + if (!DiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry)) { return; } // Now try to read the partition boot sector // If this fails then abort - if (!MachDiskReadLogicalSectors(BootDrive, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00)) + if (!MachDiskReadLogicalSectors(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00)) { return; } @@ -178,11 +165,12 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName) ChainLoadBiosBootSectorCode(); } -VOID LoadAndBootDrive(PUCHAR OperatingSystemName) +VOID LoadAndBootDrive(PCHAR OperatingSystemName) { - UCHAR SettingName[80]; - UCHAR SettingValue[80]; - ULONG SectionId; + CHAR SettingName[80]; + CHAR SettingValue[80]; + ULONG SectionId; + ULONG DriveNumber; // Find all the message box settings and run them UiShowMessageBoxesInSection(OperatingSystemName); @@ -201,11 +189,11 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName) return; } - BootDrive = DriveMapGetBiosDriveNumber(SettingValue); + DriveNumber = DriveMapGetBiosDriveNumber(SettingValue); // Now try to read the boot sector (or mbr) // If this fails then abort - if (!MachDiskReadLogicalSectors(BootDrive, 0, 1, (PVOID)0x7C00)) + if (!MachDiskReadLogicalSectors(DriveNumber, 0, 1, (PVOID)0x7C00)) { return; } diff --git a/reactos/boot/freeldr/freeldr/options.c b/reactos/boot/freeldr/freeldr/options.c index 4260283905f..70051ed6838 100644 --- a/reactos/boot/freeldr/freeldr/options.c +++ b/reactos/boot/freeldr/freeldr/options.c @@ -27,7 +27,7 @@ #include -PUCHAR OptionsMenuList[] = +PCHAR OptionsMenuList[] = { "Safe Mode", "Safe Mode with Networking", diff --git a/reactos/boot/freeldr/freeldr/oslist.c b/reactos/boot/freeldr/freeldr/oslist.c index 4dbe7ed13f8..6454b09b90d 100644 --- a/reactos/boot/freeldr/freeldr/oslist.c +++ b/reactos/boot/freeldr/freeldr/oslist.c @@ -24,18 +24,18 @@ #include #include -BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer) +BOOL InitOperatingSystemList(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer) { ULONG Idx; ULONG CurrentOperatingSystemIndex; - UCHAR SettingName[260]; - UCHAR SettingValue[260]; + CHAR SettingName[260]; + CHAR SettingValue[260]; ULONG OperatingSystemCount; ULONG SectionId; ULONG OperatingSystemSectionId; ULONG SectionSettingCount; - PUCHAR *OperatingSystemSectionNames; - PUCHAR *OperatingSystemDisplayNames; + PCHAR *OperatingSystemSectionNames; + PCHAR *OperatingSystemDisplayNames; // // Open the [FreeLoader] section @@ -88,8 +88,8 @@ BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNames ULONG CountOperatingSystems(ULONG SectionId) { ULONG Idx; - UCHAR SettingName[260]; - UCHAR SettingValue[260]; + CHAR SettingName[260]; + CHAR SettingValue[260]; ULONG OperatingSystemCount = 0; ULONG SectionSettingCount; @@ -115,17 +115,17 @@ ULONG CountOperatingSystems(ULONG SectionId) return OperatingSystemCount; } -BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG OperatingSystemCount) +BOOL AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG OperatingSystemCount) { ULONG Idx; - PUCHAR *OperatingSystemSectionNames = NULL; - PUCHAR *OperatingSystemDisplayNames = NULL; + PCHAR *OperatingSystemSectionNames = NULL; + PCHAR *OperatingSystemDisplayNames = NULL; // // Allocate memory to hold operating system list arrays // - OperatingSystemSectionNames = (PUCHAR*) MmAllocateMemory( sizeof(PUCHAR) * OperatingSystemCount); - OperatingSystemDisplayNames = (PUCHAR*) MmAllocateMemory( sizeof(PUCHAR) * OperatingSystemCount); + OperatingSystemSectionNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount); + OperatingSystemDisplayNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount); // // If either allocation failed then return FALSE @@ -148,16 +148,16 @@ BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPoint // // Clear our newly allocated memory // - memset(OperatingSystemSectionNames, 0, sizeof(PUCHAR) * OperatingSystemCount); - memset(OperatingSystemDisplayNames, 0, sizeof(PUCHAR) * OperatingSystemCount); + memset(OperatingSystemSectionNames, 0, sizeof(PCHAR) * OperatingSystemCount); + memset(OperatingSystemDisplayNames, 0, sizeof(PCHAR) * OperatingSystemCount); // // Loop through each array element and allocate it's string memory // for (Idx=0; Idx -BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* BootPartition) +BOOL DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition) { char *p; @@ -43,7 +43,21 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* Boot if (p == NULL) return FALSE; p++; - *BootPartition = 0; + *BootPartition = 0xff; + } + else if (strnicmp(p, "cdrom(", 6) == 0) + { + /* + * cdrom path: + * multi(0)disk(0)cdrom(x)\path + */ + p = p + 6; + *BootDrive = atoi(p); + p = strchr(p, ')'); + if (p == NULL) + return FALSE; + p++; + *BootPartition = 0xff; } else if (strnicmp(p, "rdisk(", 6) == 0) { @@ -73,7 +87,7 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* Boot return TRUE; } -void ConstructArcPath(PUCHAR ArcPath, PUCHAR SystemFolder, ULONG Disk, ULONG Partition) +VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition) { char tmp[50]; @@ -109,7 +123,7 @@ void ConstructArcPath(PUCHAR ArcPath, PUCHAR SystemFolder, ULONG Disk, ULONG Par } } -ULONG ConvertArcNameToBiosDriveNumber(PUCHAR ArcPath) +ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) { char * p; ULONG DriveNumber = 0; diff --git a/reactos/boot/freeldr/freeldr/reactos/binhive.c b/reactos/boot/freeldr/freeldr/reactos/binhive.c index 8a94e812a8e..e34ff86fab2 100644 --- a/reactos/boot/freeldr/freeldr/reactos/binhive.c +++ b/reactos/boot/freeldr/freeldr/reactos/binhive.c @@ -178,7 +178,7 @@ typedef struct _KEY_CELL USHORT ClassSize; /* Name of key (not zero terminated) */ - UCHAR Name[0]; + CHAR Name[0]; } __attribute__((packed)) KEY_CELL, *PKEY_CELL; @@ -223,7 +223,7 @@ typedef struct _VALUE_CELL ULONG DataType; USHORT Flags; USHORT Unused1; - UCHAR Name[0]; /* warning : not zero terminated */ + CHAR Name[0]; /* warning : not zero terminated */ } __attribute__((packed)) VALUE_CELL, *PVALUE_CELL; /* VALUE_CELL.Flags constants */ @@ -237,7 +237,7 @@ typedef struct _VALUE_CELL typedef struct _DATA_CELL { LONG CellSize; - UCHAR Data[0]; + CHAR Data[0]; } __attribute__((packed)) DATA_CELL, *PDATA_CELL; @@ -1018,7 +1018,7 @@ CmiExportValue (PREGISTRY_HIVE Hive, ULONG SrcDataSize; ULONG DstDataSize; ULONG DataType; - PUCHAR Data; + PCHAR Data; BOOL Expand = FALSE; DbgPrint((DPRINT_REGISTRY, "CmiExportValue('%s') called\n", @@ -1398,7 +1398,7 @@ RegImportValue (PHBIN RootBin, Error = RegSetValue(Key, cName, ValueCell->DataType, - (PUCHAR)&ValueCell->DataOffset, + (PCHAR)&ValueCell->DataOffset, DataSize); if (Error != ERROR_SUCCESS) { @@ -1441,7 +1441,7 @@ RegImportValue (PHBIN RootBin, Error = RegSetValue (Key, cName, ValueCell->DataType, - (PUCHAR)DataCell->Data, + DataCell->Data, DataSize); } if (Error != ERROR_SUCCESS) diff --git a/reactos/boot/freeldr/freeldr/reactos/reactos.c b/reactos/boot/freeldr/freeldr/reactos/reactos.c index 9cafa6a17da..813eea93465 100644 --- a/reactos/boot/freeldr/freeldr/reactos/reactos.c +++ b/reactos/boot/freeldr/freeldr/reactos/reactos.c @@ -15,16 +15,6 @@ #define NDEBUG #include -#define IsRecognizedPartition(P) \ - ((P) == PARTITION_FAT_12 || \ - (P) == PARTITION_FAT_16 || \ - (P) == PARTITION_HUGE || \ - (P) == PARTITION_IFS || \ - (P) == PARTITION_EXT2 || \ - (P) == PARTITION_FAT32 || \ - (P) == PARTITION_FAT32_XINT13 || \ - (P) == PARTITION_XINT13) - BOOL STDCALL FrLdrLoadKernel(PCHAR szFileName, @@ -353,11 +343,11 @@ FrLdrLoadBootDrivers(PCHAR szSystemRoot, ULONG ValueType; ULONG StartValue; ULONG TagValue; - UCHAR DriverGroup[256]; + CHAR DriverGroup[256]; ULONG DriverGroupSize; - UCHAR ImagePath[256]; - UCHAR TempImagePath[256]; + CHAR ImagePath[256]; + CHAR TempImagePath[256]; /* get 'service group order' key */ rc = RegOpenKey(NULL, @@ -559,11 +549,12 @@ FrLdrLoadBootDrivers(PCHAR szSystemRoot, } VOID -LoadAndBootReactOS(PUCHAR OperatingSystemName) +LoadAndBootReactOS(PCHAR OperatingSystemName) { PFILE FilePointer; CHAR name[1024]; CHAR value[1024]; + CHAR SystemPath[1024]; CHAR szKernelName[1024]; CHAR szHalName[1024]; CHAR szFileName[1024]; @@ -574,9 +565,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName) ULONG_PTR Base; ULONG Size; - - PARTITION_TABLE_ENTRY PartitionTableEntry; - ULONG rosPartition; extern ULONG PageDirectoryStart; extern ULONG PageDirectoryEnd; @@ -645,7 +633,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName) /* * Make sure the system path is set in the .ini file */ - if (!IniReadSettingByName(SectionId, "SystemPath", value, 1024)) + if (!IniReadSettingByName(SectionId, "SystemPath", SystemPath, sizeof(SystemPath))) { UiMessageBox("System path not specified for selected operating system."); return; @@ -654,62 +642,20 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName) /* * Special case for Live CD. */ - if (!stricmp(value, "LiveCD")) + if (!stricmp(SystemPath, "LiveCD")) { - strcpy(szBootPath, "\\reactos"); - - /* Set kernel command line */ - sprintf(multiboot_kernel_cmdline, - "multi(0)disk(0)cdrom(%u)\\reactos /MININT", - (unsigned int)BootDrive); + /* Normalize */ + MachDiskGetBootPath(SystemPath, sizeof(SystemPath)); + strcat(SystemPath, "\\reactos"); + strcat(strcpy(multiboot_kernel_cmdline, SystemPath), + " /MININT"); } else { - /* - * Verify system path - */ - if (!DissectArcPath(value, szBootPath, &BootDrive, &BootPartition)) - { - sprintf(MsgBuffer,"Invalid system path: '%s'", value); - UiMessageBox(MsgBuffer); - return; - } - - /* recalculate the boot partition for freeldr */ - i = 0; - rosPartition = 0; - while (1) - { - if (!MachDiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry)) - { - BootPartition = 0; - break; - } - if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator)) - { - if (++rosPartition == BootPartition) - { - BootPartition = i; - break; - } - } - } - - if (BootPartition == 0) - { - sprintf(MsgBuffer,"Invalid system path: '%s'", value); - UiMessageBox(MsgBuffer); - return; - } - - /* copy ARC path into kernel command line */ - strcpy(multiboot_kernel_cmdline, value); + /* copy system path into kernel command line */ + strcpy(multiboot_kernel_cmdline, SystemPath); } - /* Set boot drive and partition */ - ((LPSTR )(&LoaderBlock.BootDevice))[0] = (CHAR)BootDrive; - ((LPSTR )(&LoaderBlock.BootDevice))[1] = (CHAR)BootPartition; - /* * Read the optional kernel parameters (if any) */ @@ -719,13 +665,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName) strcat(multiboot_kernel_cmdline, value); } - /* append a backslash */ - if ((strlen(szBootPath)==0) || - szBootPath[strlen(szBootPath)] != '\\') - strcat(szBootPath, "\\"); - - DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath)); - UiDrawBackdrop(); UiDrawStatusText("Detecting Hardware..."); @@ -741,14 +680,21 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName) UiDrawProgressBarCenter(0, 100, "Loading ReactOS..."); /* - * Try to open boot drive + * Try to open system drive */ - if (!FsOpenVolume(BootDrive, BootPartition)) + if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice)) { UiMessageBox("Failed to open boot drive."); return; } + /* append a backslash */ + if ((strlen(szBootPath)==0) || + szBootPath[strlen(szBootPath)] != '\\') + strcat(szBootPath, "\\"); + + DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath)); + /* * Find the kernel image name * and try to load the kernel off the disk diff --git a/reactos/boot/freeldr/freeldr/reactos/registry.c b/reactos/boot/freeldr/freeldr/reactos/registry.c index ffc0f1a56a1..c9c19db7e8a 100644 --- a/reactos/boot/freeldr/freeldr/reactos/registry.c +++ b/reactos/boot/freeldr/freeldr/reactos/registry.c @@ -47,7 +47,7 @@ RegInitializeRegistry (VOID) RootKey->ValueCount = 0; RootKey->NameSize = 2; - RootKey->Name = (PUCHAR)MmAllocateMemory (2); + RootKey->Name = MmAllocateMemory (2); strcpy (RootKey->Name, "\\"); RootKey->DataType = 0; @@ -192,7 +192,7 @@ RegInitCurrentControlSet(BOOL LastKnownGood) Error = RegSetValue(LinkKey, NULL, REG_LINK, - (PUCHAR)&ControlSetKey, + (PCHAR)&ControlSetKey, sizeof(PVOID)); if (Error != ERROR_SUCCESS) { @@ -486,7 +486,7 @@ LONG RegSetValue(FRLDRHKEY Key, PCHAR ValueName, ULONG Type, - PUCHAR Data, + PCHAR Data, ULONG DataSize) { PLIST_ENTRY Ptr; @@ -511,7 +511,7 @@ RegSetValue(FRLDRHKEY Key, } else { - Key->Data = (PUCHAR)MmAllocateMemory(DataSize); + Key->Data = MmAllocateMemory(DataSize); Key->DataSize = DataSize; Key->DataType = Type; memcpy(Key->Data, Data, DataSize); @@ -571,7 +571,7 @@ RegSetValue(FRLDRHKEY Key, } else { - Value->Data = (PUCHAR)MmAllocateMemory(DataSize); + Value->Data = MmAllocateMemory(DataSize); if (Value->Data == NULL) return(ERROR_OUTOFMEMORY); Value->DataType = Type; diff --git a/reactos/boot/freeldr/freeldr/reactos/registry.h b/reactos/boot/freeldr/freeldr/reactos/registry.h index 6876301f78d..497d3f7412a 100644 --- a/reactos/boot/freeldr/freeldr/reactos/registry.h +++ b/reactos/boot/freeldr/freeldr/reactos/registry.h @@ -34,12 +34,12 @@ typedef struct _REG_KEY ULONG ValueCount; ULONG NameSize; - PUCHAR Name; + PCHAR Name; /* default data */ ULONG DataType; ULONG DataSize; - PUCHAR Data; + PCHAR Data; } KEY, *FRLDRHKEY, **PFRLDRHKEY; @@ -49,12 +49,12 @@ typedef struct _REG_VALUE /* value name */ ULONG NameSize; - PUCHAR Name; + PCHAR Name; /* value data */ ULONG DataType; ULONG DataSize; - PUCHAR Data; + PCHAR Data; } VALUE, *PVALUE; @@ -217,7 +217,7 @@ LONG RegSetValue(FRLDRHKEY Key, PCHAR ValueName, ULONG Type, - PUCHAR Data, + PCHAR Data, ULONG DataSize); LONG diff --git a/reactos/boot/freeldr/freeldr/reactos/setupldr.c b/reactos/boot/freeldr/freeldr/reactos/setupldr.c index bc2fe82e964..692e735631f 100644 --- a/reactos/boot/freeldr/freeldr/reactos/setupldr.c +++ b/reactos/boot/freeldr/freeldr/reactos/setupldr.c @@ -312,13 +312,11 @@ VOID RunLoader(VOID) UiDrawStatusText(""); #endif - /* set boot drive and partition */ - ((char *)(&LoaderBlock.BootDevice))[0] = (char)BootDrive; - ((char *)(&LoaderBlock.BootDevice))[1] = (char)BootPartition; - + /* set boot device */ + MachDiskGetBootDevice(&LoaderBlock.BootDevice); /* Open boot drive */ - if (!FsOpenVolume(BootDrive, BootPartition)) + if (!FsOpenBootVolume()) { #ifdef USE_UI UiMessageBox("Failed to open boot drive."); @@ -330,7 +328,7 @@ VOID RunLoader(VOID) /* Open 'txtsetup.sif' */ if (!InfOpenFile (&InfHandle, - (BootDrive < 0x80) ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif", + MachDiskBootingFromFloppy() ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif", &ErrorLine)) { printf("Failed to open 'txtsetup.sif'\n"); @@ -358,7 +356,7 @@ VOID RunLoader(VOID) printf("LoadOptions: '%s'\n", LoadOptions); #endif - if (BootDrive < 0x80) + if (MachDiskBootingFromFloppy()) { /* Boot from floppy disk */ SourcePath = "\\"; @@ -370,12 +368,9 @@ VOID RunLoader(VOID) } /* Set kernel command line */ - sprintf(multiboot_kernel_cmdline, - "multi(0)disk(0)%s(%u)%s %s", - (BootDrive < 0x80) ? "fdisk" : "cdrom", - (unsigned int)BootDrive, - SourcePath, - LoadOptions); + MachDiskGetBootPath(multiboot_kernel_cmdline, sizeof(multiboot_kernel_cmdline)); + strcat(strcat(strcat(multiboot_kernel_cmdline, SourcePath), " "), + LoadOptions); /* Load ntoskrnl.exe */ if (!LoadKernel(SourcePath, "ntoskrnl.exe")) @@ -400,7 +395,7 @@ for(;;); #endif /* Insert boot disk 2 */ - if (BootDrive < 0x80) + if (MachDiskBootingFromFloppy()) { #ifdef USE_UI UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER"); @@ -410,7 +405,7 @@ for(;;); #endif /* Open boot drive */ - if (!FsOpenVolume(BootDrive, BootPartition)) + if (!FsOpenBootVolume()) { #ifdef USE_UI UiMessageBox("Failed to open boot drive."); @@ -563,8 +558,14 @@ for(;;); /* Load keyboard driver */ +#if 0 if (!LoadDriver(SourcePath, "keyboard.sys")) return; +#endif + if (!LoadDriver(SourcePath, "i8042prt.sys")) + return; + if (!LoadDriver(SourcePath, "kbdclass.sys")) + return; /* Load screen driver */ if (!LoadDriver(SourcePath, "blue.sys")) diff --git a/reactos/boot/freeldr/freeldr/ui/tui.c b/reactos/boot/freeldr/freeldr/ui/tui.c index c88f6655ee4..a125ef79a4f 100644 --- a/reactos/boot/freeldr/freeldr/ui/tui.c +++ b/reactos/boot/freeldr/freeldr/ui/tui.c @@ -136,7 +136,7 @@ VOID TuiDrawBackdrop(VOID) * FillArea() * This function assumes coordinates are zero-based */ -VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */) +VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */) { PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer; ULONG i, j; @@ -162,7 +162,7 @@ VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillCha // Loop through each character (column) in the line and fill it in for (j=Left; j<=Right; j++) { - ScreenMemory[((i*2)*UiScreenWidth)+(j*2)] = FillChar; + ScreenMemory[((i*2)*UiScreenWidth)+(j*2)] = (UCHAR)FillChar; ScreenMemory[((i*2)*UiScreenWidth)+(j*2)+1] = Attr; } } @@ -304,7 +304,7 @@ VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyl * DrawText() * This function assumes coordinates are zero-based */ -VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr) +VOID TuiDrawText(ULONG X, ULONG Y, PCHAR Text, UCHAR Attr) { PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer; ULONG i, j; @@ -312,12 +312,12 @@ VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr) // Draw the text for (i=X, j=0; Text[j] && i -BOOL TuiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) +BOOL TuiDisplayMenu(PCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) { TUI_MENU_INFO MenuInformation; ULONG LastClockSecond; @@ -216,8 +216,8 @@ VOID TuiDrawMenu(PTUI_MENU_INFO MenuInfo) VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo) { - UCHAR MenuLineText[80]; - UCHAR TempString[80]; + CHAR MenuLineText[80]; + CHAR TempString[80]; ULONG Idx; // @@ -265,7 +265,7 @@ VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo) VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber) { ULONG Idx; - UCHAR MenuLineText[80]; + CHAR MenuLineText[80]; ULONG SpaceTotal; ULONG SpaceLeft; ULONG SpaceRight; diff --git a/reactos/boot/freeldr/freeldr/ui/ui.c b/reactos/boot/freeldr/freeldr/ui/ui.c index 0b11262e03d..5358ff5f9b2 100644 --- a/reactos/boot/freeldr/freeldr/ui/ui.c +++ b/reactos/boot/freeldr/freeldr/ui/ui.c @@ -48,7 +48,7 @@ UCHAR UiSelectedTextBgColor = COLOR_GRAY; // Selected text background color UCHAR UiEditBoxTextColor = COLOR_WHITE; // Edit box text color UCHAR UiEditBoxBgColor = COLOR_BLACK; // Edit box text background color -UCHAR UiTitleBoxTitleText[260] = "Boot Menu"; // Title box's title text +CHAR UiTitleBoxTitleText[260] = "Boot Menu"; // Title box's title text BOOL UserInterfaceUp = FALSE; // Tells us if the user interface is displayed @@ -56,14 +56,14 @@ VIDEODISPLAYMODE UiDisplayMode = VideoTextMode; // Tells us if we are in text BOOL UiUseSpecialEffects = FALSE; // Tells us if we should use fade effects -UCHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December " }; +CHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December " }; BOOL UiInitialize(BOOLEAN ShowGui) { ULONG SectionId; - UCHAR DisplayModeText[260]; - UCHAR SettingText[260]; + CHAR DisplayModeText[260]; + CHAR SettingText[260]; ULONG Depth; if (!ShowGui) { @@ -201,7 +201,7 @@ BOOL UiInitialize(BOOLEAN ShowGui) return TRUE; } -VOID UiUnInitialize(PUCHAR BootText) +VOID UiUnInitialize(PCHAR BootText) { UiDrawBackdrop(); UiDrawStatusText("Booting..."); @@ -233,7 +233,7 @@ VOID UiDrawBackdrop(VOID) } } -VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */) +VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */) { if (VideoTextMode == UiDisplayMode) { @@ -272,7 +272,7 @@ VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle } } -VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr) +VOID UiDrawText(ULONG X, ULONG Y, PCHAR Text, UCHAR Attr) { if (VideoTextMode == UiDisplayMode) { @@ -285,7 +285,7 @@ VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr) } } -VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr) +VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCHAR TextString, UCHAR Attr) { if (VideoTextMode == UiDisplayMode) { @@ -298,7 +298,7 @@ VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR } } -VOID UiDrawStatusText(PUCHAR StatusText) +VOID UiDrawStatusText(PCHAR StatusText) { if (!UserInterfaceUp) return; @@ -326,7 +326,7 @@ VOID UiUpdateDateTime(VOID) } } -VOID UiInfoBox(PUCHAR MessageText) +VOID UiInfoBox(PCHAR MessageText) { ULONG TextLength; ULONG BoxWidth; @@ -387,7 +387,7 @@ VOID UiInfoBox(PUCHAR MessageText) UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor)); } -VOID UiMessageBox(PUCHAR MessageText) +VOID UiMessageBox(PCHAR MessageText) { // We have not yet displayed the user interface // We are probably still reading the .ini file @@ -412,7 +412,7 @@ VOID UiMessageBox(PUCHAR MessageText) } } -VOID UiMessageBoxCritical(PUCHAR MessageText) +VOID UiMessageBoxCritical(PCHAR MessageText) { // We have not yet displayed the user interface // We are probably still reading the .ini file @@ -437,7 +437,7 @@ VOID UiMessageBoxCritical(PUCHAR MessageText) } } -UCHAR UiTextToColor(PUCHAR ColorText) +UCHAR UiTextToColor(PCHAR ColorText) { if (VideoTextMode == UiDisplayMode) { @@ -451,7 +451,7 @@ UCHAR UiTextToColor(PUCHAR ColorText) } } -UCHAR UiTextToFillStyle(PUCHAR FillStyleText) +UCHAR UiTextToFillStyle(PCHAR FillStyleText) { if (VideoTextMode == UiDisplayMode) { @@ -465,7 +465,7 @@ UCHAR UiTextToFillStyle(PUCHAR FillStyleText) } } -VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText) +VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) { if (!UserInterfaceUp) return; @@ -480,7 +480,7 @@ VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText) } } -VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PUCHAR ProgressText) +VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) { if (VideoTextMode == UiDisplayMode) { @@ -493,12 +493,12 @@ VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG P } } -VOID UiShowMessageBoxesInSection(PUCHAR SectionName) +VOID UiShowMessageBoxesInSection(PCHAR SectionName) { ULONG Idx; - UCHAR SettingName[80]; - UCHAR SettingValue[80]; - PUCHAR MessageBoxText; + CHAR SettingName[80]; + CHAR SettingValue[80]; + PCHAR MessageBoxText; ULONG MessageBoxTextSize; ULONG SectionId; @@ -524,7 +524,7 @@ VOID UiShowMessageBoxesInSection(PUCHAR SectionName) //if (MessageBoxTextSize > 0) { // Allocate enough memory to hold the text - MessageBoxText = (PUCHAR)MmAllocateMemory(MessageBoxTextSize); + MessageBoxText = MmAllocateMemory(MessageBoxTextSize); if (MessageBoxText) { @@ -545,7 +545,7 @@ VOID UiShowMessageBoxesInSection(PUCHAR SectionName) } } -VOID UiEscapeString(PUCHAR String) +VOID UiEscapeString(PCHAR String) { ULONG Idx; @@ -563,7 +563,7 @@ VOID UiEscapeString(PUCHAR String) } } -VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars) +VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars) { if (strlen(StringText) > MaxChars) { @@ -571,7 +571,7 @@ VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars) } } -BOOL UiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) +BOOL UiDisplayMenu(PCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) { if (VideoTextMode == UiDisplayMode) { @@ -611,7 +611,7 @@ VOID UiFadeOut(VOID) } } -BOOL UiEditBox(PUCHAR MessageText, PUCHAR EditTextBuffer, ULONG Length) +BOOL UiEditBox(PCHAR MessageText, PCHAR EditTextBuffer, ULONG Length) { if (VideoTextMode == UiDisplayMode) { diff --git a/reactos/boot/freeldr/freeldr/version.c b/reactos/boot/freeldr/freeldr/version.c index d532eecf430..f280d2d88b1 100644 --- a/reactos/boot/freeldr/freeldr/version.c +++ b/reactos/boot/freeldr/freeldr/version.c @@ -21,9 +21,9 @@ #include #include -UCHAR FreeLoaderVersionString[80]; +CHAR FreeLoaderVersionString[80]; -PUCHAR GetFreeLoaderVersionString(VOID) +PCHAR GetFreeLoaderVersionString(VOID) { if (FREELOADER_PATCH_VERSION == 0) { diff --git a/reactos/bootdata/hivesft.inf b/reactos/bootdata/hivesft.inf index fa442487eb8..d2f0dd57c1a 100644 --- a/reactos/bootdata/hivesft.inf +++ b/reactos/bootdata/hivesft.inf @@ -13,9 +13,9 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",,0x00000010 HKLM,"SOFTWARE\Microsoft\Rpc",,0x00000012 ; Version Information -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"4.0" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 6" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"1381" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"5.0" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 3" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"2195" ; Image File Execution Options (NtGlobalFlag with FLG_SHOW_LDR_SNAPS set for loadlib.exe) diff --git a/reactos/bootdata/hivesys.inf b/reactos/bootdata/hivesys.inf index 71a302b9c32..087c99f112e 100644 --- a/reactos/bootdata/hivesys.inf +++ b/reactos/bootdata/hivesys.inf @@ -64,10 +64,14 @@ HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout File",0 HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout Text",0x00000000,"US-Dvorak" HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout File",0x00000000,"kbdfr.dll" HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout Text",0x00000000,"FR" +HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout File",0x00000000,"kbdru.dll" +HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout Text",0x00000000,"Russian" HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout File",0x00000000,"kbdse.dll" HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout Text",0x00000000,"SE" HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout File",0x00000000,"kbduk.dll" HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout Text",0x00000000,"UK" +HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout File",0x00000000,"kbdsg.dll" +HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout Text",0x00000000,"SG" ; Network HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Adapters" @@ -166,13 +170,114 @@ HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040d",0x00000000,"l_intl.n HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040e",0x00000000,"l_intl.nls" HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040f",0x00000000,"l_intl.nls" HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0410",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0419",0x00000000,"l_intl.nls" HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041d",0x00000000,"l_intl.nls" HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0809",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0807",0x00000000,"l_intl.nls" HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409" ; Suported and installed locales HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale",,0x00000012 +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000402",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000403",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000404",0x00010001,"" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000405",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000406",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000407",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000807",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c07",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001407",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000408",0x00010001,"4" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000409",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000809",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c09",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001009",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001409",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001809",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c09",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002009",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003009",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003409",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100a",0x00010001,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c0a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000200a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000240a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000280a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002c0a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000300a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000340a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000380a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003c0a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000400a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000440a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000480a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00004c0a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000500a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040b",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040c",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080c",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0c",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100c",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140c",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180c",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040d",0x00010001,"" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040e",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040f",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000410",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000810",0x00010001,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000411",0x00010001,"" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000412",0x00010001,"" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000413",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000813",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000414",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000814",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000415",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000416",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000816",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000418",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000419",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041a",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081a",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c1a",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041b",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041c",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041d",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081d",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041e",0x00010001,"" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041f",0x00010001,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000420",0x00010001,"" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000421",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000422",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000423",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000424",0x00010001,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000425",0x00010001,"3" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000426",0x00010001,"3" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000427",0x00010001,"3" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000429",0x00010001,"" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042a",0x00010001,"" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042b",0x00010001,"" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042c",0x00010001,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000082c",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042d",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042f",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000436",0x00010001,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000437",0x00010001,"" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000438",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000439",0x00010001,"" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043e",0x00010001,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000083e",0x00010001,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043f",0x00010001,"5" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000440",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000441",0x00010001,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000443",0x00010001,"6" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000843",0x00010001,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000456",0x00010001,"1" ; Some installers check for SP6 HKLM,"SYSTEM\CurrentControlSet\Control\Windows","CSDVersion",0x00010001,0x00000600 @@ -288,9 +393,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Export",0x00010000,"\De HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Route",0x00010000,"3c90x1" HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","SlotNumber",0x00000000,"10" HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","BusNumber",0x00000000,"0" -HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1" -HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100" -HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0" +HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0" ; Afd driver HKLM,"SYSTEM\CurrentControlSet\Services\Afd","ErrorControl",0x00010001,0x00000001 @@ -441,6 +546,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ImagePath",0x00020000,"%Syste HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x00000002 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Type",0x00010001,0x00000010 +; DHCP client service +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ErrorControl",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Group",0x00000000,"Network" +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ImagePath",0x00020000,"%SystemRoot%\system32\dhcp.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Start",0x00010001,0x00000002 +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Type",0x00010001,0x00000010 + ; Floppy driver HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","Group",0x00000000,"Primary Disk" @@ -462,12 +574,22 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Fs_Rec","Type",0x00010001,0x00000008 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ide","Start",0x00010001,0x00000004 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ide","Type",0x00010001,0x00000001 -; Keyboard driver -HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","ErrorControl",0x00010001,0x00000000 -HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Group",0x00000000,"Keyboard Port" -HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","ImagePath",0x00020000,"system32\drivers\keyboard.sys" -HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Start",0x00010001,0x00000001 -HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Type",0x00010001,0x00000001 +; i8042 port driver +HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","ErrorControl",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","Group",0x00000000,"Keyboard Port" +HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","ImagePath",0x00020000,"system32\drivers\i8042prt.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","Start",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","Type",0x00010001,0x00000001 + +HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt\Parameters","SampleRate",0x00010001,0x00000060 +HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt\Parameters","BreakOnSysRq",0x00010001,0x00000001 + +; Keyboard class driver +HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","ErrorControl",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","Group",0x00000000,"Keyboard Class" +HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","ImagePath",0x00020000,"system32\drivers\kbdclass.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","Start",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","Type",0x00010001,0x00000001 ; Serial port enumerator HKLM,"SYSTEM\CurrentControlSet\Services\serenum","ErrorControl",0x00010001,0x00000001 @@ -567,9 +689,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103 HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Port",0x00000000,"280" HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Irq",0x00000000,"9" HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","NetworkAddress",0x00000000,"001122334455" -HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1" -HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100" -HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0" +HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0" ; one day this will happen automatically; until then we need this since ndis5 drivers ; rely on the fact that their resources are handed to them by ndis, so we have to find @@ -658,9 +780,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103 HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000","BusNumber",0x00000000,"0" HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}",,0x00000000,"Network Adapters" HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}\Connection","Name",0x00000000,"AMD PCNet (static Registry entry)" -HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1" -HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100" -HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0" +HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0" ; Named Pipe filesystem driver HKLM,"SYSTEM\CurrentControlSet\Services\Npfs","ErrorControl",0x00010001,0x00000000 @@ -727,14 +849,6 @@ HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%Syste HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000002 HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000010 -; PS/2 mouse port driver -HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","ErrorControl",0x00010001,0x00000000 -HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","Group",0x00000000,"Pointer Port" -HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","ImagePath",0x00020000,"system32\drivers\psaux.sys" -HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","Start",0x00010001,0x00000004 -HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","Type",0x00010001,0x00000001 -HKLM,"SYSTEM\CurrentControlSet\Services\Psaux\Parameters","DisableExtensionDetection",0x00010001,0x00000000 - ; RPC service HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","ImagePath",0x00020000,"%SystemRoot%\system32\rpcss.exe" @@ -794,6 +908,15 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","ImagePath",0x00020000,"system32 HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Start",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Type",0x00010001,0x00000002 +; Xbox Nvidia driver +HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ErrorControl",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Group",0x00000000,"Video" +HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ImagePath",0x00020000,"system32\drivers\xboxvmp.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Start",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Type",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp\Device0","InstalledDisplayDrivers",0x00010000,"framebuf" +HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10DE&DEV_02A0&SUBSYS_00000000&REV_A1\0000","Service",0x00000000,"XboxVmp" + ; VBE SVGA driver HKLM,"SYSTEM\CurrentControlSet\Services\VBE","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\VBE","Group",0x00000000,"Video Save SVGA" @@ -853,100 +976,4 @@ HKLM,"SYSTEM\Setup","OsLoaderPath",0x00000000,"\" HKLM,"SYSTEM\Setup","SetupType",0x00010001,0x00000001 HKLM,"SYSTEM\Setup","SystemPartition",0x00000000,"\Device\Harddisk0\Partition1" HKLM,"SYSTEM\Setup","SystemSetupInProgress",0x00010001,0x00000000 - -; ----------------------------- KJS Init ---------------------------- -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","kjsinit",0x00010000,\ -"function init(v) { var rk = '\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Kdb'; eval(System.regread(rk,v)); } for( i = 1; i <= 45; i++ ) { init((new Number(i)).toString()); }" - -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","1",0x00010000,\ -"function write(x) { System.print(x); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","2",0x00010000,\ -"function regs(n) { return System.regs(n); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","3",0x00010000,\ -"function debugebp() { return regs(0); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","4",0x00010000,\ -"function debugeip() { return regs(1); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","5",0x00010000,\ -"function tf_argmark() { return regs(2); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","6",0x00010000,\ -"function tf_pointer() { return regs(3); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","7",0x00010000,\ -"function tf_tempcs() { return regs(4); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","8",0x00010000,\ -"function tf_tempeip() { return regs(5); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","9",0x00010000,\ -"function dr0() { return regs(6); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","10",0x00010000,\ -"function dr1() { return regs(7); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","11",0x00010000,\ -"function dr2() { return regs(8); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","12",0x00010000,\ -"function dr3() { return regs(9); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","13",0x00010000,\ -"function dr6() { return regs(10); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","14",0x00010000,\ -"function dr7() { return regs(11); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","15",0x00010000,\ -"function gs() { return regs(12) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","16",0x00010000,\ -"function es() { return regs(13) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","17",0x00010000,\ -"function ds() { return regs(14) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","18",0x00010000,\ -"function edx() { return regs(15); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","19",0x00010000,\ -"function ecx() { return regs(16); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","20",0x00010000,\ -"function eax() { return regs(17); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","21",0x00010000,\ -"function tf_pmode() { return regs(18); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","22",0x00010000,\ -"function tf_exl() { return regs(19); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","23",0x00010000,\ -"function fs() { return regs(20) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","24",0x00010000,\ -"function edi() { return regs(21); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","25",0x00010000,\ -"function esi() { return regs(22); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","26",0x00010000,\ -"function ebx() { return regs(23); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","27",0x00010000,\ -"function ebp() { return regs(24); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","28",0x00010000,\ -"function error_code() { return regs(25); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","29",0x00010000,\ -"function eip() { return regs(26); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","30",0x00010000,\ -"function cs() { return regs(27) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","31",0x00010000,\ -"function eflags() { return regs(28); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","32",0x00010000,\ -"function esp() { return regs(29); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","33",0x00010000,\ -"function ss() { return regs(30) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","34",0x00010000,\ -"function v86_es() { return regs(31) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","35",0x00010000,\ -"function v86_ds() { return regs(32) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","36",0x00010000,\ -"function v86_fs() { return regs(33) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","37",0x00010000,\ -"function v86_gs() { return regs(34) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","38",0x00010000,\ -"function peekl(a) { return System.mread(4,a); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","39",0x00010000,\ -"function pokel(a,b) { return System.mwrite(4,a,b); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","40",0x00010000,\ -"function peekw(a) { return System.mread(2,a); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","41",0x00010000,\ -"function pokew(a,b) { return System.mwrite(2,a,b); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","42",0x00010000,\ -"function peek(a) { return System.mread(1,a); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","43",0x00010000,\ -"function poke(a,b) { return System.mwrite(1,a,b); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","44",0x00010000,\ -"function regread(x,y) { return System.regread(x,y); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","45",0x00010000,\ -"write('JS Registry Init Complete. Welcome to ReactOS kernel scripting');" - ; EOF diff --git a/reactos/bootdata/packages/reactos.dff b/reactos/bootdata/packages/reactos.dff index 5c5eb723e58..79a66577e5d 100755 --- a/reactos/bootdata/packages/reactos.dff +++ b/reactos/bootdata/packages/reactos.dff @@ -43,8 +43,9 @@ drivers\fs\fs_rec\fs_rec.sys 2 drivers\fs\ms\msfs.sys 2 drivers\fs\mup\mup.sys 2 drivers\fs\np\npfs.sys 2 +drivers\input\i8042prt\i8042prt.sys 2 +drivers\input\kbdclass\kbdclass.sys 2 drivers\input\mouclass\mouclass.sys 2 -drivers\input\psaux\psaux.sys 2 drivers\input\sermouse\sermouse.sys 2 drivers\net\afd\afd.sys 2 drivers\net\ndis\ndis.sys 2 @@ -88,7 +89,9 @@ lib\kbddv\kbddv.dll 1 lib\kbdes\kbdes.dll 1 lib\kbdfr\kbdfr.dll 1 lib\kbdgr\kbdgr.dll 1 +lib\kbdru\kbdru.dll 1 lib\kbdse\kbdse.dll 1 +lib\kbdsg\kbdsg.dll 1 lib\kbduk\kbduk.dll 1 lib\kbdus\kbdus.dll 1 lib\kernel32\kernel32.dll 1 @@ -165,6 +168,7 @@ subsys\system\userinit\userinit.exe 1 subsys\system\vmwinst\vmwinst.exe 1 subsys\system\winlogon\winlogon.exe 1 subsys\system\winefile\winefile.exe 1 +subsys\system\dhcp\dhcp.exe 1 services\eventlog\eventlog.exe 1 services\rpcss\rpcss.exe 1 services\umpnpmgr\umpnpmgr.exe 1 diff --git a/reactos/bootdata/txtsetup.sif b/reactos/bootdata/txtsetup.sif index 962438c9aed..3e06f270f56 100644 --- a/reactos/bootdata/txtsetup.sif +++ b/reactos/bootdata/txtsetup.sif @@ -22,7 +22,9 @@ cdrom.sys = 3 class2.sys = 3 disk.sys = 3 floppy.sys = 3 -keyboard.sys = 3 +;keyboard.sys = 3 +i8042prt.sys = 3 +kbdclass.sys = 3 l_intl.nls = 2 ntfs.sys = 3 ntoskrnl.exe = 2 @@ -35,7 +37,7 @@ Cabinet=reactos.cab [SetupData] DefaultPath = \ReactOS OsLoadOptions = "/NOGUIBOOT /NODEBUG" -;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1" +;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /BAUDRATE=19200 /IRQ=4" ;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN" ;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS" @@ -77,29 +79,35 @@ Default = "XT-, AT- or extended keyboard (83-105 keys)" 00010409 = "English (USA-Dvorak)" 0000040C = "French (France)" 00000407 = "German (Germany)" +00000419 = "Russian" 0000040A = "Spanish (traditional short)" 0000041D = "Swedish (Sweden)" +00000807 = "German (Swiss)" [Files.KeyboardLayout] 00000406 = kbdda.dll 00000407 = kbdgr.dll 00000409 = kbdus.dll 00010409 = kbddv.dll -0000040C = kbdfr.dll -0000041D = kbdse.dll -00000809 = kgbgb.dll 0000040A = kbdes.dll +0000040C = kbdfr.dll +00000419 = kbdru.dll +0000041D = kbdse.dll +00000809 = kbduk.dll +00000807 = kbdsg.dll [Mouse] ; = ,, -msps2 = "Microsoft PS2 Mouse",,psaux +i8042ps2 = "PS2 Mouse",,i8042prt +;msps2 = "Microsoft PS2 Mouse",,psaux msser = "Microsoft Serial Mouse",,sermouse mswhs = "Microsoft Serial Wheel Mouse",,sermouse none = "No Mouse" [Map.Mouse] ; = -msps2 = "MICROSOFT PS2 MOUSE" +i8042ps2 = "MICROSOFT PS2 MOUSE" +;msps2 = "MICROSOFT PS2 MOUSE" msser = "MICROSOFT SERIAL MOUSE" mswhs = "MICROSOFT MOUSE WITH WHEEL" none = "NO MOUSE" diff --git a/reactos/drivers/bus/serenum/detect.c b/reactos/drivers/bus/serenum/detect.c index 4a7ca07755a..6a315af6bfe 100644 --- a/reactos/drivers/bus/serenum/detect.c +++ b/reactos/drivers/bus/serenum/detect.c @@ -71,14 +71,16 @@ ReadBytes( PIRP Irp; IO_STATUS_BLOCK ioStatus; KEVENT event; + LARGE_INTEGER zero; NTSTATUS Status; KeInitializeEvent(&event, NotificationEvent, FALSE); + zero.QuadPart = 0; Irp = IoBuildSynchronousFsdRequest( IRP_MJ_READ, LowerDevice, Buffer, BufferSize, - 0, + &zero, &event, &ioStatus); if (!Irp) @@ -199,7 +201,7 @@ SerenumWait(ULONG milliseconds) KTIMER Timer; LARGE_INTEGER DueTime; - DueTime.QuadPart = -milliseconds * 10; + DueTime.QuadPart = milliseconds * -10; KeInitializeTimer(&Timer); KeSetTimer(&Timer, DueTime, NULL); return KeWaitForSingleObject(&Timer, Executive, KernelMode, FALSE, NULL); @@ -216,7 +218,8 @@ SerenumDetectPnpDevice( ULONG Size; ULONG Msr, Purge; ULONG i; - BOOLEAN BufferContainsBeginId, BufferContainsEndId; + BOOLEAN BufferContainsBeginId = FALSE; + BOOLEAN BufferContainsEndId = FALSE; SERIAL_LINE_CONTROL Lcr; SERIAL_TIMEOUTS Timeouts; SERIALPERF_STATS PerfStats; @@ -325,7 +328,6 @@ SerenumCollectPnpComDeviceId: NULL, 0, &PerfStats, &Size); if (!NT_SUCCESS(Status)) return Status; if (PerfStats.FrameErrorCount + PerfStats.ParityErrorCount != 0) goto SerenumConnectIdle; - BufferContainsBeginId = BufferContainsEndId = FALSE; for (i = 0; i < TotalBytesReceived; i++) { if (Buffer[i] == BEGIN_ID) BufferContainsBeginId = TRUE; @@ -422,6 +424,10 @@ SerenumDetectLegacyDevice( UNICODE_STRING CompatibleIds; NTSTATUS Status; + DPRINT("Serenum: SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n", + DeviceObject, + LowerDevice); + RtlZeroMemory(Buffer, sizeof(Buffer)); /* Reset UART */ diff --git a/reactos/drivers/bus/serenum/fdo.c b/reactos/drivers/bus/serenum/fdo.c index fbad3937c21..5a55ac3b583 100644 --- a/reactos/drivers/bus/serenum/fdo.c +++ b/reactos/drivers/bus/serenum/fdo.c @@ -18,11 +18,10 @@ SerenumAddDevice( { PDEVICE_OBJECT Fdo; PFDO_DEVICE_EXTENSION DeviceExtension; - //UNICODE_STRING SymbolicLinkName; NTSTATUS Status; - + DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo); - + /* Create new device object */ Status = IoCreateDevice(DriverObject, sizeof(FDO_DEVICE_EXTENSION), @@ -36,27 +35,22 @@ SerenumAddDevice( DPRINT("Serenum: IoCreateDevice() failed with status 0x%08lx\n", Status); return Status; } + DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION)); /* Register device interface */ -#if 0 /* FIXME: activate */ - Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, NULL, &SymbolicLinkName); + Status = IoRegisterDeviceInterface( + Pdo, + &GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, + NULL, + &DeviceExtension->SerenumInterfaceName); if (!NT_SUCCESS(Status)) { DPRINT("Serenum: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status); - goto ByeBye; + IoDeleteDevice(Fdo); + return Status; } - DPRINT1("Serenum: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName); - Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE); - if (!NT_SUCCESS(Status)) - { - DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status); - goto ByeBye; - } - RtlFreeUnicodeString(&SymbolicLinkName); -#endif - DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension; - RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION)); DeviceExtension->Common.IsFDO = TRUE; DeviceExtension->Common.PnpState = dsStopped; DeviceExtension->Pdo = Pdo; @@ -80,13 +74,22 @@ SerenumFdoStartDevice( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { - PCOMMON_DEVICE_EXTENSION DeviceExtension; + PFDO_DEVICE_EXTENSION DeviceExtension; + NTSTATUS Status; DPRINT("Serenum: SerenumFdoStartDevice() called\n"); - DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - ASSERT(DeviceExtension->PnpState == dsStopped); - DeviceExtension->PnpState = dsStarted; + ASSERT(DeviceExtension->Common.PnpState == dsStopped); + + Status = IoSetDeviceInterfaceState(&DeviceExtension->SerenumInterfaceName, TRUE); + if (!NT_SUCCESS(Status)) + { + DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status); + return Status; + } + + DeviceExtension->Common.PnpState = dsStarted; return STATUS_SUCCESS; } diff --git a/reactos/drivers/bus/serenum/misc.c b/reactos/drivers/bus/serenum/misc.c index 94eb3933474..03ef526ad17 100644 --- a/reactos/drivers/bus/serenum/misc.c +++ b/reactos/drivers/bus/serenum/misc.c @@ -14,10 +14,12 @@ NTSTATUS SerenumDuplicateUnicodeString( - OUT PUNICODE_STRING Destination, - IN PUNICODE_STRING Source, - IN POOL_TYPE PoolType) + OUT PUNICODE_STRING Destination, + IN PUNICODE_STRING Source, + IN POOL_TYPE PoolType) { + ASSERT(Destination); + if (Source == NULL) { RtlInitUnicodeString(Destination, NULL); @@ -52,6 +54,8 @@ SerenumInitMultiSzString( ULONG DestinationSize = 0; NTSTATUS Status = STATUS_SUCCESS; + ASSERT(Destination); + /* Calculate length needed for destination unicode string */ va_start(args, Destination); Source = va_arg(args, PCSZ); @@ -133,6 +137,8 @@ ForwardIrpAndWait( ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO); LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice; + ASSERT(LowerDevice); + KeInitializeEvent(&Event, NotificationEvent, FALSE); IoCopyCurrentIrpStackLocationToNext(Irp); @@ -162,6 +168,7 @@ ForwardIrpToLowerDeviceAndForget( ASSERT(DeviceExtension->Common.IsFDO); LowerDevice = DeviceExtension->LowerDevice; + ASSERT(LowerDevice); DPRINT("Serenum: calling lower device 0x%p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName); IoSkipCurrentIrpStackLocation(Irp); @@ -180,6 +187,7 @@ ForwardIrpToAttachedFdoAndForget( ASSERT(!DeviceExtension->Common.IsFDO); Fdo = DeviceExtension->AttachedFdo; + ASSERT(Fdo); DPRINT("Serenum: calling attached Fdo 0x%p [%wZ]\n", Fdo, &Fdo->DriverObject->DriverName); IoSkipCurrentIrpStackLocation(Irp); @@ -195,6 +203,7 @@ ForwardIrpAndForget( ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO); LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice; + ASSERT(LowerDevice); IoSkipCurrentIrpStackLocation(Irp); return IoCallDriver(LowerDevice, Irp); diff --git a/reactos/drivers/bus/serenum/pdo.c b/reactos/drivers/bus/serenum/pdo.c index 54ade591a6c..615f051e6cb 100644 --- a/reactos/drivers/bus/serenum/pdo.c +++ b/reactos/drivers/bus/serenum/pdo.c @@ -99,6 +99,7 @@ SerenumPdoQueryDeviceRelations( return STATUS_INSUFFICIENT_RESOURCES; ObReferenceObject(DeviceObject); + DeviceRelations->Count = 1; DeviceRelations->Objects[0] = DeviceObject; *pDeviceRelations = DeviceRelations; @@ -156,7 +157,7 @@ SerenumPdoPnp( } case TargetDeviceRelation: { - PDEVICE_RELATIONS DeviceRelations; + PDEVICE_RELATIONS DeviceRelations = NULL; DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n"); Status = SerenumPdoQueryDeviceRelations(DeviceObject, &DeviceRelations); Information = (ULONG_PTR)DeviceRelations; diff --git a/reactos/drivers/bus/serenum/serenum.c b/reactos/drivers/bus/serenum/serenum.c index ead4e826458..5715843c854 100644 --- a/reactos/drivers/bus/serenum/serenum.c +++ b/reactos/drivers/bus/serenum/serenum.c @@ -52,7 +52,9 @@ IrpStub( { DPRINT1("Serenum: FDO stub for major function 0x%lx\n", IoGetCurrentIrpStackLocation(Irp)->MajorFunction); +#ifndef NDEBUG DbgBreakPoint(); +#endif Status = Irp->IoStatus.Status; } } @@ -73,7 +75,9 @@ IrpStub( { DPRINT1("Serenum: PDO stub for major function 0x%lx\n", IoGetCurrentIrpStackLocation(Irp)->MajorFunction); +#ifndef NDEBUG DbgBreakPoint(); +#endif Status = Irp->IoStatus.Status; } } @@ -100,12 +104,6 @@ DriverEntry( for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++) DriverObject->MajorFunction[i] = IrpStub; - /*DriverObject->MajorFunction[IRP_MJ_CREATE] = SerialCreate; - DriverObject->MajorFunction[IRP_MJ_CLOSE] = SerialClose; - DriverObject->MajorFunction[IRP_MJ_CLEANUP] = SerialCleanup; - DriverObject->MajorFunction[IRP_MJ_READ] = SerialRead; - DriverObject->MajorFunction[IRP_MJ_WRITE] = SerialWrite;*/ - //DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = Serenum; //DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation; DriverObject->MajorFunction[IRP_MJ_PNP] = SerenumPnp; //DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower; diff --git a/reactos/drivers/bus/serenum/serenum.h b/reactos/drivers/bus/serenum/serenum.h index cab635a72da..1341666b3dd 100644 --- a/reactos/drivers/bus/serenum/serenum.h +++ b/reactos/drivers/bus/serenum/serenum.h @@ -66,6 +66,8 @@ typedef struct _FDO_DEVICE_EXTENSION PDEVICE_OBJECT Pdo; IO_REMOVE_LOCK RemoveLock; + UNICODE_STRING SerenumInterfaceName; + PDEVICE_OBJECT AttachedPdo; ULONG Flags; } FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION; @@ -122,7 +124,7 @@ SerenumDuplicateUnicodeString( NTSTATUS SerenumInitMultiSzString( OUT PUNICODE_STRING Destination, - ... /* list of ANSI_STRINGs */); + ... /* list of PCSZ */); NTSTATUS ForwardIrpAndWait( diff --git a/reactos/drivers/dd/green/createclose.c b/reactos/drivers/dd/green/createclose.c new file mode 100644 index 00000000000..c16a1cd8b3f --- /dev/null +++ b/reactos/drivers/dd/green/createclose.c @@ -0,0 +1,38 @@ +/* $Id: + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS VT100 emulator + * FILE: drivers/dd/green/createclose.c + * PURPOSE: IRP_MJ_CREATE, IRP_MJ_CLOSE and IRP_MJ_CLEANUP operations + * + * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com) + */ + +//#define NDEBUG +#include "green.h" + +NTSTATUS STDCALL +GreenCreate( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT("Green: IRP_MJ_CREATE\n"); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +NTSTATUS STDCALL +GreenClose( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT("Green: IRP_MJ_CLOSE\n"); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} diff --git a/reactos/drivers/dd/green/dispatch.c b/reactos/drivers/dd/green/dispatch.c new file mode 100644 index 00000000000..18ca6730cc2 --- /dev/null +++ b/reactos/drivers/dd/green/dispatch.c @@ -0,0 +1,65 @@ +/* $Id: + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS VT100 emulator + * FILE: drivers/dd/green/dispatch.c + * PURPOSE: Dispatch routines + * + * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com) + */ + +#define NDEBUG +#include "green.h" + +NTSTATUS STDCALL +GreenDispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + ULONG MajorFunction; + GREEN_DEVICE_TYPE DeviceType; + ULONG_PTR Information; + NTSTATUS Status; + + MajorFunction = IoGetCurrentIrpStackLocation(Irp)->MajorFunction; + DeviceType = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; + + Information = Irp->IoStatus.Information; + Status = Irp->IoStatus.Status; + + DPRINT("Green: Dispatching major function 0x%lx, DeviceType %d\n", + MajorFunction, DeviceType); + + if (MajorFunction == IRP_MJ_CREATE && DeviceType == Green) + return GreenCreate(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_CLOSE && DeviceType == Green) + return GreenClose(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Green) + { + return KeyboardInternalDeviceControl( + ((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Keyboard, + Irp); + } + else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Keyboard) + return KeyboardInternalDeviceControl(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Green) + { + return ScreenDeviceControl( + ((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Screen, + Irp); + } + else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Screen) + return ScreenDeviceControl(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_WRITE && DeviceType == Screen) + return ScreenWrite(DeviceObject, Irp); + else + { + DPRINT1("Green: unknown combination: MajorFunction 0x%lx, DeviceType %d\n", + MajorFunction, DeviceType); + } + + Irp->IoStatus.Information = Information; + Irp->IoStatus.Status = Status; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return Status; +} diff --git a/reactos/drivers/dd/green/green.c b/reactos/drivers/dd/green/green.c new file mode 100644 index 00000000000..d21e73a0f7d --- /dev/null +++ b/reactos/drivers/dd/green/green.c @@ -0,0 +1,44 @@ +/* $Id: + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS VT100 emulator + * FILE: drivers/dd/green/green.c + * PURPOSE: Driver entry point + * + * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com) + */ + +//#define NDEBUG +#include "green.h" + +VOID STDCALL +DriverUnload(IN PDRIVER_OBJECT DriverObject) +{ + // nothing to do here yet +} + +/* + * Standard DriverEntry method. + */ +NTSTATUS STDCALL +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegPath) +{ + ULONG i; + + DriverObject->DriverUnload = DriverUnload; + DriverObject->DriverExtension->AddDevice = GreenAddDevice; + + for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++) + DriverObject->MajorFunction[i] = GreenDispatch; + + /* keyboard only */ + //DriverObject->DriverStartIo = GreenStartIo; + + /* keyboard and screen */ + DriverObject->MajorFunction[IRP_MJ_CREATE] = GreenCreate; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = GreenClose; + + return STATUS_SUCCESS; +} diff --git a/reactos/drivers/dd/green/green.h b/reactos/drivers/dd/green/green.h new file mode 100644 index 00000000000..46cda1d5894 --- /dev/null +++ b/reactos/drivers/dd/green/green.h @@ -0,0 +1,179 @@ +#if defined(__GNUC__) + #include + #include + #include + #include + #include /* should be in kbdmou.h */ + + #include + + /* FIXME: should be in kbdmou.h */ + typedef struct _CONNECT_DATA { + PDEVICE_OBJECT ClassDeviceObject; + PVOID ClassService; + } CONNECT_DATA, *PCONNECT_DATA; + + /* FIXME: should be in kbdmou.h */ + #define IOCTL_INTERNAL_KEYBOARD_CONNECT \ + CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS) + + NTSTATUS STDCALL + ObReferenceObjectByName(PUNICODE_STRING ObjectPath, + ULONG Attributes, + PACCESS_STATE PassedAccessState, + ACCESS_MASK DesiredAccess, + POBJECT_TYPE ObjectType, + KPROCESSOR_MODE AccessMode, + PVOID ParseContext, + PVOID* ObjectPtr); + + /* FIXME: should be in kbdmou.h */ + typedef VOID (*PSERVICE_CALLBACK_ROUTINE)(PDEVICE_OBJECT, PKEYBOARD_INPUT_DATA, PKEYBOARD_INPUT_DATA, PULONG); + + typedef struct _CLASS_INFORMATION + { + PDEVICE_OBJECT DeviceObject; + PVOID CallBack; + } CLASS_INFORMATION, *PCLASS_INFORMATION; + + #define KEYBOARD_BUFFER_SIZE 100 + +#elif defined(_MSC_VER) + #include + #include + #include + + #define STDCALL + + #define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint + #define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__) + #define DPRINT DPRINT1 + #define CHECKPOINT CHECKPOINT1 +#else + #error Unknown compiler! +#endif + +typedef enum +{ + Green, + Screen, + Keyboard +} GREEN_DEVICE_TYPE; + +typedef struct _COMMON_DEVICE_EXTENSION +{ + GREEN_DEVICE_TYPE Type; +} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION; + +typedef struct _KEYBOARD_DEVICE_EXTENSION +{ + COMMON_DEVICE_EXTENSION Common; + PDEVICE_OBJECT Green; + + CLASS_INFORMATION ClassInformation; + HANDLE WorkerThreadHandle; + KDPC KeyboardDpc; + + ULONG ActiveQueue; + ULONG InputDataCount[2]; + KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE]; +} KEYBOARD_DEVICE_EXTENSION, *PKEYBOARD_DEVICE_EXTENSION; + +typedef struct _SCREEN_DEVICE_EXTENSION +{ + COMMON_DEVICE_EXTENSION Common; + PDEVICE_OBJECT Green; + + PUCHAR VideoMemory; /* Pointer to video memory */ + USHORT CharAttribute; /* Current color attribute */ + ULONG Mode; + UCHAR ScanLines; /* Height of a text line */ + UCHAR Rows; /* Number of rows */ + UCHAR Columns; /* Number of columns */ + UCHAR TabWidth; + + ULONG LogicalOffset; /* Position of the cursor */ + + UCHAR SendBuffer[1024]; + ULONG SendBufferPosition; +} SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION; + +typedef struct _GREEN_DEVICE_EXTENSION +{ + COMMON_DEVICE_EXTENSION Common; + PDEVICE_OBJECT Serial; + + PDEVICE_OBJECT LowerDevice; + ULONG BaudRate; + SERIAL_LINE_CONTROL LineControl; + SERIAL_TIMEOUTS Timeouts; + + PDEVICE_OBJECT Keyboard; + PDEVICE_OBJECT Screen; +} GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION; + +/************************************ createclose.c */ + +NTSTATUS STDCALL +GreenCreate( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +NTSTATUS STDCALL +GreenClose( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ dispatch.c */ + +NTSTATUS STDCALL +GreenDispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ keyboard.c */ + +NTSTATUS +KeyboardInitialize( + IN PDRIVER_OBJECT DriverObject, + OUT PDEVICE_OBJECT* KeyboardFdo); + +NTSTATUS +KeyboardInternalDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ misc.c */ + +NTSTATUS +GreenDeviceIoControl( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG CtlCode, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferSize, + IN OUT PVOID OutputBuffer OPTIONAL, + IN OUT PULONG OutputBufferSize); + +/************************************ pnp.c */ + +NTSTATUS STDCALL +GreenAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo); + +/************************************ screen.c */ + +NTSTATUS +ScreenInitialize( + IN PDRIVER_OBJECT DriverObject, + OUT PDEVICE_OBJECT* ScreenFdo); + +NTSTATUS +ScreenWrite( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +NTSTATUS +ScreenDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); diff --git a/reactos/drivers/dd/green/green.rc b/reactos/drivers/dd/green/green.rc new file mode 100644 index 00000000000..7096b7dfd1d --- /dev/null +++ b/reactos/drivers/dd/green/green.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "VT100 Server Driver\0" +#define REACTOS_STR_INTERNAL_NAME "green\0" +#define REACTOS_STR_ORIGINAL_FILENAME "green.sys\0" +#include diff --git a/reactos/drivers/dd/green/keyboard.c b/reactos/drivers/dd/green/keyboard.c new file mode 100644 index 00000000000..dd8c592ec0c --- /dev/null +++ b/reactos/drivers/dd/green/keyboard.c @@ -0,0 +1,346 @@ +/* $Id: + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS VT100 emulator + * FILE: drivers/dd/green/keyboard.c + * PURPOSE: Keyboard part of green management + * + * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com) + */ + +#define NDEBUG +#include "green.h" + +static BOOLEAN +TranslateCharToScanCodes( + IN PUCHAR InputBuffer, + IN ULONG InputBufferSize, + OUT KEYBOARD_INPUT_DATA* OutputBuffer, + OUT PULONG OutputBufferSize, + OUT PULONG BytesConsumed) +{ + BOOLEAN NormalKey = FALSE; + USHORT MakeCode; + + if (InputBufferSize == 0) + return FALSE; + + switch (*InputBuffer) + { + case 0x1b: MakeCode = 0x01; NormalKey = TRUE; break; /* ESC */ + + case '1': MakeCode = 0x02; NormalKey = TRUE; break; + case '2': MakeCode = 0x03; NormalKey = TRUE; break; + case '3': MakeCode = 0x04; NormalKey = TRUE; break; + case '4': MakeCode = 0x05; NormalKey = TRUE; break; + case '5': MakeCode = 0x06; NormalKey = TRUE; break; + case '6': MakeCode = 0x07; NormalKey = TRUE; break; + case '7': MakeCode = 0x08; NormalKey = TRUE; break; + case '8': MakeCode = 0x09; NormalKey = TRUE; break; + case '9': MakeCode = 0x0a; NormalKey = TRUE; break; + case '0': MakeCode = 0x0b; NormalKey = TRUE; break; + case '-': MakeCode = 0x0c; NormalKey = TRUE; break; + case '=': MakeCode = 0x0d; NormalKey = TRUE; break; + case '\b': MakeCode = 0x0e; NormalKey = TRUE; break; + + case '\t': MakeCode = 0x0f; NormalKey = TRUE; break; + case 'q': MakeCode = 0x10; NormalKey = TRUE; break; + case 'w': MakeCode = 0x11; NormalKey = TRUE; break; + case 'e': MakeCode = 0x12; NormalKey = TRUE; break; + case 'r': MakeCode = 0x13; NormalKey = TRUE; break; + case 't': MakeCode = 0x14; NormalKey = TRUE; break; + case 'y': MakeCode = 0x15; NormalKey = TRUE; break; + case 'u': MakeCode = 0x16; NormalKey = TRUE; break; + case 'i': MakeCode = 0x17; NormalKey = TRUE; break; + case 'o': MakeCode = 0x18; NormalKey = TRUE; break; + case 'p': MakeCode = 0x19; NormalKey = TRUE; break; + case '[': MakeCode = 0x1a; NormalKey = TRUE; break; + case ']': MakeCode = 0x1b; NormalKey = TRUE; break; + + case '\r': MakeCode = 0x1c; NormalKey = TRUE; break; + + case 'a': MakeCode = 0x1e; NormalKey = TRUE; break; + case 's': MakeCode = 0x1f; NormalKey = TRUE; break; + case 'd': MakeCode = 0x20; NormalKey = TRUE; break; + case 'f': MakeCode = 0x21; NormalKey = TRUE; break; + case 'g': MakeCode = 0x22; NormalKey = TRUE; break; + case 'h': MakeCode = 0x23; NormalKey = TRUE; break; + case 'j': MakeCode = 0x24; NormalKey = TRUE; break; + case 'k': MakeCode = 0x25; NormalKey = TRUE; break; + case 'l': MakeCode = 0x26; NormalKey = TRUE; break; + case ';': MakeCode = 0x27; NormalKey = TRUE; break; + case '\'': MakeCode = 0x28; NormalKey = TRUE; break; + + case '`': MakeCode = 0x29; NormalKey = TRUE; break; + + case '\\': MakeCode = 0x2b; NormalKey = TRUE; break; + + case 'z': MakeCode = 0x2c; NormalKey = TRUE; break; + case 'x': MakeCode = 0x2d; NormalKey = TRUE; break; + case 'c': MakeCode = 0x2e; NormalKey = TRUE; break; + case 'v': MakeCode = 0x2f; NormalKey = TRUE; break; + case 'b': MakeCode = 0x30; NormalKey = TRUE; break; + case 'n': MakeCode = 0x31; NormalKey = TRUE; break; + case 'm': MakeCode = 0x32; NormalKey = TRUE; break; + case ',': MakeCode = 0x33; NormalKey = TRUE; break; + case '.': MakeCode = 0x34; NormalKey = TRUE; break; + case '/': MakeCode = 0x35; NormalKey = TRUE; break; + + case ' ': MakeCode = 0x39; NormalKey = TRUE; break; + } + if (NormalKey && *OutputBufferSize >= 2) + { + OutputBuffer[0].MakeCode = MakeCode; + OutputBuffer[0].Flags = KEY_MAKE; + OutputBuffer[1].MakeCode = MakeCode; + OutputBuffer[1].Flags = KEY_BREAK; + *BytesConsumed = 2; + return TRUE; + } + + /* Consume strange character by ignoring it */ + DPRINT1("Green: strange byte received 0x%02x ('%c')\n", + *InputBuffer, *InputBuffer >= 32 ? *InputBuffer : '.'); + *BytesConsumed = 1; + return TRUE; +} + +NTSTATUS +KeyboardInitialize( + IN PDRIVER_OBJECT DriverObject, + OUT PDEVICE_OBJECT* KeyboardFdo) +{ + PDEVICE_OBJECT Fdo; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass1"); + NTSTATUS Status; + + DPRINT("Green: KeyboardInitialize() called\n"); + + Status = IoCreateDevice(DriverObject, + sizeof(KEYBOARD_DEVICE_EXTENSION), + &DeviceName, /* FIXME: don't hardcode string */ + FILE_DEVICE_KEYBOARD, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + if (!NT_SUCCESS(Status)) + return Status; + + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(KEYBOARD_DEVICE_EXTENSION)); + DeviceExtension->Common.Type = Keyboard; + Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO; + Fdo->Flags &= ~DO_DEVICE_INITIALIZING; + + *KeyboardFdo = Fdo; + + return STATUS_SUCCESS; +} + +static VOID STDCALL +KeyboardDpcSendData( + IN PKDPC Dpc, + IN PVOID pDeviceExtension, /* real type PKEYBOARD_DEVICE_EXTENSION */ + IN PVOID Unused1, + IN PVOID Unused2) +{ + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + ULONG Queue; + ULONG InputDataConsumed; + + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)pDeviceExtension; + + Queue = DeviceExtension->ActiveQueue % 2; + InterlockedIncrement((PLONG)&DeviceExtension->ActiveQueue); + (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassInformation.CallBack)( + DeviceExtension->ClassInformation.DeviceObject, + DeviceExtension->KeyboardInputData[Queue], + &DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]], + &InputDataConsumed); + + DeviceExtension->InputDataCount[Queue] = 0; +} +static VOID STDCALL +KeyboardDeviceWorker( + PVOID Context) +{ + PDEVICE_OBJECT DeviceObject; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + PGREEN_DEVICE_EXTENSION GreenDeviceExtension; + PDEVICE_OBJECT LowerDevice; + UCHAR Buffer[16]; /* Arbitrary size */ + ULONG BufferSize; + PIRP Irp; + IO_STATUS_BLOCK ioStatus; + KEVENT event; + KIRQL OldIrql; + ULONG i, Queue; + ULONG SpaceInQueue; + ULONG BytesConsumed; + PKEYBOARD_INPUT_DATA Input; + NTSTATUS Status; + + DPRINT("Green: KeyboardDeviceWorker() called\n"); + + DeviceObject = (PDEVICE_OBJECT)Context; + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension; + LowerDevice = GreenDeviceExtension->Serial; + BufferSize = sizeof(Buffer); + + /* Initialize device extension */ + DeviceExtension->ActiveQueue = 0; + DeviceExtension->InputDataCount[0] = 0; + DeviceExtension->InputDataCount[1] = 0; + KeInitializeDpc(&DeviceExtension->KeyboardDpc, KeyboardDpcSendData, DeviceExtension); + RtlZeroMemory(&DeviceExtension->KeyboardInputData, sizeof(DeviceExtension->KeyboardInputData)); + + /* main read loop */ + while (TRUE) + { + KeInitializeEvent(&event, NotificationEvent, FALSE); + Irp = IoBuildSynchronousFsdRequest( + IRP_MJ_READ, + LowerDevice, + Buffer, BufferSize, + 0, + &event, + &ioStatus); + if (!Irp) + { + /* no memory actually, try later */ + CHECKPOINT; + KeStallExecutionProcessor(10); + continue; + } + + Status = IoCallDriver(LowerDevice, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL); + Status = ioStatus.Status; + } + if (!NT_SUCCESS(Status)) + continue; + + /* Read all available data and process */ + i = 0; + while (i < ioStatus.Information) + { + Queue = DeviceExtension->ActiveQueue % 2; + + Input = &DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]]; + + /* Translate current chars to scan codes */ + SpaceInQueue = KEYBOARD_BUFFER_SIZE - DeviceExtension->InputDataCount[Queue]; + if (TranslateCharToScanCodes( + &Buffer[i], /* input buffer */ + ioStatus.Information - i, /* input buffer size */ + Input, /* output buffer */ + &SpaceInQueue, /* output buffer size */ + &BytesConsumed)) /* bytes consumed in input buffer */ + { + DPRINT1("Green: got char 0x%02x (%c)\n", Buffer[i], Buffer[i] >= 32 ? Buffer[i] : ' '); + DeviceExtension->InputDataCount[Queue] += BytesConsumed; + + /* Send the data to the keyboard class driver */ + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + KeInsertQueueDpc(&DeviceExtension->KeyboardDpc, NULL, NULL); + KeLowerIrql(OldIrql); + i += BytesConsumed; + } + else + { + /* TranslateCharToScanCodes failed. Possible reasons: + * - not enough bytes in input buffer (escape control code; wait next received bytes) + * - not enough room in output buffer (wait for the Dpc to empty it) + * + * The best way to resolve this is to try later. + */ + i++; + } + } + } + + PsTerminateSystemThread(STATUS_SUCCESS); +} + +NTSTATUS +KeyboardInternalDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + PGREEN_DEVICE_EXTENSION GreenDeviceExtension; + OBJECT_ATTRIBUTES objectAttributes; + PDEVICE_OBJECT LowerDevice; + NTSTATUS Status; + + Stack = IoGetCurrentIrpStackLocation(Irp); + Irp->IoStatus.Information = 0; + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension; + LowerDevice = GreenDeviceExtension->Serial; + DPRINT1("Green: LowerDevice %p\n", LowerDevice); + + switch (Stack->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_INTERNAL_KEYBOARD_CONNECT: + { + ULONG Fcr; + + DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n"); + if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) + { + Status = STATUS_INVALID_PARAMETER; + break; + } + + DeviceExtension->ClassInformation = + *((PCLASS_INFORMATION)Stack->Parameters.DeviceIoControl.Type3InputBuffer); + + /* Initialize serial port */ + Fcr = 0; + Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL, + &Fcr, sizeof(Fcr), NULL, NULL); + if (!NT_SUCCESS(Status)) break; + /* Set serial port speed */ + Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE, + &GreenDeviceExtension->BaudRate, sizeof(GreenDeviceExtension->BaudRate), NULL, NULL); + if (!NT_SUCCESS(Status)) break; + /* Set LCR */ + Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL, + &GreenDeviceExtension->LineControl, sizeof(GreenDeviceExtension->LineControl), NULL, NULL); + if (!NT_SUCCESS(Status)) break; + + /* Set timeouts */ + Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS, + &GreenDeviceExtension->Timeouts, sizeof(GreenDeviceExtension->Timeouts), NULL, NULL); + if (!NT_SUCCESS(Status)) break; + + /* Start read loop */ + InitializeObjectAttributes(&objectAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL); + Status = PsCreateSystemThread( + &DeviceExtension->WorkerThreadHandle, + (ACCESS_MASK)0L, + &objectAttributes, + NULL, + NULL, + KeyboardDeviceWorker, + DeviceObject); + break; + } + default: + { + DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n", + Stack->Parameters.DeviceIoControl.IoControlCode); + Status = STATUS_INVALID_DEVICE_REQUEST; + } + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return Status; +} diff --git a/reactos/drivers/dd/green/makefile b/reactos/drivers/dd/green/makefile new file mode 100644 index 00000000000..a92f8280d74 --- /dev/null +++ b/reactos/drivers/dd/green/makefile @@ -0,0 +1,24 @@ +# $Id: + +PATH_TO_TOP = ../../.. + +TARGET_BOOTSTRAP = yes + +TARGET_TYPE = driver + +TARGET_NAME = green + +TARGET_CFLAGS = -Wall -Werror -D__USE_W32API + +TARGET_OBJECTS = \ + $(TARGET_NAME).o \ + createclose.o \ + dispatch.o \ + keyboard.o \ + misc.o \ + pnp.o \ + screen.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/dd/green/misc.c b/reactos/drivers/dd/green/misc.c new file mode 100644 index 00000000000..e5a4872be0c --- /dev/null +++ b/reactos/drivers/dd/green/misc.c @@ -0,0 +1,60 @@ +/* $Id: + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS VT100 emulator + * FILE: drivers/dd/green/misc.c + * PURPOSE: Misceallenous operations + * + * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com) + */ + +//#define NDEBUG +#include "green.h" + +NTSTATUS +GreenDeviceIoControl( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG CtlCode, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferSize, + IN OUT PVOID OutputBuffer OPTIONAL, + IN OUT PULONG OutputBufferSize) +{ + KEVENT Event; + PIRP Irp; + IO_STATUS_BLOCK IoStatus; + NTSTATUS Status; + + KeInitializeEvent (&Event, NotificationEvent, FALSE); + + Irp = IoBuildDeviceIoControlRequest(CtlCode, + DeviceObject, + InputBuffer, + InputBufferSize, + OutputBuffer, + (OutputBufferSize) ? *OutputBufferSize : 0, + FALSE, + &Event, + &IoStatus); + if (Irp == NULL) + { + DPRINT("Green: IoBuildDeviceIoControlRequest() failed\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + Status = IoCallDriver(DeviceObject, Irp); + + if (Status == STATUS_PENDING) + { + DPRINT("Green: Operation pending\n"); + KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); + Status = IoStatus.Status; + } + + if (OutputBufferSize) + { + *OutputBufferSize = IoStatus.Information; + } + + return Status; +} diff --git a/reactos/drivers/dd/green/pnp.c b/reactos/drivers/dd/green/pnp.c new file mode 100644 index 00000000000..698acccf186 --- /dev/null +++ b/reactos/drivers/dd/green/pnp.c @@ -0,0 +1,87 @@ +/* $Id: + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS VT100 emulator + * FILE: drivers/dd/green/pnp.c + * PURPOSE: IRP_MJ_PNP operations + * + * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com) + */ + +#define NDEBUG +#include "green.h" + +NTSTATUS STDCALL +GreenAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo) +{ + PDEVICE_OBJECT Fdo = NULL; + PGREEN_DEVICE_EXTENSION DeviceExtension; + UNICODE_STRING serialPortName; + NTSTATUS Status; + + DPRINT("Green: AddDevice(DriverObject %p, Pdo %p)\n", DriverObject, Pdo); + + /* Create green FDO */ + Status = IoCreateDevice(DriverObject, + sizeof(GREEN_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_UNKNOWN, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + if (!NT_SUCCESS(Status)) + return Status; + + DeviceExtension = (PGREEN_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(GREEN_DEVICE_EXTENSION)); + DeviceExtension->Common.Type = Green; + + Status = KeyboardInitialize(DriverObject, &DeviceExtension->Keyboard); + if (!NT_SUCCESS(Status)) + { + IoDeleteDevice(Fdo); + return Status; + } + ((PKEYBOARD_DEVICE_EXTENSION)DeviceExtension->Keyboard->DeviceExtension)->Green = Fdo; + + Status = ScreenInitialize(DriverObject, &DeviceExtension->Screen); + if (!NT_SUCCESS(Status)) + { + IoDeleteDevice(DeviceExtension->Keyboard); + IoDeleteDevice(Fdo); + return Status; + } + ((PSCREEN_DEVICE_EXTENSION)DeviceExtension->Screen->DeviceExtension)->Green = Fdo; + + /* initialize green Fdo */ + DeviceExtension->LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo); + DeviceExtension->LineControl.WordLength = 8; + DeviceExtension->LineControl.Parity = NO_PARITY; + DeviceExtension->LineControl.StopBits = STOP_BIT_1; + DeviceExtension->BaudRate = SERIAL_BAUD_38400; + DeviceExtension->Timeouts.ReadTotalTimeoutConstant = 1; /* not null */ + DeviceExtension->Timeouts.ReadIntervalTimeout = INFINITE; + DeviceExtension->Timeouts.ReadTotalTimeoutMultiplier = INFINITE; + DeviceExtension->Timeouts.WriteTotalTimeoutMultiplier = 0; /* FIXME */ + DeviceExtension->Timeouts.WriteTotalTimeoutConstant = 0; /* FIXME */ + + /* open associated serial port */ + RtlInitUnicodeString(&serialPortName, L"\\Device\\Serial1"); /* FIXME: don't hardcode string */ + Status = ObReferenceObjectByName( + &serialPortName, + OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE, + NULL, + (ACCESS_MASK)0, + IoDeviceObjectType, + KernelMode, + NULL, + (PVOID*)&DeviceExtension->Serial); + /* FIXME: we never ObDereferenceObject */ + + Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO; + Fdo->Flags &= ~DO_DEVICE_INITIALIZING; + + return Status; +} diff --git a/reactos/drivers/dd/green/screen.c b/reactos/drivers/dd/green/screen.c new file mode 100644 index 00000000000..3543f707abe --- /dev/null +++ b/reactos/drivers/dd/green/screen.c @@ -0,0 +1,544 @@ +/* $Id: + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS VT100 emulator + * FILE: drivers/dd/green/screen.c + * PURPOSE: Screen part of green management + * + * PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de) + * Art Yerkes + * Hervé Poussineau (hpoussin@reactos.com) + */ + +#define NDEBUG +#include "green.h" +#include + +#define ESC ((UCHAR)0x1b) + +/* Force a move of the cursor on each printer char. + * Very useful for debug, but it is very slow... + */ +//#define FORCE_POSITION + +/* UCHAR is promoted to int when passed through '...', + * so we get int with va_arg and cast them back to UCHAR. + */ +static VOID +AddToSendBuffer( + IN PSCREEN_DEVICE_EXTENSION DeviceExtension, + IN ULONG NumberOfChars, + ... /* IN int */) +{ + PIRP Irp; + IO_STATUS_BLOCK ioStatus; + va_list args; + PDEVICE_OBJECT SerialDevice; + ULONG SizeLeft; + int CurrentInt; + UCHAR CurrentChar; + NTSTATUS Status; + + SizeLeft = sizeof(DeviceExtension->SendBuffer) - DeviceExtension->SendBufferPosition; + if (SizeLeft < NumberOfChars * 2 || NumberOfChars == 0) + { + SerialDevice = ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->Serial; + Irp = IoBuildSynchronousFsdRequest( + IRP_MJ_WRITE, + SerialDevice, + DeviceExtension->SendBuffer, DeviceExtension->SendBufferPosition, + NULL, /* StartingOffset */ + NULL, /* Event */ + &ioStatus); + if (!Irp) + { + DPRINT1("Green: IoBuildSynchronousFsdRequest() failed. Unable to flush output buffer\n"); + return; + } + Status = IoCallDriver(SerialDevice, Irp); + if (!NT_SUCCESS(Status) && Status != STATUS_PENDING) + { + DPRINT1("Green: IoCallDriver() failed. Status = 0x%08lx\n", Status); + return; + } + DeviceExtension->SendBufferPosition = 0; + SizeLeft = sizeof(DeviceExtension->SendBuffer); + } + + va_start(args, NumberOfChars); + while (NumberOfChars-- > 0) + { + CurrentInt = va_arg(args, int); + if (CurrentInt > 0) + { + CurrentChar = (UCHAR)CurrentInt; + + /* Why 0xff chars are printed on a 'dir' ? */ + if (CurrentChar == 0xff) CurrentChar = ' '; + + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = CurrentChar; + SizeLeft--; + } + else if (CurrentInt == 0) + { + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = '0'; + SizeLeft--; + } + else + { + CurrentInt = -CurrentInt; + ASSERT(CurrentInt < 100); + if (CurrentInt >= 10) + { + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = + (CurrentInt / 10) % 10 + '0'; + SizeLeft--; + } + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = + CurrentInt % 10 + '0'; + SizeLeft--; + } + } + va_end(args); +} + +NTSTATUS +ScreenInitialize( + IN PDRIVER_OBJECT DriverObject, + OUT PDEVICE_OBJECT* ScreenFdo) +{ + PDEVICE_OBJECT Fdo; + PSCREEN_DEVICE_EXTENSION DeviceExtension; + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BlueScreen"); + NTSTATUS Status; + + DPRINT("Green: ScreenInitialize() called\n"); + + Status = IoCreateDevice(DriverObject, + sizeof(SCREEN_DEVICE_EXTENSION), + &DeviceName, /* FIXME: don't hardcode string */ + FILE_DEVICE_SCREEN, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + if (!NT_SUCCESS(Status)) + return Status; + + DeviceExtension = (PSCREEN_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(SCREEN_DEVICE_EXTENSION)); + DeviceExtension->Common.Type = Screen; + /* initialize screen */ + DeviceExtension->Columns = 80; + DeviceExtension->Rows = 25; + DeviceExtension->ScanLines = 16; + DeviceExtension->VideoMemory = (PUCHAR)ExAllocatePool( + PagedPool, + 2 * DeviceExtension->Columns * DeviceExtension->Rows * sizeof(UCHAR)); + if (!DeviceExtension->VideoMemory) + { + IoDeleteDevice(Fdo); + return STATUS_INSUFFICIENT_RESOURCES; + } + DeviceExtension->TabWidth = 8; + + /* more initialization */ + DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT | + ENABLE_WRAP_AT_EOL_OUTPUT; + + /* initialize screen at next write */ + AddToSendBuffer(DeviceExtension, 2, ESC, 'c'); /* reset device */ + AddToSendBuffer(DeviceExtension, 4, ESC, '[', '7', 'l'); /* disable line wrap */ + AddToSendBuffer(DeviceExtension, 4, ESC, '[', '3', 'g'); /* clear all tabs */ + + Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO; + Fdo->Flags &= ~DO_DEVICE_INITIALIZING; + + *ScreenFdo = Fdo; + + return STATUS_SUCCESS; +} + +NTSTATUS +ScreenWrite( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PUCHAR Buffer; + PSCREEN_DEVICE_EXTENSION DeviceExtension; + PUCHAR VideoMemory; /* FIXME: is it useful? */ + ULONG VideoMemorySize; /* FIXME: is it useful? */ + + ULONG Columns, Rows; + ULONG CursorX, CursorY; + ULONG i, j; + NTSTATUS Status; + + DPRINT("Green: IRP_MJ_WRITE\n"); + + Stack = IoGetCurrentIrpStackLocation (Irp); + Buffer = Irp->UserBuffer; + DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + VideoMemory = DeviceExtension->VideoMemory; + + Columns = DeviceExtension->Columns; + Rows = DeviceExtension->Rows; + CursorX = (DeviceExtension->LogicalOffset / 2) % Columns + 1; + CursorY = (DeviceExtension->LogicalOffset / 2) / Columns + 1; + VideoMemorySize = Columns * Rows * 2 * sizeof(UCHAR); + DPRINT1("Y: %lu\n", CursorY); + DPRINT1("Buffer ="); + for (i = 0; i < Stack->Parameters.Write.Length; i++) + DbgPrint(" 0x%02x", Buffer[i]); + DbgPrint("\n"); + + if (!(DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT)) + { + /* raw output mode */ + CHECKPOINT; + Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + + return STATUS_NOT_SUPPORTED; + } + else + { + for (i = 0; i < Stack->Parameters.Write.Length; i++, Buffer++) + { + switch (*Buffer) + { + case '\b': + { + if (CursorX > 1) + { + CursorX--; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + AddToSendBuffer(DeviceExtension, 1, ' '); + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + } + else if (CursorY > 1) + { + CursorX = Columns; + CursorY--; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + } + break; + } + case '\n': + { + CursorY++; + CursorX = 1; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H'); + break; + } + case '\r': + { + if (CursorX > 1) + { + AddToSendBuffer(DeviceExtension, 4, ESC, '[', -(int)(CursorX-1), 'D'); + CursorX = 1; + } + break; + } + case '\t': + { + ULONG Offset = DeviceExtension->TabWidth - (CursorX % DeviceExtension->TabWidth); + for (j = 0; j < Offset; j++) + { +#ifdef FORCE_POSITION + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); +#endif + AddToSendBuffer(DeviceExtension, 1, ' '); + CursorX++; + if (CursorX > Columns) + { + CursorX = 1; + CursorY++; + } + } + break; + } + default: + { +#ifdef FORCE_POSITION + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); +#endif + AddToSendBuffer(DeviceExtension, 1, *Buffer); + CursorX++; + if (CursorX > Columns) + { + CursorX = 1; + DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY + 1); + CursorY++; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H'); + + } + } + } + if (CursorY > Rows) + { + DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY - 1); + CursorY--; + AddToSendBuffer(DeviceExtension, 2, ESC, 'D'); + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + } + } + } + + DeviceExtension->LogicalOffset = ((CursorX-1) + (CursorY-1) * Columns) * 2; + + /* flush output buffer */ + AddToSendBuffer(DeviceExtension, 0); + + Status = STATUS_SUCCESS; + Irp->IoStatus.Status = Status; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + + return Status; +} + +NTSTATUS +ScreenDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PSCREEN_DEVICE_EXTENSION DeviceExtension; + NTSTATUS Status; + + Stack = IoGetCurrentIrpStackLocation(Irp); + DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + switch (Stack->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO: + { + PCONSOLE_SCREEN_BUFFER_INFO pcsbi; + DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO\n"); + + pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer; + + pcsbi->dwSize.X = DeviceExtension->Columns; + pcsbi->dwSize.Y = DeviceExtension->Rows; + + pcsbi->dwCursorPosition.X = (SHORT)(DeviceExtension->LogicalOffset % DeviceExtension->Columns); + pcsbi->dwCursorPosition.Y = (SHORT)(DeviceExtension->LogicalOffset / DeviceExtension->Columns); + + pcsbi->wAttributes = DeviceExtension->CharAttribute; + + pcsbi->srWindow.Left = 1; + pcsbi->srWindow.Right = DeviceExtension->Columns; + pcsbi->srWindow.Top = 1; + pcsbi->srWindow.Bottom = DeviceExtension->Rows; + + pcsbi->dwMaximumWindowSize.X = DeviceExtension->Columns; + pcsbi->dwMaximumWindowSize.Y = DeviceExtension->Rows; + + Irp->IoStatus.Information = sizeof(CONSOLE_SCREEN_BUFFER_INFO); + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO: + { + PCONSOLE_SCREEN_BUFFER_INFO pcsbi; + DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO\n"); + + pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer; + /* FIXME: remove */ { pcsbi->dwCursorPosition.X++; } + /* FIXME: remove */ { pcsbi->dwCursorPosition.Y++; } + ASSERT(pcsbi->dwCursorPosition.X >= 1); + ASSERT(pcsbi->dwCursorPosition.Y >= 1); + ASSERT(pcsbi->dwCursorPosition.X <= DeviceExtension->Columns); + ASSERT(pcsbi->dwCursorPosition.Y <= DeviceExtension->Rows); + + DeviceExtension->LogicalOffset = ( + (pcsbi->dwCursorPosition.Y-1) * DeviceExtension->Columns + + (pcsbi->dwCursorPosition.X-1)) * 2; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', + -(int)pcsbi->dwCursorPosition.Y, ';', + -(int)pcsbi->dwCursorPosition.X, 'H'); + + /* flush buffer */ + AddToSendBuffer(DeviceExtension, 0); + + DeviceExtension->CharAttribute = pcsbi->wAttributes; + + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_GET_CURSOR_INFO: + { + PCONSOLE_CURSOR_INFO pcci = (PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer; + DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_CURSOR_INFO\n"); + + pcci->dwSize = 1; + pcci->bVisible = TRUE; + + Irp->IoStatus.Information = sizeof (CONSOLE_CURSOR_INFO); + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_GET_MODE: + { + PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer; + DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_MODE\n"); + + pcm->dwMode = DeviceExtension->Mode; + + Irp->IoStatus.Information = sizeof(CONSOLE_MODE); + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_SET_MODE: + { + PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer; + DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_MODE\n"); + + DeviceExtension->Mode = pcm->dwMode; + + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE: + { + DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE */ + break; + } + case IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE: + { + DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE */ + break; + } + case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE: + { + DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE */ + break; + } + case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE: + { + DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE\n"); + + DeviceExtension->CharAttribute = (WORD)*(PWORD)Irp->AssociatedIrp.SystemBuffer; + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER: + { + DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME:IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER */ + break; + } + case IOCTL_CONSOLE_READ_OUTPUT_CHARACTER: + { + DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_CHARACTER\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_CHARACTER */ + break; + } + case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER: + { + DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER */ + break; + } + case IOCTL_CONSOLE_DRAW: + { + PCONSOLE_DRAW ConsoleDraw; + PUCHAR Video; + ULONG x, y; + BOOLEAN DoOptimization = FALSE; + DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_DRAW\n"); + + ConsoleDraw = (PCONSOLE_DRAW)MmGetSystemAddressForMdl(Irp->MdlAddress); + /* FIXME: remove */ { ConsoleDraw->X++; ConsoleDraw->CursorX++; } + /* FIXME: remove */ { ConsoleDraw->Y++; ConsoleDraw->CursorY++; } + DPRINT1("%lu %lu %lu %lu\n", + ConsoleDraw->X, ConsoleDraw->Y, + ConsoleDraw->SizeX, ConsoleDraw->SizeY); + ASSERT(ConsoleDraw->X >= 1); + ASSERT(ConsoleDraw->Y >= 1); + ASSERT(ConsoleDraw->X <= DeviceExtension->Columns); + ASSERT(ConsoleDraw->Y <= DeviceExtension->Rows); + ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX >= 1); + ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY >= 1); + ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX - 1 <= DeviceExtension->Columns); + ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY - 1 <= DeviceExtension->Rows); + ASSERT(ConsoleDraw->CursorX >= 1); + ASSERT(ConsoleDraw->CursorY >= 1); + ASSERT(ConsoleDraw->CursorX <= DeviceExtension->Columns); + ASSERT(ConsoleDraw->CursorY <= DeviceExtension->Rows); + +#if 0 + if (ConsoleDraw->X == 1 + && ConsoleDraw->Y == 1 + && ConsoleDraw->SizeX == DeviceExtension->Columns + && ConsoleDraw->SizeY == DeviceExtension->Rows) + { + CHECKPOINT1; + /* search if we need to clear all screen */ + DoOptimization = TRUE; + Video = (PUCHAR)(ConsoleDraw + 1); + x = 0; + while (DoOptimization && x < DeviceExtension->Columns * DeviceExtension->Rows) + { + if (Video[x++] != ' ') + { + CHECKPOINT1; + DoOptimization = FALSE; + } + /*if (Video[x++] != DeviceExtension->CharAttribute) DoOptimization = FALSE; */ + } + if (DoOptimization) + { + CHECKPOINT1; + AddToSendBuffer(DeviceExtension, 4, ESC, '[', '2', 'J'); + } + } +#endif + /* add here more optimizations if needed */ + + if (!DoOptimization) + { + for (y = 0; y < ConsoleDraw->SizeY; y++) + { + AddToSendBuffer(DeviceExtension, 6, ESC, '[', + -(int)(ConsoleDraw->Y + y), ';', + -(int)(ConsoleDraw->X), 'H'); + Video = (PUCHAR)(ConsoleDraw + 1); + Video = &Video[((ConsoleDraw->Y + y) * DeviceExtension->Columns + ConsoleDraw->X) * 2]; + for (x = 0; x < ConsoleDraw->SizeX; x++) + { + AddToSendBuffer(DeviceExtension, 1, Video[x * 2]); + } + } + } + + DeviceExtension->LogicalOffset = ( + (ConsoleDraw->CursorY-1) * DeviceExtension->Columns + + (ConsoleDraw->CursorX-1)) * 2; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', + -(int)(ConsoleDraw->CursorY), ';', + -(int)(ConsoleDraw->CursorX), 'H'); + + /* flush buffer */ + AddToSendBuffer(DeviceExtension, 0); + + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } + default: + DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / unknown ioctl code 0x%lx\n", + Stack->Parameters.DeviceIoControl.IoControlCode); + Status = STATUS_NOT_IMPLEMENTED; + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return Status; +} diff --git a/reactos/drivers/dd/sdisk/makefile b/reactos/drivers/dd/sdisk/makefile deleted file mode 100644 index ed9697b50a4..00000000000 --- a/reactos/drivers/dd/sdisk/makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = driver - -TARGET_NAME = sdisk - -TARGET_OBJECTS = sdisk.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/dd/sdisk/sdisk.c b/reactos/drivers/dd/sdisk/sdisk.c deleted file mode 100644 index d9635ffc515..00000000000 --- a/reactos/drivers/dd/sdisk/sdisk.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: services/sdisk/sdisk.c - * PURPOSE: Disk driver for Bochs - * PROGRAMMER: David Welch (welch@mcmail.com) - * UPDATE HISTORY: - */ - -/* INCLUDES ****************************************************************/ - -#include -#include - -#define NDEBUG -#include - -/* FUNCTIONS **************************************************************/ - -#define PORT (0x3ec) - -static VOID SdWriteOffset(ULONG Offset) -{ - outl_p(PORT,Offset); -} - -NTSTATUS STDCALL -Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) -/* - * FUNCTION: Handles user mode requests - * ARGUMENTS: - * DeviceObject = Device for request - * Irp = I/O request packet describing request - * RETURNS: Success or failure - */ -{ - PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS status; - int i; - PCH Buffer; - ULONG Length; - ULONG Information = 0; - - switch (Stack->MajorFunction) - { - case IRP_MJ_CREATE: - DPRINT("Creating\n",0); - status = STATUS_SUCCESS; - break; - - case IRP_MJ_CLOSE: - status = STATUS_SUCCESS; - break; - - case IRP_MJ_WRITE: - DPRINT("Writing %d bytes\n", - Stack->Parameters.Write.Length); - Length = Stack->Parameters.Write.Length; - if ((Length%512)>0) - { - Length = Length - (Length%512); - } - Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); - DPRINT("Buffer %x\n",Buffer); - #if 0 - for (i=0;iParameters.Write.ByteOffset.LowPart+i); - SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i); - } - outb_p(PORT,Buffer[i]); - DbgPrint("%c",Buffer[i]); - } - #endif - for (i=0;i<(Length/512);i++) - { - DPRINT("Offset %x\n", - Stack->Parameters.Write.ByteOffset.LowPart+i); - SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i); - outsb(PORT,Buffer,512); - } - status = STATUS_SUCCESS; - Information = Length; - break; - - case IRP_MJ_READ: - DPRINT("Reading %d bytes\n", - Stack->Parameters.Write.Length); - Length = Stack->Parameters.Write.Length; - if ((Length%512)>0) - { - Length = Length - (Length%512); - } - Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); - for (i=0;iParameters.Write.ByteOffset.LowPart+i); - SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i); - } - Buffer[i]=inb_p(PORT); - } - status = STATUS_SUCCESS; - break; - - default: - status = STATUS_NOT_IMPLEMENTED; - break; - } - - Irp->IoStatus.Status = status; - Irp->IoStatus.Information = Information; - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return(status); -} - -NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) -/* - * FUNCTION: Called by the system to initalize the driver - * ARGUMENTS: - * DriverObject = object describing this driver - * RegistryPath = path to our configuration entries - * RETURNS: Success or failure - */ -{ - PDEVICE_OBJECT DeviceObject; - NTSTATUS ret; - ANSI_STRING astr; - UNICODE_STRING ustr; - ANSI_STRING asymlink; - UNICODE_STRING usymlink; - - DbgPrint("Simple Disk Driver 0.0.1\n"); - - RtlInitAnsiString(&astr,"\\Device\\SDisk"); - RtlAnsiStringToUnicodeString(&ustr,&astr,TRUE); - ret = IoCreateDevice(DriverObject,0,&ustr, - FILE_DEVICE_DISK,0,FALSE,&DeviceObject); - if (ret!=STATUS_SUCCESS) - { - return(ret); - } - - RtlInitAnsiString(&asymlink,"\\??\\C:"); - RtlAnsiStringToUnicodeString(&usymlink,&asymlink,TRUE); - IoCreateSymbolicLink(&usymlink,&ustr); - - DeviceObject->Flags=DO_DIRECT_IO; - DriverObject->MajorFunction[IRP_MJ_CLOSE] = Dispatch; - DriverObject->MajorFunction[IRP_MJ_CREATE] = Dispatch; - DriverObject->MajorFunction[IRP_MJ_READ] = Dispatch; - DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch; - DriverObject->DriverUnload = NULL; - - return(STATUS_SUCCESS); -} - diff --git a/reactos/drivers/dd/serial/circularbuffer.c b/reactos/drivers/dd/serial/circularbuffer.c index 31c9cc22cf5..521f0ab3b89 100644 --- a/reactos/drivers/dd/serial/circularbuffer.c +++ b/reactos/drivers/dd/serial/circularbuffer.c @@ -17,6 +17,7 @@ InitializeCircularBuffer( IN ULONG BufferSize) { DPRINT("Serial: InitializeCircularBuffer(pBuffer %p, BufferSize %lu)\n", pBuffer, BufferSize); + ASSERT(pBuffer); pBuffer->Buffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, BufferSize * sizeof(UCHAR), SERIAL_TAG); if (!pBuffer->Buffer) return STATUS_INSUFFICIENT_RESOURCES; @@ -30,6 +31,7 @@ FreeCircularBuffer( IN PCIRCULAR_BUFFER pBuffer) { DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer); + ASSERT(pBuffer); ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG); return STATUS_SUCCESS; } @@ -39,6 +41,7 @@ IsCircularBufferEmpty( IN PCIRCULAR_BUFFER pBuffer) { DPRINT("Serial: IsCircularBufferEmpty(pBuffer %p)\n", pBuffer); + ASSERT(pBuffer); return (pBuffer->ReadPosition == pBuffer->WritePosition); } @@ -49,6 +52,7 @@ PushCircularBufferEntry( { ULONG NextPosition; DPRINT("Serial: PushCircularBufferEntry(pBuffer %p, Entry 0x%x)\n", pBuffer, Entry); + ASSERT(pBuffer); ASSERT(pBuffer->Length); NextPosition = (pBuffer->WritePosition + 1) % pBuffer->Length; if (NextPosition == pBuffer->ReadPosition) @@ -64,6 +68,7 @@ PopCircularBufferEntry( OUT PUCHAR Entry) { DPRINT("Serial: PopCircularBufferEntry(pBuffer %p)\n", pBuffer); + ASSERT(pBuffer); ASSERT(pBuffer->Length); if (IsCircularBufferEmpty(pBuffer)) return STATUS_ARRAY_BOUNDS_EXCEEDED; @@ -80,6 +85,7 @@ IncreaseCircularBufferSize( PUCHAR NewBuffer; DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize); + ASSERT(pBuffer); ASSERT(pBuffer->Length); if (pBuffer->Length > NewBufferSize) return STATUS_INVALID_PARAMETER; diff --git a/reactos/drivers/dd/serial/create.c b/reactos/drivers/dd/serial/create.c index e823916ca7b..3757bc9338e 100644 --- a/reactos/drivers/dd/serial/create.c +++ b/reactos/drivers/dd/serial/create.c @@ -26,6 +26,8 @@ SerialCreate( FileObject = Stack->FileObject; DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + ASSERT(FileObject); + if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE) { CHECKPOINT; @@ -43,7 +45,7 @@ SerialCreate( if(DeviceExtension->IsOpened) { - DPRINT("Serial: COM%lu is already opened", DeviceExtension->ComPort); + DPRINT("Serial: COM%lu is already opened\n", DeviceExtension->ComPort); Status = STATUS_ACCESS_DENIED; goto ByeBye; } diff --git a/reactos/drivers/dd/serial/devctrl.c b/reactos/drivers/dd/serial/devctrl.c index 72e8a5158f0..2f0f83c09e6 100644 --- a/reactos/drivers/dd/serial/devctrl.c +++ b/reactos/drivers/dd/serial/devctrl.c @@ -20,10 +20,10 @@ SerialGetUserBuffers( OUT PVOID* BufferIn, OUT PVOID* BufferOut) { - ASSERT(Irp); - ASSERT(BufferIn); - ASSERT(BufferOut); - + ASSERT(Irp); + ASSERT(BufferIn); + ASSERT(BufferOut); + switch (IO_METHOD_FROM_CTL_CODE(IoControlCode)) { case METHOD_BUFFERED: @@ -118,6 +118,9 @@ SerialSetLineControl( UCHAR Lcr = 0; NTSTATUS Status; + ASSERT(DeviceExtension); + ASSERT(NewSettings); + DPRINT("Serial: SerialSetLineControl(COM%lu, Settings { %lu %lu %lu })\n", DeviceExtension->ComPort, NewSettings->StopBits, NewSettings->Parity, NewSettings->WordLength); @@ -184,6 +187,8 @@ BOOLEAN SerialClearPerfStats( IN PSERIAL_DEVICE_EXTENSION DeviceExtension) { + ASSERT(DeviceExtension); + RtlZeroMemory(&DeviceExtension->SerialPerfStats, sizeof(SERIALPERF_STATS)); DeviceExtension->BreakInterruptErrorCount = 0; return TRUE; @@ -195,6 +200,7 @@ SerialGetPerfStats(IN PIRP pIrp) PSERIAL_DEVICE_EXTENSION pDeviceExtension; pDeviceExtension = (PSERIAL_DEVICE_EXTENSION) IoGetCurrentIrpStackLocation(pIrp)->DeviceObject->DeviceExtension; + ASSERT(pDeviceExtension); /* * we assume buffer is big enough to hold SerialPerfStats structure * caller must verify this @@ -212,6 +218,8 @@ SerialGetCommProp( OUT PSERIAL_COMMPROP pCommProp, IN PSERIAL_DEVICE_EXTENSION DeviceExtension) { + ASSERT(pCommProp); + RtlZeroMemory(pCommProp, sizeof(SERIAL_COMMPROP)); pCommProp->PacketLength = sizeof(SERIAL_COMMPROP); @@ -257,6 +265,7 @@ SerialGetCommStatus( { KIRQL Irql; + ASSERT(pSerialStatus); RtlZeroMemory(pSerialStatus, sizeof(SERIAL_STATUS)); pSerialStatus->Errors = 0; diff --git a/reactos/drivers/dd/serial/info.c b/reactos/drivers/dd/serial/info.c index 0b63deb794f..85fcee47283 100644 --- a/reactos/drivers/dd/serial/info.c +++ b/reactos/drivers/dd/serial/info.c @@ -37,12 +37,13 @@ SerialQueryInformation( DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FileStandardInformation\n"); if (BufferLength < sizeof(FILE_STANDARD_INFORMATION)) Status = STATUS_BUFFER_OVERFLOW; - else + else if (!StandardInfo) + Status = STATUS_INVALID_PARAMETER; { StandardInfo->AllocationSize.QuadPart = 0; StandardInfo->EndOfFile.QuadPart = 0; - StandardInfo->Directory = FALSE; - StandardInfo->NumberOfLinks = 0; + StandardInfo->Directory = FALSE; + StandardInfo->NumberOfLinks = 0; StandardInfo->DeletePending = FALSE; /* FIXME: should be TRUE sometimes */ Status = STATUS_SUCCESS; } @@ -52,9 +53,13 @@ SerialQueryInformation( { PFILE_POSITION_INFORMATION PositionInfo = (PFILE_POSITION_INFORMATION)SystemBuffer; + ASSERT(PositionInfo); + DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FilePositionInformation\n"); if (BufferLength < sizeof(PFILE_POSITION_INFORMATION)) Status = STATUS_BUFFER_OVERFLOW; + else if (!PositionInfo) + Status = STATUS_INVALID_PARAMETER; else { PositionInfo->CurrentByteOffset.QuadPart = 0; diff --git a/reactos/drivers/dd/serial/misc.c b/reactos/drivers/dd/serial/misc.c index 04c2205dccc..8e730bc4904 100644 --- a/reactos/drivers/dd/serial/misc.c +++ b/reactos/drivers/dd/serial/misc.c @@ -32,6 +32,8 @@ ForwardIrpAndWait( KEVENT Event; NTSTATUS Status; + ASSERT(LowerDevice); + KeInitializeEvent(&Event, NotificationEvent, FALSE); IoCopyCurrentIrpStackLocationToNext(Irp); @@ -56,6 +58,8 @@ ForwardIrpAndForget( { PDEVICE_OBJECT LowerDevice = ((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice; + ASSERT(LowerDevice); + IoSkipCurrentIrpStackLocation(Irp); return IoCallDriver(LowerDevice, Irp); } @@ -126,11 +130,13 @@ SerialSendByte( DeviceExtension->ComPort, Byte); DeviceExtension->SerialPerfStats.TransmittedCount++; } + if (!IsCircularBufferEmpty(&DeviceExtension->OutputBuffer)) + { + /* allow new interrupts */ + IER = READ_PORT_UCHAR(SER_IER(ComPortBase)); + WRITE_PORT_UCHAR(SER_IER(ComPortBase), IER | SR_IER_THR_EMPTY); + } KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql); - - /* allow new interrupts */ - IER = READ_PORT_UCHAR(SER_IER(ComPortBase)); - WRITE_PORT_UCHAR(SER_IER(ComPortBase), IER | SR_IER_THR_EMPTY); } BOOLEAN STDCALL diff --git a/reactos/drivers/dd/serial/pnp.c b/reactos/drivers/dd/serial/pnp.c index 211f7ae4386..04e08f1af38 100644 --- a/reactos/drivers/dd/serial/pnp.c +++ b/reactos/drivers/dd/serial/pnp.c @@ -26,12 +26,14 @@ SerialAddDeviceInternal( NTSTATUS Status; WCHAR DeviceNameBuffer[32]; UNICODE_STRING DeviceName; - //UNICODE_STRING SymbolicLinkName; static ULONG DeviceNumber = 0; static ULONG ComPortNumber = 1; - + DPRINT("Serial: SerialAddDeviceInternal called\n"); - + + ASSERT(DriverObject); + ASSERT(Pdo); + /* Create new device object */ swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceNumber); RtlInitUnicodeString(&DeviceName, DeviceNameBuffer); @@ -52,23 +54,13 @@ SerialAddDeviceInternal( RtlZeroMemory(DeviceExtension, sizeof(SERIAL_DEVICE_EXTENSION)); /* Register device interface */ -#if 0 /* FIXME: activate */ - Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &SymbolicLinkName); + Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &DeviceExtension->SerialInterfaceName); if (!NT_SUCCESS(Status)) { DPRINT("Serial: IoRegisterDeviceInterface() failed with status 0x%08x\n", Status); goto ByeBye; } - DPRINT1("Serial: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName); - Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE); - if (!NT_SUCCESS(Status)) - { - DPRINT("Serial: IoSetDeviceInterfaceState() failed with status 0x%08x\n", Status); - goto ByeBye; - } - RtlFreeUnicodeString(&SymbolicLinkName); -#endif - + DeviceExtension->SerialPortNumber = DeviceNumber++; if (pComPortNumber == NULL) DeviceExtension->ComPort = ComPortNumber++; @@ -125,12 +117,10 @@ SerialAddDevice( if (Pdo == NULL) return STATUS_SUCCESS; - /* We have here a PDO that does not correspond to a legacy - * serial port. So call the internal AddDevice function. + /* We have here a PDO not null. It represents a real serial + * port. So call the internal AddDevice function. */ return SerialAddDeviceInternal(DriverObject, Pdo, UartUnknown, NULL, NULL); - - } NTSTATUS STDCALL @@ -160,6 +150,8 @@ SerialPnpStartDevice( DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + ASSERT(ResourceList); + ASSERT(DeviceExtension); ASSERT(DeviceExtension->PnpState == dsStopped); DeviceExtension->BaudRate = 19200 | SERIAL_BAUD_USER; @@ -251,6 +243,15 @@ SerialPnpStartDevice( return Status; } + /* Activate serial interface */ + Status = IoSetDeviceInterfaceState(&DeviceExtension->SerialInterfaceName, TRUE); + if (!NT_SUCCESS(Status)) + { + DPRINT("Serial: IoSetDeviceInterfaceState() failed with status 0x%08x\n", Status); + IoDeleteSymbolicLink(&LinkName); + return Status; + } + /* Connect interrupt and enable them */ Status = IoConnectInterrupt( &DeviceExtension->Interrupt, SerialInterruptService, @@ -261,6 +262,7 @@ SerialPnpStartDevice( if (!NT_SUCCESS(Status)) { DPRINT("Serial: IoConnectInterrupt() failed with status 0x%08x\n", Status); + IoSetDeviceInterfaceState(&DeviceExtension->SerialInterfaceName, FALSE); IoDeleteSymbolicLink(&LinkName); return Status; } @@ -363,6 +365,7 @@ SerialPnp( IoAcquireRemoveLock IoReleaseRemoveLockAndWait pass request to DeviceExtension-LowerDriver + disable interface IoDeleteDevice(Fdo) and/or IoDetachDevice break; }*/ diff --git a/reactos/drivers/dd/serial/rw.c b/reactos/drivers/dd/serial/rw.c index f58b4f2bfc4..38c1735d533 100644 --- a/reactos/drivers/dd/serial/rw.c +++ b/reactos/drivers/dd/serial/rw.c @@ -37,6 +37,9 @@ ReadBytes( ULONG_PTR Information = 0; NTSTATUS Status; + ASSERT(DeviceObject); + ASSERT(WorkItemData); + DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension; ComPortBase = (PUCHAR)DeviceExtension->BaseAddress; Length = IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length; @@ -285,9 +288,19 @@ SerialWrite( Status = PushCircularBufferEntry(&DeviceExtension->OutputBuffer, Buffer[Information]); if (!NT_SUCCESS(Status)) { - DPRINT("Serial: buffer overrun on COM%lu\n", DeviceExtension->ComPort); - DeviceExtension->SerialPerfStats.BufferOverrunErrorCount++; - break; + if (Status == STATUS_BUFFER_TOO_SMALL) + { + KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql); + SerialSendByte(NULL, DeviceExtension, NULL, NULL); + KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql); + continue; + } + else + { + DPRINT("Serial: buffer overrun on COM%lu\n", DeviceExtension->ComPort); + DeviceExtension->SerialPerfStats.BufferOverrunErrorCount++; + break; + } } Information++; } diff --git a/reactos/drivers/dd/serial/serial.c b/reactos/drivers/dd/serial/serial.c index 7d66d153ca9..937af1bb94e 100644 --- a/reactos/drivers/dd/serial/serial.c +++ b/reactos/drivers/dd/serial/serial.c @@ -26,7 +26,6 @@ DriverEntry( IN PUNICODE_STRING RegPath) { ULONG i; - static BOOLEAN FirstTime = TRUE; DriverObject->DriverUnload = DriverUnload; DriverObject->DriverExtension->AddDevice = SerialAddDevice; @@ -43,16 +42,5 @@ DriverEntry( DriverObject->MajorFunction[IRP_MJ_PNP] = SerialPnp; DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower; - /* FIXME: It seems that DriverEntry function may be called more - * than once. Do only legacy detection the first time. */ - if (FirstTime) - { - FirstTime = FALSE; - return DetectLegacyDevices(DriverObject); - } - else - { - DPRINT1("Serial: DriverEntry called for the second time!\n"); - return STATUS_SUCCESS; - } + return DetectLegacyDevices(DriverObject); } diff --git a/reactos/drivers/dd/serial/serial.h b/reactos/drivers/dd/serial/serial.h index a57afe46dd3..6e22e1bf4a2 100644 --- a/reactos/drivers/dd/serial/serial.h +++ b/reactos/drivers/dd/serial/serial.h @@ -100,6 +100,8 @@ typedef struct _SERIAL_DEVICE_EXTENSION CIRCULAR_BUFFER OutputBuffer; KSPIN_LOCK OutputBufferLock; + UNICODE_STRING SerialInterfaceName; + /* Current values */ UCHAR MCR; /* Base+4, Modem Control Register */ UCHAR MSR; /* Base+6, Modem Status Register */ diff --git a/reactos/drivers/fs/ms/create.c b/reactos/drivers/fs/ms/create.c index 66e1a2c6508..6a317edabd6 100644 --- a/reactos/drivers/fs/ms/create.c +++ b/reactos/drivers/fs/ms/create.c @@ -28,7 +28,7 @@ MsfsCreate(PDEVICE_OBJECT DeviceObject, PMSFS_DEVICE_EXTENSION DeviceExtension; PMSFS_MAILSLOT Mailslot; PMSFS_FCB Fcb; - PMSFS_MAILSLOT current; + PMSFS_MAILSLOT current = NULL; PLIST_ENTRY current_entry; KIRQL oldIrql; diff --git a/reactos/drivers/fs/np/fsctrl.c b/reactos/drivers/fs/np/fsctrl.c index 1413589d5a1..9c880a973b5 100644 --- a/reactos/drivers/fs/np/fsctrl.c +++ b/reactos/drivers/fs/np/fsctrl.c @@ -351,6 +351,8 @@ NpfsGetState(PIRP Irp, Reply->OutBufferSize = Pipe->OutboundQuota; Reply->Timeout = Pipe->TimeOut; + Irp->IoStatus.Information = sizeof(NPFS_GET_STATE); + DPRINT("Status (0x%X).\n", STATUS_SUCCESS); return STATUS_SUCCESS; @@ -463,6 +465,8 @@ NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject, DPRINT("Pipe: %p\n", Pipe); DPRINT("PipeName: %wZ\n", &Pipe->PipeName); + Irp->IoStatus.Information = 0; + switch (IoStack->Parameters.FileSystemControl.FsControlCode) { case FSCTL_PIPE_ASSIGN_EVENT: @@ -553,7 +557,6 @@ NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject, if (Status != STATUS_PENDING) { Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); } diff --git a/reactos/drivers/fs/vfat/fsctl.c b/reactos/drivers/fs/vfat/fsctl.c index 2e13e7084ee..1ca040bbd8d 100644 --- a/reactos/drivers/fs/vfat/fsctl.c +++ b/reactos/drivers/fs/vfat/fsctl.c @@ -373,6 +373,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext) UNICODE_STRING NameU = RTL_CONSTANT_STRING(L"\\$$Fat$$"); UNICODE_STRING VolumeNameU = RTL_CONSTANT_STRING(L"\\$$Volume$$"); ULONG HashTableSize; + ULONG eocMark; FATINFO FatInfo; DPRINT("VfatMount(IrpContext %x)\n", IrpContext); @@ -460,6 +461,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext) DeviceExt->GetNextCluster = FAT12GetNextCluster; DeviceExt->FindAndMarkAvailableCluster = FAT12FindAndMarkAvailableCluster; DeviceExt->WriteCluster = FAT12WriteCluster; + DeviceExt->CleanShutBitMask = 0; break; case FAT16: @@ -467,6 +469,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext) DeviceExt->GetNextCluster = FAT16GetNextCluster; DeviceExt->FindAndMarkAvailableCluster = FAT16FindAndMarkAvailableCluster; DeviceExt->WriteCluster = FAT16WriteCluster; + DeviceExt->CleanShutBitMask = 0x8000; break; case FAT32: @@ -474,6 +477,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext) DeviceExt->GetNextCluster = FAT32GetNextCluster; DeviceExt->FindAndMarkAvailableCluster = FAT32FindAndMarkAvailableCluster; DeviceExt->WriteCluster = FAT32WriteCluster; + DeviceExt->CleanShutBitMask = 0x80000000; break; } @@ -576,6 +580,20 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext) /* read volume label */ ReadVolumeLabel(DeviceExt, DeviceObject->Vpb); + + /* read clean shutdown bit status */ + Status = GetNextCluster(DeviceExt, 1, &eocMark); + if (NT_SUCCESS(Status)) + { + if (eocMark & DeviceExt->CleanShutBitMask) + { + /* unset clean shutdown bit */ + eocMark &= ~DeviceExt->CleanShutBitMask; + WriteCluster(DeviceExt, 1, eocMark); + VolumeFcb->Flags |= VCB_CLEAR_DIRTY; + } + } + VolumeFcb->Flags |= VCB_IS_DIRTY; Status = STATUS_SUCCESS; ByeBye: @@ -787,6 +805,56 @@ VfatRosQueryLcnMapping(PVFAT_IRP_CONTEXT IrpContext) } #endif +static NTSTATUS +VfatIsVolumeDirty(PVFAT_IRP_CONTEXT IrpContext) +{ + PULONG Flags; + + DPRINT("VfatIsVolumeDirty(IrpContext %x)\n", IrpContext); + + if (IrpContext->Stack->Parameters.FileSystemControl.OutputBufferLength != sizeof(ULONG)) + return STATUS_INVALID_BUFFER_SIZE; + else if (!IrpContext->Irp->AssociatedIrp.SystemBuffer) + return STATUS_INVALID_USER_BUFFER; + + Flags = (PULONG)IrpContext->Irp->AssociatedIrp.SystemBuffer; + *Flags = 0; + + if (IrpContext->DeviceExt->VolumeFcb->Flags & VCB_IS_DIRTY + && !(IrpContext->DeviceExt->VolumeFcb->Flags & VCB_CLEAR_DIRTY)) + { + *Flags |= VOLUME_IS_DIRTY; + } + + return STATUS_SUCCESS; +} + +static NTSTATUS +VfatMarkVolumeDirty(PVFAT_IRP_CONTEXT IrpContext) +{ + ULONG eocMark; + PDEVICE_EXTENSION DeviceExt; + NTSTATUS Status = STATUS_SUCCESS; + + DPRINT("VfatMarkVolumeDirty(IrpContext %x)\n", IrpContext); + DeviceExt = IrpContext->DeviceExt; + + if (!(DeviceExt->VolumeFcb->Flags & VCB_IS_DIRTY)) + { + Status = GetNextCluster(DeviceExt, 1, &eocMark); + if (NT_SUCCESS(Status)) + { + /* unset clean shutdown bit */ + eocMark &= ~DeviceExt->CleanShutBitMask; + Status = WriteCluster(DeviceExt, 1, eocMark); + } + } + + DeviceExt->VolumeFcb->Flags &= ~VCB_CLEAR_DIRTY; + + return Status; +} + NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext) /* * FUNCTION: File system control @@ -822,6 +890,12 @@ NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext) Status = VfatRosQueryLcnMapping(IrpContext); break; #endif + case FSCTL_IS_VOLUME_DIRTY: + Status = VfatIsVolumeDirty(IrpContext); + break; + case FSCTL_MARK_VOLUME_DIRTY: + Status = VfatMarkVolumeDirty(IrpContext); + break; default: Status = STATUS_INVALID_DEVICE_REQUEST; } diff --git a/reactos/drivers/fs/vfat/shutdown.c b/reactos/drivers/fs/vfat/shutdown.c index 9feaeaa97fc..a5db8e3ca52 100644 --- a/reactos/drivers/fs/vfat/shutdown.c +++ b/reactos/drivers/fs/vfat/shutdown.c @@ -48,6 +48,7 @@ VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp) NTSTATUS Status; PLIST_ENTRY ListEntry; PDEVICE_EXTENSION DeviceExt; + ULONG eocMark; DPRINT("VfatShutdown(DeviceObject %x, Irp %x)\n",DeviceObject, Irp); @@ -64,6 +65,17 @@ VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp) ListEntry = ListEntry->Flink; ExAcquireResourceExclusiveLite(&DeviceExt->DirResource, TRUE); + if (DeviceExt->VolumeFcb->Flags & VCB_CLEAR_DIRTY) + { + /* set clean shutdown bit */ + Status = GetNextCluster(DeviceExt, 1, &eocMark); + if (NT_SUCCESS(Status)) + { + eocMark |= DeviceExt->CleanShutBitMask; + if (NT_SUCCESS(WriteCluster(DeviceExt, 1, eocMark))) + DeviceExt->VolumeFcb->Flags &= ~VCB_IS_DIRTY; + } + } Status = VfatFlushVolume(DeviceExt, DeviceExt->VolumeFcb); if (NT_SUCCESS(Status)) { diff --git a/reactos/drivers/fs/vfat/vfat.h b/reactos/drivers/fs/vfat/vfat.h index 37a6d017efa..a69876d04ac 100644 --- a/reactos/drivers/fs/vfat/vfat.h +++ b/reactos/drivers/fs/vfat/vfat.h @@ -13,6 +13,7 @@ NTSTATUS NTAPI RtlOemStringToUnicodeString(PUNICODE_STRING, CONST STRING *, BOOL NTSTATUS NTAPI RtlDowncaseUnicodeString(PUNICODE_STRING, PCUNICODE_STRING, BOOLEAN); NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING, PCUNICODE_STRING, BOOLEAN); #undef DeleteFile /* FIXME */ +#define VOLUME_IS_DIRTY 0x00000001 /* FIXME */ #endif #ifdef USE_ROS_CC_AND_FS @@ -193,6 +194,8 @@ typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY; #define VCB_VOLUME_LOCKED 0x0001 #define VCB_DISMOUNT_PENDING 0x0002 #define VCB_IS_FATX 0x0004 +#define VCB_IS_DIRTY 0x4000 /* Volume is dirty */ +#define VCB_CLEAR_DIRTY 0x8000 /* Clean dirty flag at shutdown */ typedef struct { @@ -257,6 +260,7 @@ typedef struct DEVICE_EXTENSION PGET_NEXT_CLUSTER GetNextCluster; PFIND_AND_MARK_AVAILABLE_CLUSTER FindAndMarkAvailableCluster; PWRITE_CLUSTER WriteCluster; + ULONG CleanShutBitMask; /* Pointers to functions for manipulating directory entries. */ PGET_NEXT_DIR_ENTRY GetNextDirEntry; diff --git a/reactos/drivers/input/Makefile b/reactos/drivers/input/Makefile index 5e4fd073a87..47a03a5c67e 100644 --- a/reactos/drivers/input/Makefile +++ b/reactos/drivers/input/Makefile @@ -6,7 +6,7 @@ PATH_TO_TOP = ../.. include $(PATH_TO_TOP)/rules.mak -DRIVERS = keyboard mouclass psaux sermouse +DRIVERS = mouclass sermouse i8042prt kbdclass all: $(DRIVERS) diff --git a/reactos/drivers/input/directory.xml b/reactos/drivers/input/directory.xml index 19e345a5aee..b4a50d073e3 100644 --- a/reactos/drivers/input/directory.xml +++ b/reactos/drivers/input/directory.xml @@ -1,12 +1,12 @@ - - + + + + + - - - diff --git a/reactos/drivers/input/i8042prt/README.txt b/reactos/drivers/input/i8042prt/README.txt new file mode 100644 index 00000000000..a8f09ff5f59 --- /dev/null +++ b/reactos/drivers/input/i8042prt/README.txt @@ -0,0 +1,83 @@ +Intel 8042 port driver + +This directory contains a driver for Intels 8042 and compatible controllers. +It is based on the information in the DDK documentation on MSDN. It is intended +to be compatible with keyboard and mouse drivers written for Windows. It is +not based on the i8042prt example driver that's included with the DDK. + +The directory contains these files: + +i8042prt.c: Main controller functionality, things shared by keyboards and mice + +keyboard.c: keyboard functionality: detection, interrupt handling + +mouse.c: mouse functionality: detection, interrupt handling, packet parsing for + standard ps2 and microsoft mice + +ps2pp.c: logitech ps2++ mouse packat parsing (basic) + +registry.c: registry reading + +makefile, i8042prt.rc: obvious + + +Some parts of the driver make little sense. This is because it implements +an interface that has evolved over a long time, and because the ps/2 +'standard' is really awful. + +Things to add: + +- Better AT (before ps2) keyboard handling +- SiS keyboard controller detection +- Mouse identification +- General robustness: reset mouse if things go wrong +- Handling all registry settings +- ACPI +- Make it work more like a WDM driver + +Things not to add: + +- Other mouse protocols, touchpad handling etc. : Write a filter driver instead +- Keyboard lights handling: Should be in win32k +- Keyboard scancode translation: Should be in win32k + +Things requiring work elsewhere: + +- Debugger interface (TAB + key): + Currently this interface wants translated keycodes, which are not + implemented by this driver. As it just uses a giant switch with + hardcoded cases, this should not be hard to fix. + +- Class drivers: + I wrote a keyboard class driver, which does keycode translations. It + should not do this, win32k should get untranslated keycodes and do + the translation itself. + + I changed the mouse class driver (mouclass) to work like Microsofts mouclass. + Unfortunately this means that the original psaux driver doesn't work + anymore (the same holds for the other mice drivers, probably). + + The keyboard class driver passes on ioctls from win32k, so it can change + keyboard settings. As far as I could see, the mouse class driver does not + do this yet. + + The class drivers should be able to handle reads for more than one packet + at a time (kbdclass should, mouclass does not). Win32k should send such + requests. + + +I put a lot of work in making it work like Microsofts driver does, so third party drivers can work. Please keep it that way. + + +Links: + +Here's a link describing most of the registry settings: + +http://www.microsoft.com/resources/documentation/Windows/2000/server/reskit/en-us/Default.asp?url=/resources/documentation/Windows/2000/server/reskit/en-us/regentry/31493.asp + +PS/2 protocol documentation: + +http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html + +It also contains a link to a description of the ps2++ protocol, which has +since disappeared. Archive.org still has it. diff --git a/reactos/drivers/input/i8042prt/i8042prt.c b/reactos/drivers/input/i8042prt/i8042prt.c new file mode 100644 index 00000000000..0e6455f5be9 --- /dev/null +++ b/reactos/drivers/input/i8042prt/i8042prt.c @@ -0,0 +1,818 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/input/i8042prt/i8042prt.c + * PURPOSE: i8042 (ps/2 keyboard-mouse controller) driver + * PROGRAMMER: Victor Kirhenshtein (sauros@iname.com) + * Jason Filby (jasonfilby@yahoo.com) + * Tinus + */ + +/* INCLUDES ****************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#define NDEBUG +#include + +#include "i8042prt.h" + +/* GLOBALS *******************************************************************/ + +/* + * Driver data + */ +#define I8042_TIMEOUT 500000 + +#define I8042_MAX_COMMAND_LENGTH 16 +#define I8042_MAX_UPWARDS_STACK 5 + +/* FUNCTIONS *****************************************************************/ + +/* + * FUNCTION: Write data to a port, waiting first for it to become ready + */ +BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, int addr, BYTE data) +{ + ULONG ResendIterations = DevExt->Settings.PollingIterations; + + while ((KBD_IBF & READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT)) && + (ResendIterations--)) + { + KeStallExecutionProcessor(50); + } + + if (ResendIterations) { + WRITE_PORT_UCHAR((PUCHAR)addr,data); + DPRINT("Sent %x to %x\n", data, addr); + return TRUE; + } + return FALSE; +} + +#if 0 /* function is not needed */ +/* + * FUNCTION: Write data to a port, without waiting first + */ +static BOOLEAN I8042WriteNoWait(PDEVICE_EXTENSION DevExt, int addr, BYTE data) +{ + WRITE_PORT_UCHAR((PUCHAR)addr,data); + DPRINT("Sent %x to %x\n", data, addr); + return TRUE; +} +#endif + +/* + * FUNCTION: Read data from port 0x60 + */ +NTSTATUS I8042ReadData(BYTE *Data) +{ + BYTE Status; + Status=READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT); + + // If data is available + if ((Status & KBD_OBF)) { + Data[0]=READ_PORT_UCHAR((PUCHAR)I8042_DATA_PORT); + DPRINT("Read: %x (status: %x)\n", Data[0], Status); + + // If the data is valid (not timeout, not parity error) + if (0 == (Status & (KBD_GTO | KBD_PERR))) + return STATUS_SUCCESS; + } + return STATUS_UNSUCCESSFUL; +} + +NTSTATUS I8042ReadStatus(BYTE *Status) +{ + Status[0]=READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT); + return STATUS_SUCCESS; +} + +/* + * FUNCTION: Read data from port 0x60 + */ +NTSTATUS I8042ReadDataWait(PDEVICE_EXTENSION DevExt, BYTE *Data) +{ + ULONG Counter = DevExt->Settings.PollingIterations; + NTSTATUS Status; + + while (Counter--) { + Status = I8042ReadData(Data); + + if (STATUS_SUCCESS == Status) + return Status; + + KeStallExecutionProcessor(50); + } + // Timed out + return STATUS_IO_TIMEOUT; +} + +VOID I8042Flush() +{ + BYTE Ignore; + + while (STATUS_SUCCESS == I8042ReadData(&Ignore)) { + ; /* drop */ + } +} + +VOID STDCALL I8042IsrWritePort(PDEVICE_EXTENSION DevExt, + UCHAR Value, + UCHAR SelectCmd) +{ + if (SelectCmd) + if (!I8042Write(DevExt, I8042_CTRL_PORT, SelectCmd)) + return; + + I8042Write(DevExt, I8042_DATA_PORT, Value); +} + +/* + * These functions are callbacks for filter driver custom + * initialization routines. + */ +NTSTATUS STDCALL I8042SynchWritePort(PDEVICE_EXTENSION DevExt, + UCHAR Port, + UCHAR Value, + BOOLEAN WaitForAck) +{ + NTSTATUS Status; + UCHAR Ack; + UINT ResendIterations = DevExt->Settings.ResendIterations + 1; + + do { + if (Port) + if (!I8042Write(DevExt, I8042_DATA_PORT, Port)) + return STATUS_TIMEOUT; + + if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) + return STATUS_TIMEOUT; + + if (WaitForAck) { + Status = I8042ReadDataWait(DevExt, &Ack); + if (Status != STATUS_SUCCESS) + return Status; + if (Ack == KBD_ACK) + return STATUS_SUCCESS; + if (Ack != KBD_RESEND) + return STATUS_UNEXPECTED_IO_ERROR; + } else { + return STATUS_SUCCESS; + } + ResendIterations--; + } while (ResendIterations); + return STATUS_TIMEOUT; +} + +/* + * This one reads a value from the port; You don't have to specify + * which one, it'll always be from the one you talked to, so one function + * is enough this time. Note how MSDN specifies the + * WaitForAck parameter to be ignored. + */ +static NTSTATUS STDCALL I8042SynchReadPort(PVOID Context, + PUCHAR Value, + BOOLEAN WaitForAck) +{ + PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION)Context; + + return I8042ReadDataWait(DevExt, Value); +} + +/* Write the current byte of the packet. Returns FALSE in case + * of problems. + */ +static BOOLEAN STDCALL I8042PacketWrite(PDEVICE_EXTENSION DevExt) +{ + UCHAR Port = DevExt->PacketPort; + + if (Port) { + if (!I8042Write(DevExt, + I8042_CTRL_PORT, + Port)) { + /* something is really wrong! */ + DPRINT1("Failed to send packet byte!\n"); + return FALSE; + } + } + + return I8042Write(DevExt, + I8042_DATA_PORT, + DevExt->Packet.Bytes[DevExt->Packet.CurrentByte]); +} + + +/* + * This function starts a packet. It must be called with the + * correct DIRQL. + */ +NTSTATUS STDCALL I8042StartPacket(PDEVICE_EXTENSION DevExt, + PDEVICE_OBJECT Device, + PUCHAR Bytes, + ULONG ByteCount, + PIRP Irp) +{ + KIRQL Irql; + NTSTATUS Status; + PFDO_DEVICE_EXTENSION FdoDevExt = Device->DeviceExtension; + + Irql = KeAcquireInterruptSpinLock(DevExt->HighestDIRQLInterrupt); + + DevExt->CurrentIrp = Irp; + DevExt->CurrentIrpDevice = Device; + + if (Idle != DevExt->Packet.State) { + Status = STATUS_DEVICE_BUSY; + goto startpacketdone; + } + + DevExt->Packet.Bytes = Bytes; + DevExt->Packet.CurrentByte = 0; + DevExt->Packet.ByteCount = ByteCount; + DevExt->Packet.State = SendingBytes; + DevExt->PacketResult = Status = STATUS_PENDING; + + if (Mouse == FdoDevExt->Type) + DevExt->PacketPort = 0xD4; + else + DevExt->PacketPort = 0; + + if (!I8042PacketWrite(DevExt)) { + Status = STATUS_TIMEOUT; + DevExt->Packet.State = Idle; + DevExt->PacketResult = STATUS_ABANDONED; + goto startpacketdone; + } + + DevExt->Packet.CurrentByte++; + +startpacketdone: + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, Irql); + + if (STATUS_PENDING != Status) { + DevExt->CurrentIrp = NULL; + DevExt->CurrentIrpDevice = NULL; + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + return Status; +} + +BOOLEAN STDCALL I8042PacketIsr(PDEVICE_EXTENSION DevExt, + UCHAR Output) +{ + if (Idle == DevExt->Packet.State) + return FALSE; + + switch (Output) { + case KBD_RESEND: + DevExt->PacketResends++; + if (DevExt->PacketResends > DevExt->Settings.ResendIterations) { + DevExt->Packet.State = Idle; + DevExt->PacketComplete = TRUE; + DevExt->PacketResult = STATUS_TIMEOUT; + DevExt->PacketResends = 0; + return TRUE; + } + DevExt->Packet.CurrentByte--; + break; + + case KBD_NACK: + DevExt->Packet.State = Idle; + DevExt->PacketComplete = TRUE; + DevExt->PacketResult = STATUS_UNEXPECTED_IO_ERROR; + DevExt->PacketResends = 0; + return TRUE; + + default: + DevExt->PacketResends = 0; + } + + if (DevExt->Packet.CurrentByte >= DevExt->Packet.ByteCount) { + DevExt->Packet.State = Idle; + DevExt->PacketComplete = TRUE; + DevExt->PacketResult = STATUS_SUCCESS; + return TRUE; + } + + if (!I8042PacketWrite(DevExt)) { + DevExt->Packet.State = Idle; + DevExt->PacketComplete = TRUE; + DevExt->PacketResult = STATUS_TIMEOUT; + return TRUE; + } + DevExt->Packet.CurrentByte++; + + return TRUE; +} + +VOID I8042PacketDpc(PDEVICE_EXTENSION DevExt) +{ + BOOL FinishIrp = FALSE; + NTSTATUS Result = STATUS_INTERNAL_ERROR; /* Shouldn't happen */ + KIRQL Irql; + + /* If the interrupt happens before this is setup, the key + * was already in the buffer. Too bad! */ + if (!DevExt->HighestDIRQLInterrupt) + return; + + Irql = KeAcquireInterruptSpinLock(DevExt->HighestDIRQLInterrupt); + + if (Idle == DevExt->Packet.State && + DevExt->PacketComplete) { + FinishIrp = TRUE; + Result = DevExt->PacketResult; + DevExt->PacketComplete = FALSE; + } + + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, + Irql); + + if (!FinishIrp) + return; + + if (DevExt->CurrentIrp) { + DevExt->CurrentIrp->IoStatus.Status = Result; + IoCompleteRequest(DevExt->CurrentIrp, IO_NO_INCREMENT); + IoStartNextPacket(DevExt->CurrentIrpDevice, FALSE); + DevExt->CurrentIrp = NULL; + DevExt->CurrentIrpDevice = NULL; + } +} + +VOID STDCALL I8042SendHookWorkItem(PDEVICE_OBJECT DeviceObject, + PVOID Context) +{ + KEVENT Event; + IO_STATUS_BLOCK IoStatus; + NTSTATUS Status; + PDEVICE_EXTENSION DevExt; + PFDO_DEVICE_EXTENSION FdoDevExt; + PIRP NewIrp; + PI8042_HOOK_WORKITEM WorkItemData = (PI8042_HOOK_WORKITEM)Context; + + ULONG IoControlCode; + PVOID InputBuffer; + ULONG InputBufferLength; + BOOLEAN IsKbd; + + DPRINT("HookWorkItem\n"); + + FdoDevExt = (PFDO_DEVICE_EXTENSION) + DeviceObject->DeviceExtension; + + DevExt = FdoDevExt->PortDevExt; + + if (WorkItemData->Target == DevExt->KeyboardData.ClassDeviceObject) { + IoControlCode = IOCTL_INTERNAL_I8042_HOOK_KEYBOARD; + InputBuffer = &DevExt->KeyboardHook; + InputBufferLength = sizeof(INTERNAL_I8042_HOOK_KEYBOARD); + IsKbd = TRUE; + DPRINT ("is for keyboard.\n"); + } else if (WorkItemData->Target == DevExt->MouseData.ClassDeviceObject){ + IoControlCode = IOCTL_INTERNAL_I8042_HOOK_MOUSE; + InputBuffer = &DevExt->MouseHook; + InputBufferLength = sizeof(INTERNAL_I8042_HOOK_MOUSE); + IsKbd = FALSE; + DPRINT ("is for mouse.\n"); + } else { + DPRINT1("I8042SendHookWorkItem: Can't find DeviceObject\n"); + WorkItemData->Irp->IoStatus.Status = STATUS_INTERNAL_ERROR; + goto hookworkitemdone; + } + + KeInitializeEvent(&Event, NotificationEvent, FALSE); + + NewIrp = IoBuildDeviceIoControlRequest( + IoControlCode, + WorkItemData->Target, + InputBuffer, + InputBufferLength, + NULL, + 0, + TRUE, + &Event, + &IoStatus); + + if (!NewIrp) { + DPRINT("IOCTL_INTERNAL_(device)_CONNECT: " + "Can't allocate IRP\n"); + WorkItemData->Irp->IoStatus.Status = + STATUS_INSUFFICIENT_RESOURCES; + goto hookworkitemdone; + } + + Status = IoCallDriver( + WorkItemData->Target, + NewIrp); + + if (STATUS_PENDING == Status) + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FALSE, + NULL); + + if (IsKbd) { + /* Call the hooked initialization if it exists */ + if (DevExt->KeyboardHook.InitializationRoutine) { + Status = DevExt->KeyboardHook.InitializationRoutine( + DevExt->KeyboardHook.Context, + DevExt, + I8042SynchReadPort, + I8042SynchWritePortKbd, + FALSE); + if (Status != STATUS_SUCCESS) { + WorkItemData->Irp->IoStatus.Status = Status; + goto hookworkitemdone; + } + } + /* TODO: Now would be the right time to enable the interrupt */ + + DevExt->KeyboardClaimed = TRUE; + } else { + /* Mouse doesn't have this, but we need to send a + * reset to start the detection. + */ + KIRQL Irql; + + Irql = KeAcquireInterruptSpinLock( + DevExt->HighestDIRQLInterrupt); + + I8042Write(DevExt, I8042_CTRL_PORT, 0xD4); + I8042Write(DevExt, I8042_DATA_PORT, 0xFF); + + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, Irql); + } + + WorkItemData->Irp->IoStatus.Status = STATUS_SUCCESS; + +hookworkitemdone: + WorkItemData->Irp->IoStatus.Information = 0; + IoCompleteRequest(WorkItemData->Irp, IO_NO_INCREMENT); + + IoFreeWorkItem(WorkItemData->WorkItem); + ExFreePool(WorkItemData); + DPRINT("HookWorkItem done\n"); +} + +VOID STDCALL I8042StartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + if (!I8042StartIoKbd(DeviceObject, Irp)) { + DPRINT1("Unhandled StartIo!\n"); + } +} + +NTSTATUS STDCALL I8042InternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + + DPRINT("InternalDeviceControl\n"); + + switch (FdoDevExt->Type) { + case Keyboard: + Status = I8042InternalDeviceControlKbd(DeviceObject, Irp); + break; + case Mouse: + Status = I8042InternalDeviceControlMouse(DeviceObject, Irp); + break; + } + + if (Status == STATUS_INVALID_DEVICE_REQUEST) { + DPRINT1("Invalid internal device request!\n"); + } + + if (Status != STATUS_PENDING) + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} + +NTSTATUS STDCALL I8042CreateDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + NTSTATUS Status; + + DPRINT ("I8042CreateDispatch\n"); + + Status = STATUS_SUCCESS; + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} + +static NTSTATUS STDCALL I8042BasicDetect(PDEVICE_EXTENSION DevExt) +{ + NTSTATUS Status; + UCHAR Value; + UINT Counter; + + I8042Flush(); + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_SELF_TEST)) + return STATUS_TIMEOUT; + + // Wait longer? + Counter = 3; + do { + Status = I8042ReadDataWait(DevExt, &Value); + } while ((Counter--) && (STATUS_TIMEOUT == Status)); + + if (Status != STATUS_SUCCESS) + return Status; + + if (Value != 0x55) { + DPRINT1("Got %x instead of 55\n", Value); + return STATUS_IO_DEVICE_ERROR; + } + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_LINE_TEST)) + return STATUS_TIMEOUT; + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) + return Status; + + if (Value == 0) { + DevExt->KeyboardExists = TRUE; + } else { + DevExt->KeyboardExists = FALSE; + } + + if (!I8042Write(DevExt, I8042_CTRL_PORT, MOUSE_LINE_TEST)) + return STATUS_TIMEOUT; + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) + return Status; + + if (Value == 0) { + DevExt->MouseExists = TRUE; + } else { + DevExt->MouseExists = FALSE; + } + + return STATUS_SUCCESS; +} + +static NTSTATUS STDCALL I8042Initialize(PDEVICE_EXTENSION DevExt) +{ + NTSTATUS Status; + + Status = I8042BasicDetect(DevExt); + if (Status != STATUS_SUCCESS) { + DPRINT1("Basic keyboard detection failed: %x\n", Status); + return Status; + } + + if (!DevExt->KeyboardExists) { + DPRINT("Keyboard not detected\n") + if (DevExt->Settings.Headless) + /* Act as if it exists regardless */ + DevExt->KeyboardExists = TRUE; + } else { + DPRINT("Keyboard detected\n"); + DevExt->KeyboardExists = I8042DetectKeyboard(DevExt); + } + + if (DevExt->KeyboardExists) { + I8042KeyboardEnable(DevExt); + I8042KeyboardEnableInterrupt(DevExt); + } + + if (DevExt->MouseExists) + I8042MouseEnable(DevExt); + + return STATUS_SUCCESS; +} + +static NTSTATUS STDCALL I8042AddDevice(PDRIVER_OBJECT DriverObject, + PDEVICE_OBJECT Pdo) +{ + UNICODE_STRING DeviceName = ROS_STRING_INITIALIZER(L"\\Device\\KeyboardClass0"); + UNICODE_STRING MouseName = ROS_STRING_INITIALIZER(L"\\Device\\PointerClass0"); + ULONG MappedIrqKeyboard = 0, MappedIrqMouse = 0; + KIRQL DirqlKeyboard = 0; + KIRQL DirqlMouse = 0; + KIRQL DirqlMax; + KAFFINITY Affinity; + NTSTATUS Status; + PDEVICE_EXTENSION DevExt; + PFDO_DEVICE_EXTENSION FdoDevExt; + PDEVICE_OBJECT Fdo; + + DPRINT("I8042AddDevice\n"); + + Status = IoCreateDevice(DriverObject, + sizeof(DEVICE_EXTENSION), + NULL, + FILE_DEVICE_8042_PORT, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + + if (!NT_SUCCESS(Status)) + return Status; + + IoAttachDeviceToDeviceStack(Fdo, Pdo); + + DevExt = Fdo->DeviceExtension; + + RtlZeroMemory(DevExt, sizeof(DEVICE_EXTENSION)); + + I8042ReadRegistry(DriverObject, DevExt); + + KeInitializeSpinLock(&DevExt->SpinLock); + InitializeListHead(&DevExt->BusDevices); + + KeInitializeDpc(&DevExt->DpcKbd, + I8042DpcRoutineKbd, + DevExt); + + KeInitializeDpc(&DevExt->DpcMouse, + I8042DpcRoutineMouse, + DevExt); + + KeInitializeDpc(&DevExt->DpcMouseTimeout, + I8042DpcRoutineMouseTimeout, + DevExt); + + KeInitializeTimer(&DevExt->TimerMouseTimeout); + + Status = I8042Initialize(DevExt); + if (!NT_SUCCESS(STATUS_SUCCESS)) { + DPRINT1("Initialization failure: %x\n", Status); + return Status; + } + + if (DevExt->KeyboardExists) { + MappedIrqKeyboard = HalGetInterruptVector(Internal, + 0, + 0, + KEYBOARD_IRQ, + &DirqlKeyboard, + &Affinity); + + Status = IoCreateDevice(DriverObject, + sizeof(FDO_DEVICE_EXTENSION), + &DeviceName, + FILE_DEVICE_8042_PORT, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + + if (NT_SUCCESS(Status)) + { + FdoDevExt = Fdo->DeviceExtension; + + RtlZeroMemory(FdoDevExt, sizeof(FDO_DEVICE_EXTENSION)); + + FdoDevExt->PortDevExt = DevExt; + FdoDevExt->Type = Keyboard; + FdoDevExt->DeviceObject = Fdo; + + Fdo->Flags |= DO_BUFFERED_IO; + + DevExt->DebugWorkItem = IoAllocateWorkItem(Fdo); + DevExt->KeyboardObject = Fdo; + + DevExt->KeyboardBuffer = ExAllocatePoolWithTag( + NonPagedPool, + DevExt->KeyboardAttributes.InputDataQueueLength * + sizeof(KEYBOARD_INPUT_DATA), + TAG_I8042); + + if (!DevExt->KeyboardBuffer) { + DPRINT1("No memory for keyboardbuffer\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + InsertTailList(&DevExt->BusDevices, &FdoDevExt->BusDevices); + } + else + DevExt->KeyboardExists = FALSE; + } + + if (DevExt->MouseExists) { + MappedIrqMouse = HalGetInterruptVector(Internal, + 0, + 0, + MOUSE_IRQ, + &DirqlMouse, + &Affinity); + + Status = IoCreateDevice(DriverObject, + sizeof(FDO_DEVICE_EXTENSION), + &MouseName, + FILE_DEVICE_8042_PORT, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + + if (NT_SUCCESS(Status)) + { + FdoDevExt = Fdo->DeviceExtension; + + RtlZeroMemory(FdoDevExt, sizeof(FDO_DEVICE_EXTENSION)); + + FdoDevExt->PortDevExt = DevExt; + FdoDevExt->Type = Mouse; + FdoDevExt->DeviceObject = Fdo; + + Fdo->Flags |= DO_BUFFERED_IO; + DevExt->MouseObject = Fdo; + + DevExt->MouseBuffer = ExAllocatePoolWithTag( + NonPagedPool, + DevExt->MouseAttributes.InputDataQueueLength * + sizeof(MOUSE_INPUT_DATA), + TAG_I8042); + + if (!DevExt->MouseBuffer) { + ExFreePoolWithTag(DevExt->KeyboardBuffer, TAG_I8042); + DPRINT1("No memory for mouse buffer\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + InsertTailList(&DevExt->BusDevices, &FdoDevExt->BusDevices); + } + else + DevExt->MouseExists = FALSE; + } + + if (DirqlKeyboard > DirqlMouse) + DirqlMax = DirqlKeyboard; + else + DirqlMax = DirqlMouse; + + if (DevExt->KeyboardExists) { + Status = IoConnectInterrupt(&DevExt->KeyboardInterruptObject, + I8042InterruptServiceKbd, + (PVOID)DevExt, + &DevExt->SpinLock, + MappedIrqKeyboard, + DirqlKeyboard, + DirqlMax, + LevelSensitive, + FALSE, + Affinity, + FALSE); + + DPRINT("Keyboard Irq Status: %x\n", Status); + } + + if (DevExt->MouseExists) { + Status = IoConnectInterrupt(&DevExt->MouseInterruptObject, + I8042InterruptServiceMouse, + (PVOID)DevExt, + &DevExt->SpinLock, + MappedIrqMouse, + DirqlMouse, + DirqlMax, + LevelSensitive, + FALSE, + Affinity, + FALSE); + + DPRINT("Mouse Irq Status: %x\n", Status); + } + + if (DirqlKeyboard > DirqlMouse) + DevExt->HighestDIRQLInterrupt = DevExt->KeyboardInterruptObject; + else + DevExt->HighestDIRQLInterrupt = DevExt->MouseInterruptObject; + + DPRINT("I8042AddDevice done\n"); + + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) +/* + * FUNCTION: Module entry point + */ +{ + DPRINT("I8042 Driver 0.0.1\n"); + + DriverObject->MajorFunction[IRP_MJ_CREATE] = I8042CreateDispatch; + DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = + I8042InternalDeviceControl; + + DriverObject->DriverStartIo = I8042StartIo; + DriverObject->DriverExtension->AddDevice = I8042AddDevice; + + return(STATUS_SUCCESS); +} + diff --git a/reactos/drivers/input/i8042prt/i8042prt.h b/reactos/drivers/input/i8042prt/i8042prt.h new file mode 100644 index 00000000000..6d155e200e9 --- /dev/null +++ b/reactos/drivers/input/i8042prt/i8042prt.h @@ -0,0 +1,392 @@ +#ifndef _I8042DRV_H +#define _I8042DRV_H +#include +#include +#include + +#define KEYBOARD_IRQ 1 +#define MOUSE_IRQ 12 +#define KBD_BUFFER_SIZE 32 + +// should be in ntdd8042.h + +typedef VOID DDKAPI +(*KEYBOARD_CLASS_SERVICE_CALLBACK) ( + IN PDEVICE_OBJECT DeviceObject, + IN PKEYBOARD_INPUT_DATA InputDataStart, + IN PKEYBOARD_INPUT_DATA InputDataEnd, + IN OUT PULONG InputDataConsumed +); + +/* I'm not actually sure if this is in the ddk, would seem logical */ +typedef VOID DDKAPI +(*MOUSE_CLASS_SERVICE_CALLBACK) ( + IN PDEVICE_OBJECT DeviceObject, + IN PMOUSE_INPUT_DATA InputDataStart, + IN PMOUSE_INPUT_DATA InputDataEnd, + IN OUT PULONG InputDataConsumed +); + +typedef struct _CONNECT_DATA { + PDEVICE_OBJECT ClassDeviceObject; + PVOID ClassService; +} CONNECT_DATA, *PCONNECT_DATA; + +#define IOCTL_INTERNAL_KEYBOARD_CONNECT \ + CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS) + +#define IOCTL_INTERNAL_MOUSE_CONNECT \ + CTL_CODE(FILE_DEVICE_MOUSE, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS) + +/* For some bizarre reason, these are different from the defines in + * w32api. I'm quite sure these are correct though, needs to be checked + * against the ddk + */ +#define KEYBOARD_SCROLL_LOCK_ON 0x01 +#define KEYBOARD_NUM_LOCK_ON 0x02 +#define KEYBOARD_CAPS_LOCK_ON 0x04 + +/*----------------------------------------------------- + * DeviceExtension + * --------------------------------------------------*/ +typedef struct _COMMAND_CONTEXT +{ + int NumInput; + int CurInput; + UCHAR * Input; + int NumOutput; + int CurOutput; + UCHAR * Output; + NTSTATUS Status; + + BOOLEAN GotAck; + KEVENT Event; + + PVOID DevExt; +} COMMAND_CONTEXT, *PCOMMAND_CONTEXT; + +typedef enum _MOUSE_TIMEOUT_STATE +{ + NoChange, + TimeoutStart, + TimeoutCancel +} MOUSE_TIMEOUT_STATE, *PMOUSE_TIMEOUT_STATE; + +/* TODO: part of this should be in the _ATTRIBUTES structs instead */ +typedef struct _I8042_SETTINGS +{ + DWORD Headless; /* done */ + DWORD CrashScroll; + DWORD CrashSysRq; /* done */ + DWORD ReportResetErrors; + DWORD PollStatusIterations; /* done */ + DWORD ResendIterations; /* done */ + DWORD PollingIterations; + DWORD PollingIterationsMaximum; + DWORD OverrideKeyboardType; + DWORD OverrideKeyboardSubtype; + DWORD MouseResendStallTime; + DWORD MouseSynchIn100ns; + DWORD MouseResolution; + DWORD NumberOfButtons; + DWORD EnableWheelDetection; +} I8042_SETTINGS, *PI8042_SETTINGS; + +typedef enum _I8042_MOUSE_TYPE +{ + GenericPS2, + Intellimouse, + IntellimouseExplorer, + Ps2pp +} I8042_MOUSE_TYPE, *PI8042_MOUSE_TYPE; + +typedef enum _I8042_DEVICE_TYPE +{ + Keyboard, + Mouse +} I8042_DEVICE_TYPE, *PI8042_DEVICE_TYPE; + +typedef struct _I8042_DEVICE +{ + LIST_ENTRY ListEntry; + PDEVICE_OBJECT Pdo; +} I8042_DEVICE, *PI8042_DEVICE; + +typedef struct _DEVICE_EXTENSION +{ + PDEVICE_OBJECT KeyboardObject; + PDEVICE_OBJECT MouseObject; + + CONNECT_DATA KeyboardData; + CONNECT_DATA MouseData; + + BOOLEAN KeyboardExists; + BOOLEAN KeyboardIsAT; + BOOLEAN MouseExists; + + BOOLEAN KeyboardClaimed; + BOOLEAN MouseClaimed; + + ULONG BusNumber; + LIST_ENTRY BusDevices; + + INTERNAL_I8042_START_INFORMATION KeyboardStartInformation; + INTERNAL_I8042_START_INFORMATION MouseStartInformation; + + INTERNAL_I8042_HOOK_KEYBOARD KeyboardHook; + INTERNAL_I8042_HOOK_MOUSE MouseHook; + + PKINTERRUPT KeyboardInterruptObject; + PKINTERRUPT MouseInterruptObject; + PKINTERRUPT HighestDIRQLInterrupt; + KSPIN_LOCK SpinLock; + KDPC DpcKbd; + KDPC DpcMouse; + + KTIMER TimerMouseTimeout; + KDPC DpcMouseTimeout; + MOUSE_TIMEOUT_STATE MouseTimeoutState; + BOOLEAN MouseTimeoutActive; + + KEYBOARD_ATTRIBUTES KeyboardAttributes; + KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicators; + KEYBOARD_TYPEMATIC_PARAMETERS KeyboardTypematic; + + BOOLEAN WantAck; + BOOLEAN WantOutput; + BOOLEAN SignalEvent; + + KEYBOARD_SCAN_STATE KeyboardScanState; + BOOLEAN KeyComplete; + KEYBOARD_INPUT_DATA *KeyboardBuffer; + ULONG KeysInBuffer; + + MOUSE_ATTRIBUTES MouseAttributes; + + MOUSE_STATE MouseState; + BOOLEAN MouseComplete; + MOUSE_RESET_SUBSTATE MouseResetState; + MOUSE_INPUT_DATA *MouseBuffer; + ULONG MouseInBuffer; + USHORT MouseButtonState; + + UCHAR MouseLogiBuffer[3]; + UCHAR MouseLogitechID; + I8042_MOUSE_TYPE MouseType; + + OUTPUT_PACKET Packet; + UINT PacketResends; + BOOLEAN PacketComplete; + NTSTATUS PacketResult; + UCHAR PacketBuffer[16]; + UCHAR PacketPort; + + PIRP CurrentIrp; + PDEVICE_OBJECT CurrentIrpDevice; + + /* registry config values */ + I8042_SETTINGS Settings; + + /* Debugger stuff */ + BOOLEAN TabPressed; + ULONG DebugKey; + PIO_WORKITEM DebugWorkItem; +} DEVICE_EXTENSION, *PDEVICE_EXTENSION; + +typedef struct _FDO_DEVICE_EXTENSION +{ + PDEVICE_EXTENSION PortDevExt; + I8042_DEVICE_TYPE Type; + PDEVICE_OBJECT DeviceObject; + + LIST_ENTRY BusDevices; +} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION; + +typedef struct _I8042_HOOK_WORKITEM +{ + PIO_WORKITEM WorkItem; + PDEVICE_OBJECT Target; + PIRP Irp; +} I8042_HOOK_WORKITEM, *PI8042_HOOK_WORKITEM; + +/* + * Some defines + */ +#define TAG_I8042 TAG('8', '0', '4', '2') + +#define KBD_WRAP_MASK 0x1F + +#define disable() __asm__("cli\n\t") +#define enable() __asm__("sti\n\t") + +#define ALT_PRESSED (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED) +#define CTRL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) + + +/* + * Keyboard controller ports + */ + +#define I8042_DATA_PORT 0x60 +#define I8042_CTRL_PORT 0x64 + + +/* + * Controller commands + */ + +#define KBD_READ_MODE 0x20 +#define KBD_WRITE_MODE 0x60 +#define KBD_SELF_TEST 0xAA +#define KBD_LINE_TEST 0xAB +#define KBD_CTRL_ENABLE 0xAE + +#define MOUSE_LINE_TEST 0xA9 +#define MOUSE_CTRL_ENABLE 0xA8 + +#define KBD_READ_OUTPUT_PORT 0xD0 +#define KBD_WRITE_OUTPUT_PORT 0xD1 + +/* + * Keyboard commands + */ + +#define KBD_SET_LEDS 0xED +#define KBD_GET_ID 0xF2 +#define KBD_ENABLE 0xF4 +#define KBD_DISABLE 0xF5 +#define KBD_RESET 0xFF + + +/* + * Keyboard responces + */ + +#define KBD_BATCC 0xAA +#define KBD_ACK 0xFA +#define KBD_NACK 0xFC +#define KBD_RESEND 0xFE + +/* + * Controller status register bits + */ + +#define KBD_OBF 0x01 +#define KBD_IBF 0x02 +#define KBD_AUX 0x10 +#define KBD_GTO 0x40 +#define KBD_PERR 0x80 + + +/* + * LED bits + */ + +#define KBD_LED_SCROLL 0x01 +#define KBD_LED_NUM 0x02 +#define KBD_LED_CAPS 0x04 + +/* + * Mouse responses + */ +#define MOUSE_ACK 0xFA +#define MOUSE_ERROR 0xFC +#define MOUSE_NACK 0xFE + +/* i8042prt.c */ +NTSTATUS I8042ReadData(BYTE *Data); + +NTSTATUS I8042ReadStatus(BYTE *Status); + +NTSTATUS I8042ReadDataWait(PDEVICE_EXTENSION DevExt, BYTE *Data); + +VOID I8042Flush(); + +VOID STDCALL I8042IsrWritePort(PDEVICE_EXTENSION DevExt, + UCHAR Value, + UCHAR SelectCmd); + +NTSTATUS STDCALL I8042SynchWritePort(PDEVICE_EXTENSION DevExt, + UCHAR Port, + UCHAR Value, + BOOLEAN WaitForAck); + +NTSTATUS STDCALL I8042StartPacket(PDEVICE_EXTENSION DevExt, + PDEVICE_OBJECT Device, + PUCHAR Bytes, + ULONG ByteCount, + PIRP Irp); + +BOOLEAN STDCALL I8042PacketIsr(PDEVICE_EXTENSION DevExt, + UCHAR Output); + +VOID I8042PacketDpc(PDEVICE_EXTENSION DevExt); + +VOID STDCALL I8042SendHookWorkItem(PDEVICE_OBJECT DeviceObject, + PVOID Context); + +BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, int addr, BYTE data); + +/* keyboard.c */ +VOID STDCALL I8042IsrWritePortKbd(PVOID Context, + UCHAR Value); + +NTSTATUS STDCALL I8042SynchWritePortKbd(PVOID Context, + UCHAR Value, + BOOLEAN WaitForAck); + +BOOLEAN STDCALL I8042InterruptServiceKbd(struct _KINTERRUPT *Interrupt, + VOID * Context); + +VOID STDCALL I8042DpcRoutineKbd(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2); + +BOOLEAN STDCALL I8042StartIoKbd(PDEVICE_OBJECT DeviceObject, PIRP Irp); + +NTSTATUS STDCALL I8042InternalDeviceControlKbd(PDEVICE_OBJECT DeviceObject, + PIRP Irp); + +BOOLEAN STDCALL I8042KeyboardEnable(PDEVICE_EXTENSION DevExt); + +BOOLEAN STDCALL I8042KeyboardEnableInterrupt(PDEVICE_EXTENSION DevExt); + +BOOLEAN STDCALL I8042DetectKeyboard(PDEVICE_EXTENSION DevExt); + +/* registry.c */ +VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject, + PDEVICE_EXTENSION DevExt); + +/* mouse.c */ +VOID STDCALL I8042DpcRoutineMouse(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2); + +VOID STDCALL I8042DpcRoutineMouseTimeout(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2); + +BOOLEAN STDCALL I8042InterruptServiceMouse(struct _KINTERRUPT *Interrupt, + VOID *Context); + +NTSTATUS STDCALL I8042InternalDeviceControlMouse(PDEVICE_OBJECT DeviceObject, + PIRP Irp); + +VOID STDCALL I8042QueueMousePacket(PVOID Context); + +VOID STDCALL I8042MouseHandleButtons(PDEVICE_EXTENSION DevExt, + USHORT Mask); + +VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt, + BYTE Output); + +BOOLEAN STDCALL I8042MouseEnable(PDEVICE_EXTENSION DevExt); +BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt); + +/* ps2pp.c */ +VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, BYTE Input); + +#endif // _KEYBOARD_H_ diff --git a/reactos/drivers/input/i8042prt/i8042prt.rc b/reactos/drivers/input/i8042prt/i8042prt.rc new file mode 100644 index 00000000000..6c44176265e --- /dev/null +++ b/reactos/drivers/input/i8042prt/i8042prt.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "I8042 Port Device Driver\0" +#define REACTOS_STR_INTERNAL_NAME "i8042prt\0" +#define REACTOS_STR_ORIGINAL_FILENAME "i8042prt.sys\0" +#include diff --git a/reactos/drivers/input/i8042prt/i8042prt.xml b/reactos/drivers/input/i8042prt/i8042prt.xml new file mode 100644 index 00000000000..0a191737516 --- /dev/null +++ b/reactos/drivers/input/i8042prt/i8042prt.xml @@ -0,0 +1,13 @@ + + + . + + ntoskrnl + hal + i8042prt.c + keyboard.c + mouse.c + ps2pp.c + registry.c + i8042prt.rc + diff --git a/reactos/drivers/input/i8042prt/keyboard.c b/reactos/drivers/input/i8042prt/keyboard.c new file mode 100644 index 00000000000..e81a6a14138 --- /dev/null +++ b/reactos/drivers/input/i8042prt/keyboard.c @@ -0,0 +1,701 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/input/i8042prt/keyboard.c + * PURPOSE: i8042 (ps/2 keyboard-mouse controller) driver + * keyboard specifics + * PROGRAMMER: Victor Kirhenshtein (sauros@iname.com) + * Jason Filby (jasonfilby@yahoo.com) + * Tinus + */ + +/* INCLUDES ****************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#define NDEBUG +#include + +#include "i8042prt.h" + +/* GLOBALS *******************************************************************/ + +static BYTE TypematicTable[] = { + 0x00, 0x00, 0x00, 0x05, 0x08, 0x0B, 0x0D, 0x0F, 0x10, 0x12, /* 0-9 */ + 0x13, 0x14, 0x15, 0x16, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1A, /* 10-19 */ + 0x1B, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1E }; + +typedef struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION { + USHORT NumberOfIndicatorKeys; + INDICATOR_LIST IndicatorList[3]; +} LOCAL_KEYBOARD_INDICATOR_TRANSLATION, *PLOCAL_KEYBOARD_INDICATOR_TRANSLATION; + +static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation = { 3, { + {0x3A, KEYBOARD_CAPS_LOCK_ON}, + {0x45, KEYBOARD_NUM_LOCK_ON}, + {0x46, KEYBOARD_SCROLL_LOCK_ON}}}; + +static VOID STDCALL I8042DebugWorkItem(PDEVICE_OBJECT DeviceObject, + PVOID Context); + +/* FUNCTIONS *****************************************************************/ + +/* + * These functions are callbacks for filter driver custom interrupt + * service routines. + */ +VOID STDCALL I8042IsrWritePortKbd(PVOID Context, + UCHAR Value) +{ + I8042IsrWritePort(Context, Value, 0); +} + +static VOID STDCALL I8042QueueKeyboardPacket(PVOID Context) +{ + PDEVICE_OBJECT DeviceObject = Context; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + PDEVICE_EXTENSION DevExt = FdoDevExt->PortDevExt; + + DevExt->KeyComplete = TRUE; + DevExt->KeysInBuffer++; + if (DevExt->KeysInBuffer > + DevExt->KeyboardAttributes.InputDataQueueLength) { + DPRINT1("Keyboard buffer overflow\n"); + DevExt->KeysInBuffer--; + } + + DPRINT("Irq completes key\n"); + KeInsertQueueDpc(&DevExt->DpcKbd, DevExt, NULL); +} + +/* + * These functions are callbacks for filter driver custom + * initialization routines. + */ +NTSTATUS STDCALL I8042SynchWritePortKbd(PVOID Context, + UCHAR Value, + BOOLEAN WaitForAck) +{ + return I8042SynchWritePort((PDEVICE_EXTENSION)Context, + 0, + Value, + WaitForAck); +} + +BOOLEAN STDCALL I8042InterruptServiceKbd(struct _KINTERRUPT *Interrupt, + VOID * Context) +{ + BYTE Output; + BYTE PortStatus; + NTSTATUS Status; + PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context; + BOOLEAN HookContinue = FALSE, HookReturn; + UINT Iterations = 0; + + KEYBOARD_INPUT_DATA *InputData = + DevExt->KeyboardBuffer + DevExt->KeysInBuffer; + + do { + Status = I8042ReadStatus(&PortStatus); + DPRINT("PortStatus: %x\n", PortStatus); + Status = I8042ReadData(&Output); + Iterations++; + if (STATUS_SUCCESS == Status) + break; + KeStallExecutionProcessor(1); + } while (Iterations < DevExt->Settings.PollStatusIterations); + + if (STATUS_SUCCESS != Status) { + DPRINT1("Spurious I8042 interrupt\n"); + return FALSE; + } + + DPRINT("Got: %x\n", Output); + + if (DevExt->KeyboardHook.IsrRoutine) { + HookReturn = DevExt->KeyboardHook.IsrRoutine( + DevExt->KeyboardHook.Context, + InputData, + &DevExt->Packet, + PortStatus, + &Output, + &HookContinue, + &DevExt->KeyboardScanState); + + if (!HookContinue) + return HookReturn; + } + + if (I8042PacketIsr(DevExt, Output)) { + if (DevExt->PacketComplete) { + DPRINT("Packet complete\n"); + KeInsertQueueDpc(&DevExt->DpcKbd, DevExt, NULL); + } + DPRINT("Irq eaten by packet\n"); + return TRUE; + } + + DPRINT("Irq is keyboard input\n"); + + if (Normal == DevExt->KeyboardScanState) { + switch (Output) { + case 0xe0: + DevExt->KeyboardScanState = GotE0; + return TRUE; + case 0xe1: + DevExt->KeyboardScanState = GotE1; + return TRUE; + default: + ;/* continue */ + } + } + + InputData->Flags = 0; + + switch (DevExt->KeyboardScanState) { + case GotE0: + InputData->Flags |= KEY_E0; + break; + case GotE1: + InputData->Flags |= KEY_E1; + break; + default: + ; + } + DevExt->KeyboardScanState = Normal; + + if (Output & 0x80) + InputData->Flags |= KEY_BREAK; + else + InputData->Flags |= KEY_MAKE; + + InputData->MakeCode = Output & 0x7f; + + I8042QueueKeyboardPacket(DevExt->KeyboardObject); + + return TRUE; +} + +VOID STDCALL I8042DpcRoutineKbd(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2) +{ + PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION)SystemArgument1; + ULONG KeysTransferred = 0; + ULONG KeysInBufferCopy; + KIRQL Irql; + + I8042PacketDpc(DevExt); + + if (!DevExt->KeyComplete) + return; + + /* We got the interrupt as it was being enabled, too bad */ + if (!DevExt->HighestDIRQLInterrupt) + return; + + Irql = KeAcquireInterruptSpinLock(DevExt->HighestDIRQLInterrupt); + + DevExt->KeyComplete = FALSE; + KeysInBufferCopy = DevExt->KeysInBuffer; + + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, Irql); + + /* Test for TAB (debugging) */ + if (DevExt->Settings.CrashSysRq) { + PKEYBOARD_INPUT_DATA InputData = DevExt->KeyboardBuffer + + KeysInBufferCopy - 1; + if (InputData->MakeCode == 0x0F) { + DPRINT("Tab!\n"); + DevExt->TabPressed = !(InputData->Flags & KEY_BREAK); + } else if (DevExt->TabPressed) { + DPRINT ("Queueing work item %x\n", DevExt->DebugWorkItem); + DevExt->DebugKey = InputData->MakeCode; + DevExt->TabPressed = FALSE; + + IoQueueWorkItem(DevExt->DebugWorkItem, + &(I8042DebugWorkItem), + DelayedWorkQueue, + DevExt); + } + } + + DPRINT ("Send a key\n"); + + if (!DevExt->KeyboardData.ClassService) + return; + + ((KEYBOARD_CLASS_SERVICE_CALLBACK) DevExt->KeyboardData.ClassService)( + DevExt->KeyboardData.ClassDeviceObject, + DevExt->KeyboardBuffer, + DevExt->KeyboardBuffer + KeysInBufferCopy, + &KeysTransferred); + + Irql = KeAcquireInterruptSpinLock(DevExt->HighestDIRQLInterrupt); + DevExt->KeysInBuffer -= KeysTransferred; + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, Irql); +} + +/* You have to send the rate/delay in a somewhat awkward format */ +static USHORT I8042GetTypematicByte(USHORT Rate, USHORT Delay) +{ + USHORT ret; + + if (Rate < 3) { + ret = 0x0; + } else if (Rate > 26) { + ret = 0x1F; + } else { + ret = TypematicTable[Rate]; + } + + if (Delay < 375) { + ; + } else if (Delay < 625) { + ret |= 0x20; + } else if (Delay < 875) { + ret |= 0x40; + } else { + ret |= 0x60; + } + return ret; +} +/* + * Process the keyboard internal device requests + * returns FALSE if it doesn't understand the + * call so someone else can handle it. + */ +BOOLEAN STDCALL I8042StartIoKbd(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stk; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + PDEVICE_EXTENSION DevExt = FdoDevExt->PortDevExt; + + Stk = IoGetCurrentIrpStackLocation(Irp); + + switch (Stk->Parameters.DeviceIoControl.IoControlCode) { + case IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER: + I8042StartPacket( + DevExt, + DeviceObject, + Stk->Parameters.DeviceIoControl.Type3InputBuffer, + Stk->Parameters.DeviceIoControl.InputBufferLength, + Irp); + break; + + case IOCTL_KEYBOARD_SET_INDICATORS: + DevExt->PacketBuffer[0] = 0xED; + DevExt->PacketBuffer[1] = 0; + if (DevExt->KeyboardIndicators.LedFlags & KEYBOARD_CAPS_LOCK_ON) + DevExt->PacketBuffer[1] |= 0x04; + + if (DevExt->KeyboardIndicators.LedFlags & KEYBOARD_NUM_LOCK_ON) + DevExt->PacketBuffer[1] |= 0x02; + + if (DevExt->KeyboardIndicators.LedFlags & KEYBOARD_SCROLL_LOCK_ON) + DevExt->PacketBuffer[1] |= 0x01; + + I8042StartPacket(DevExt, + DeviceObject, + DevExt->PacketBuffer, + 2, + Irp); + break; + case IOCTL_KEYBOARD_SET_TYPEMATIC: + DevExt->PacketBuffer[0] = 0xF3; + DevExt->PacketBuffer[1] = I8042GetTypematicByte( + DevExt->KeyboardTypematic.Rate, + DevExt->KeyboardTypematic.Delay); + + I8042StartPacket(DevExt, + DeviceObject, + DevExt->PacketBuffer, + 2, + Irp); + break; + default: + return FALSE; + } + + return TRUE; +} + +/* + * Runs the keyboard IOCTL_INTERNAL dispatch. + * Returns NTSTATUS_INVALID_DEVICE_REQUEST if it doesn't handle this request + * so someone else can have a try at it. + */ +NTSTATUS STDCALL I8042InternalDeviceControlKbd(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stk; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + PDEVICE_EXTENSION DevExt = FdoDevExt->PortDevExt; + + DPRINT("InternalDeviceControl\n"); + + Irp->IoStatus.Information = 0; + Stk = IoGetCurrentIrpStackLocation(Irp); + + switch (Stk->Parameters.DeviceIoControl.IoControlCode) { + + case IOCTL_INTERNAL_KEYBOARD_CONNECT: + DPRINT("IOCTL_INTERNAL_KEYBOARD_CONNECT\n"); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < + sizeof(CONNECT_DATA)) { + DPRINT1("Keyboard IOCTL_INTERNAL_KEYBOARD_CONNECT " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + goto intcontfailure; + } + + if (!DevExt->KeyboardExists) { + Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED; + goto intcontfailure; + } + + if (DevExt->KeyboardClaimed) { + DPRINT1("IOCTL_INTERNAL_KEYBOARD_CONNECT: " + "Keyboard is already claimed\n"); + Irp->IoStatus.Status = STATUS_SHARING_VIOLATION; + goto intcontfailure; + } + + memcpy(&DevExt->KeyboardData, + Stk->Parameters.DeviceIoControl.Type3InputBuffer, + sizeof(CONNECT_DATA)); + DevExt->KeyboardHook.IsrWritePort = I8042IsrWritePortKbd; + DevExt->KeyboardHook.QueueKeyboardPacket = + I8042QueueKeyboardPacket; + DevExt->KeyboardHook.CallContext = DevExt; + + { + PIO_WORKITEM WorkItem; + PI8042_HOOK_WORKITEM WorkItemData; + + WorkItem = IoAllocateWorkItem(DeviceObject); + if (!WorkItem) { + DPRINT ("IOCTL_INTERNAL_KEYBOARD_CONNECT: " + "Can't allocate work item\n"); + Irp->IoStatus.Status = + STATUS_INSUFFICIENT_RESOURCES; + goto intcontfailure; + } + + WorkItemData = ExAllocatePoolWithTag( + NonPagedPool, + sizeof(I8042_HOOK_WORKITEM), + TAG_I8042); + if (!WorkItemData) { + DPRINT ("IOCTL_INTERNAL_KEYBOARD_CONNECT: " + "Can't allocate work item data\n"); + Irp->IoStatus.Status = + STATUS_INSUFFICIENT_RESOURCES; + IoFreeWorkItem(WorkItem); + goto intcontfailure; + } + WorkItemData->WorkItem = WorkItem; + WorkItemData->Target = + DevExt->KeyboardData.ClassDeviceObject; + WorkItemData->Irp = Irp; + + IoMarkIrpPending(Irp); + IoQueueWorkItem(WorkItem, + I8042SendHookWorkItem, + DelayedWorkQueue, + WorkItemData); + + Irp->IoStatus.Status = STATUS_PENDING; + } + + break; + case IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER: + DPRINT("IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER\n"); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < 1) { + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + goto intcontfailure; + } + if (!DevExt->KeyboardInterruptObject) { + Irp->IoStatus.Status = STATUS_DEVICE_NOT_READY; + goto intcontfailure; + } + + IoMarkIrpPending(Irp); + IoStartPacket(DeviceObject, Irp, NULL, NULL); + Irp->IoStatus.Status = STATUS_PENDING; + + break; + case IOCTL_KEYBOARD_QUERY_ATTRIBUTES: + DPRINT("IOCTL_KEYBOARD_QUERY_ATTRIBUTES\n"); + if (Stk->Parameters.DeviceIoControl.OutputBufferLength < + sizeof(KEYBOARD_ATTRIBUTES)) { + DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_ATTRIBUTES " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + goto intcontfailure; + } + memcpy(Irp->AssociatedIrp.SystemBuffer, + &DevExt->KeyboardAttributes, + sizeof(KEYBOARD_ATTRIBUTES)); + + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + case IOCTL_KEYBOARD_QUERY_INDICATORS: + DPRINT("IOCTL_KEYBOARD_QUERY_INDICATORS\n"); + if (Stk->Parameters.DeviceIoControl.OutputBufferLength < + sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { + DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_INDICATORS " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + goto intcontfailure; + } + memcpy(Irp->AssociatedIrp.SystemBuffer, + &DevExt->KeyboardIndicators, + sizeof(KEYBOARD_INDICATOR_PARAMETERS)); + + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + case IOCTL_KEYBOARD_QUERY_TYPEMATIC: + DPRINT("IOCTL_KEYBOARD_QUERY_TYPEMATIC\n"); + if (Stk->Parameters.DeviceIoControl.OutputBufferLength < + sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { + DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_TYPEMATIC " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + goto intcontfailure; + } + memcpy(Irp->AssociatedIrp.SystemBuffer, + &DevExt->KeyboardTypematic, + sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)); + + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + case IOCTL_KEYBOARD_SET_INDICATORS: + DPRINT("IOCTL_KEYBOARD_SET_INDICATORS\n"); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < + sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { + DPRINT("Keyboard IOCTL_KEYBOARD_SET_INDICTATORS " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + goto intcontfailure; + } + + memcpy(&DevExt->KeyboardIndicators, + Irp->AssociatedIrp.SystemBuffer, + sizeof(KEYBOARD_INDICATOR_PARAMETERS)); + + DPRINT("%x\n", DevExt->KeyboardIndicators.LedFlags); + + IoMarkIrpPending(Irp); + IoStartPacket(DeviceObject, Irp, NULL, NULL); + Irp->IoStatus.Status = STATUS_PENDING; + + break; + case IOCTL_KEYBOARD_SET_TYPEMATIC: + DPRINT("IOCTL_KEYBOARD_SET_TYPEMATIC\n"); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < + sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { + DPRINT("Keyboard IOCTL_KEYBOARD_SET_TYPEMATIC " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + goto intcontfailure; + } + + memcpy(&DevExt->KeyboardTypematic, + Irp->AssociatedIrp.SystemBuffer, + sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)); + + IoMarkIrpPending(Irp); + IoStartPacket(DeviceObject, Irp, NULL, NULL); + Irp->IoStatus.Status = STATUS_PENDING; + + break; + case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION: + /* We should check the UnitID, but it's kind of pointless as + * all keyboards are supposed to have the same one + */ + if (Stk->Parameters.DeviceIoControl.OutputBufferLength < + sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION)) { + DPRINT("IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION: " + "invalid buffer size (expected)\n"); + /* It's to query the buffer size */ + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + goto intcontfailure; + } + Irp->IoStatus.Information = + sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION); + + memcpy(Irp->AssociatedIrp.SystemBuffer, + &IndicatorTranslation, + sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION)); + + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + case IOCTL_INTERNAL_I8042_HOOK_KEYBOARD: + /* Nothing to do here */ + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + default: + Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; + break; + } + +intcontfailure: + return Irp->IoStatus.Status; +} + +BOOLEAN STDCALL I8042KeyboardEnable(PDEVICE_EXTENSION DevExt) +{ + DPRINT("Enabling keyboard\n"); + if (STATUS_SUCCESS != I8042SynchWritePort(DevExt, + 0, + KBD_ENABLE, + TRUE)) { + DPRINT("Can't enable keyboard\n"); + return FALSE; + } + return TRUE; +} + +BOOLEAN STDCALL I8042KeyboardEnableInterrupt(PDEVICE_EXTENSION DevExt) +{ + UCHAR Value; + NTSTATUS Status; + + DPRINT("Enabling keyboard interrupt\n"); + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_READ_MODE)) { + DPRINT1("Can't read i8042 mode\n"); + return FALSE; + } + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) { + DPRINT1("No response after read i8042 mode\n"); + return FALSE; + } + + Value &= ~(0x10); // don't disable keyboard + Value |= 0x01; // enable keyboard interrupts + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) { + DPRINT1("Can't set i8042 mode\n"); + return FALSE; + } + + if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) { + DPRINT1("Can't send i8042 mode\n"); + return FALSE; + } + + return TRUE; +} + +BOOLEAN STDCALL I8042DetectKeyboard(PDEVICE_EXTENSION DevExt) +{ + NTSTATUS Status; + UCHAR Value; + UINT RetryCount = 10; + + DPRINT("Detecting keyboard\n"); + + do { + Status = I8042SynchWritePort(DevExt, 0, KBD_GET_ID, TRUE); + } while (STATUS_TIMEOUT == Status && RetryCount--); + + if (Status != STATUS_SUCCESS) { + DPRINT("Can't write GET_ID (%x)\n", Status); + return FALSE; + } + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) { + DPRINT1("No response after GET_ID\n"); + /* Could be an AT keyboard */ + DevExt->KeyboardIsAT = TRUE; + goto detectsetleds; + } + DevExt->KeyboardIsAT = FALSE; + + if (Value != 0xAB && Value != 0xAC) { + DPRINT("Bad ID: %x\n", Value); + /* This is certainly not a keyboard */ + return FALSE; + } + + DPRINT("Keyboard ID: %x", Value); + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) { + DPRINT("Partial ID\n"); + return FALSE; + } + + DPRINT ("%x\n", Value); + +detectsetleds: + Status = I8042SynchWritePort(DevExt, 0, KBD_SET_LEDS, TRUE); + if (Status != STATUS_SUCCESS) { + DPRINT("Can't write SET_LEDS (%x)\n", Status); + return FALSE; + } + Status = I8042SynchWritePort(DevExt, 0, 0, TRUE); + if (Status != STATUS_SUCCESS) { + DPRINT("Can't finish SET_LEDS (%x)\n", Status); + return FALSE; + } + + // Turn on translation + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_READ_MODE)) { + DPRINT1("Can't read i8042 mode\n"); + return FALSE; + } + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) { + DPRINT1("No response after read i8042 mode\n"); + return FALSE; + } + + Value |= 0x40; // enable keyboard translation + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) { + DPRINT1("Can't set i8042 mode\n"); + return FALSE; + } + + if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) { + DPRINT1("Can't send i8042 mode\n"); + return FALSE; + } + + return TRUE; +} + +/* debug stuff */ +VOID STDCALL +KdpServiceDispatcher(ULONG Code, PVOID Context1, PVOID Context2); + +static VOID STDCALL I8042DebugWorkItem(PDEVICE_OBJECT DeviceObject, + PVOID Context) +{ + ULONG Key; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + PDEVICE_EXTENSION DevExt = FdoDevExt->PortDevExt; + + Key = InterlockedExchange(&DevExt->DebugKey, 0); + DPRINT("Debug key: %x\n", Key); + + if (!Key) + return; + + KdpServiceDispatcher(TAG('R', 'o', 's', ' '), (PVOID)Key, NULL); +} diff --git a/reactos/drivers/input/i8042prt/makefile b/reactos/drivers/input/i8042prt/makefile new file mode 100644 index 00000000000..e9a809ce7d8 --- /dev/null +++ b/reactos/drivers/input/i8042prt/makefile @@ -0,0 +1,17 @@ +# $Id$ + +PATH_TO_TOP = ../../.. + +TARGET_BOOTSTRAP = yes + +TARGET_TYPE = driver + +TARGET_NAME = i8042prt + +TARGET_CFLAGS = -Wall -Werror -D__USE_W32API + +TARGET_OBJECTS = $(TARGET_NAME).o keyboard.o registry.o mouse.o ps2pp.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/input/i8042prt/mouse.c b/reactos/drivers/input/i8042prt/mouse.c new file mode 100644 index 00000000000..b044b0fc89a --- /dev/null +++ b/reactos/drivers/input/i8042prt/mouse.c @@ -0,0 +1,865 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/input/i8042prt/mouse.c + * PURPOSE: i8042 (ps/2 keyboard-mouse controller) driver + * mouse specifics + * PROGRAMMER: Victor Kirhenshtein (sauros@iname.com) + * Jason Filby (jasonfilby@yahoo.com) + * Tinus + */ + +/* INCLUDES ****************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#define NDEBUG +#include + +#include "i8042prt.h" + +/* + * These functions are callbacks for filter driver custom interrupt + * service routines. + */ +VOID STDCALL I8042IsrWritePortMouse(PVOID Context, + UCHAR Value) +{ + I8042IsrWritePort(Context, Value, 0xD4); +} + +NTSTATUS STDCALL I8042SynchWritePortMouse(PVOID Context, + UCHAR Value, + BOOLEAN WaitForAck) +{ + return I8042SynchWritePort((PDEVICE_EXTENSION)Context, + 0xD4, + Value, + WaitForAck); +} + +/* + * Call the customization hook. The Ret2 parameter is about wether + * we should go on with the interrupt. The return value is what + * we should return (indicating to the system wether someone else + * should try to handle the interrupt) + */ +BOOLEAN STDCALL I8042MouseCallIsrHook(PDEVICE_EXTENSION DevExt, + UCHAR Status, + PUCHAR Input, + PBOOLEAN ToReturn) +{ + BOOLEAN HookReturn, HookContinue; + + HookContinue = FALSE; + + if (DevExt->MouseHook.IsrRoutine) { + HookReturn = DevExt->MouseHook.IsrRoutine( + DevExt->MouseHook.Context, + DevExt->MouseBuffer + DevExt->MouseInBuffer, + &DevExt->Packet, + Status, + Input, + &HookContinue, + &DevExt->MouseState, + &DevExt->MouseResetState); + + if (!HookContinue) { + *ToReturn = HookReturn; + return TRUE; + } + } + return FALSE; +} + +BOOLEAN STDCALL I8042MouseResetIsr(PDEVICE_EXTENSION DevExt, + UCHAR Status, + PUCHAR Value) +{ + BOOLEAN ToReturn; + + if (I8042MouseCallIsrHook(DevExt, Status, Value, &ToReturn)) + return ToReturn; + + if (MouseResetting != DevExt->MouseState) { + return FALSE; + } + DevExt->MouseTimeoutState = TimeoutStart; + + switch (DevExt->MouseResetState) { + case 1100: /* the first ack, drop it. */ + DevExt->MouseResetState = ExpectingReset; + return TRUE; + /* First, 0xFF is sent. The mouse is supposed to say AA00 if ok, + * FC00 if not. + */ + case ExpectingReset: + if (0xAA == *Value) { + DevExt->MouseResetState++; + } else { + DevExt->MouseExists = FALSE; + DevExt->MouseState = MouseIdle; + DPRINT("Mouse returned bad reset reply: " + "%x (expected aa)\n", *Value); + } + return TRUE; + case ExpectingResetId: + if (0x00 == *Value) { + DevExt->MouseResetState++; + DevExt->MouseType = GenericPS2; + I8042IsrWritePortMouse(DevExt, 0xF2); + } else { + DevExt->MouseExists = FALSE; + DevExt->MouseState = MouseIdle; + DPRINT1("Mouse returned bad reset reply part two: " + "%x (expected 0)\n", Value); + } + return TRUE; + case ExpectingGetDeviceIdACK: + if (MOUSE_ACK == *Value) { + DevExt->MouseResetState++; + } else if (MOUSE_NACK == *Value || + MOUSE_ERROR == *Value) { + DevExt->MouseResetState++; + /* Act as if 00 (normal mouse) was received */ + DPRINT("Mouse doesn't support 0xd2, " + "(returns %x, expected %x), faking.\n", + *Value, MOUSE_ACK); + *Value = 0; + I8042MouseResetIsr(DevExt, Status, Value); + } + return TRUE; + case ExpectingGetDeviceIdValue: + switch (*Value) { + case 0x02: + DevExt->MouseAttributes.MouseIdentifier = + BALLPOINT_I8042_HARDWARE; + break; + case 0x03: + case 0x04: + DevExt->MouseAttributes.MouseIdentifier = + WHEELMOUSE_I8042_HARDWARE; + break; + default: + DevExt->MouseAttributes.MouseIdentifier = + MOUSE_I8042_HARDWARE; + } + DevExt->MouseResetState++; + I8042IsrWritePortMouse(DevExt, 0xE8); + return TRUE; + case ExpectingSetResolutionDefaultACK: + DevExt->MouseResetState++; + I8042IsrWritePortMouse(DevExt, 0x00); + return TRUE; + case ExpectingSetResolutionDefaultValueACK: + DevExt->MouseResetState = ExpectingSetScaling1to1ACK; + I8042IsrWritePortMouse(DevExt, 0xE6); + return TRUE; + case ExpectingSetScaling1to1ACK: + case ExpectingSetScaling1to1ACK2: + DevExt->MouseResetState++; + I8042IsrWritePortMouse(DevExt, 0xE6); + return TRUE; + case ExpectingSetScaling1to1ACK3: + DevExt->MouseResetState++; + I8042IsrWritePortMouse(DevExt, 0xE9); + return TRUE; + case ExpectingReadMouseStatusACK: + DevExt->MouseResetState++; + return TRUE; + case ExpectingReadMouseStatusByte1: + DevExt->MouseLogiBuffer[0] = *Value; + DevExt->MouseResetState++; + return TRUE; + case ExpectingReadMouseStatusByte2: + DevExt->MouseLogiBuffer[1] = *Value; + DevExt->MouseResetState++; + return TRUE; + case ExpectingReadMouseStatusByte3: + DevExt->MouseLogiBuffer[2] = *Value; + /* Now MouseLogiBuffer is a set of info. If the second + * byte is 0, the mouse didn't understand the magic + * code. Otherwise, it it a Logitech and the second byte + * is the number of buttons, bit 7 of the first byte tells + * if it understands special E7 commands, the rest is an ID. + */ + if (DevExt->MouseLogiBuffer[1]) { + DevExt->MouseAttributes.NumberOfButtons = + DevExt->MouseLogiBuffer[1]; + /* For some reason the ID is the wrong way around */ + DevExt->MouseLogitechID = + ((DevExt->MouseLogiBuffer[0] >> 4) & 0x07) | + ((DevExt->MouseLogiBuffer[0] << 3) & 0x78); + DevExt->MouseType = Ps2pp; + I8042IsrWritePortMouse(DevExt, 0xf3); + DevExt->MouseResetState = ExpectingSetSamplingRateACK; + return TRUE; + /* TODO: Go through EnableWheel and Enable5Buttons */ + } + DevExt->MouseResetState = EnableWheel; + I8042MouseResetIsr(DevExt, Status, Value); + return TRUE; + case EnableWheel: + I8042IsrWritePortMouse(DevExt, 0xf3); + DevExt->MouseResetState = 1001; + return TRUE; + case 1001: + I8042IsrWritePortMouse(DevExt, 0xc8); + DevExt->MouseResetState++; + return TRUE; + case 1002: + case 1004: + I8042IsrWritePortMouse(DevExt, 0xf3); + DevExt->MouseResetState++; + return TRUE; + case 1003: + I8042IsrWritePortMouse(DevExt, 0x64); + DevExt->MouseResetState++; + return TRUE; + case 1005: + I8042IsrWritePortMouse(DevExt, 0x50); + DevExt->MouseResetState++; + return TRUE; + case 1006: + I8042IsrWritePortMouse(DevExt, 0xf2); + DevExt->MouseResetState++; + return TRUE; + case 1007: + /* Ignore ACK */ + DevExt->MouseResetState++; + return TRUE; + case 1008: + /* Now if the value == 3, it's either an Intellimouse + * or Intellimouse Explorer. */ + if (0x03 == *Value) { + DevExt->MouseAttributes.NumberOfButtons = 3; + DevExt->MouseAttributes.MouseIdentifier = + WHEELMOUSE_I8042_HARDWARE; + DevExt->MouseType = Intellimouse; + DevExt->MouseResetState = Enable5Buttons; + I8042MouseResetIsr(DevExt, Status, Value); + return TRUE; + } /* Else, just set the default settings and be done */ + I8042IsrWritePortMouse(DevExt, 0xf3); + DevExt->MouseResetState = ExpectingSetSamplingRateACK; + return TRUE; + case Enable5Buttons: + I8042IsrWritePortMouse(DevExt, 0xf3); + DevExt->MouseResetState = 1021; + return TRUE; + case 1022: + case 1024: + I8042IsrWritePortMouse(DevExt, 0xf3); + DevExt->MouseResetState++; + return TRUE; + case 1021: + case 1023: + I8042IsrWritePortMouse(DevExt, 0xc8); + DevExt->MouseResetState++; + return TRUE; + case 1025: + I8042IsrWritePortMouse(DevExt, 0x50); + DevExt->MouseResetState++; + return TRUE; + case 1026: + I8042IsrWritePortMouse(DevExt, 0xf2); + DevExt->MouseResetState++; + return TRUE; + case 1027: + if (0x04 == *Value) { + DevExt->MouseAttributes.NumberOfButtons = 5; + DevExt->MouseAttributes.MouseIdentifier = + WHEELMOUSE_I8042_HARDWARE; + DevExt->MouseType = IntellimouseExplorer; + } + I8042IsrWritePortMouse(DevExt, 0xf3); + DevExt->MouseResetState = ExpectingSetSamplingRateACK; + return TRUE; + case ExpectingSetSamplingRateACK: + I8042IsrWritePortMouse(DevExt, + DevExt->MouseAttributes.SampleRate); + DevExt->MouseResetState++; + return TRUE; + case ExpectingSetSamplingRateValueACK: + if (MOUSE_NACK == *Value) { + I8042IsrWritePortMouse(DevExt, 0x3c); + DevExt->MouseAttributes.SampleRate = 60; + DevExt->MouseResetState = 1040; + return TRUE; + } + case 1040: /* Fallthrough */ + I8042IsrWritePortMouse(DevExt, 0xe8); + DevExt->MouseResetState = ExpectingFinalResolutionACK; + return TRUE; + case ExpectingFinalResolutionACK: + I8042IsrWritePortMouse(DevExt, 0x03); + DevExt->MouseResetState = ExpectingFinalResolutionValueACK; + return TRUE; + case ExpectingFinalResolutionValueACK: + I8042IsrWritePortMouse(DevExt, 0xf4); + DevExt->MouseResetState = ExpectingEnableACK; + return TRUE; + case ExpectingEnableACK: + DevExt->MouseState = MouseIdle; + DevExt->MouseTimeoutState = TimeoutCancel; + DPRINT("Mouse type = %d\n", DevExt->MouseType); + return TRUE; + default: + if (DevExt->MouseResetState < 100 || + DevExt->MouseResetState > 999) + DPRINT1("MouseResetState went out of range: %d\n", + DevExt->MouseResetState); + return FALSE; + } +} + +/* + * Prepare for reading the next packet and queue the dpc for handling + * this one. + * + * Context is the device object. + */ +VOID STDCALL I8042QueueMousePacket(PVOID Context) +{ + PDEVICE_OBJECT DeviceObject = Context; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + PDEVICE_EXTENSION DevExt = FdoDevExt->PortDevExt; + + DevExt->MouseComplete = TRUE; + DevExt->MouseInBuffer++; + if (DevExt->MouseInBuffer > + DevExt->MouseAttributes.InputDataQueueLength) { + DPRINT1("Mouse buffer overflow\n"); + DevExt->MouseInBuffer--; + } + + DPRINT("Irq completes mouse packet\n"); + KeInsertQueueDpc(&DevExt->DpcMouse, DevExt, NULL); +} + +/* + * Updates ButtonFlags according to RawButtons and a saved state; + * Only takes in account the bits that are set in Mask + */ +VOID STDCALL I8042MouseHandleButtons(PDEVICE_EXTENSION DevExt, + USHORT Mask) +{ + PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer + + DevExt->MouseInBuffer; + USHORT NewButtonData = MouseInput->RawButtons & Mask; + USHORT ButtonDiff = (NewButtonData ^ DevExt->MouseButtonState) & Mask; + + /* Note that the defines are such: + * MOUSE_LEFT_BUTTON_DOWN 1 + * MOUSE_LEFT_BUTTON_UP 2 + */ + MouseInput->ButtonFlags |= (NewButtonData & ButtonDiff) | + (((~(NewButtonData)) << 1) & + (ButtonDiff << 1)) | + (MouseInput->RawButtons & 0xfc00); + + DPRINT("Left raw/up/down: %d/%d/%d\n", MouseInput->RawButtons & MOUSE_LEFT_BUTTON_DOWN, + MouseInput->ButtonFlags & MOUSE_LEFT_BUTTON_DOWN, + MouseInput->ButtonFlags & MOUSE_LEFT_BUTTON_UP); + + DevExt->MouseButtonState = (DevExt->MouseButtonState & ~Mask) | + (NewButtonData & Mask); +} + +VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt, + BYTE Output) +{ + PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer + + DevExt->MouseInBuffer; + CHAR Scroll; + + switch (DevExt->MouseState) { + case MouseIdle: + /* This bit should be 1, if not drop the packet, we + * might be lucky and get in sync again + */ + if (!(Output & 8)) { + DPRINT1("Bad input, dropping..\n"); + return; + } + + MouseInput->Buttons = 0; + MouseInput->RawButtons = 0; + MouseInput->Flags = MOUSE_MOVE_RELATIVE; + + /* Note how we ignore the overflow bits, like Windows + * is said to do. There's no reasonable thing to do + * anyway. + */ + + if (Output & 16) + MouseInput->LastX = 1; + else + MouseInput->LastX = 0; + + if (Output & 32) + MouseInput->LastY = 1; + else + MouseInput->LastY = 0; + + if (Output & 1) { + MouseInput->RawButtons |= MOUSE_LEFT_BUTTON_DOWN; + } + + if (Output & 2) { + MouseInput->RawButtons |= MOUSE_RIGHT_BUTTON_DOWN; + } + + if (Output & 4) { + MouseInput->RawButtons |= MOUSE_MIDDLE_BUTTON_DOWN; + } + DevExt->MouseState = XMovement; + break; + case XMovement: + if (MouseInput->LastX) + MouseInput->LastX = (LONG) Output - 256; + else + MouseInput->LastX = Output; + + DevExt->MouseState = YMovement; + break; + case YMovement: + if (MouseInput->LastY) + MouseInput->LastY = (LONG)Output - 256; + else + MouseInput->LastY = (LONG)Output; + + /* Windows wants it the other way around */ + MouseInput->LastY = -MouseInput->LastY; + + if (DevExt->MouseType == GenericPS2 || + DevExt->MouseType == Ps2pp) { + I8042MouseHandleButtons(DevExt, + MOUSE_LEFT_BUTTON_DOWN | + MOUSE_RIGHT_BUTTON_DOWN | + MOUSE_MIDDLE_BUTTON_DOWN); + I8042QueueMousePacket( + DevExt->MouseObject); + DevExt->MouseState = MouseIdle; + } else { + DevExt->MouseState = ZMovement; + } + break; + case ZMovement: + Scroll = Output & 0x0f; + if (Scroll & 8) + Scroll |= 0xf0; + + if (Scroll) { + MouseInput->RawButtons |= MOUSE_WHEEL; + MouseInput->ButtonData = (USHORT) Scroll; + } + + if (DevExt->MouseType == IntellimouseExplorer) { + if (Output & 16) + MouseInput->RawButtons |= MOUSE_BUTTON_4_DOWN; + + if (Output & 32) + MouseInput->RawButtons |= MOUSE_BUTTON_5_DOWN; + } + I8042MouseHandleButtons(DevExt, MOUSE_LEFT_BUTTON_DOWN | + MOUSE_RIGHT_BUTTON_DOWN | + MOUSE_MIDDLE_BUTTON_DOWN | + MOUSE_BUTTON_4_DOWN | + MOUSE_BUTTON_5_DOWN); + I8042QueueMousePacket(DevExt->MouseObject); + DevExt->MouseState = MouseIdle; + break; + default: + DPRINT1("Unexpected state!\n"); + } +} + +BOOLEAN STDCALL I8042InterruptServiceMouse(struct _KINTERRUPT *Interrupt, + VOID *Context) +{ + BYTE Output, PortStatus; + NTSTATUS Status; + PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context; + UINT Iterations = 0; + + do { + Status = I8042ReadStatus(&PortStatus); + Status = I8042ReadData(&Output); + Iterations++; + if (STATUS_SUCCESS == Status) + break; + KeStallExecutionProcessor(1); + } while (Iterations < DevExt->Settings.PollStatusIterations); + + if (STATUS_SUCCESS != Status) { + DPRINT1("Spurious I8042 mouse interrupt\n"); + return FALSE; + } + + DPRINT("Got: %x\n", Output); + + if (I8042PacketIsr(DevExt, Output)) { + if (DevExt->PacketComplete) { + DPRINT("Packet complete\n"); + KeInsertQueueDpc(&DevExt->DpcKbd, DevExt, NULL); + } + DPRINT("Irq eaten by packet\n"); + return TRUE; + } + + if (I8042MouseResetIsr(DevExt, PortStatus, &Output)) { + DPRINT("Handled by ResetIsr or hooked Isr\n"); + if (NoChange != DevExt->MouseTimeoutState) { + KeInsertQueueDpc(&DevExt->DpcMouse, DevExt, NULL); + } + return TRUE; + } + + if (DevExt->MouseType == Ps2pp) + I8042MouseHandlePs2pp(DevExt, Output); + else + I8042MouseHandle(DevExt, Output); + + return TRUE; +} + +VOID STDCALL I8042DpcRoutineMouse(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2) +{ + PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION)SystemArgument1; + ULONG MouseTransferred = 0; + ULONG MouseInBufferCopy; + KIRQL Irql; + LARGE_INTEGER Timeout; + + switch (DevExt->MouseTimeoutState) { + case TimeoutStart: + DevExt->MouseTimeoutState = NoChange; + if (DevExt->MouseTimeoutActive && + !KeCancelTimer(&DevExt->TimerMouseTimeout)) { + /* The timer fired already, give up */ + DevExt->MouseTimeoutActive = FALSE; + return; + } + + Timeout.QuadPart = -15000000; + /* 1.5 seconds, should be enough */ + + KeSetTimer(&DevExt->TimerMouseTimeout, + Timeout, + &DevExt->DpcMouseTimeout); + DevExt->MouseTimeoutActive = TRUE; + return; + case TimeoutCancel: + DevExt->MouseTimeoutState = NoChange; + KeCancelTimer(&DevExt->TimerMouseTimeout); + DevExt->MouseTimeoutActive = FALSE; + default: + /* nothing, don't want a warning */ ; + } + + /* Should be unlikely */ + if (!DevExt->MouseComplete) + return; + + Irql = KeAcquireInterruptSpinLock(DevExt->HighestDIRQLInterrupt); + + DevExt->MouseComplete = FALSE; + MouseInBufferCopy = DevExt->MouseInBuffer; + + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, Irql); + + DPRINT ("Send a mouse packet\n"); + + if (!DevExt->MouseData.ClassService) + return; + + ((MOUSE_CLASS_SERVICE_CALLBACK) DevExt->MouseData.ClassService)( + DevExt->MouseData.ClassDeviceObject, + DevExt->MouseBuffer, + DevExt->MouseBuffer + MouseInBufferCopy, + &MouseTransferred); + + Irql = KeAcquireInterruptSpinLock(DevExt->HighestDIRQLInterrupt); + + DevExt->MouseInBuffer -= MouseTransferred; + if (DevExt->MouseInBuffer) + RtlMoveMemory(DevExt->MouseBuffer, + DevExt->MouseBuffer+MouseTransferred, + DevExt->MouseInBuffer * sizeof(MOUSE_INPUT_DATA)); + + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, Irql); +} + +/* This timer DPC will be called when the mouse reset times out. + * I'll just send the 'disable mouse port' command to the controller + * and say the mouse doesn't exist. + */ +VOID STDCALL I8042DpcRoutineMouseTimeout(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2) +{ + PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION)DeferredContext; + KIRQL Irql; + + Irql = KeAcquireInterruptSpinLock(DevExt->HighestDIRQLInterrupt); + + DPRINT1("Mouse initialization timeout! (substate %x) " + "Disabling mouse.\n", + DevExt->MouseResetState); + + if (!I8042MouseDisable(DevExt)) { + DPRINT1("Failed to disable mouse.\n"); + } + + DevExt->MouseExists = FALSE; + + KeReleaseInterruptSpinLock(DevExt->HighestDIRQLInterrupt, Irql); +} + +/* + * Process the mouse internal device requests + * returns FALSE if it doesn't understand the + * call so someone else can handle it. + */ +BOOLEAN STDCALL I8042StartIoMouse(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stk; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + PDEVICE_EXTENSION DevExt = FdoDevExt->PortDevExt; + + Stk = IoGetCurrentIrpStackLocation(Irp); + + switch (Stk->Parameters.DeviceIoControl.IoControlCode) { + case IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER: + I8042StartPacket( + DevExt, + DeviceObject, + Stk->Parameters.DeviceIoControl.Type3InputBuffer, + Stk->Parameters.DeviceIoControl.InputBufferLength, + Irp); + break; + + default: + return FALSE; + } + + return TRUE; +} + +/* + * Runs the mouse IOCTL_INTERNAL dispatch. + * Returns NTSTATUS_INVALID_DEVICE_REQUEST if it doesn't handle this request + * so someone else can have a try at it. + */ +NTSTATUS STDCALL I8042InternalDeviceControlMouse(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stk; + PFDO_DEVICE_EXTENSION FdoDevExt = DeviceObject->DeviceExtension; + PDEVICE_EXTENSION DevExt = FdoDevExt->PortDevExt; + + DPRINT("InternalDeviceControl\n"); + + Irp->IoStatus.Information = 0; + Stk = IoGetCurrentIrpStackLocation(Irp); + + switch (Stk->Parameters.DeviceIoControl.IoControlCode) { + + case IOCTL_INTERNAL_MOUSE_CONNECT: + DPRINT("IOCTL_INTERNAL_MOUSE_CONNECT\n"); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < + sizeof(CONNECT_DATA)) { + DPRINT1("Mouse IOCTL_INTERNAL_MOUSE_CONNECT " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + goto intcontfailure; + } + + if (!DevExt->MouseExists) { + Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED; + goto intcontfailure; + } + + if (DevExt->MouseClaimed) { + DPRINT1("IOCTL_INTERNAL_MOUSE_CONNECT: " + "Mouse is already claimed\n"); + Irp->IoStatus.Status = STATUS_SHARING_VIOLATION; + goto intcontfailure; + } + + memcpy(&DevExt->MouseData, + Stk->Parameters.DeviceIoControl.Type3InputBuffer, + sizeof(CONNECT_DATA)); + DevExt->MouseHook.IsrWritePort = I8042IsrWritePortMouse; + DevExt->MouseHook.QueueMousePacket = + I8042QueueMousePacket; + DevExt->MouseHook.CallContext = DevExt; + + { + PIO_WORKITEM WorkItem; + PI8042_HOOK_WORKITEM WorkItemData; + + WorkItem = IoAllocateWorkItem(DeviceObject); + if (!WorkItem) { + DPRINT ("IOCTL_INTERNAL_MOUSE_CONNECT: " + "Can't allocate work item\n"); + Irp->IoStatus.Status = + STATUS_INSUFFICIENT_RESOURCES; + goto intcontfailure; + } + + WorkItemData = ExAllocatePoolWithTag( + NonPagedPool, + sizeof(I8042_HOOK_WORKITEM), + TAG_I8042); + if (!WorkItemData) { + DPRINT ("IOCTL_INTERNAL_MOUSE_CONNECT: " + "Can't allocate work item data\n"); + Irp->IoStatus.Status = + STATUS_INSUFFICIENT_RESOURCES; + IoFreeWorkItem(WorkItem); + goto intcontfailure; + } + WorkItemData->WorkItem = WorkItem; + WorkItemData->Target = + DevExt->MouseData.ClassDeviceObject; + WorkItemData->Irp = Irp; + + IoMarkIrpPending(Irp); + DevExt->MouseState = MouseResetting; + DevExt->MouseResetState = 1100; + IoQueueWorkItem(WorkItem, + I8042SendHookWorkItem, + DelayedWorkQueue, + WorkItemData); + + Irp->IoStatus.Status = STATUS_PENDING; + } + + break; + case IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER: + DPRINT("IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER\n"); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < 1) { + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + goto intcontfailure; + } + if (!DevExt->MouseInterruptObject) { + Irp->IoStatus.Status = STATUS_DEVICE_NOT_READY; + goto intcontfailure; + } + + IoMarkIrpPending(Irp); + IoStartPacket(DeviceObject, Irp, NULL, NULL); + Irp->IoStatus.Status = STATUS_PENDING; + + break; + case IOCTL_MOUSE_QUERY_ATTRIBUTES: + DPRINT("IOCTL_MOUSE_QUERY_ATTRIBUTES\n"); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < + sizeof(MOUSE_ATTRIBUTES)) { + DPRINT("Mouse IOCTL_MOUSE_QUERY_ATTRIBUTES " + "invalid buffer size\n"); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + goto intcontfailure; + } + memcpy(Irp->AssociatedIrp.SystemBuffer, + &DevExt->MouseAttributes, + sizeof(MOUSE_ATTRIBUTES)); + + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + default: + Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; + break; + } + +intcontfailure: + return Irp->IoStatus.Status; +} + +BOOLEAN STDCALL I8042MouseEnable(PDEVICE_EXTENSION DevExt) +{ + UCHAR Value; + NTSTATUS Status; + + DPRINT("Enabling mouse\n"); + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_READ_MODE)) { + DPRINT1("Can't read i8042 mode\n"); + return FALSE; + } + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) { + DPRINT1("No response after read i8042 mode\n"); + return FALSE; + } + + Value &= ~(0x20); // don't disable mouse + Value |= 0x02; // enable mouse interrupts + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) { + DPRINT1("Can't set i8042 mode\n"); + return FALSE; + } + + if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) { + DPRINT1("Can't send i8042 mode\n"); + return FALSE; + } + + return TRUE; +} + +BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt) +{ + UCHAR Value; + NTSTATUS Status; + + DPRINT("Disabling mouse\n"); + + I8042Flush(); /* Just to be (kind of) sure */ + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_READ_MODE)) { + DPRINT1("Can't read i8042 mode\n"); + return FALSE; + } + + Status = I8042ReadDataWait(DevExt, &Value); + if (Status != STATUS_SUCCESS) { + DPRINT1("No response after read i8042 mode\n"); + return FALSE; + } + + Value |= 0x20; // don't disable mouse + Value &= ~(0x02); // enable mouse interrupts + + if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) { + DPRINT1("Can't set i8042 mode\n"); + return FALSE; + } + + if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) { + DPRINT1("Can't send i8042 mode\n"); + return FALSE; + } + + I8042Flush(); + /* Just to be (kind of) sure; if the mouse would + * say something while we are disabling it, these bytes would + * block the keyboard. + */ + + return TRUE; +} diff --git a/reactos/drivers/input/i8042prt/ps2pp.c b/reactos/drivers/input/i8042prt/ps2pp.c new file mode 100644 index 00000000000..cf03f1e4058 --- /dev/null +++ b/reactos/drivers/input/i8042prt/ps2pp.c @@ -0,0 +1,140 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/input/i8042prt/ps2pp.c + * PURPOSE: i8042prt driver + * ps2pp protocol handling + * PROGRAMMER: Tinus + */ + +/* INCLUDES ****************************************************************/ + +#include + +#include +#include + +#define NDEBUG +#include + +#include "i8042prt.h" + + +VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, BYTE Input) +{ + UCHAR PktType; + PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer + + DevExt->MouseInBuffer; + +/* First, collect 3 bytes for a packet + * We can detect out-of-sync only by checking + * the whole packet anyway. + * + * If bit 7 and 8 of the first byte are 0, its + * a normal packet. + * + * Otherwise, the packet is different, like this: + * 1: E 1 b3 b2 x x x x + * 2: x x b1 b0 x1 x0 1 0 + * 3: x x x x x x x1 x0 + * + * b3-0 form a code that specifies the packet type: + * + * 0 Device Type + * 1 Rollers and buttons + * 2 Reserved + * 3 Reserved + * 4 Device ID + * 5 Channel & Battery + * 6 Wireless notifications + * 7 Reserved + * 8 ShortID LSB (ShortID is a number that is supposed to differentiate + * 9 ShortID MSB between your mouse and your neighbours') + * 10 Reserved + * 11 Mouse capabilities + * 12 Remote control LSB + * 13 Remote control MSB + * 14 Reserved + * 15 Extended packet + */ + + switch (DevExt->MouseState) { + case MouseIdle: + case XMovement: + DevExt->MouseLogiBuffer[DevExt->MouseState] = Input; + DevExt->MouseState++; + break; + + case YMovement: + DevExt->MouseLogiBuffer[2] = Input; + DevExt->MouseState = MouseIdle; + + /* first check if it's a normal packet */ + + if (!(DevExt->MouseLogiBuffer[0] & 0xC0)) { + DevExt->MouseState = MouseIdle; + I8042MouseHandle(DevExt, DevExt->MouseLogiBuffer[0]); + I8042MouseHandle(DevExt, DevExt->MouseLogiBuffer[1]); + I8042MouseHandle(DevExt, DevExt->MouseLogiBuffer[2]); + /* We could care about wether MouseState really + * advances, but we don't need to because we're + * only doing three bytes anyway, so the packet + * will never complete if it's broken. + */ + return; + } + + /* sanity check */ + + if (((DevExt->MouseLogiBuffer[0] & 0x48) != 0x48) || + (((DevExt->MouseLogiBuffer[1] & 0x0C) >> 2) != + (DevExt->MouseLogiBuffer[2] & 0x03))) { + DPRINT1("Ps2pp packet fails sanity checks\n"); + return; + } + + /* Now get the packet type */ + + PktType = ((DevExt->MouseLogiBuffer[0] & 0x30) >> 4) & + ((DevExt->MouseLogiBuffer[1] & 0x30) >> 6); + + switch (PktType) { + case 0: + /* The packet contains the device ID, but we + * already read that in the initialization + * sequence. Ignore it. + */ + return; + case 1: + RtlZeroMemory(MouseInput, sizeof(MOUSE_INPUT_DATA)); + if (DevExt->MouseLogiBuffer[2] & 0x10) + MouseInput->RawButtons |= MOUSE_BUTTON_4_DOWN; + + if (DevExt->MouseLogiBuffer[2] & 0x20) + MouseInput->RawButtons |= MOUSE_BUTTON_5_DOWN; + + if (DevExt->MouseLogiBuffer[2] & 0x0F) { + MouseInput->ButtonFlags |= MOUSE_WHEEL; + if (DevExt->MouseLogiBuffer[2] & 0x08) + MouseInput->ButtonData = + (DevExt->MouseLogiBuffer[2] & 0x07) - + 8; + else + MouseInput->ButtonData = + DevExt->MouseLogiBuffer[2] & 0x07; + } + I8042MouseHandleButtons(DevExt, MOUSE_BUTTON_4_DOWN | + MOUSE_BUTTON_5_DOWN); + I8042QueueMousePacket( + DevExt->MouseObject); + return; + default: + /* These are for things that would probably + * be handled by logitechs own driver. + */ + return; + } + default: + DPRINT1("Unexpected input state for ps2pp!\n"); + } +} diff --git a/reactos/drivers/input/i8042prt/registry.c b/reactos/drivers/input/i8042prt/registry.c new file mode 100644 index 00000000000..ad274d64342 --- /dev/null +++ b/reactos/drivers/input/i8042prt/registry.c @@ -0,0 +1,237 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/input/i8042prt/registry.c + * PURPOSE: i8042 (ps/2 keyboard-mouse controller) driver + * Reading the registry + * PROGRAMMER: Victor Kirhenshtein (sauros@iname.com) + * Jason Filby (jasonfilby@yahoo.com) + * Tinus + */ + +/* INCLUDES ****************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#define NDEBUG +#include + +#include "i8042prt.h" + +/* FUNCTIONS *****************************************************************/ + +/* + * Read the registry keys associated with this device. The RegistryPath + * var is a hack. This should be more like what microsoft does, but I + * don't know exactly what they do except that it's a hack too... + */ +VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject, + PDEVICE_EXTENSION DevExt) + +{ + RTL_QUERY_REGISTRY_TABLE Parameters[18]; + UNICODE_STRING ParametersPath; + + PWSTR RegistryPath = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\i8042Prt\\Parameters"; + + NTSTATUS Status; + + DWORD DefaultHeadless = 0; + DWORD DefaultCrashScroll = 0; + DWORD DefaultCrashSysRq = 0; + DWORD DefaultReportResetErrors = 0; + DWORD DefaultPollStatusIterations = 1; + DWORD DefaultResendIterations = 3; + DWORD DefaultPollingIterations = 12000; + DWORD DefaultPollingIterationsMaximum = 12000; + DWORD DefaultKeyboardDataQueueSize = 100; + DWORD DefaultOverrideKeyboardType = 0; + DWORD DefaultOverrideKeyboardSubtype = 0; + DWORD DefaultMouseDataQueueSize = 100; + DWORD DefaultMouseResendStallTime = 1000; + DWORD DefaultMouseSynchIn100ns = 20000000; + DWORD DefaultMouseResolution = 3; + DWORD DefaultSampleRate = 60; + DWORD DefaultNumberOfButtons = 2; + DWORD DefaultEnableWheelDetection = 1; + + RtlInitUnicodeString(&ParametersPath, NULL); + ParametersPath.MaximumLength = (wcslen(RegistryPath) * + sizeof(WCHAR)) + + sizeof(UNICODE_NULL); + + ParametersPath.Buffer = ExAllocatePoolWithTag(PagedPool, + ParametersPath.MaximumLength, + TAG_I8042); + + if (!ParametersPath.Buffer) { + DPRINT1("No buffer space for reading registry\n"); + return; + } + + RtlZeroMemory(ParametersPath.Buffer, ParametersPath.MaximumLength); + RtlAppendUnicodeToString(&ParametersPath, RegistryPath); + + RtlZeroMemory(Parameters, sizeof(Parameters)); + + Parameters[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[0].Name = L"Headless"; + Parameters[0].EntryContext = &DevExt->Settings.Headless; + Parameters[0].DefaultType = REG_DWORD; + Parameters[0].DefaultData = &DefaultHeadless; + Parameters[0].DefaultLength = sizeof(ULONG); + + Parameters[1].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[1].Name = L"CrashOnCtrlScroll"; + Parameters[1].EntryContext = &DevExt->Settings.CrashScroll; + Parameters[1].DefaultType = REG_DWORD; + Parameters[1].DefaultData = &DefaultCrashScroll; + Parameters[1].DefaultLength = sizeof(ULONG); + + Parameters[2].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[2].Name = L"BreakOnSysRq"; + Parameters[2].EntryContext = &DevExt->Settings.CrashSysRq; + Parameters[2].DefaultType = REG_DWORD; + Parameters[2].DefaultData = &DefaultCrashSysRq; + Parameters[2].DefaultLength = sizeof(ULONG); + + Parameters[3].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[3].Name = L"ReportResetErrors"; + Parameters[3].EntryContext = &DevExt->Settings.ReportResetErrors; + Parameters[3].DefaultType = REG_DWORD; + Parameters[3].DefaultData = &DefaultReportResetErrors; + Parameters[3].DefaultLength = sizeof(ULONG); + + Parameters[4].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[4].Name = L"PollStatusIterations"; + Parameters[4].EntryContext = &DevExt->Settings.PollStatusIterations; + Parameters[4].DefaultType = REG_DWORD; + Parameters[4].DefaultData = &DefaultPollStatusIterations; + Parameters[4].DefaultLength = sizeof(ULONG); + + Parameters[5].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[5].Name = L"ResendIterations"; + Parameters[5].EntryContext = &DevExt->Settings.ResendIterations; + Parameters[5].DefaultType = REG_DWORD; + Parameters[5].DefaultData = &DefaultResendIterations; + Parameters[5].DefaultLength = sizeof(ULONG); + + Parameters[6].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[6].Name = L"PollingIterations"; + Parameters[6].EntryContext = &DevExt->Settings.PollingIterations; + Parameters[6].DefaultType = REG_DWORD; + Parameters[6].DefaultData = &DefaultPollingIterations; + Parameters[6].DefaultLength = sizeof(ULONG); + + Parameters[7].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[7].Name = L"PollingIterationsMaximum"; + Parameters[7].EntryContext = &DevExt->Settings.PollingIterationsMaximum; + Parameters[7].DefaultType = REG_DWORD; + Parameters[7].DefaultData = &DefaultPollingIterationsMaximum; + Parameters[7].DefaultLength = sizeof(ULONG); + + Parameters[8].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[8].Name = L"KeyboardDataQueueSize"; + Parameters[8].EntryContext = + &DevExt->KeyboardAttributes.InputDataQueueLength; + Parameters[8].DefaultType = REG_DWORD; + Parameters[8].DefaultData = &DefaultKeyboardDataQueueSize; + Parameters[8].DefaultLength = sizeof(ULONG); + + Parameters[9].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[9].Name = L"OverrideKeyboardType"; + Parameters[9].EntryContext = &DevExt->Settings.OverrideKeyboardType; + Parameters[9].DefaultType = REG_DWORD; + Parameters[9].DefaultData = &DefaultOverrideKeyboardType; + Parameters[9].DefaultLength = sizeof(ULONG); + + Parameters[10].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[10].Name = L"OverrideKeyboardSubtype"; + Parameters[10].EntryContext = &DevExt->Settings.OverrideKeyboardSubtype; + Parameters[10].DefaultType = REG_DWORD; + Parameters[10].DefaultData = &DefaultOverrideKeyboardSubtype; + Parameters[10].DefaultLength = sizeof(ULONG); + + Parameters[11].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[11].Name = L"MouseDataQueueSize"; + Parameters[11].EntryContext = + &DevExt->MouseAttributes.InputDataQueueLength; + Parameters[11].DefaultType = REG_DWORD; + Parameters[11].DefaultData = &DefaultMouseDataQueueSize; + Parameters[11].DefaultLength = sizeof(ULONG); + + Parameters[12].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[12].Name = L"MouseResendStallTime"; + Parameters[12].EntryContext = &DevExt->Settings.MouseResendStallTime; + Parameters[12].DefaultType = REG_DWORD; + Parameters[12].DefaultData = &DefaultMouseResendStallTime; + Parameters[12].DefaultLength = sizeof(ULONG); + + Parameters[13].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[13].Name = L"MouseSynchIn100ns"; + Parameters[13].EntryContext = &DevExt->Settings.MouseSynchIn100ns; + Parameters[13].DefaultType = REG_DWORD; + Parameters[13].DefaultData = &DefaultMouseSynchIn100ns; + Parameters[13].DefaultLength = sizeof(ULONG); + + Parameters[14].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[14].Name = L"MouseResolution"; + Parameters[14].EntryContext = &DevExt->Settings.MouseResolution; + Parameters[14].DefaultType = REG_DWORD; + Parameters[14].DefaultData = &DefaultMouseResolution; + Parameters[14].DefaultLength = sizeof(ULONG); + + Parameters[14].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[14].Name = L"SampleRate"; + Parameters[14].EntryContext = &DevExt->MouseAttributes.SampleRate; + Parameters[14].DefaultType = REG_DWORD; + Parameters[14].DefaultData = &DefaultSampleRate; + Parameters[14].DefaultLength = sizeof(ULONG); + + Parameters[15].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[15].Name = L"NumberOfButtons"; + Parameters[15].EntryContext = &DevExt->Settings.NumberOfButtons; + Parameters[15].DefaultType = REG_DWORD; + Parameters[15].DefaultData = &DefaultNumberOfButtons; + Parameters[15].DefaultLength = sizeof(ULONG); + + Parameters[16].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[16].Name = L"EnableWheelDetection"; + Parameters[16].EntryContext = &DevExt->Settings.EnableWheelDetection; + Parameters[16].DefaultType = REG_DWORD; + Parameters[16].DefaultData = &DefaultEnableWheelDetection; + Parameters[16].DefaultLength = sizeof(ULONG); + + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE | + RTL_REGISTRY_OPTIONAL, + ParametersPath.Buffer, + Parameters, + NULL, + NULL); + + if (Status != STATUS_SUCCESS) { + DPRINT1 ("Can't read registry: %x\n", Status); + /* Actually, the defaults are not set when the function + * fails, as would happen during setup, so you have to + * set them manually anyway... + */ + RTL_QUERY_REGISTRY_TABLE *Current = Parameters; + while (Current->Name) { + *((DWORD *)Current->EntryContext) = + *((DWORD *)Current->DefaultData); + Current++; + } + DPRINT1 ("Manually set defaults\n"); + + } + ExFreePoolWithTag(ParametersPath.Buffer, TAG_I8042); + DPRINT("Done reading registry\n"); +} + diff --git a/reactos/drivers/input/kbdclass/kbdclass.c b/reactos/drivers/input/kbdclass/kbdclass.c new file mode 100644 index 00000000000..866275ae61f --- /dev/null +++ b/reactos/drivers/input/kbdclass/kbdclass.c @@ -0,0 +1,306 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/input/kbdclass/kbdclass.c + * PURPOSE: Keyboard class driver + * PROGRAMMER: Victor Kirhenshtein (sauros@iname.com) + * Jason Filby (jasonfilby@yahoo.com) + * Tinus_ + */ + +/* INCLUDES ****************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#define NDEBUG +#include + +#include "kbdclass.h" + +/* GLOBALS *******************************************************************/ + +/* + * Driver data + */ + +static BOOLEAN AlreadyOpened = FALSE; + +static VOID STDCALL KbdCopyKeys(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PDEVICE_EXTENSION DevExt = DeviceObject->DeviceExtension; + PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); + ULONG NrToRead = stk->Parameters.Read.Length / + sizeof(KEYBOARD_INPUT_DATA); + ULONG NrRead = Irp->IoStatus.Information/sizeof(KEYBOARD_INPUT_DATA); + KEYBOARD_INPUT_DATA *Rec = + (KEYBOARD_INPUT_DATA *)Irp->AssociatedIrp.SystemBuffer; + + while (DevExt->KeysInBuffer && + NrRead < NrToRead) { + memcpy(&Rec[NrRead], + &DevExt->KbdBuffer[DevExt->BufHead], + sizeof(KEYBOARD_INPUT_DATA)); + + if (++DevExt->BufHead >= KBD_BUFFER_SIZE) + DevExt->BufHead = 0; + + DevExt->KeysInBuffer--; + NrRead++; + } + Irp->IoStatus.Information = NrRead * sizeof(KEYBOARD_INPUT_DATA); + + if (NrRead < NrToRead) { + Irp->IoStatus.Status = STATUS_PENDING; + DPRINT("Pending... (NrRead %d, NrToRead %d\n", NrRead, NrToRead); + } else { + DPRINT("Send scancode: %x\n", ((KEYBOARD_INPUT_DATA*)Irp->AssociatedIrp.SystemBuffer)->MakeCode); + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + IoStartNextPacket (DeviceObject, FALSE); + DPRINT("Success!\n"); + } +} + +static VOID STDCALL KbdClassServiceCallback ( + PDEVICE_OBJECT DeviceObject, + PKEYBOARD_INPUT_DATA InputDataStart, + PKEYBOARD_INPUT_DATA InputDataEnd, + PULONG InputDataConsumed) +{ + PDEVICE_EXTENSION DevExt = DeviceObject->DeviceExtension; + PKEYBOARD_INPUT_DATA CurrentInput = InputDataStart; + + DPRINT("ServiceCallback called\n"); + + while (DevExt->KeysInBuffer < KBD_BUFFER_SIZE && + CurrentInput < InputDataEnd) { + memcpy(&DevExt->KbdBuffer[DevExt->BufTail], + CurrentInput, + sizeof(KEYBOARD_INPUT_DATA)); + + if (++DevExt->BufTail >= KBD_BUFFER_SIZE) + DevExt->BufTail = 0; + DevExt->KeysInBuffer++; + + CurrentInput++; + InputDataConsumed[0]++; + } + + if (CurrentInput < InputDataStart) + /* Copy the rest to the beginning, perhaps the keyboard + * can buffer it for us */ + memmove(InputDataStart, + CurrentInput, + ((char *)InputDataEnd - (char *)CurrentInput)); + + if (DeviceObject->CurrentIrp) { + PIRP Irp = DeviceObject->CurrentIrp; + PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); + if (stk->MajorFunction == IRP_MJ_READ) + KbdCopyKeys(DeviceObject, Irp); + } +} + +VOID STDCALL KbdStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + /* We only do this for read irps */ + DPRINT("KeyboardStartIo(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + KbdCopyKeys(DeviceObject, Irp); +} + + +/* + * These are just passed down the stack but we must change the IOCTL to be + * INTERNAL. MSDN says there might be more... + */ +NTSTATUS STDCALL KbdDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PDEVICE_EXTENSION DevExt = DeviceObject->DeviceExtension; + PIO_STACK_LOCATION Stk = IoGetCurrentIrpStackLocation(Irp); + PIO_STACK_LOCATION NextStk = IoGetNextIrpStackLocation(Irp); + + DPRINT ("KbdDeviceControl %x\n", Stk->Parameters.DeviceIoControl.IoControlCode); + + switch (Stk->Parameters.DeviceIoControl.IoControlCode) { + case IOCTL_KEYBOARD_QUERY_ATTRIBUTES: + case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION: + case IOCTL_KEYBOARD_QUERY_INDICATORS: + case IOCTL_KEYBOARD_QUERY_TYPEMATIC: + case IOCTL_KEYBOARD_SET_INDICATORS: + case IOCTL_KEYBOARD_SET_TYPEMATIC: /* not in MSDN, would seem logical */ + IoCopyCurrentIrpStackLocationToNext(Irp); + NextStk->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; + + return IoCallDriver(DevExt->I8042Device, Irp); + default: + return STATUS_INVALID_DEVICE_REQUEST; + } +} + +static NTSTATUS STDCALL KbdInternalDeviceControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PDEVICE_EXTENSION DevExt = DeviceObject->DeviceExtension; + + DPRINT ("KbdInternalDeviceControl\n"); + + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DevExt->I8042Device, Irp); +} + +static NTSTATUS STDCALL KbdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); + NTSTATUS Status; + + DPRINT("DeviceObject %x\n",DeviceObject); + DPRINT("Irp %x\n",Irp); + + DPRINT("Dispatch: stk->MajorFunction %d\n", stk->MajorFunction); + DPRINT("AlreadyOpened %d\n",AlreadyOpened); + + switch (stk->MajorFunction) { + case IRP_MJ_CREATE: + if (AlreadyOpened == TRUE) { + CHECKPOINT; + Status = STATUS_UNSUCCESSFUL; + DPRINT1("Keyboard is already open\n"); + } else { + CHECKPOINT; + Status = STATUS_SUCCESS; + AlreadyOpened = TRUE; + } + break; + + case IRP_MJ_CLOSE: + Status = STATUS_SUCCESS; + AlreadyOpened = FALSE; + break; + + case IRP_MJ_READ: + DPRINT("Queueing packet\n"); + IoMarkIrpPending(Irp); + IoStartPacket(DeviceObject,Irp,NULL,NULL); + return(STATUS_PENDING); + + default: + Status = STATUS_NOT_IMPLEMENTED; + break; + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp,IO_NO_INCREMENT); + DPRINT("Status %d\n",Status); + return(Status); +} + +static VOID STDCALL KbdClassSendConnect(PDEVICE_EXTENSION DevExt) +{ + CONNECT_DATA ConnectData; + KEVENT Event; + IO_STATUS_BLOCK IoStatus; + NTSTATUS Status; + PIRP Irp; + + KeInitializeEvent(&Event, NotificationEvent, FALSE); + + ConnectData.ClassDeviceObject = DevExt->DeviceObject; + ConnectData.ClassService = KbdClassServiceCallback; + + Irp = IoBuildDeviceIoControlRequest( + IOCTL_INTERNAL_KEYBOARD_CONNECT, + DevExt->I8042Device, + &ConnectData, + sizeof(CONNECT_DATA), + NULL, + 0, + TRUE, + &Event, + &IoStatus); + + if (!Irp) + return; + + Status = IoCallDriver( + DevExt->I8042Device, + Irp); + DPRINT("SendConnect status: %x\n", Status); + + if (STATUS_PENDING ==Status) + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FALSE, + NULL); + DPRINT("SendConnect done\n"); +} + +NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) +/* + * FUNCTION: Module entry point + */ +{ + PDEVICE_OBJECT DeviceObject; + PDEVICE_EXTENSION DevExt; + PFILE_OBJECT I8042File; + NTSTATUS Status; + UNICODE_STRING DeviceName = ROS_STRING_INITIALIZER(L"\\Device\\Keyboard"); + UNICODE_STRING SymlinkName = ROS_STRING_INITIALIZER(L"\\??\\Keyboard"); + UNICODE_STRING I8042Name = ROS_STRING_INITIALIZER(L"\\Device\\KeyboardClass0"); + + DPRINT("Keyboard Class Driver 0.0.1\n"); + + DriverObject->MajorFunction[IRP_MJ_CREATE] = KbdDispatch; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = KbdDispatch; + DriverObject->MajorFunction[IRP_MJ_READ] = KbdDispatch; + DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = + KbdInternalDeviceControl; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = KbdDeviceControl; + + DriverObject->DriverStartIo = KbdStartIo; + + IoCreateDevice(DriverObject, + sizeof(DEVICE_EXTENSION), + &DeviceName, + FILE_DEVICE_KEYBOARD, + 0, + TRUE, + &DeviceObject); + + RtlZeroMemory(DeviceObject->DeviceExtension, sizeof(DEVICE_EXTENSION)); + DevExt = DeviceObject->DeviceExtension; + DevExt->DeviceObject = DeviceObject; + + Status = IoGetDeviceObjectPointer(&I8042Name, + FILE_READ_DATA, + &I8042File, + &DevExt->I8042Device); + + if (STATUS_SUCCESS != Status) { + DPRINT("Failed to open device: %x\n", Status); + return Status; + } + + ObReferenceObject(DevExt->I8042Device); + ObDereferenceObject(I8042File); + + DeviceObject->Flags = DeviceObject->Flags | DO_BUFFERED_IO; + + DeviceObject->StackSize = 1 + DevExt->I8042Device->StackSize; + + IoCreateSymbolicLink(&SymlinkName, &DeviceName); + + KbdClassSendConnect(DevExt); + + return(STATUS_SUCCESS); +} diff --git a/reactos/drivers/input/keyboard/keyboard.h b/reactos/drivers/input/kbdclass/kbdclass.h similarity index 78% rename from reactos/drivers/input/keyboard/keyboard.h rename to reactos/drivers/input/kbdclass/kbdclass.h index 18885ceac13..a96273d610d 100644 --- a/reactos/drivers/input/keyboard/keyboard.h +++ b/reactos/drivers/input/kbdclass/kbdclass.h @@ -3,26 +3,37 @@ #include #include +#define KBD_BUFFER_SIZE 32 +#define KBD_WRAP_MASK 0x1F /*----------------------------------------------------- * DeviceExtension * --------------------------------------------------*/ typedef struct _DEVICE_EXTENSION { - - PI8042_KEYBOARD_INITIALIZATION_ROUTINE InitializationHookCallback; - PI8042_KEYBOARD_ISR IsrHookCallback; - PVOID HookContext; + PDEVICE_OBJECT I8042Device; + PDEVICE_OBJECT DeviceObject; + KEYBOARD_INPUT_DATA KbdBuffer[KBD_BUFFER_SIZE]; + int BufHead,BufTail; + int KeysInBuffer; + + BOOLEAN AlreadyOpened; } DEVICE_EXTENSION, *PDEVICE_EXTENSION; +typedef struct _CONNECT_DATA { + PDEVICE_OBJECT ClassDeviceObject; + PVOID ClassService; +} CONNECT_DATA, *PCONNECT_DATA; + /* * Some defines */ +#define IOCTL_INTERNAL_KEYBOARD_CONNECT \ + CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS) + #define KEYBOARD_IRQ 1 -#define KBD_BUFFER_SIZE 32 -#define KBD_WRAP_MASK 0x1F #define disable() __asm__("cli\n\t") #define enable() __asm__("sti\n\t") diff --git a/reactos/drivers/input/keyboard/keyboard.rc b/reactos/drivers/input/kbdclass/kbdclass.rc similarity index 100% rename from reactos/drivers/input/keyboard/keyboard.rc rename to reactos/drivers/input/kbdclass/kbdclass.rc diff --git a/reactos/drivers/input/kbdclass/kbdclass.xml b/reactos/drivers/input/kbdclass/kbdclass.xml new file mode 100644 index 00000000000..b0c834865d4 --- /dev/null +++ b/reactos/drivers/input/kbdclass/kbdclass.xml @@ -0,0 +1,9 @@ + + + . + + ntoskrnl + hal + kbdclass.c + kbdclass.rc + diff --git a/reactos/drivers/input/keyboard/makefile b/reactos/drivers/input/kbdclass/makefile similarity index 72% rename from reactos/drivers/input/keyboard/makefile rename to reactos/drivers/input/kbdclass/makefile index dd1ae53ee47..d87c4e09e5b 100644 --- a/reactos/drivers/input/keyboard/makefile +++ b/reactos/drivers/input/kbdclass/makefile @@ -6,9 +6,9 @@ TARGET_BOOTSTRAP = yes TARGET_TYPE = driver -TARGET_NAME = keyboard +TARGET_NAME = kbdclass -TARGET_CFLAGS = -Wall -Werror +TARGET_CFLAGS = -Wall -Werror -D__USE_W32API TARGET_OBJECTS = $(TARGET_NAME).o diff --git a/reactos/drivers/input/keyboard/keyboard.c b/reactos/drivers/input/keyboard/keyboard.c deleted file mode 100644 index 2a5c31843ad..00000000000 --- a/reactos/drivers/input/keyboard/keyboard.c +++ /dev/null @@ -1,907 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: services/dd/keyboard/keyboard.c - * PURPOSE: Keyboard driver - * PROGRAMMER: Victor Kirhenshtein (sauros@iname.com) - * Jason Filby (jasonfilby@yahoo.com) - */ - -/* INCLUDES ****************************************************************/ - -#include -#include -#include -#include -#include - -#include -#include - -#define NDEBUG -#include - -#include "keyboard.h" - -/* GLOBALS *******************************************************************/ - -/* - * Driver data - */ - -static KEY_EVENT_RECORD kbdBuffer[KBD_BUFFER_SIZE]; -static int bufHead,bufTail; -static int keysInBuffer; -static int extKey; -static BYTE ledStatus; -static BYTE capsDown,numDown,scrollDown; -static DWORD ctrlKeyState; -static PKINTERRUPT KbdInterrupt; -static KDPC KbdDpc; -static PIO_WORKITEM KbdWorkItem = NULL; -static BOOLEAN AlreadyOpened = FALSE; - -/* - * PURPOSE: Current irp being processed - */ -static PIRP CurrentIrp; - -/* - * PURPOSE: Number of keys that have been read into the current irp's buffer - */ -static ULONG KeysRead; -static ULONG KeysRequired; - -/* - * Virtual key codes table - * - * Comments: - * * PrtSc = VK_PRINT - * * Alt+PrtSc (SysRq) = VK_EXECUTE - * * Alt = VK_MENU - */ - -static const WORD vkTable[128]= -{ - /* 00 - 07 */ 0, VK_ESCAPE, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, - /* 08 - 0F */ VK_7, VK_8, VK_9, VK_0, 189, 187, VK_BACK, VK_TAB, - /* 10 - 17 */ VK_Q, VK_W, VK_E, VK_R, VK_T, VK_Y, VK_U, VK_I, - /* 18 - 1F */ VK_O, VK_P, 219, 221, VK_RETURN, VK_CONTROL, VK_A, VK_S, - /* 20 - 27 */ VK_D, VK_F, VK_G, VK_H, VK_J, VK_K, VK_L, 186, - /* 28 - 2F */ 222, 192, VK_SHIFT, 220, VK_Z, VK_X, VK_C, VK_V, - /* 30 - 37 */ VK_B, VK_N, VK_M, 188, 190, 191, VK_SHIFT, VK_MULTIPLY, - /* 38 - 3F */ VK_MENU, VK_SPACE, VK_CAPITAL, VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, - /* 40 - 47 */ VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, VK_NUMLOCK, VK_SCROLL, VK_HOME, - /* 48 - 4F */ VK_UP, VK_PRIOR, VK_SUBTRACT, VK_LEFT, VK_CLEAR, VK_RIGHT, VK_ADD, VK_END, - /* 50 - 57 */ VK_DOWN, VK_NEXT, VK_INSERT, VK_DELETE, VK_EXECUTE, 0, 0, VK_F11, - /* 58 - 5F */ VK_F12, 0, 0, 91, 92, 93, 0, 0, - /* 60 - 67 */ 0, 0, 0, 0, 0, 0, 0, 0, - /* 68 - 6F */ 0, 0, 0, 0, 0, 0, 0, 0, - /* 70 - 77 */ 0, 0, 0, 0, 0, 0, 0, 0, - /* 78 - 7F */ 0, 0, 0, 0, 0, 0, 0, VK_PAUSE -}; -static const WORD vkKeypadTable[13]= /* 47 - 53 */ -{ - VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_SUBTRACT, - VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_ADD, - VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD0, VK_DECIMAL -}; - - -/* - * ASCII translation tables - */ - -static const BYTE asciiTable1[10]= -{ - ')','!','@','#','$','%','^','&','*','(' -}; -static const BYTE asciiTable2[16]= -{ - '0','1','2','3','4','5','6','7','8','9','*','+',0,'-','.','/' -}; -static const BYTE asciiTable3[37]= -{ - ';','=',',','-','.','/','`', 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - '[', '\\', ']', '\'' -}; -static const BYTE asciiTable4[37]= -{ - ':','+','<','_','>','?','~', 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - '{', '|', '}', '"' -}; - -VOID STDCALL -KdSystemDebugControl(ULONG Code); - -static LONG DoSystemDebug = -1; -static BOOLEAN InSysRq = FALSE; - -/* FUNCTIONS *****************************************************************/ - -static void KbdWrite(int addr,BYTE data) -/* - * FUNCTION: Write data to keyboard - */ -{ - BYTE status; - - do - { - status=READ_PORT_UCHAR((PUCHAR)KBD_CTRL_PORT); // Wait until input buffer empty - } while(status & KBD_IBF); - WRITE_PORT_UCHAR((PUCHAR)addr,data); -} - -static int KbdReadData(void) -/* - * FUNCTION: Read data from port 0x60 - */ -{ - int i; - BYTE status,data; - - i=500000; - do - { - status=READ_PORT_UCHAR((PUCHAR)KBD_CTRL_PORT); - if (!(status & KBD_OBF)) // Check if data available - continue; - data=READ_PORT_UCHAR((PUCHAR)KBD_DATA_PORT); - if (status & (KBD_GTO | KBD_PERR)) // Check for timeout error - continue; - return data; - } while(--i); - return -1; // Timed out -} - - -/* - * Set keyboard LED's - */ - -static void SetKeyboardLEDs(BYTE status) -{ - KbdWrite(KBD_DATA_PORT,0xED); - if (KbdReadData()!=KBD_ACK) // Error - return; - KbdWrite(KBD_DATA_PORT,status); - KbdReadData(); -} - - -/* - * Process scan code - */ - -static void ProcessScanCode(BYTE scanCode,BOOL isDown) -{ - switch(scanCode) - { - case 0x1D: // Ctrl - if (extKey) - { - if (isDown) - ctrlKeyState|=RIGHT_CTRL_PRESSED; - else - ctrlKeyState&=~RIGHT_CTRL_PRESSED; - } - else - { - if (isDown) - ctrlKeyState|=LEFT_CTRL_PRESSED; - else - ctrlKeyState&=~LEFT_CTRL_PRESSED; - } - break; - case 0x2A: // Left shift - case 0x36: // Right shift - if (isDown) - ctrlKeyState|=SHIFT_PRESSED; - else - ctrlKeyState&=~SHIFT_PRESSED; - break; - case 0x38: // Alt - if (extKey) - { - if (isDown) - ctrlKeyState|=RIGHT_ALT_PRESSED; - else - ctrlKeyState&=~RIGHT_ALT_PRESSED; - } - else - { - if (isDown) - ctrlKeyState|=LEFT_ALT_PRESSED; - else - ctrlKeyState&=~LEFT_ALT_PRESSED; - } - break; - case 0x3A: // CapsLock - if (ctrlKeyState & CTRL_PRESSED) - break; - if (isDown) - { - if (!capsDown) - { - capsDown=1; - if (ctrlKeyState & CAPSLOCK_ON) - { - ledStatus&=~KBD_LED_CAPS; - ctrlKeyState&=~CAPSLOCK_ON; - } - else - { - ledStatus|=KBD_LED_CAPS; - ctrlKeyState|=CAPSLOCK_ON; - } - SetKeyboardLEDs(ledStatus); - } - } - else - { - capsDown=0; - } - break; - case 0x45: // NumLock - if (ctrlKeyState & CTRL_PRESSED) - break; - if (isDown) - { - if (!numDown) - { - numDown=1; - if (ctrlKeyState & NUMLOCK_ON) - { - ledStatus&=~KBD_LED_NUM; - ctrlKeyState&=~NUMLOCK_ON; - } - else - { - ledStatus|=KBD_LED_NUM; - ctrlKeyState|=NUMLOCK_ON; - } - SetKeyboardLEDs(ledStatus); - } - } - else - { - numDown=0; - } - break; - case 0x46: // ScrollLock - if (ctrlKeyState & CTRL_PRESSED) - break; - if (isDown) - { - if (!scrollDown) - { - scrollDown=1; - if (ctrlKeyState & SCROLLLOCK_ON) - { - ledStatus&=~KBD_LED_SCROLL; - ctrlKeyState&=~SCROLLLOCK_ON; - } - else - { - ledStatus|=KBD_LED_SCROLL; - ctrlKeyState|=SCROLLLOCK_ON; - } - SetKeyboardLEDs(ledStatus); - } - } - else - { - scrollDown=0; - } - break; - default: - break; - } -} - - -/* - * Translate virtual key code to ASCII - */ - -static BYTE VirtualToAscii(WORD keyCode,BOOL isDown) -{ - if ((ctrlKeyState & ALT_PRESSED)&&(ctrlKeyState & CTRL_PRESSED)) - return 0; // Ctrl+Alt+char always 0 - if ((!isDown)&&(ctrlKeyState & ALT_PRESSED)) - return 0; // Alt+char is 0 when key is released - - if (ctrlKeyState & CTRL_PRESSED) - { - if ((keyCode>=VK_A)&&(keyCode<=VK_Z)) - return keyCode-VK_A+1; - switch(keyCode) - { - case VK_SPACE: - return ' '; - case VK_BACK: - return 127; - case VK_RETURN: - return '\r'; - case 219: /* [ */ - if (ctrlKeyState & SHIFT_PRESSED) - return 0; - return 27; - case 220: /* \ */ - if (ctrlKeyState & SHIFT_PRESSED) - return 0; - return 28; - case 221: /* ] */ - if (ctrlKeyState & SHIFT_PRESSED) - return 0; - return 29; - default: - return 0; - } - } - - if ((keyCode>=VK_A)&&(keyCode<=VK_Z)) - { - if (ctrlKeyState & CAPSLOCK_ON) - if (ctrlKeyState & SHIFT_PRESSED) - return keyCode-VK_A+'a'; - else - return keyCode-VK_A+'A'; - else - if (ctrlKeyState & SHIFT_PRESSED) - return keyCode-VK_A+'A'; - else - return keyCode-VK_A+'a'; - } - - if ((keyCode>=VK_0)&&(keyCode<=VK_9)) - { - if (ctrlKeyState & SHIFT_PRESSED) - return asciiTable1[keyCode-VK_0]; - else - return keyCode-VK_0+'0'; - } - - if ((keyCode>=VK_NUMPAD0)&&(keyCode<=VK_DIVIDE)) - return asciiTable2[keyCode-VK_NUMPAD0]; - - if ((keyCode>=186)&&(keyCode<=222)) - { - if (ctrlKeyState & SHIFT_PRESSED) - return asciiTable4[keyCode-186]; - else - return asciiTable3[keyCode-186]; - } - - switch(keyCode) - { - case VK_SPACE: - return ' '; - case VK_RETURN: - return '\r'; - case VK_BACK: - return 8; - case VK_TAB: - return 9; - } - return 0; -} - - -/* - * Translate scan code to virtual key code - */ - -static WORD ScanToVirtual(BYTE scanCode) -{ - if ((scanCode>=0x47)&&(scanCode<=0x53)&&(ctrlKeyState & NUMLOCK_ON)&& - (!extKey)&&(!(ctrlKeyState & SHIFT_PRESSED))) - return vkKeypadTable[scanCode-0x47]; - if ((scanCode==0x35)&&(extKey)) // Gray divide - return VK_DIVIDE; - if ((scanCode==0x37)&&(extKey)) // Print screen - return VK_PRINT; - return vkTable[scanCode]; -} - - -/* - * Debug request handler - */ - -static VOID STDCALL -KbdWorkItemRoutine(IN PDEVICE_OBJECT DeviceObject, - IN PVOID Context) -{ - LONG Debug; - - Debug = InterlockedExchange(&DoSystemDebug, -1); - if (Debug != -1) - { - KdSystemDebugControl(Debug); - } -} - - -/* - * Keyboard IRQ handler - */ - -static VOID STDCALL -KbdDpcRoutine(PKDPC Dpc, - PVOID DeferredContext, - PVOID SystemArgument1, - PVOID SystemArgument2) -{ - PIRP Irp = (PIRP)SystemArgument2; - PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)SystemArgument1; - - if (SystemArgument1 == NULL && DoSystemDebug != -1) - { - if (KbdWorkItem != NULL && DoSystemDebug == 10) /* 10 is Tab + K (enter kernel debugger) */ - { - IoQueueWorkItem(KbdWorkItem, (PIO_WORKITEM_ROUTINE)KbdWorkItemRoutine, DelayedWorkQueue, NULL); - } - else - { - KdSystemDebugControl(DoSystemDebug); - DoSystemDebug = -1; - } - return; - } - - CHECKPOINT; - DPRINT("KbdDpcRoutine(DeviceObject %x, Irp %x)\n", - DeviceObject,Irp); - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp,IO_NO_INCREMENT); - IoStartNextPacket(DeviceObject,FALSE); -} - - -static BOOLEAN STDCALL -KeyboardHandler(PKINTERRUPT Interrupt, - PVOID Context) -{ - BYTE thisKey; - BOOL isDown; - static BYTE lastKey; - CHAR Status; - PDEVICE_OBJECT deviceObject = (PDEVICE_OBJECT) Context; - PDEVICE_EXTENSION deviceExtension = (PDEVICE_EXTENSION) deviceObject->DeviceExtension; - - CHECKPOINT; - - /* - * Check status - */ - Status = READ_PORT_UCHAR((PUCHAR)KBD_CTRL_PORT); - if (!(Status & KBD_OBF)) - { - return (FALSE); - } - - // Read scan code - thisKey=READ_PORT_UCHAR((PUCHAR)KBD_DATA_PORT); - - // Call hook routine. May change scancode value. - if (deviceExtension->IsrHookCallback) { - BOOLEAN cont = FALSE, ret; - //BUG BUG: rewrite to have valid CurrentScanState!!! - ret = (*deviceExtension->IsrHookCallback)( - deviceObject, - NULL,//&deviceExtension->CurrentInput, - NULL,//&deviceExtension->CurrentOutput, - Status, - &thisKey, //&scanCode, - &cont, - NULL //&deviceExtension->CurrentScanState - ); - - if (!cont) { - return ret; - } - } - - - if ((thisKey==0xE0)||(thisKey==0xE1)) // Extended key - { - extKey=1; // Wait for next byte - lastKey=thisKey; - return FALSE; - } - - isDown=!(thisKey & 0x80); - thisKey&=0x7F; - - // The keyboard maintains its own internal caps lock and num lock - // statuses. In caps lock mode E0 AA precedes make code and - // E0 2A follow break code. In num lock mode, E0 2A precedes - // make code and E0 AA follow break code. We maintain our own caps lock - // and num lock statuses, so we will just ignore these. - // Some keyboards have L-Shift/R-Shift modes instead of caps lock - // mode. If right shift pressed, E0 B6 / E0 36 pairs generated. - if (extKey & ((thisKey==0x2A)||(thisKey==0x36))) - { - extKey=0; - return FALSE; - } - - // Check for PAUSE sequence - if (extKey && (lastKey==0xE1)) - { - if (thisKey==0x1D) - lastKey=0xFF; // Sequence is OK - else - extKey=0; - return FALSE; - } - if (extKey && (lastKey==0xFF)) - { - if (thisKey!=0x45) - { - extKey=0; // Bad sequence - return FALSE; - } - thisKey=0x7F; // Pseudo-code for PAUSE - } - - ProcessScanCode(thisKey,isDown); - -// DbgPrint("Key: %c\n",VirtualToAscii(ScanToVirtual(thisKey),isDown)); -// DbgPrint("Key: %x\n",ScanToVirtual(thisKey)); - if (ScanToVirtual(thisKey) == VK_TAB && isDown) - { - InSysRq = TRUE; - } - else if (ScanToVirtual(thisKey) == VK_TAB && !isDown) - { - InSysRq = FALSE; - } - else if (InSysRq == TRUE && ScanToVirtual(thisKey) >= VK_A && - ScanToVirtual(thisKey) <= VK_Z && isDown) - { - InterlockedExchange(&DoSystemDebug, ScanToVirtual(thisKey) - VK_A); - KeInsertQueueDpc(&KbdDpc, NULL, NULL); - return(TRUE); - } - - if (CurrentIrp!=NULL) - { - KEY_EVENT_RECORD* rec = (KEY_EVENT_RECORD *) - CurrentIrp->AssociatedIrp.SystemBuffer; - - CHECKPOINT; - - rec[KeysRead].bKeyDown=isDown; - rec[KeysRead].wRepeatCount=1; - rec[KeysRead].wVirtualKeyCode=ScanToVirtual(thisKey); - rec[KeysRead].wVirtualScanCode=thisKey; - rec[KeysRead].uChar.AsciiChar=VirtualToAscii(rec->wVirtualKeyCode,isDown); - rec[KeysRead].dwControlKeyState=ctrlKeyState; - if (extKey) - { - rec[KeysRead].dwControlKeyState|=ENHANCED_KEY; - extKey = 0; - } - KeysRead++; - DPRINT("KeysRequired %d KeysRead %x\n",KeysRequired,KeysRead); - if (KeysRead==KeysRequired) - { - PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT) Context; - KeInsertQueueDpc(&KbdDpc,DeviceObject,CurrentIrp); - CurrentIrp=NULL; - } - CHECKPOINT; - return TRUE; - } - - // Buffer is full ? - if (keysInBuffer==KBD_BUFFER_SIZE) // Buffer is full - { - extKey=0; - return(TRUE); - } - kbdBuffer[bufHead].bKeyDown=isDown; - kbdBuffer[bufHead].wRepeatCount=1; - kbdBuffer[bufHead].wVirtualKeyCode=ScanToVirtual(thisKey); - kbdBuffer[bufHead].wVirtualScanCode=thisKey; - kbdBuffer[bufHead].uChar.UnicodeChar=0; - // kbdBuffer[bufHead].uChar.AsciiChar=TranslateScanCode(thisKey); - kbdBuffer[bufHead].uChar.AsciiChar=VirtualToAscii(kbdBuffer[bufHead].wVirtualKeyCode,isDown); - kbdBuffer[bufHead].dwControlKeyState=ctrlKeyState; - if (extKey) - kbdBuffer[bufHead].dwControlKeyState|=ENHANCED_KEY; - bufHead++; - bufHead&=KBD_WRAP_MASK; // Modulo KBD_BUFFER_SIZE - keysInBuffer++; - extKey=0; - return TRUE; -} - - -// -// Initialize keyboard -// -static void KeyboardConnectInterrupt(PDEVICE_OBJECT DeviceObject) -{ - ULONG MappedIrq; - KIRQL Dirql; - KAFFINITY Affinity; - NTSTATUS Status; - - MappedIrq = HalGetInterruptVector(Internal, - 0, - 0, - KEYBOARD_IRQ, - &Dirql, - &Affinity); - Status = IoConnectInterrupt(&KbdInterrupt, - KeyboardHandler, - (PVOID)DeviceObject, - NULL, - MappedIrq, - Dirql, - Dirql, - 0, - FALSE, - Affinity, - FALSE); -} - -VOID -KbdClearInput(VOID) -{ - ULONG i; - CHAR Status; - - for (i = 0; i < 100; i++) - { - Status = READ_PORT_UCHAR((PUCHAR)KBD_CTRL_PORT); - if (!(Status & KBD_OBF)) - { - return; - } - (VOID)READ_PORT_UCHAR((PUCHAR)KBD_DATA_PORT); - } -} - -static int InitializeKeyboard(PDEVICE_OBJECT DeviceObject) -{ - // Initialize variables - bufHead=0; - bufTail=0; - keysInBuffer=0; - ledStatus=0; - capsDown=0; - numDown=0; - scrollDown=0; - ctrlKeyState=0; - extKey=0; - - KbdClearInput(); - KeyboardConnectInterrupt(DeviceObject); - KeInitializeDpc(&KbdDpc,KbdDpcRoutine,NULL); - KbdWorkItem = IoAllocateWorkItem(DeviceObject); - if (KbdWorkItem == NULL) - { - DPRINT("Warning: Couldn't allocate work item!\n"); - } - return 0; -} - -/* - * Read data from keyboard buffer - */ -BOOLEAN STDCALL -KbdSynchronizeRoutine(PVOID Context) -{ - PIRP Irp = (PIRP)Context; - KEY_EVENT_RECORD* rec = (KEY_EVENT_RECORD *)Irp->AssociatedIrp.SystemBuffer; - PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); - ULONG NrToRead = stk->Parameters.Read.Length/sizeof(KEY_EVENT_RECORD); - int i; - - DPRINT("NrToRead %d keysInBuffer %d\n",NrToRead,keysInBuffer); - NrToRead = min(NrToRead,keysInBuffer); - - DPRINT("NrToRead %d stk->Parameters.Read.Length %d\n", - NrToRead,stk->Parameters.Read.Length); - DPRINT("sizeof(KEY_EVENT_RECORD) %d\n",sizeof(KEY_EVENT_RECORD)); - for (i=0;iParameters.Read.Length/sizeof(KEY_EVENT_RECORD))==NrToRead) - { - return(TRUE); - } - - KeysRequired=stk->Parameters.Read.Length/sizeof(KEY_EVENT_RECORD); - KeysRead=NrToRead; - CurrentIrp=Irp; - - return(FALSE); -} - -VOID STDCALL KbdStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp) -{ -#ifndef NDEBUG - PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); -#endif - - DPRINT("KeyboardStartIo(DeviceObject %x Irp %x)\n",DeviceObject,Irp); - - if (KeSynchronizeExecution(KbdInterrupt, KbdSynchronizeRoutine, Irp)) - { - KIRQL oldIrql; - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - oldIrql = KeGetCurrentIrql(); - if (oldIrql < DISPATCH_LEVEL) - { - KeRaiseIrql (DISPATCH_LEVEL, &oldIrql); - IoStartNextPacket (DeviceObject, FALSE); - KeLowerIrql(oldIrql); - } - else - { - IoStartNextPacket (DeviceObject, FALSE); - } - } - - DPRINT("stk->Parameters.Read.Length %d\n",stk->Parameters.Read.Length); - DPRINT("KeysRequired %d\n",KeysRequired); -} - -NTSTATUS STDCALL KbdInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) -{ - PIO_STACK_LOCATION stk; - PINTERNAL_I8042_HOOK_KEYBOARD hookKeyboard; - PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension; - NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST; - - Irp->IoStatus.Information = 0; - stk = IoGetCurrentIrpStackLocation(Irp); - - switch (stk->Parameters.DeviceIoControl.IoControlCode) - { - /*-----------------11/29/2001 4:12PM---------------- - * This internal ioctrl belongs in i8042 driver. Should be - * moved to the appropriate driver later. - * --------------------------------------------------*/ - case IOCTL_INTERNAL_I8042_HOOK_KEYBOARD: - - if (stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(INTERNAL_I8042_HOOK_KEYBOARD)) - { - DPRINT(("Keyboard IOCTL_INTERNAL_I8042_HOOK_KEYBOARD invalid buffer size\n")); - status = STATUS_INVALID_PARAMETER; - } - else { - // - // Copy the values if they are filled in - // - hookKeyboard = (PINTERNAL_I8042_HOOK_KEYBOARD) - stk->Parameters.DeviceIoControl.Type3InputBuffer; - - DevExt->HookContext = hookKeyboard->Context; - if (hookKeyboard->InitializationRoutine) { - DbgPrint("Keyboard: InitializationHookCallback NOT IMPLEMENTED\n"); - DevExt->InitializationHookCallback = - hookKeyboard->InitializationRoutine; - } - - if (hookKeyboard->IsrRoutine) { - DevExt->IsrHookCallback = hookKeyboard->IsrRoutine; - } - - status = STATUS_SUCCESS; - } - break; - default: - status = STATUS_INVALID_DEVICE_REQUEST; - break; - } - - Irp->IoStatus.Status = status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return status; -} - -NTSTATUS STDCALL KbdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) -{ - PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS Status; - - DPRINT("DeviceObject %x\n",DeviceObject); - DPRINT("Irp %x\n",Irp); - - DPRINT("IRP_MJ_CREATE %d stk->MajorFunction %d\n", - IRP_MJ_CREATE, stk->MajorFunction); - DPRINT("AlreadyOpened %d\n",AlreadyOpened); - - switch (stk->MajorFunction) - { - case IRP_MJ_CREATE: - if (AlreadyOpened == TRUE) - { - CHECKPOINT; -// Status = STATUS_UNSUCCESSFUL; - Status = STATUS_SUCCESS; - } - else - { - CHECKPOINT; - Status = STATUS_SUCCESS; - AlreadyOpened = TRUE; - } - break; - - case IRP_MJ_CLOSE: - Status = STATUS_SUCCESS; - break; - - case IRP_MJ_READ: - DPRINT("Handling Read request\n"); - DPRINT("Queueing packet\n"); - IoMarkIrpPending(Irp); - IoStartPacket(DeviceObject,Irp,NULL,NULL); - return(STATUS_PENDING); - - default: - Status = STATUS_NOT_IMPLEMENTED; - break; - } - - Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp,IO_NO_INCREMENT); - DPRINT("Status %d\n",Status); - return(Status); -} - -NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath) -/* - * FUNCTION: Module entry point - */ -{ - PDEVICE_OBJECT DeviceObject; - UNICODE_STRING DeviceName = ROS_STRING_INITIALIZER(L"\\Device\\Keyboard"); - UNICODE_STRING SymlinkName = ROS_STRING_INITIALIZER(L"\\??\\Keyboard"); - - DPRINT("Keyboard Driver 0.0.4\n"); - - DriverObject->MajorFunction[IRP_MJ_CREATE] = KbdDispatch; - DriverObject->MajorFunction[IRP_MJ_CLOSE] = KbdDispatch; - DriverObject->MajorFunction[IRP_MJ_READ] = KbdDispatch; - DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = - KbdInternalDeviceControl; - - DriverObject->DriverStartIo = KbdStartIo; - - IoCreateDevice(DriverObject, - sizeof(DEVICE_EXTENSION), - &DeviceName, - FILE_DEVICE_KEYBOARD, - 0, - TRUE, - &DeviceObject); - - RtlZeroMemory(DeviceObject->DeviceExtension, sizeof(DEVICE_EXTENSION)); - - DeviceObject->Flags = DeviceObject->Flags | DO_BUFFERED_IO; - InitializeKeyboard( DeviceObject ); - - IoCreateSymbolicLink(&SymlinkName, &DeviceName); - - return(STATUS_SUCCESS); -} diff --git a/reactos/drivers/input/keyboard/keyboard.xml b/reactos/drivers/input/keyboard/keyboard.xml deleted file mode 100644 index 4cfc55eda74..00000000000 --- a/reactos/drivers/input/keyboard/keyboard.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - . - ntoskrnl - hal - keyboard.c - keyboard.rc - diff --git a/reactos/drivers/input/mouclass/mouclass.c b/reactos/drivers/input/mouclass/mouclass.c index 553b2fd082d..8882a57d812 100644 --- a/reactos/drivers/input/mouclass/mouclass.c +++ b/reactos/drivers/input/mouclass/mouclass.c @@ -21,17 +21,22 @@ BOOLEAN MouseClassCallBack( PDEVICE_OBJECT ClassDeviceObject, PMOUSE_INPUT_DATA MouseDataStart, - PMOUSE_INPUT_DATA MouseDataEnd, PULONG InputCount) + PMOUSE_INPUT_DATA MouseDataEnd, PULONG ConsumedCount) { PDEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension; PIRP Irp; KIRQL OldIrql; PIO_STACK_LOCATION Stack; - ULONG SafeInputCount = *InputCount; + ULONG InputCount = MouseDataEnd - MouseDataStart; ULONG ReadSize; DPRINT("Entering MouseClassCallBack\n"); - if (ClassDeviceExtension->ReadIsPending == TRUE) + /* A filter driver might have consumed all the data already; I'm + * not sure if they are supposed to move the packets when they + * consume them though. + */ + if (ClassDeviceExtension->ReadIsPending == TRUE && + InputCount) { Irp = ClassDeviceObject->CurrentIrp; ClassDeviceObject->CurrentIrp = NULL; @@ -52,19 +57,20 @@ BOOLEAN MouseClassCallBack( /* Skip the packet we just sent away */ MouseDataStart++; - SafeInputCount--; + (*ConsumedCount)++; + InputCount--; } /* If we have data from the port driver and a higher service to send the data to */ - if (SafeInputCount != 0) + if (InputCount != 0) { KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql); - if (ClassDeviceExtension->InputCount + SafeInputCount > MOUSE_BUFFER_SIZE) + if (ClassDeviceExtension->InputCount + InputCount > MOUSE_BUFFER_SIZE) { ReadSize = MOUSE_BUFFER_SIZE - ClassDeviceExtension->InputCount; } else { - ReadSize = SafeInputCount; + ReadSize = InputCount; } /* @@ -84,6 +90,7 @@ BOOLEAN MouseClassCallBack( ClassDeviceExtension->InputCount += ReadSize; KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql); + (*ConsumedCount) += ReadSize; } else { DPRINT("MouseClassCallBack() entered, InputCount = %d - DOING NOTHING\n", *InputCount); } diff --git a/reactos/drivers/input/psaux/controller.c b/reactos/drivers/input/psaux/controller.c deleted file mode 100644 index 9599de9d39f..00000000000 --- a/reactos/drivers/input/psaux/controller.c +++ /dev/null @@ -1,157 +0,0 @@ -// All or parts of this file are from CHAOS (http://www.se.chaosdev.org/). -// CHAOS is also under the GNU General Public License. - -#include - -#include "controller.h" -#include "keyboard.h" -#include "mouse.h" - -/* This reads the controller status port, and does the appropriate - action. It requires that we hold the keyboard controller spinlock. */ - -int controller_read_data(void); -unsigned handle_event(void) -{ - unsigned status = controller_read_status(); - unsigned int work; - - for(work = 0; (work < 10000) && ((status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) != 0); work++) - { - unsigned scancode; - - scancode = controller_read_input(); - -#if 0 - /* Ignore error bytes. */ - - if((status &(CONTROLLER_STATUS_GENERAL_TIMEOUT | - CONTROLLER_STATUS_PARITY_ERROR)) == 0) -#endif - { - if((status & CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL) != 0) - { -// mouse_handle_event(scancode); we just use the mouse handler directly.. - } - else - { -// keyboard_handle_event(scancode); - } - } - - status = controller_read_status(); - - } - - if(work == 10000) - { - DbgPrint("PSAUX: Keyboard controller jammed\n"); - } - - return status; -} - -/* Wait for keyboard controller input buffer to drain. - Quote from PS/2 System Reference Manual: - "Address hex 0060 and address hex 0064 should be written only - when the input-buffer-full bit and output-buffer-full bit in the - Controller Status register are set 0." */ - -void controller_wait(void) -{ - unsigned long timeout; - LARGE_INTEGER Millisecond_Timeout; - - Millisecond_Timeout.QuadPart = -10000L; - - for(timeout = 0; timeout < CONTROLLER_TIMEOUT; timeout++) - { - // "handle_keyboard_event()" will handle any incoming events - // while we wait -- keypresses or mouse movement - - unsigned char status = handle_event(); - - if((status & CONTROLLER_STATUS_INPUT_BUFFER_FULL) == 0) return; - - // Sleep for one millisecond - KeDelayExecutionThread (KernelMode, FALSE, &Millisecond_Timeout); - } - - DbgPrint("PSAUX: Keyboard timed out\n"); -} - -/* Wait for input from the keyboard controller. */ - -int controller_wait_for_input(void) -{ - int timeout; - LARGE_INTEGER Millisecond_Timeout; - - Millisecond_Timeout.QuadPart = -10000L; - - for(timeout = KEYBOARD_INIT_TIMEOUT; timeout > 0; timeout--) - { - int return_value = controller_read_data(); - - if(return_value >= 0) return return_value; - - // Sleep for one millisecond - KeDelayExecutionThread (KernelMode, FALSE, &Millisecond_Timeout); - } - - DbgPrint("PSAUX: Timed out on waiting for input from controller\n"); - return -1; -} - -/* Write a command word to the keyboard controller. */ - -void controller_write_command_word(unsigned data) -{ - controller_wait(); - controller_write_command(data); -} - -/* Write an output word to the keyboard controller. */ - -void controller_write_output_word(unsigned data) -{ - controller_wait(); - controller_write_output(data); -} - -/* Empty the keyboard input buffer. */ - -void keyboard_clear_input(void) -{ - int max_read; - - for(max_read = 0; max_read < 100; max_read++) - { - if(controller_read_data() == KEYBOARD_NO_DATA) - { - break; - } - } -} - -/* Read data from the keyboard controller. */ - -int controller_read_data(void) -{ - int return_value = KEYBOARD_NO_DATA; - unsigned status; - - status = controller_read_status(); - if(status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) - { - unsigned data = controller_read_input(); - - return_value = data; - if(status &(CONTROLLER_STATUS_GENERAL_TIMEOUT | - CONTROLLER_STATUS_PARITY_ERROR)) - { - return_value = KEYBOARD_BAD_DATA; - } - } - return return_value; -} diff --git a/reactos/drivers/input/psaux/controller.h b/reactos/drivers/input/psaux/controller.h deleted file mode 100644 index 055cade8d5c..00000000000 --- a/reactos/drivers/input/psaux/controller.h +++ /dev/null @@ -1,140 +0,0 @@ -// All or parts of this file are from CHAOS (http://www.se.chaosdev.org/). -// CHAOS is also under the GNU General Public License. - -/* Keyboard controller registers. */ - -#define CONTROLLER_REGISTER_STATUS 0x64 -#define CONTROLLER_REGISTER_CONTROL 0x64 -#define CONTROLLER_REGISTER_DATA 0x60 - -/* Keyboard controller commands. */ -/* Read mode bits. */ - -#define CONTROLLER_COMMAND_READ_MODE 0x20 - -/* Write mode bits. */ - -#define CONTROLLER_COMMAND_WRITE_MODE 0x60 - -/* Get controller version. */ - -#define CONTROLLER_COMMAND_GET_VERSION 0xA1 - -/* Disable mouse interface. */ - -#define CONTROLLER_COMMAND_MOUSE_DISABLE 0xA7 - -/* Enable mouse interface. */ - -#define CONTROLLER_COMMAND_MOUSE_ENABLE 0xA8 - -/* Mouse interface test. */ - -#define CONTROLLER_COMMAND_TEST_MOUSE 0xA9 - -/* Controller self test. */ - -#define CONTROLLER_COMMAND_SELF_TEST 0xAA - -/* Keyboard interface test. */ - -#define CONTROLLER_COMMAND_KEYBOARD_TEST 0xAB - -/* Keyboard interface disable. */ - -#define CONTROLLER_COMMAND_KEYBOARD_DISABLE 0xAD - -/* Keyboard interface enable. */ - -#define CONTROLLER_COMMAND_KEYBOARD_ENABLE 0xAE - -/* Write to output buffer as if initiated by the auxiliary device. */ - -#define CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER 0xD3 - -/* Write the following byte to the mouse. */ - -#define CONTROLLER_COMMAND_WRITE_MOUSE 0xD4 - -/* Status Register Bits. */ -/* Keyboard output buffer full. */ - -#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL 0x01 - -/* Keyboard input buffer full. */ - -#define CONTROLLER_STATUS_INPUT_BUFFER_FULL 0x02 - -/* Self test successful. */ - -#define CONTROLLER_STATUS_SELF_TEST 0x04 - -/* Last write was a command write. (0 = data) */ - -#define CONTROLLER_STATUS_COMMAND 0x08 - -/* Zero if keyboard locked. */ - -#define CONTROLLER_STATUS_UNLOCKED 0x10 - -/* Mouse output buffer full. */ - -#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL 0x20 - -/* General receive/xmit timeout. */ - -#define CONTROLLER_STATUS_GENERAL_TIMEOUT 0x40 - -/* Parity error. */ - -#define CONTROLLER_STATUS_PARITY_ERROR 0x80 - -#define AUX_STATUS_OUTPUT_BUFFER_FULL (CONTROLLER_STATUS_OUTPUT_BUFFER_FULL | \ - CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL) - -/* Controller mode register bits. */ -/* Keyboard data generate IRQ1. */ - -#define CONTROLLER_MODE_KEYBOARD_INTERRUPT 0x01 - -/* Mouse data generate IRQ12. */ - -#define CONTROLLER_MODE_MOUSE_INTERRUPT 0x02 - -/* The system flag. (?) */ - -#define CONTROLLER_MODE_SYS 0x04 - -/* The keylock doesn't affect the keyboard if set. */ - -#define CONTROLLER_MODE_NO_KEYLOCK 0x08 - -/* Disable keyboard interface. */ - -#define CONTROLLER_MODE_DISABLE_KEYBOARD 0x10 - -/* Disable mouse interface. */ - -#define CONTROLLER_MODE_DISABLE_MOUSE 0x20 - -/* Scan code conversion to PC format. */ - -#define CONTROLLER_MODE_KCC 0x40 -#define CONTROLLER_MODE_RFU 0x80 - -/* Timeout in ms for sending to keyboard controller. */ - -#define CONTROLLER_TIMEOUT 250 - -/* Hardware defines. */ - -#define CONTROLLER_PORT_BASE 0x60 -#define CONTROLLER_PORTS 0x10 - -/* Macros for accessing the keyboard controller on this platform. */ - -#define controller_read_input() READ_PORT_UCHAR ((PUCHAR)CONTROLLER_REGISTER_DATA) -#define controller_read_status() READ_PORT_UCHAR ((PUCHAR)CONTROLLER_REGISTER_STATUS) -#define controller_write_output(value) WRITE_PORT_UCHAR ((PUCHAR)CONTROLLER_REGISTER_DATA, value) -#define controller_write_command(value) WRITE_PORT_UCHAR ((PUCHAR)CONTROLLER_REGISTER_CONTROL, value) -void controller_write_command_word(unsigned data); diff --git a/reactos/drivers/input/psaux/keyboard.h b/reactos/drivers/input/psaux/keyboard.h deleted file mode 100644 index 738b5917bf8..00000000000 --- a/reactos/drivers/input/psaux/keyboard.h +++ /dev/null @@ -1,51 +0,0 @@ -// All or parts of this file are from CHAOS (http://www.se.chaosdev.org/). -// CHAOS is also under the GNU General Public License. - -/* Timeout in ms for keyboard command acknowledge. */ - -#define KEYBOARD_TIMEOUT 1000 - -/* Timeout in ms for initializing the keyboard. */ - -#define KEYBOARD_INIT_TIMEOUT 1000 - -/* Keyboard commands. */ - -#define KEYBOARD_COMMAND_SET_LEDS 0xED -#define KEYBOARD_COMMAND_SET_RATE 0xF3 -#define KEYBOARD_COMMAND_ENABLE 0xF4 -#define KEYBOARD_COMMAND_DISABLE 0xF5 -#define KEYBOARD_COMMAND_RESET 0xFF - -/* Keyboard replies. */ -/* Power on reset. */ - -#define KEYBOARD_REPLY_POWER_ON_RESET 0xAA - -/* Acknowledgement of previous command. */ - -#define KEYBOARD_REPLY_ACK 0xFA - -/* Command NACK, send the command again. */ - -#define KEYBOARD_REPLY_RESEND 0xFE - -/* Hardware defines. */ - -#define KEYBOARD_IRQ 1 - -/* Return values from keyboard_read_data (). */ -/* No data. */ - -#define KEYBOARD_NO_DATA (-1) - -/* Parity or other error. */ - -#define KEYBOARD_BAD_DATA (-2) - -/* Common variables. */ - -int mouse_replies_expected; -BOOLEAN has_mouse; -// mailbox_id_type keyboard_target_mailbox_id; -unsigned keyboard_pressed_keys[16]; diff --git a/reactos/drivers/input/psaux/logips2pp.c b/reactos/drivers/input/psaux/logips2pp.c deleted file mode 100644 index 148126654b3..00000000000 --- a/reactos/drivers/input/psaux/logips2pp.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Logitech PS/2++ mouse driver - * - * Copyright (c) 1999-2003 Vojtech Pavlik - * Copyright (c) 2003 Eric Wong - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#include -#include -#include "mouse.h" -#include "logips2pp.h" - -/* - * Process a PS2++ or PS2T++ packet. - */ - -int SendCommand(PDEVICE_EXTENSION DeviceExtension, unsigned char *param, int command); -void PS2PPProcessPacket(PDEVICE_EXTENSION DeviceExtension, PMOUSE_INPUT_DATA Input, int *wheel) -{ - unsigned char *packet = DeviceExtension->MouseBuffer; - - if ((packet[0] & 0x48) == 0x48 && (packet[1] & 0x02) == 0x02) { - - switch ((packet[1] >> 4) | (packet[0] & 0x30)) { - - case 0x0d: /* Mouse extra info */ - - /* FIXME - mouse seems to have 2 wheels - input_report_rel(dev, packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL, - (int) (packet[2] & 8) - (int) (packet[2] & 7)); */ - - *wheel = (int)(packet[2] & 8) - (int)(packet[2] & 7); - Input->RawButtons |= (((packet[2] >> 4) & 1) ? GPM_B_FOURTH : 0); - Input->RawButtons |= (((packet[2] >> 5) & 1) ? GPM_B_FIFTH : 0); - - break; - - case 0x0e: /* buttons 4, 5, 6, 7, 8, 9, 10 info */ - - Input->RawButtons |= ((packet[2] & 1) ? GPM_B_FOURTH : 0); - Input->RawButtons |= (((packet[2] >> 1) & 1) ? GPM_B_FIFTH : 0); - - /* FIXME - support those buttons??? - input_report_key(dev, BTN_BACK, (packet[2] >> 3) & 1); - input_report_key(dev, BTN_FORWARD, (packet[2] >> 4) & 1); - input_report_key(dev, BTN_TASK, (packet[2] >> 2) & 1); - */ - - break; - - case 0x0f: /* TouchPad extra info */ - - /* FIXME - mouse seems to have 2 wheels - input_report_rel(dev, packet[2] & 0x08 ? REL_HWHEEL : REL_WHEEL, - (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7)); */ - - *wheel = (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7); - - packet[0] = packet[2] | 0x08; - break; - - default: - DbgPrint("logips2pp.c: Received PS2++ packet 0x%x, but don't know how to handle.\n", - (packet[1] >> 4) | (packet[0] & 0x30)); - } - - packet[0] &= 0x0f; - packet[1] = 0; - packet[2] = 0; - - } -} - -/* - * ps2pp_cmd() sends a PS2++ command, sliced into two bit - * pieces through the SETRES command. This is needed to send extended - * commands to mice on notebooks that try to understand the PS/2 protocol - * Ugly. - */ - -static int ps2pp_cmd(PDEVICE_EXTENSION DeviceExtension, unsigned char *param, unsigned char command) -{ - unsigned char d; - int i; - - if (SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11)) - return -1; - - for (i = 6; i >= 0; i -= 2) { - d = (command >> i) & 3; - if(SendCommand(DeviceExtension, &d, PSMOUSE_CMD_SETRES)) - return -1; - } - - if (SendCommand(DeviceExtension, param, PSMOUSE_CMD_POLL)) - return -1; - - return 0; -} - -/* - * SmartScroll / CruiseControl for some newer Logitech mice Defaults to - * enabled if we do nothing to it. Of course I put this in because I want it - * disabled :P - * 1 - enabled (if previously disabled, also default) - * 0/2 - disabled - */ - -static void ps2pp_set_smartscroll(PDEVICE_EXTENSION DeviceExtension) -{ - unsigned char param[4]; - - ps2pp_cmd(DeviceExtension, param, 0x32); - - param[0] = 0; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - - if (DeviceExtension->SmartScroll == 1) - param[0] = 1; - else - if (DeviceExtension->SmartScroll > 2) - return; - - /* else leave param[0] == 0 to disable */ - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); -} - -/* - * Support 800 dpi resolution _only_ if the user wants it (there are good - * reasons to not use it even if the mouse supports it, and of course there are - * also good reasons to use it, let the user decide). - */ - -void PS2PPSet800dpi(PDEVICE_EXTENSION DeviceExtension) -{ - unsigned char param = 3; - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, ¶m, PSMOUSE_CMD_SETRES); -} - -/* - * Detect the exact model and features of a PS2++ or PS2T++ Logitech mouse or - * touchpad. - */ - -int PS2PPDetectModel(PDEVICE_EXTENSION DeviceExtension, unsigned char *param) -{ - int i; - //char *vendor, *name; - static int logitech_wheel[] = { 52, 53, 75, 76, 80, 81, 83, 88, 112, -1 }; - static int logitech_ps2pp[] = { 12, 13, 40, 41, 42, 43, 50, 51, 52, 53, 73, 75, - 76, 80, 81, 83, 88, 96, 97, 112, -1 }; - static int logitech_mx[] = { 112, -1 }; - - //vendor = "Logitech"; - //DbgPrint("Vendor: %s, name: %s\n", vendor, name); - DeviceExtension->MouseModel = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); - - /*if (param[1] < 3) - clear_bit(BTN_MIDDLE, DeviceExtension->dev.keybit); - if (param[1] < 2) - clear_bit(BTN_RIGHT, DeviceExtension->dev.keybit);*/ - - DeviceExtension->MouseType = PSMOUSE_PS2; - - for (i = 0; logitech_ps2pp[i] != -1; i++) - if (logitech_ps2pp[i] == DeviceExtension->MouseModel) - DeviceExtension->MouseType = PSMOUSE_PS2PP; - - if (DeviceExtension->MouseType == PSMOUSE_PS2PP) { - - /* for (i = 0; logitech_4btn[i] != -1; i++) - if (logitech_4btn[i] == DeviceExtension->MouseModel) - set_bit(BTN_SIDE, psmouse->dev.keybit); -*/ - for (i = 0; logitech_wheel[i] != -1; i++) - if (logitech_wheel[i] == DeviceExtension->MouseModel) { -// set_bit(REL_WHEEL, psmouse->dev.relbit); - //name = "Wheel Mouse";DbgPrint("Vendor: %s, name: %s\n", vendor, name); - } - - for (i = 0; logitech_mx[i] != -1; i++) - if (logitech_mx[i] == DeviceExtension->MouseModel) { - /* set_bit(BTN_SIDE, psmouse->dev.keybit); - set_bit(BTN_EXTRA, psmouse->dev.keybit); - set_bit(BTN_BACK, psmouse->dev.keybit); - set_bit(BTN_FORWARD, psmouse->dev.keybit); - set_bit(BTN_TASK, psmouse->dev.keybit); - */ //name = "MX Mouse";DbgPrint("Vendor: %s, name: %s\n", vendor, name); - } - -/* - * Do Logitech PS2++ / PS2T++ magic init. - */ - - if (DeviceExtension->MouseModel == 97) { /* TouchPad 3 */ - -// set_bit(REL_WHEEL, psmouse->dev.relbit); -// set_bit(REL_HWHEEL, psmouse->dev.relbit); - - param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */ - SendCommand(DeviceExtension, param, 0x30d1); - param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */ - SendCommand(DeviceExtension, param, 0x30d1); - param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */ - SendCommand(DeviceExtension, param, 0x30d1); - - param[0] = 0; - if (!SendCommand(DeviceExtension, param, 0x13d1) && - param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) { - //name = "TouchPad 3";DbgPrint("Vendor: %s, name: %s\n", vendor, name); - return PSMOUSE_PS2TPP; - } - - } else { - - param[0] = param[1] = param[2] = 0; - ps2pp_cmd(DeviceExtension, param, 0x39); /* Magic knock */ - ps2pp_cmd(DeviceExtension, param, 0xDB); - - if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 && - (param[2] & 3) == ((param[1] >> 2) & 3)) { - ps2pp_set_smartscroll(DeviceExtension); - return PSMOUSE_PS2PP; - } - } - } - - return 0; -} - diff --git a/reactos/drivers/input/psaux/logips2pp.h b/reactos/drivers/input/psaux/logips2pp.h deleted file mode 100644 index 06c361af2dd..00000000000 --- a/reactos/drivers/input/psaux/logips2pp.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Logitech PS/2++ mouse driver header - * - * Copyright (c) 2003 Vojtech Pavlik - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ -#include -#include -#include "psaux.h" - -#ifndef _LOGIPS2PP_H -#define _LOGIPS2PP_H -void ps2pp_process_packet(PDEVICE_EXTENSION DeviceExtension, PMOUSE_INPUT_DATA Input); -void ps2pp_set_800dpi(PDEVICE_EXTENSION DeviceExtension); -int ps2pp_detect_model(PDEVICE_EXTENSION DeviceExtension, unsigned char *param); -#endif diff --git a/reactos/drivers/input/psaux/makefile b/reactos/drivers/input/psaux/makefile deleted file mode 100644 index f138a3acece..00000000000 --- a/reactos/drivers/input/psaux/makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $Id$ - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = driver - -TARGET_NAME = psaux - -TARGET_CFLAGS = -Wall -Werror - -TARGET_OBJECTS = $(TARGET_NAME).o controller.o mouse.o logips2pp.o synaptics.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/input/psaux/mouse.c b/reactos/drivers/input/psaux/mouse.c deleted file mode 100644 index 4791c223546..00000000000 --- a/reactos/drivers/input/psaux/mouse.c +++ /dev/null @@ -1,679 +0,0 @@ -/* - ** PS/2 Mouse Driver - ** Written by Thomas Weidenmueller (w3seek@users.sourceforge.net) - ** For ReactOS (www.reactos.com) - ** Adapted from the linux 2.6 mouse driver -*/ - -#include -#include -#include "controller.h" -#include "mouse.h" -#include "psaux.h" - -#define NDEBUG -#include - - -int InitSynaptics(PDEVICE_EXTENSION DeviceExtension); -void PS2PPProcessPacket(PDEVICE_EXTENSION DeviceExtension, PMOUSE_INPUT_DATA Input, int *wheel); -void PS2PPSet800dpi(PDEVICE_EXTENSION DeviceExtension); -int PS2PPDetectModel(PDEVICE_EXTENSION DeviceExtension, unsigned char *param); - -// Parse incoming packets -BOOLEAN FASTCALL -ParsePackets(PDEVICE_EXTENSION DeviceExtension, PMOUSE_INPUT_DATA Input) -{ - ULONG ButtonsDiff; - int wheel = 0; - unsigned char *packet = DeviceExtension->MouseBuffer; - - /* Determine the current state of the buttons */ - Input->RawButtons = ((packet[0] & 1) ? GPM_B_LEFT : 0); - Input->RawButtons |= (((packet[0] >> 1) & 1) ? GPM_B_RIGHT : 0); - Input->RawButtons |= (((packet[0] >> 2) & 1) ? GPM_B_MIDDLE : 0); - - /* - * The PS2++ protocol is a little bit complex - */ - - if(DeviceExtension->MouseType == PSMOUSE_PS2PP || DeviceExtension->MouseType == PSMOUSE_PS2TPP) - PS2PPProcessPacket(DeviceExtension, Input, &wheel); - - /* - * Scroll wheel on IntelliMice, scroll buttons on NetMice - */ - - if(DeviceExtension->MouseType == PSMOUSE_IMPS || DeviceExtension->MouseType == PSMOUSE_GENPS) - { - wheel = (int)(-(signed char) packet[3]); - } - - /* - * Scroll wheel and buttons on IntelliMouse Explorer - */ - - if(DeviceExtension->MouseType == PSMOUSE_IMEX) - { - wheel = (int)(packet[3] & 8) - (int)(packet[3] & 7); - Input->RawButtons |= (((packet[3] >> 4) & 1) ? GPM_B_FOURTH : 0); - Input->RawButtons |= (((packet[3] >> 5) & 1) ? GPM_B_FIFTH : 0); - } - - /* - * Extra buttons on Genius NewNet 3D - */ - - if(DeviceExtension->MouseType == PSMOUSE_GENPS) - { - Input->RawButtons |= (((packet[0] >> 6) & 1) ? GPM_B_FOURTH : 0); - Input->RawButtons |= (((packet[0] >> 7) & 1) ? GPM_B_FIFTH : 0); - } - - /* - * Determine ButtonFlags - */ - - Input->ButtonFlags = 0; - ButtonsDiff = DeviceExtension->PreviousButtons ^ Input->RawButtons; - - /* - * Generic PS/2 Mouse - */ - - if(ButtonsDiff & GPM_B_LEFT) - Input->ButtonFlags |= ((Input->RawButtons & GPM_B_LEFT) ? MOUSE_BUTTON_1_DOWN : MOUSE_BUTTON_1_UP); - - if(ButtonsDiff & GPM_B_RIGHT) - Input->ButtonFlags |= ((Input->RawButtons & GPM_B_RIGHT) ? MOUSE_BUTTON_2_DOWN : MOUSE_BUTTON_2_UP); - - if(ButtonsDiff & GPM_B_MIDDLE) - Input->ButtonFlags |= ((Input->RawButtons & GPM_B_MIDDLE) ? MOUSE_BUTTON_3_DOWN : MOUSE_BUTTON_3_UP); - - if(ButtonsDiff & GPM_B_FOURTH) - Input->ButtonFlags |= ((Input->RawButtons & GPM_B_FOURTH) ? MOUSE_BUTTON_4_DOWN : MOUSE_BUTTON_4_UP); - - if(ButtonsDiff & GPM_B_FIFTH) - Input->ButtonFlags |= ((Input->RawButtons & GPM_B_FIFTH) ? MOUSE_BUTTON_5_DOWN : MOUSE_BUTTON_5_UP); - - /* Some PS/2 mice send reports with negative bit set in data[0] and zero for - * movement. I think this is a bug in the mouse, but working around it only - * causes artifacts when the actual report is -256; they'll be treated as zero. - * This should be rare if the mouse sampling rate is set to a reasonable value; - * the default of 100 Hz is plenty. (Stephen Tell) */ - - /* Determine LastX */ - if(packet[1]) - Input->LastX = ((packet[0] & 0x10) ? (int)(packet[1] - 256) : (int) packet[1]); - else - Input->LastX = 0; - - /* Determine LastY */ - if(packet[2]) - Input->LastY = -((packet[0] & 0x20) ? (int)(packet[2] - 256) : (int) packet[2]); - else - Input->LastY = 0; - - /* Copy RawButtons to Previous Buttons for Input */ - DeviceExtension->PreviousButtons = Input->RawButtons; - - if((wheel != 0) && (wheel >= -8) && (wheel <= 7)) - { - Input->ButtonFlags |= MOUSE_WHEEL; - Input->ButtonData = (UINT)(wheel * WHEEL_DELTA); - } - - return TRUE; -} - -// Handle a mouse event -BOOLEAN STDCALL -MouseHandler(PKINTERRUPT Interrupt, PVOID ServiceContext) -{ - PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)ServiceContext; - PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - PMOUSE_INPUT_DATA Input; - ULONG Queue; - BOOLEAN ret; - unsigned scancode; - unsigned status = controller_read_status(); - scancode = controller_read_input(); - - /* Don't handle the mouse event if we aren't connected to the mouse class driver */ - if (DeviceExtension->ClassInformation.CallBack == NULL) - { - return FALSE; - } - - if ((status & CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL) != 0) - { - // mouse_handle_event(scancode); proceed to handle it - } - else - { - return FALSE; // keyboard_handle_event(scancode); - } - - /* Add this scancode to the mouse event queue. */ - DeviceExtension->MouseBuffer[DeviceExtension->MouseBufferPosition] = scancode; - DeviceExtension->MouseBufferPosition++; - - /* If the buffer is full, parse this event */ - if (DeviceExtension->MouseBufferPosition == DeviceExtension->MouseBufferSize) - { - Queue = DeviceExtension->ActiveQueue % 2; - - /* Reset the buffer state. */ - DeviceExtension->MouseBufferPosition = 0; - - /* Prevent buffer overflow */ - if (DeviceExtension->InputDataCount[Queue] == MOUSE_BUFFER_SIZE) - { - return TRUE; - } - - Input = &DeviceExtension->MouseInputData[Queue] - [DeviceExtension->InputDataCount[Queue]]; - - ret = ParsePackets(DeviceExtension, Input); - - /* Send the Input data to the Mouse Class driver */ - DeviceExtension->InputDataCount[Queue]++; - KeInsertQueueDpc(&DeviceExtension->IsrDpc, DeviceObject->CurrentIrp, NULL); - - return ret; - } - return TRUE; -} - - -// Write a PS/2 mouse command. -static void mouse_write_command(int command) -{ - controller_wait(); - controller_write_command(CONTROLLER_COMMAND_WRITE_MODE); - controller_wait(); - controller_write_output(command); -} - - -// Sends a byte to the mouse -static int SendByte(PDEVICE_EXTENSION DeviceExtension, unsigned char byte) -{ - int timeout = 100; /* 100 msec */ - int scancode; - unsigned char status; - LARGE_INTEGER Millisecond_Timeout; - - Millisecond_Timeout.QuadPart = -10000L; - - DeviceExtension->ack = 0; - DeviceExtension->acking = 1; - - controller_wait(); - controller_write_command(CONTROLLER_COMMAND_WRITE_MOUSE); - controller_wait(); - controller_write_output(byte); - while ((DeviceExtension->ack == 0) && timeout--) - { - status = controller_read_status(); - if((status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) != 0) - { - scancode = controller_read_input(); - if(scancode >= 0) - { - switch(scancode) - { - case PSMOUSE_RET_ACK: - DeviceExtension->ack = 1; - break; - case PSMOUSE_RET_NAK: - DeviceExtension->ack = -1; - break; - default: - DeviceExtension->ack = 1; /* Workaround for mice which don't ACK the Get ID command */ - if (DeviceExtension->RepliesExpected) - DeviceExtension->pkt[--DeviceExtension->RepliesExpected] = scancode; - break; - } - return (int)(-(DeviceExtension->ack <= 0)); - } - } - KeDelayExecutionThread (KernelMode, FALSE, &Millisecond_Timeout); - } - return (int)(-(DeviceExtension->ack <= 0)); -} - - -// Send a PS/2 command to the mouse. -int SendCommand(PDEVICE_EXTENSION DeviceExtension, unsigned char *param, int command) -{ - LARGE_INTEGER Millisecond_Timeout; - unsigned char status; - int scancode; - int timeout = 500; /* 500 msec */ - int send = (command >> 12) & 0xf; - int receive = (command >> 8) & 0xf; - int i; - - Millisecond_Timeout.QuadPart = -10000L; - - DeviceExtension->RepliesExpected = receive; - if (command == PSMOUSE_CMD_RESET_BAT) - timeout = 2000; /* 2 sec */ - - if (command & 0xff) - if (SendByte(DeviceExtension, command & 0xff)) - return (int)(DeviceExtension->RepliesExpected = 0) - 1; - - for (i = 0; i < send; i++) - if (SendByte(DeviceExtension, param[i])) - return (int)(DeviceExtension->RepliesExpected = 0) - 1; - - while (DeviceExtension->RepliesExpected && timeout--) - { - if (DeviceExtension->RepliesExpected == 1 && command == PSMOUSE_CMD_RESET_BAT) - timeout = 100; - - if (DeviceExtension->RepliesExpected == 1 && command == PSMOUSE_CMD_GETID && - DeviceExtension->pkt[1] != 0xab && DeviceExtension->pkt[1] != 0xac) - { - DeviceExtension->RepliesExpected = 0; - break; - } - - status = controller_read_status(); - if((status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) != 0) - { - scancode = controller_read_input(); - if(scancode >= 0) - { - DeviceExtension->pkt[--DeviceExtension->RepliesExpected] = scancode; - } - } - - KeDelayExecutionThread (KernelMode, FALSE, &Millisecond_Timeout); - } - - for (i = 0; i < receive; i++) - param[i] = DeviceExtension->pkt[(receive - 1) - i]; - - if (DeviceExtension->RepliesExpected) - return (int)(DeviceExtension->RepliesExpected = 0) - 1; - - return 0; -} - - -// changes the resolution of the mouse -void SetResolution(PDEVICE_EXTENSION DeviceExtension) -{ - unsigned char param[1]; - - if(DeviceExtension->MouseType == PSMOUSE_PS2PP && DeviceExtension->Resolution > 400) - { - PS2PPSet800dpi(DeviceExtension); - return; - } - - if(!DeviceExtension->Resolution || DeviceExtension->Resolution >= 200) - param[0] = 3; - else if(DeviceExtension->Resolution >= 100) - param[0] = 2; - else if(DeviceExtension->Resolution >= 50) - param[0] = 1; - else if(DeviceExtension->Resolution ) - param[0] = 0; - - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); -} - - -// Detect mouse models -int TestMouseExtensions(PDEVICE_EXTENSION DeviceExtension) -{ - unsigned char param[4]; - int type = 0; - - param[0] = 0; - - // vendor = Generic - // name = Mouse - DeviceExtension->MouseModel = 0; - - /* - * Try Synaptics TouchPad magic ID - */ - param[0] = 0; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_GETINFO); - if(param[1] == 0x47) - { - // vendor = Synaptics - // name = TouchPad - if(!InitSynaptics(DeviceExtension)) - return PSMOUSE_SYNAPTICS; - else - return PSMOUSE_PS2; - } - - /* - * Try Genius NetMouse magic init. - */ - param[0] = 3; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_GETINFO); - if(param[0] == 0x00 && param[1] == 0x33 && param[2] == 0x55) - { - // vendor = Genius - // name = Wheel Mouse - // Features = 4th, 5th, Wheel - return PSMOUSE_GENPS; - } - - /* - * Try Logitech magic ID. - */ - param[0] = 0; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRES); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - param[1] = 0; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_GETINFO); - if(param[1]) - { - type = PS2PPDetectModel(DeviceExtension, param); - if(type) - return type; - } - - /* - * Try IntelliMouse magic init. - */ - param[0] = 200; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - param[0] = 100; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - param[0] = 80; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_GETID); - if(param[0] == 3) - { - // Features = Wheel - - /* - * Try IntelliMouse/Explorer magic init. - */ - param[0] = 200; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - param[0] = 200; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - param[0] = 80; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - SendCommand(DeviceExtension, param, PSMOUSE_CMD_GETID); - if(param[0] == 4) - { - // name = Explorer Mouse - // Features = 4th, 5th, Wheel - return PSMOUSE_IMEX; - } - - // name = Wheel Mouse - return PSMOUSE_IMPS; - } - -/* - * Okay, all failed, we have a standard mouse here. The number of the buttons - * is still a question, though. We assume 3. - */ - return PSMOUSE_PS2; -} - - -// Detect if mouse is just a standard ps/2 mouse -int TestMouse(PDEVICE_EXTENSION DeviceExtension) -{ - unsigned char param[4]; - - param[0] = param[1] = 0xa5; - - /* - * First, we check if it's a mouse. It should send 0x00 or 0x03 - * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer. - */ - if(SendCommand(DeviceExtension, param, PSMOUSE_CMD_GETID)) - return -1; - - if(param[0] != 0x00 && param[0] != 0x03 && param[0] != 0x04) - return -1; - - /* - * Then we reset and disable the mouse so that it doesn't generate events. - */ - - if(DeviceExtension->NoExtensions) - { - return DeviceExtension->MouseType = PSMOUSE_PS2; - } - - if(SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_RESET_DIS)) - return -1; - - return DeviceExtension->MouseType = TestMouseExtensions(DeviceExtension); -} - - -// Initialize and enable the mouse -void InitializeMouse(PDEVICE_EXTENSION DeviceExtension) -{ - unsigned char param[4]; - - /* - * We set the mouse report rate to a highest possible value. - * We try 100 first in case mouse fails to set 200. - */ - - param[0] = 200; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - - param[0] = 100; - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETRATE); - - SetResolution(DeviceExtension); - SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11); - - /* - * We set the mouse into streaming mode. - */ - - SendCommand(DeviceExtension, param, PSMOUSE_CMD_SETSTREAM); - - /* - * Last, we enable the mouse so that we get reports from it. - */ - - if(SendCommand(DeviceExtension, NULL, PSMOUSE_CMD_ENABLE)) - DbgPrint("mouse.c: Failed to enable mouse!\n"); -} - - -// Load settings from registry (by Filip Navara) -BOOL LoadMouseSettings(PDEVICE_EXTENSION DeviceExtension, PUNICODE_STRING RegistryPath) -{ - /* - * Get the parameters from registry - */ - ULONG DefaultMouseResolution = 0; - ULONG DisableExtensionDetection = 1; - UNICODE_STRING ParametersPath; - RTL_QUERY_REGISTRY_TABLE Parameters[3]; - PWSTR ParametersKeyPath = L"\\Parameters"; - NTSTATUS Status; - - RtlZeroMemory(Parameters, sizeof(Parameters)); - - /* - * Formulate path to registry - */ - RtlInitUnicodeString(&ParametersPath, NULL); - ParametersPath.MaximumLength = RegistryPath->Length + - (wcslen(ParametersKeyPath) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); - ParametersPath.Buffer = ExAllocatePool(PagedPool, - ParametersPath.MaximumLength); - if (!ParametersPath.Buffer) - { - DPRINT("Can't allocate buffer for parameters\n"); - return FALSE; - } - RtlZeroMemory(ParametersPath.Buffer, ParametersPath.MaximumLength); - RtlAppendUnicodeToString(&ParametersPath, RegistryPath->Buffer); - RtlAppendUnicodeToString(&ParametersPath, ParametersKeyPath); - DPRINT("Parameters Path: %wZ\n", &ParametersPath); - - Parameters[0].Flags = RTL_QUERY_REGISTRY_DIRECT; - Parameters[0].Name = L"Resolution"; - Parameters[0].EntryContext = &DeviceExtension->Resolution; - Parameters[0].DefaultType = REG_DWORD; - Parameters[0].DefaultData = &DefaultMouseResolution; - Parameters[0].DefaultLength = sizeof(ULONG); - - Parameters[1].Flags = RTL_QUERY_REGISTRY_DIRECT; - Parameters[1].Name = L"DisableExtensionDetection"; - Parameters[1].EntryContext = &DeviceExtension->NoExtensions; - Parameters[1].DefaultType = REG_DWORD; - Parameters[1].DefaultData = &DisableExtensionDetection; - Parameters[1].DefaultLength = sizeof(ULONG); - - Status = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, - ParametersPath.Buffer, - Parameters, - NULL, - NULL); - - if (!NT_SUCCESS(Status)) - { - DPRINT("RtlQueryRegistryValues failed (0x%x)\n", Status); - return FALSE; - } - return TRUE; -} - - -// Initialize the PS/2 mouse support -BOOLEAN SetupMouse(PDEVICE_OBJECT DeviceObject, PUNICODE_STRING RegistryPath) -{ - PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - ULONG MappedIrq; - KIRQL Dirql; - KAFFINITY Affinity; - LARGE_INTEGER Millisecond_Timeout; - - Millisecond_Timeout.QuadPart = -10000L; - - /* setup */ - DeviceExtension->NoExtensions = 0; - DeviceExtension->InputDataCount[0] = 0; - DeviceExtension->InputDataCount[1] = 0; - DeviceExtension->ActiveQueue = 0; - DeviceExtension->MouseBufferPosition = 0; - DeviceExtension->MouseBufferSize = 3; - DeviceExtension->Resolution = 0; - DeviceExtension->RepliesExpected = 0; - DeviceExtension->PreviousButtons = 0; - DeviceExtension->SmartScroll = 1; - DeviceExtension->ack = 0; - DeviceExtension->acking = 0; - - LoadMouseSettings(DeviceExtension, RegistryPath); - - // Enable the PS/2 mouse port - controller_write_command_word (CONTROLLER_COMMAND_MOUSE_ENABLE); - - //InitializeMouse(DeviceExtension); - DeviceExtension->MouseType = TestMouse(DeviceExtension); - - if(DeviceExtension->MouseType > 0) - { - /* set the incoming buffer to 4 if needed */ - DeviceExtension->MouseBufferSize += (DeviceExtension->MouseType >= PSMOUSE_GENPS); - - DPRINT("Detected Mouse: 0x%x\n", DeviceExtension->MouseType); - - InitializeMouse(DeviceExtension); - - // Enable controller interrupts - mouse_write_command (MOUSE_INTERRUPTS_ON); - - // Connect the interrupt for the mouse irq - MappedIrq = HalGetInterruptVector(Internal, 0, 0, MOUSE_IRQ, &Dirql, &Affinity); - - IoConnectInterrupt(&DeviceExtension->MouseInterrupt, MouseHandler, DeviceObject, NULL, MappedIrq, - Dirql, Dirql, 0, FALSE, Affinity, FALSE); - } - else - { - /* FIXME - this fixes the crash if no mouse was detected */ - - // Connect the interrupt for the mouse irq - MappedIrq = HalGetInterruptVector(Internal, 0, 0, MOUSE_IRQ, &Dirql, &Affinity); - - IoConnectInterrupt(&DeviceExtension->MouseInterrupt, MouseHandler, DeviceObject, NULL, MappedIrq, - Dirql, Dirql, 0, FALSE, Affinity, FALSE); - } - - return TRUE; -} - - -// Check if this is a dual port controller. -BOOLEAN DetectPS2Port(void) -{ - int loops; - unsigned scancode; - BOOLEAN return_value = FALSE; - LARGE_INTEGER Millisecond_Timeout; - - Millisecond_Timeout.QuadPart = -10000L; - - //return TRUE; // The rest of this code fails under BOCHs - - /* Put the value 0x5A in the output buffer using the "WriteAuxiliary Device Output Buffer" command (0xD3). - Poll the Status Register for a while to see if the value really turns up in the Data Register. If the - KEYBOARD_STATUS_MOUSE_OBF bit is also set to 1 in the Status Register, we assume this controller has an - Auxiliary Port (a.k.a. Mouse Port). */ - - controller_wait (); - controller_write_command(CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER); - controller_wait (); - - /* 0x5A is a random dummy value */ - controller_write_output(0x5A); - - for (loops = 0; loops < 10; loops++) - { - unsigned char status = controller_read_status(); - - if((status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) != 0) - { - scancode = controller_read_input(); - if((status & CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL) != 0) - { - return_value = TRUE; - } - break; - } - - KeDelayExecutionThread(KernelMode, FALSE, &Millisecond_Timeout); - } - - return return_value; -} - diff --git a/reactos/drivers/input/psaux/mouse.h b/reactos/drivers/input/psaux/mouse.h deleted file mode 100644 index 4d0e720b433..00000000000 --- a/reactos/drivers/input/psaux/mouse.h +++ /dev/null @@ -1,59 +0,0 @@ -// All or parts of this file are from CHAOS (http://www.se.chaosdev.org/). -// CHAOS is also under the GNU General Public License. - -#define WHEEL_DELTA (120) - -#define PSMOUSE_CMD_SETSCALE11 0x00e6 -#define PSMOUSE_CMD_SETRES 0x10e8 -#define PSMOUSE_CMD_GETINFO 0x03e9 -#define PSMOUSE_CMD_SETSTREAM 0x00ea -#define PSMOUSE_CMD_POLL 0x03eb -#define PSMOUSE_CMD_GETID 0x02f2 -#define PSMOUSE_CMD_SETRATE 0x10f3 -#define PSMOUSE_CMD_ENABLE 0x00f4 -#define PSMOUSE_CMD_RESET_DIS 0x00f6 -#define PSMOUSE_CMD_RESET_BAT 0x02ff - -#define PSMOUSE_RET_BAT 0xaa -#define PSMOUSE_RET_ACK 0xfa -#define PSMOUSE_RET_NAK 0xfe - -#define MOUSE_INTERRUPTS_OFF (CONTROLLER_MODE_KCC | \ - CONTROLLER_MODE_DISABLE_MOUSE | \ - CONTROLLER_MODE_SYS | \ - CONTROLLER_MODE_KEYBOARD_INTERRUPT) - -#define MOUSE_INTERRUPTS_ON (CONTROLLER_MODE_KCC | \ - CONTROLLER_MODE_SYS | \ - CONTROLLER_MODE_MOUSE_INTERRUPT | \ - CONTROLLER_MODE_KEYBOARD_INTERRUPT) - -// Used with mouse buttons -#define GPM_B_LEFT 0x01 -#define GPM_B_RIGHT 0x02 -#define GPM_B_MIDDLE 0x04 -#define GPM_B_FOURTH 0x10 -#define GPM_B_FIFTH 0x20 - -// Mouse types -#define PSMOUSE_PS2 1 -#define PSMOUSE_PS2PP 2 -#define PSMOUSE_PS2TPP 3 -#define PSMOUSE_GENPS 4 -#define PSMOUSE_IMPS 5 -#define PSMOUSE_IMEX 6 -#define PSMOUSE_SYNAPTICS 7 - -// Some aux operations take long time -#define MAX_RETRIES 60 - -// Hardware defines -#define MOUSE_IRQ 12 -#define MOUSE_WRAP_MASK 0x1F - -#define MOUSE_ISINTELLIMOUSE 0x03 -#define MOUSE_ISINTELLIMOUSE5BUTTONS 0x04 - -BOOLEAN DetectPS2Port(void); -BOOLEAN SetupMouse(PDEVICE_OBJECT DeviceObject, PUNICODE_STRING RegistryPath); -void controller_wait(void); diff --git a/reactos/drivers/input/psaux/psaux.c b/reactos/drivers/input/psaux/psaux.c deleted file mode 100644 index 44a4c319525..00000000000 --- a/reactos/drivers/input/psaux/psaux.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - ** PS/2 driver 0.0.2 - ** Written by Jason Filby (jasonfilby@yahoo.com) - ** For ReactOS (www.reactos.com) - - ** Handles the keyboard and mouse on the PS/2 ports - - ** TODO: Fix detect_ps2_port(void) so that it works under BOCHs -*/ - -#include -#include -#include "mouse.h" -#include "psaux.h" - -#define NDEBUG -#include - -static PIRP CurrentIrp; -static ULONG MouseDataRead; -static ULONG MouseDataRequired; -static BOOLEAN AlreadyOpened = FALSE; - -BOOLEAN STDCALL -MouseSynchronizeRoutine(PVOID Context) -{ - PIRP Irp = (PIRP)Context; - PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); - ULONG NrToRead = stk->Parameters.Read.Length/sizeof(MOUSE_INPUT_DATA); - - if ((stk->Parameters.Read.Length/sizeof(MOUSE_INPUT_DATA))==NrToRead) - { - return(TRUE); - } - - MouseDataRequired=stk->Parameters.Read.Length/sizeof(MOUSE_INPUT_DATA); - MouseDataRead=NrToRead; - CurrentIrp=Irp; - - return(FALSE); -} - -VOID STDCALL -PS2MouseStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp) -{ - PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - - if (KeSynchronizeExecution(DeviceExtension->MouseInterrupt, MouseSynchronizeRoutine, Irp)) - { - KIRQL oldIrql; - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - oldIrql = KeGetCurrentIrql(); - if (oldIrql < DISPATCH_LEVEL) - { - KeRaiseIrql (DISPATCH_LEVEL, &oldIrql); - IoStartNextPacket (DeviceObject, FALSE); - KeLowerIrql(oldIrql); - } - else - { - IoStartNextPacket (DeviceObject, FALSE); - } - } -} - -NTSTATUS STDCALL -PS2MouseDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) -{ - PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS Status; - - switch (stk->MajorFunction) - { - case IRP_MJ_CREATE: - if (AlreadyOpened == TRUE) - { - Status = STATUS_SUCCESS; - } - else - { - Status = STATUS_SUCCESS; - AlreadyOpened = TRUE; - } - break; - - case IRP_MJ_CLOSE: - Status = STATUS_SUCCESS; - break; - - default: - DPRINT1("NOT IMPLEMENTED\n"); - Status = STATUS_NOT_IMPLEMENTED; - break; - } - - if (Status==STATUS_PENDING) - { - IoMarkIrpPending(Irp); - } - else - { - Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp,IO_NO_INCREMENT); - } - return(Status); -} - -BOOLEAN STDCALL PS2MouseInitializeDataQueue(PVOID Context) -{ - return(TRUE); -} - -NTSTATUS STDCALL -PS2MouseInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) -{ - PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS status; - - switch(Stack->Parameters.DeviceIoControl.IoControlCode) - { - case IOCTL_INTERNAL_MOUSE_CONNECT: - - DeviceExtension->ClassInformation = - *((PCLASS_INFORMATION)Stack->Parameters.DeviceIoControl.Type3InputBuffer); - - // Reinitialize the port input data queue synchronously - KeSynchronizeExecution(DeviceExtension->MouseInterrupt, - PS2MouseInitializeDataQueue, DeviceExtension); - - status = STATUS_SUCCESS; - break; - - default: - status = STATUS_INVALID_DEVICE_REQUEST; - break; - } - - Irp->IoStatus.Status = status; - if (status == STATUS_PENDING) { - IoMarkIrpPending(Irp); - IoStartPacket(DeviceObject, Irp, NULL, NULL); - } else { - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } - - return status; -} - -VOID PS2MouseIsrDpc(PKDPC Dpc, PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context) -{ - PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - ULONG Queue; - - Queue = DeviceExtension->ActiveQueue % 2; - InterlockedIncrement((PLONG)&DeviceExtension->ActiveQueue); - (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassInformation.CallBack)( - DeviceExtension->ClassInformation.DeviceObject, - DeviceExtension->MouseInputData[Queue], - NULL, - &DeviceExtension->InputDataCount[Queue]); - DeviceExtension->InputDataCount[Queue] = 0; -} - -/* Maximum value plus one for \Device\PointerClass* device name */ -#define POINTER_PORTS_MAXIMUM 8 -/* Letter count for POINTER_PORTS_MAXIMUM variable * sizeof(WCHAR) */ -#define SUFFIX_MAXIMUM_SIZE (1 * sizeof(WCHAR)) - -/* This is almost the same routine as in sermouse.c. */ -STATIC PDEVICE_OBJECT -AllocatePointerDevice(PDRIVER_OBJECT DriverObject) -{ - PDEVICE_OBJECT DeviceObject; - UNICODE_STRING DeviceName; - UNICODE_STRING SuffixString; - PDEVICE_EXTENSION DeviceExtension; - ULONG Suffix; - NTSTATUS Status; - - /* Allocate buffer for full device name */ - RtlInitUnicodeString(&DeviceName, NULL); - DeviceName.MaximumLength = sizeof(DD_MOUSE_DEVICE_NAME_U) + SUFFIX_MAXIMUM_SIZE + sizeof(UNICODE_NULL); - DeviceName.Buffer = ExAllocatePool(PagedPool, DeviceName.MaximumLength); - RtlAppendUnicodeToString(&DeviceName, DD_MOUSE_DEVICE_NAME_U); - - /* Allocate buffer for device name suffix */ - RtlInitUnicodeString(&SuffixString, NULL); - SuffixString.MaximumLength = SUFFIX_MAXIMUM_SIZE + sizeof(UNICODE_NULL); - SuffixString.Buffer = ExAllocatePool(PagedPool, SuffixString.MaximumLength); - - /* Generate full qualified name with suffix */ - for (Suffix = 0; Suffix < POINTER_PORTS_MAXIMUM; ++Suffix) - { - ANSI_STRING DebugString; - - RtlIntegerToUnicodeString(Suffix, 10, &SuffixString); - RtlAppendUnicodeToString(&DeviceName, SuffixString.Buffer); - // FIXME: this isn't really a serial mouse port driver - Status = IoCreateDevice(DriverObject, sizeof(DEVICE_EXTENSION), - &DeviceName, FILE_DEVICE_SERIAL_MOUSE_PORT, 0, TRUE, &DeviceObject); - RtlUnicodeStringToAnsiString(&DebugString, &DeviceName, TRUE); - DPRINT("%s", DebugString.Buffer); - RtlFreeAnsiString(&DebugString); - /* Device successfully created, leave the cyclus */ - if (NT_SUCCESS(Status)) - break; - DeviceName.Length -= SuffixString.Length; - } - - ExFreePool(DeviceName.Buffer); - ExFreePool(SuffixString.Buffer); - - /* Couldn't create device */ - if (!NT_SUCCESS(Status)) - { - return NULL; - } - - DeviceObject->Flags = DeviceObject->Flags | DO_BUFFERED_IO; - - DeviceExtension = DeviceObject->DeviceExtension; - KeInitializeDpc(&DeviceExtension->IsrDpc, (PKDEFERRED_ROUTINE)PS2MouseIsrDpc, DeviceObject); - - return DeviceObject; -} - -NTSTATUS STDCALL -DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) -{ - PDEVICE_OBJECT DeviceObject; - - if (DetectPS2Port() == TRUE) { - DPRINT("PS2 Port Driver version 0.0.2\n"); - } else { - DPRINT1("PS2 port not found.\n"); - return STATUS_UNSUCCESSFUL; - } - - DriverObject->MajorFunction[IRP_MJ_CREATE] = PS2MouseDispatch; - DriverObject->MajorFunction[IRP_MJ_CLOSE] = PS2MouseDispatch; - DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = PS2MouseInternalDeviceControl; - DriverObject->DriverStartIo = PS2MouseStartIo; - - DeviceObject = AllocatePointerDevice(DriverObject); - - SetupMouse(DeviceObject, RegistryPath); - - return(STATUS_SUCCESS); -} diff --git a/reactos/drivers/input/psaux/psaux.h b/reactos/drivers/input/psaux/psaux.h deleted file mode 100644 index 1782e5da438..00000000000 --- a/reactos/drivers/input/psaux/psaux.h +++ /dev/null @@ -1,28 +0,0 @@ -typedef struct _DEVICE_EXTENSION { - - PDEVICE_OBJECT DeviceObject; - - ULONG ActiveQueue; - ULONG InputDataCount[2]; - MOUSE_INPUT_DATA MouseInputData[2][MOUSE_BUFFER_SIZE]; - - unsigned char MouseBuffer[8]; - unsigned char pkt[8]; - unsigned char MouseType; - unsigned char MouseModel; - unsigned char ack, acking; - ULONG SmartScroll; - ULONG NoExtensions; - UINT MouseBufferPosition; - UINT MouseBufferSize; - UINT Resolution; - UINT RepliesExpected; - ULONG PreviousButtons; - - - CLASS_INFORMATION ClassInformation; - - PKINTERRUPT MouseInterrupt; - KDPC IsrDpc; -} DEVICE_EXTENSION, *PDEVICE_EXTENSION; - diff --git a/reactos/drivers/input/psaux/psaux.rc b/reactos/drivers/input/psaux/psaux.rc deleted file mode 100644 index 6e8fe381e2c..00000000000 --- a/reactos/drivers/input/psaux/psaux.rc +++ /dev/null @@ -1,7 +0,0 @@ -/* $Id$ */ - -#define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "PS Auxiliary Device Driver\0" -#define REACTOS_STR_INTERNAL_NAME "psaux\0" -#define REACTOS_STR_ORIGINAL_FILENAME "psaux.sys\0" -#include diff --git a/reactos/drivers/input/psaux/psaux.xml b/reactos/drivers/input/psaux/psaux.xml deleted file mode 100644 index 8471aa65826..00000000000 --- a/reactos/drivers/input/psaux/psaux.xml +++ /dev/null @@ -1,11 +0,0 @@ - - . - ntoskrnl - hal - controller.c - logips2pp.c - mouse.c - psaux.c - synaptics.c - psaux.rc - diff --git a/reactos/drivers/input/psaux/synaptics.c b/reactos/drivers/input/psaux/synaptics.c deleted file mode 100644 index 4a9a209cfa9..00000000000 --- a/reactos/drivers/input/psaux/synaptics.c +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Synaptics TouchPad PS/2 mouse driver - * - * 2003 Peter Osterlund - * Ported to 2.5 input device infrastructure. - * - * Copyright (C) 2001 Stefan Gmeiner - * start merging tpconfig and gpm code to a xfree-input module - * adding some changes and extensions (ex. 3rd and 4th button) - * - * Copyright (c) 1997 C. Scott Ananian - * Copyright (c) 1998-2000 Bruce Kalk - * code for the special synaptics commands (from the tpconfig-source) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Trademarks are the property of their respective owners. - */ - - - - #define NO_SYNAPTICS - - - - -#include -#include -#include -#include "mouse.h" -#include "psaux.h" - -#ifndef NO_SYNAPTICS - -#include "synaptics.h" - -/***************************************************************************** - * Synaptics communications functions - ****************************************************************************/ - -/* - * Use the Synaptics extended ps/2 syntax to write a special command byte. - * special command: 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu - * is the command. A 0xF3 or 0xE9 must follow (see synaptics_send_cmd - * and synaptics_set_mode) - */ -static int synaptics_special_cmd(PDEVICE_EXTENSION DeviceExtension, unsigned char command) -{ - int i; - - if (psmouse_command(DeviceExtension, NULL, PSMOUSE_CMD_SETSCALE11)) - return -1; - - for (i = 6; i >= 0; i -= 2) { - unsigned char d = (command >> i) & 3; - if (psmouse_command(DeviceExtension, &d, PSMOUSE_CMD_SETRES)) - return -1; - } - - return 0; -} - -/* - * Send a command to the synpatics touchpad by special commands - */ -static int synaptics_send_cmd(PDEVICE_EXTENSION DeviceExtension, unsigned char c, unsigned char *param) -{ - if (synaptics_special_cmd(DeviceExtension, c)) - return -1; - if (psmouse_command(DeviceExtension, param, PSMOUSE_CMD_GETINFO)) - return -1; - return 0; -} - -/* - * Set the synaptics touchpad mode byte by special commands - */ -static int synaptics_set_mode(PDEVICE_EXTENSION DeviceExtension, unsigned char mode) -{ - unsigned char param[1]; - - if (synaptics_special_cmd(DeviceExtension, mode)) - return -1; - param[0] = 0x14; - if (psmouse_command(DeviceExtension, param, PSMOUSE_CMD_SETRATE)) - return -1; - return 0; -} - -static int synaptics_reset(PDEVICE_EXTENSION DeviceExtension) -{ - unsigned char r[2]; - - if (psmouse_command(DeviceExtension, r, PSMOUSE_CMD_RESET_BAT)) - return -1; - if (r[0] == 0xAA && r[1] == 0x00) - return 0; - return -1; -} - -/* - * Read the model-id bytes from the touchpad - * see also SYN_MODEL_* macros - */ -static int synaptics_model_id(struct psmouse *psmouse, unsigned long int *model_id) -{ - unsigned char mi[3]; - - if (synaptics_send_cmd(psmouse, SYN_QUE_MODEL, mi)) - return -1; - *model_id = (mi[0]<<16) | (mi[1]<<8) | mi[2]; - return 0; -} - -/* - * Read the capability-bits from the touchpad - * see also the SYN_CAP_* macros - */ -static int synaptics_capability(struct psmouse *psmouse, unsigned long int *capability) -{ - unsigned char cap[3]; - - if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) - return -1; - *capability = (cap[0]<<16) | (cap[1]<<8) | cap[2]; - if (SYN_CAP_VALID(*capability)) - return 0; - return -1; -} - -/* - * Identify Touchpad - * See also the SYN_ID_* macros - */ -static int synaptics_identify(struct psmouse *psmouse, unsigned long int *ident) -{ - unsigned char id[3]; - - if (synaptics_send_cmd(psmouse, SYN_QUE_IDENTIFY, id)) - return -1; - *ident = (id[0]<<16) | (id[1]<<8) | id[2]; - if (SYN_ID_IS_SYNAPTICS(*ident)) - return 0; - return -1; -} - -static int synaptics_enable_device(struct psmouse *psmouse) -{ - if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_ENABLE)) - return -1; - return 0; -} - -static void print_ident(struct synaptics_data *priv) -{ - printk(KERN_INFO "Synaptics Touchpad, model: %ld\n", SYN_ID_MODEL(priv->identity)); - printk(KERN_INFO " Firware: %ld.%ld\n", SYN_ID_MAJOR(priv->identity), - SYN_ID_MINOR(priv->identity)); - - if (SYN_MODEL_ROT180(priv->model_id)) - printk(KERN_INFO " 180 degree mounted touchpad\n"); - if (SYN_MODEL_PORTRAIT(priv->model_id)) - printk(KERN_INFO " portrait touchpad\n"); - printk(KERN_INFO " Sensor: %ld\n", SYN_MODEL_SENSOR(priv->model_id)); - if (SYN_MODEL_NEWABS(priv->model_id)) - printk(KERN_INFO " new absolute packet format\n"); - if (SYN_MODEL_PEN(priv->model_id)) - printk(KERN_INFO " pen detection\n"); - - if (SYN_CAP_EXTENDED(priv->capabilities)) { - printk(KERN_INFO " Touchpad has extended capability bits\n"); - if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) - printk(KERN_INFO " -> four buttons\n"); - if (SYN_CAP_MULTIFINGER(priv->capabilities)) - printk(KERN_INFO " -> multifinger detection\n"); - if (SYN_CAP_PALMDETECT(priv->capabilities)) - printk(KERN_INFO " -> palm detection\n"); - } -} - -static int query_hardware(struct psmouse *psmouse) -{ - struct synaptics_data *priv = psmouse->private; - int retries = 0; - - while ((retries++ < 3) && synaptics_reset(psmouse)) - printk(KERN_ERR "synaptics reset failed\n"); - - if (synaptics_identify(psmouse, &priv->identity)) - return -1; - if (synaptics_model_id(psmouse, &priv->model_id)) - return -1; - if (synaptics_capability(psmouse, &priv->capabilities)) - return -1; - if (synaptics_set_mode(psmouse, (SYN_BIT_ABSOLUTE_MODE | - SYN_BIT_HIGH_RATE | - SYN_BIT_DISABLE_GESTURE | - SYN_BIT_W_MODE))) - return -1; - - synaptics_enable_device(psmouse); - - print_ident(priv); - - return 0; -} - -/***************************************************************************** - * Driver initialization/cleanup functions - ****************************************************************************/ - -static inline void set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) -{ - dev->absmin[axis] = min; - dev->absmax[axis] = max; - dev->absfuzz[axis] = fuzz; - dev->absflat[axis] = flat; - - set_bit(axis, dev->absbit); -} - -int synaptics_init(struct psmouse *psmouse) -{ - struct synaptics_data *priv; - - psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); - if (!priv) - return -1; - memset(priv, 0, sizeof(struct synaptics_data)); - - priv->inSync = 1; - - if (query_hardware(psmouse)) { - printk(KERN_ERR "Unable to query/initialize Synaptics hardware.\n"); - goto init_fail; - } - - /* - * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, - * which says that they should be valid regardless of the actual size of - * the senser. - */ - set_bit(EV_ABS, psmouse->dev.evbit); - set_abs_params(&psmouse->dev, ABS_X, 1472, 5472, 0, 0); - set_abs_params(&psmouse->dev, ABS_Y, 1408, 4448, 0, 0); - set_abs_params(&psmouse->dev, ABS_PRESSURE, 0, 255, 0, 0); - - set_bit(EV_MSC, psmouse->dev.evbit); - set_bit(MSC_GESTURE, psmouse->dev.mscbit); - - set_bit(EV_KEY, psmouse->dev.evbit); - set_bit(BTN_LEFT, psmouse->dev.keybit); - set_bit(BTN_RIGHT, psmouse->dev.keybit); - set_bit(BTN_FORWARD, psmouse->dev.keybit); - set_bit(BTN_BACK, psmouse->dev.keybit); - - clear_bit(EV_REL, psmouse->dev.evbit); - clear_bit(REL_X, psmouse->dev.relbit); - clear_bit(REL_Y, psmouse->dev.relbit); - - return 0; - - init_fail: - kfree(priv); - return -1; -} - -void synaptics_disconnect(struct psmouse *psmouse) -{ - struct synaptics_data *priv = psmouse->private; - - kfree(priv); -} - -/***************************************************************************** - * Functions to interpret the absolute mode packets - ****************************************************************************/ - -static void synaptics_parse_hw_state(struct synaptics_data *priv, struct synaptics_hw_state *hw) -{ - unsigned char *buf = priv->proto_buf; - - hw->x = (((buf[3] & 0x10) << 8) | - ((buf[1] & 0x0f) << 8) | - buf[4]); - hw->y = (((buf[3] & 0x20) << 7) | - ((buf[1] & 0xf0) << 4) | - buf[5]); - - hw->z = buf[2]; - hw->w = (((buf[0] & 0x30) >> 2) | - ((buf[0] & 0x04) >> 1) | - ((buf[3] & 0x04) >> 2)); - - hw->left = (buf[0] & 0x01) ? 1 : 0; - hw->right = (buf[0] & 0x2) ? 1 : 0; - hw->up = 0; - hw->down = 0; - - if (SYN_CAP_EXTENDED(priv->capabilities) && - (SYN_CAP_FOUR_BUTTON(priv->capabilities))) { - hw->up = ((buf[3] & 0x01)) ? 1 : 0; - if (hw->left) - hw->up = !hw->up; - hw->down = ((buf[3] & 0x02)) ? 1 : 0; - if (hw->right) - hw->down = !hw->down; - } -} - -/* - * called for each full received packet from the touchpad - */ -static void synaptics_process_packet(struct psmouse *psmouse) -{ - struct input_dev *dev = &psmouse->dev; - struct synaptics_data *priv = psmouse->private; - struct synaptics_hw_state hw; - - synaptics_parse_hw_state(priv, &hw); - - if (hw.z > 0) { - int w_ok = 0; - /* - * Use capability bits to decide if the w value is valid. - * If not, set it to 5, which corresponds to a finger of - * normal width. - */ - if (SYN_CAP_EXTENDED(priv->capabilities)) { - switch (hw.w) { - case 0 ... 1: - w_ok = SYN_CAP_MULTIFINGER(priv->capabilities); - break; - case 2: - w_ok = SYN_MODEL_PEN(priv->model_id); - break; - case 4 ... 15: - w_ok = SYN_CAP_PALMDETECT(priv->capabilities); - break; - } - } - if (!w_ok) - hw.w = 5; - } - - /* Post events */ - input_report_abs(dev, ABS_X, hw.x); - input_report_abs(dev, ABS_Y, hw.y); - input_report_abs(dev, ABS_PRESSURE, hw.z); - - if (hw.w != priv->old_w) { - input_event(dev, EV_MSC, MSC_GESTURE, hw.w); - priv->old_w = hw.w; - } - - input_report_key(dev, BTN_LEFT, hw.left); - input_report_key(dev, BTN_RIGHT, hw.right); - input_report_key(dev, BTN_FORWARD, hw.up); - input_report_key(dev, BTN_BACK, hw.down); - - input_sync(dev); -} - -void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) -{ - struct input_dev *dev = &psmouse->dev; - struct synaptics_data *priv = psmouse->private; - unsigned char *pBuf = priv->proto_buf; - unsigned char u = psmouse->packet[0]; - - input_regs(dev, regs); - - pBuf[priv->proto_buf_tail++] = u; - - /* check first byte */ - if ((priv->proto_buf_tail == 1) && ((u & 0xC8) != 0x80)) { - priv->inSync = 0; - priv->proto_buf_tail = 0; - printk(KERN_WARNING "Synaptics driver lost sync at 1st byte\n"); - return; - } - - /* check 4th byte */ - if ((priv->proto_buf_tail == 4) && ((u & 0xc8) != 0xc0)) { - priv->inSync = 0; - priv->proto_buf_tail = 0; - printk(KERN_WARNING "Synaptics driver lost sync at 4th byte\n"); - return; - } - - if (priv->proto_buf_tail >= 6) { /* Full packet received */ - if (!priv->inSync) { - priv->inSync = 1; - printk(KERN_NOTICE "Synaptics driver resynced.\n"); - } - synaptics_process_packet(psmouse); - priv->proto_buf_tail = 0; - } -} - -#else - -int InitSynaptics(PDEVICE_EXTENSION DeviceExtension) -{ - return -1; -} - -#endif diff --git a/reactos/drivers/input/psaux/synaptics.h b/reactos/drivers/input/psaux/synaptics.h deleted file mode 100644 index f7f2259cf3b..00000000000 --- a/reactos/drivers/input/psaux/synaptics.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Synaptics TouchPad PS/2 mouse driver - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ -#ifndef NO_SYNAPTICS - -#ifndef _SYNAPTICS_H -#define _SYNAPTICS_H - -extern void synaptics_process_byte(DeviceExtension, struct pt_regs *regs); -#endif -extern int synaptics_init(DeviceExtension); -#ifndef NO_SYNAPTICS -extern void synaptics_disconnect(DeviceExtension); - -/* synaptics queries */ -#define SYN_QUE_IDENTIFY 0x00 -#define SYN_QUE_MODES 0x01 -#define SYN_QUE_CAPABILITIES 0x02 -#define SYN_QUE_MODEL 0x03 -#define SYN_QUE_SERIAL_NUMBER_PREFIX 0x06 -#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 -#define SYN_QUE_RESOLUTION 0x08 - -/* synatics modes */ -#define SYN_BIT_ABSOLUTE_MODE (1 << 7) -#define SYN_BIT_HIGH_RATE (1 << 6) -#define SYN_BIT_SLEEP_MODE (1 << 3) -#define SYN_BIT_DISABLE_GESTURE (1 << 2) -#define SYN_BIT_W_MODE (1 << 0) - -/* synaptics model ID bits */ -#define SYN_MODEL_ROT180(m) ((m) & (1 << 23)) -#define SYN_MODEL_PORTRAIT(m) ((m) & (1 << 22)) -#define SYN_MODEL_SENSOR(m) (((m) >> 16) & 0x3f) -#define SYN_MODEL_HARDWARE(m) (((m) >> 9) & 0x7f) -#define SYN_MODEL_NEWABS(m) ((m) & (1 << 7)) -#define SYN_MODEL_PEN(m) ((m) & (1 << 6)) -#define SYN_MODEL_SIMPLIC(m) ((m) & (1 << 5)) -#define SYN_MODEL_GEOMETRY(m) ((m) & 0x0f) - -/* synaptics capability bits */ -#define SYN_CAP_EXTENDED(c) ((c) & (1 << 23)) -#define SYN_CAP_SLEEP(c) ((c) & (1 << 4)) -#define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3)) -#define SYN_CAP_MULTIFINGER(c) ((c) & (1 << 1)) -#define SYN_CAP_PALMDETECT(c) ((c) & (1 << 0)) -#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) - -/* synaptics modes query bits */ -#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) -#define SYN_MODE_RATE(m) ((m) & (1 << 6)) -#define SYN_MODE_BAUD_SLEEP(m) ((m) & (1 << 3)) -#define SYN_MODE_DISABLE_GESTURE(m) ((m) & (1 << 2)) -#define SYN_MODE_PACKSIZE(m) ((m) & (1 << 1)) -#define SYN_MODE_WMODE(m) ((m) & (1 << 0)) - -/* synaptics identify query bits */ -#define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f) -#define SYN_ID_MAJOR(i) ((i) & 0x0f) -#define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) -#define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47) - -/* - * A structure to describe the state of the touchpad hardware (buttons and pad) - */ - -struct synaptics_hw_state { - int x; - int y; - int z; - int w; - int left; - int right; - int up; - int down; -}; - -struct synaptics_data { - /* Data read from the touchpad */ - unsigned long int model_id; /* Model-ID */ - unsigned long int capabilities; /* Capabilities */ - unsigned long int identity; /* Identification */ - - /* Data for normal processing */ - unsigned char proto_buf[6]; /* Buffer for Packet */ - unsigned char last_byte; /* last received byte */ - int inSync; /* Packets in sync */ - int proto_buf_tail; - - int old_w; /* Previous w value */ -}; - -#endif /* _SYNAPTICS_H */ - -#endif /* NO_SYNAPTICS */ - diff --git a/reactos/drivers/lib/ip/network/ip.c b/reactos/drivers/lib/ip/network/ip.c index ef23f27b5d1..b25b1424696 100644 --- a/reactos/drivers/lib/ip/network/ip.c +++ b/reactos/drivers/lib/ip/network/ip.c @@ -232,6 +232,27 @@ VOID IPDestroyInterface( exFreePool(IF); } +VOID IPAddInterfaceRoute( PIP_INTERFACE IF ) { + PNEIGHBOR_CACHE_ENTRY NCE; + IP_ADDRESS NetworkAddress; + + /* Add a permanent neighbor for this NTE */ + NCE = NBAddNeighbor(IF, &IF->Unicast, + IF->Address, IF->AddressLength, + NUD_PERMANENT); + if (!NCE) { + TI_DbgPrint(MIN_TRACE, ("Could not create NCE.\n")); + } + + AddrWidenAddress( &NetworkAddress, &IF->Unicast, &IF->Netmask ); + + if (!RouterAddRoute(&NetworkAddress, &IF->Netmask, NCE, 1)) { + TI_DbgPrint(MIN_TRACE, ("Could not add route due to insufficient resources.\n")); + } + + /* Allow TCP to hang some configuration on this interface */ + IF->TCPContext = TCPPrepareInterface( IF ); +} BOOLEAN IPRegisterInterface( PIP_INTERFACE IF) @@ -246,8 +267,6 @@ BOOLEAN IPRegisterInterface( KIRQL OldIrql; UINT ChosenIndex = 1; BOOLEAN IndexHasBeenChosen; - IP_ADDRESS NetworkAddress; - PNEIGHBOR_CACHE_ENTRY NCE; IF_LIST_ITER(Interface); TI_DbgPrint(MID_TRACE, ("Called. IF (0x%X).\n", IF)); @@ -264,38 +283,37 @@ BOOLEAN IPRegisterInterface( } } EndFor(Interface); } while( !IndexHasBeenChosen ); - + IF->Index = ChosenIndex; - /* Add a permanent neighbor for this NTE */ - NCE = NBAddNeighbor(IF, &IF->Unicast, - IF->Address, IF->AddressLength, - NUD_PERMANENT); - if (!NCE) { - TI_DbgPrint(MIN_TRACE, ("Could not create NCE.\n")); - TcpipReleaseSpinLock(&IF->Lock, OldIrql); - return FALSE; - } - - AddrWidenAddress( &NetworkAddress, &IF->Unicast, &IF->Netmask ); - - if (!RouterAddRoute(&NetworkAddress, &IF->Netmask, NCE, 1)) { - TI_DbgPrint(MIN_TRACE, ("Could not add route due to insufficient resources.\n")); - } + IPAddInterfaceRoute( IF ); /* Add interface to the global interface list */ TcpipInterlockedInsertTailList(&InterfaceListHead, &IF->ListEntry, &InterfaceListLock); - /* Allow TCP to hang some configuration on this interface */ - IF->TCPContext = TCPPrepareInterface( IF ); - TcpipReleaseSpinLock(&IF->Lock, OldIrql); return TRUE; } +VOID IPRemoveInterfaceRoute( PIP_INTERFACE IF ) { + PNEIGHBOR_CACHE_ENTRY NCE; + IP_ADDRESS GeneralRoute; + + TCPDisposeInterfaceData( IF->TCPContext ); + IF->TCPContext = NULL; + + AddrWidenAddress(&GeneralRoute,&IF->Unicast,&IF->Netmask); + RouterRemoveRoute(&GeneralRoute, &IF->Unicast); + + /* Remove permanent NCE, but first we have to find it */ + NCE = NBLocateNeighbor(&IF->Unicast); + if (NCE) + NBRemoveNeighbor(NCE); + +} VOID IPUnregisterInterface( PIP_INTERFACE IF) @@ -306,15 +324,11 @@ VOID IPUnregisterInterface( */ { KIRQL OldIrql3; - PNEIGHBOR_CACHE_ENTRY NCE; TI_DbgPrint(DEBUG_IP, ("Called. IF (0x%X).\n", IF)); - /* Remove permanent NCE, but first we have to find it */ - NCE = NBLocateNeighbor(&IF->Unicast); - if (NCE) - NBRemoveNeighbor(NCE); - + IPRemoveInterfaceRoute( IF ); + TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql3); RemoveEntryList(&IF->ListEntry); TcpipReleaseSpinLock(&InterfaceListLock, OldIrql3); diff --git a/reactos/drivers/lib/ip/network/loopback.c b/reactos/drivers/lib/ip/network/loopback.c index e2be1fa4383..375b274cb17 100644 --- a/reactos/drivers/lib/ip/network/loopback.c +++ b/reactos/drivers/lib/ip/network/loopback.c @@ -189,6 +189,10 @@ NDIS_STATUS LoopRegisterAdapter( Loopback = IPCreateInterface(&BindInfo); + Loopback->Name.Buffer = L"Loopback"; + Loopback->Name.MaximumLength = Loopback->Name.Length = + wcslen(Loopback->Name.Buffer) * sizeof(WCHAR); + AddrInitIPv4(&Loopback->Unicast, LOOPBACK_ADDRESS_IPv4); AddrInitIPv4(&Loopback->Netmask, LOOPBACK_ADDRMASK_IPv4); diff --git a/reactos/drivers/lib/ip/network/neighbor.c b/reactos/drivers/lib/ip/network/neighbor.c index 99e9bbf6e55..ab035a8a262 100644 --- a/reactos/drivers/lib/ip/network/neighbor.c +++ b/reactos/drivers/lib/ip/network/neighbor.c @@ -289,6 +289,8 @@ PNEIGHBOR_CACHE_ENTRY NBAddNeighbor( NCE->LinkAddress = (PVOID)&NCE[1]; if( LinkAddress ) RtlCopyMemory(NCE->LinkAddress, LinkAddress, LinkAddressLength); + else + memset(NCE->LinkAddress, 0xff, LinkAddressLength); NCE->State = State; NCE->EventTimer = 0; /* Not in use */ InitializeListHead( &NCE->PacketQueue ); diff --git a/reactos/drivers/lib/ip/transport/tcp/if.c b/reactos/drivers/lib/ip/transport/tcp/if.c index 729bc0eabee..027e68d71bb 100644 --- a/reactos/drivers/lib/ip/transport/tcp/if.c +++ b/reactos/drivers/lib/ip/transport/tcp/if.c @@ -65,6 +65,10 @@ PVOID TCPPrepareInterface( PIP_INTERFACE IF ) { return ifaddr; } +VOID TCPDisposeInterfaceData( PVOID Ptr ) { + exFreePool( Ptr ); +} + POSK_IFADDR TCPFindInterface( void *ClientData, OSK_UINT AddrType, OSK_UINT FindType, diff --git a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h index a4216674c13..d5f3d0f6442 100644 --- a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h +++ b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h @@ -129,7 +129,7 @@ void printf __P((const char *, ...)); int __cdecl vprintf(const char *, va_list); #define log bsd_log -static inline int bsd_log ( int blah, const char* fmt, ... ) +static int bsd_log ( int blah, const char* fmt, ... ) { va_list arg; int i; diff --git a/reactos/drivers/lib/oskittcp/makefile b/reactos/drivers/lib/oskittcp/makefile index 52e791c66bb..6ec60412082 100644 --- a/reactos/drivers/lib/oskittcp/makefile +++ b/reactos/drivers/lib/oskittcp/makefile @@ -11,11 +11,8 @@ TARGET_TYPE = library TARGET_NAME = oskittcp #-DMEMTRACK -TARGET_CFLAGS = -g -D__REACTOS__=1 -D__NTDRIVER__ -DKERNEL -Iinclude/freebsd -Iinclude/freebsd/sys/include -Iinclude/freebsd/src/sys -Iinclude/freebsd/dev/include -Iinclude/freebsd/net/include -Iinclude -I$(PATH_TO_TOP)/w32api/include -I$(PATH_TO_TOP)/include # require os code to explicitly request A/W version of structs/functions -TARGET_CFLAGS += -D_DISABLE_TIDENTS - TARGET_ASFLAGS = -I $(PATH_TO_TOP)/include TARGET_LFLAGS = -Wl,--file-alignment,0x1000 \ @@ -71,6 +68,8 @@ include $(TOOLS_PATH)/helper.mk include $(TOOLS_PATH)/depend.mk +TARGET_CFLAGS += -D__REACTOS__=1 -D__NTDRIVER__ -DKERNEL -Iinclude/freebsd -Iinclude/freebsd/sys/include -Iinclude/freebsd/src/sys -Iinclude/freebsd/dev/include -Iinclude/freebsd/net/include -Iinclude + %/TAGS: etags -o $(@D)/TAGS $(@D)/\*.c diff --git a/reactos/drivers/net/afd/afd/lock.c b/reactos/drivers/net/afd/afd/lock.c index c173ead9ab5..08ebc314547 100644 --- a/reactos/drivers/net/afd/afd/lock.c +++ b/reactos/drivers/net/afd/afd/lock.c @@ -50,7 +50,6 @@ PAFD_WSABUF LockBuffers( PAFD_WSABUF Buf, UINT Count, UINT Size = sizeof(AFD_WSABUF) * (Count + Lock); PAFD_WSABUF NewBuf = ExAllocatePool( PagedPool, Size * 2 ); PMDL NewMdl; - INT NewBufferLen; AFD_DbgPrint(MID_TRACE,("Called\n")); @@ -59,7 +58,14 @@ PAFD_WSABUF LockBuffers( PAFD_WSABUF Buf, UINT Count, _SEH_TRY { RtlCopyMemory( NewBuf, Buf, sizeof(AFD_WSABUF) * Count ); - NewBufferLen = *AddressLen; + if( LockAddress ) { + NewBuf[Count].buf = AddressBuf; + NewBuf[Count].len = *AddressLen; + Count++; + NewBuf[Count].buf = (PVOID)AddressLen; + NewBuf[Count].len = sizeof(*AddressLen); + Count++; + } } _SEH_HANDLE { AFD_DbgPrint(MIN_TRACE,("Access violation copying buffer info " "from userland (%x %x)\n", @@ -68,15 +74,6 @@ PAFD_WSABUF LockBuffers( PAFD_WSABUF Buf, UINT Count, return NULL; } _SEH_END; - if( LockAddress ) { - NewBuf[Count].buf = AddressBuf; - NewBuf[Count].len = NewBufferLen; - Count++; - NewBuf[Count].buf = (PVOID)AddressLen; - NewBuf[Count].len = sizeof(*AddressLen); - Count++; - } - for( i = 0; i < Count; i++ ) { AFD_DbgPrint(MID_TRACE,("Locking buffer %d (%x:%d)\n", i, NewBuf[i].buf, NewBuf[i].len)); diff --git a/reactos/drivers/net/afd/afd/main.c b/reactos/drivers/net/afd/afd/main.c index d348151322e..1b9ab1d032d 100644 --- a/reactos/drivers/net/afd/afd/main.c +++ b/reactos/drivers/net/afd/afd/main.c @@ -20,8 +20,8 @@ #ifdef DBG /* See debug.h for debug/trace constants */ -DWORD DebugTraceLevel = DEBUG_ULTRA; -//DWORD DebugTraceLevel = 0; +//DWORD DebugTraceLevel = DEBUG_ULTRA; +DWORD DebugTraceLevel = 0; #endif /* DBG */ diff --git a/reactos/drivers/net/afd/afd/read.c b/reactos/drivers/net/afd/afd/read.c index 569da4619f2..179a78e7b4f 100644 --- a/reactos/drivers/net/afd/afd/read.c +++ b/reactos/drivers/net/afd/afd/read.c @@ -36,7 +36,7 @@ BOOLEAN CantReadMore( PAFD_FCB FCB ) { VOID HandleEOFOnIrp( PAFD_FCB FCB, NTSTATUS Status, UINT Information ) { if( Status == STATUS_SUCCESS && Information == 0 ) { AFD_DbgPrint(MID_TRACE,("Looks like an EOF\n")); - FCB->PollState |= AFD_EVENT_CLOSE /*| AFD_EVENT_DISCONNECT */; + FCB->PollState |= AFD_EVENT_DISCONNECT; PollReeval( FCB->DeviceExt, FCB->FileObject ); } } @@ -109,10 +109,11 @@ NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB, ReceiveComplete, FCB ); - if( Status == STATUS_SUCCESS ) - FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information; - HandleEOFOnIrp( FCB, Status, FCB->Recv.Content ); SocketCalloutLeave( FCB ); + + if( Status == STATUS_SUCCESS ) + FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information; + HandleEOFOnIrp( FCB, Status, FCB->ReceiveIrp.Iosb.Information ); } } diff --git a/reactos/drivers/net/afd/afd/select.c b/reactos/drivers/net/afd/afd/select.c index aae2412693a..352a85d8ba7 100644 --- a/reactos/drivers/net/afd/afd/select.c +++ b/reactos/drivers/net/afd/afd/select.c @@ -120,6 +120,7 @@ VOID KillSelectsForFCB( PAFD_DEVICE_EXTENSION DeviceExt, PAFD_ACTIVE_POLL Poll; PIRP Irp; PAFD_POLL_INFO PollReq; + PAFD_HANDLE HandleArray; int i; AFD_DbgPrint(MID_TRACE,("Killing selects that refer to %x\n", FileObject)); @@ -132,11 +133,12 @@ VOID KillSelectsForFCB( PAFD_DEVICE_EXTENSION DeviceExt, ListEntry = ListEntry->Flink; Irp = Poll->Irp; PollReq = Irp->AssociatedIrp.SystemBuffer; - + HandleArray = AFD_HANDLES(PollReq); + for( i = 0; i < PollReq->HandleCount; i++ ) { AFD_DbgPrint(MAX_TRACE,("Req: %x, This %x\n", - PollReq->Handles[i].Handle, FileObject)); - if( (PVOID)PollReq->Handles[i].Handle == FileObject && + HandleArray[i].Handle, FileObject)); + if( (PVOID)HandleArray[i].Handle == FileObject && (!OnlyExclusive || (OnlyExclusive && Poll->Exclusive)) ) { ZeroEvents( PollReq->Handles, PollReq->HandleCount ); SignalSocket( Poll, PollReq, STATUS_SUCCESS ); diff --git a/reactos/drivers/net/tcpip/datalink/lan.c b/reactos/drivers/net/tcpip/datalink/lan.c index 79972b7d905..1a544a6fc29 100644 --- a/reactos/drivers/net/tcpip/datalink/lan.c +++ b/reactos/drivers/net/tcpip/datalink/lan.c @@ -18,6 +18,9 @@ UINT TransferDataCompleteCalled = 0; UINT LanReceiveWorkerCalled = 0; BOOLEAN LanReceiveWorkerBusy = FALSE; +#define CCS_ROOT L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet" +#define TCPIP_GUID L"{4D36E972-E325-11CE-BFC1-08002BE10318}" + #define NGFP(_Packet) \ { \ PVOID _Header; \ @@ -331,21 +334,21 @@ VOID STDCALL LanReceiveWorker( PVOID Context ) { IPPacket.Position = 0; TI_DbgPrint - (DEBUG_DATALINK, - ("Ether Type = %x ContigSize = %d Total = %d\n", - PacketType, IPPacket.ContigSize, IPPacket.TotalSize)); + (DEBUG_DATALINK, + ("Ether Type = %x ContigSize = %d Total = %d\n", + PacketType, IPPacket.ContigSize, IPPacket.TotalSize)); switch (PacketType) { - case ETYPE_IPv4: - case ETYPE_IPv6: - TI_DbgPrint(MID_TRACE,("Received IP Packet\n")); - IPReceive(Adapter->Context, &IPPacket); - break; - case ETYPE_ARP: - TI_DbgPrint(MID_TRACE,("Received ARP Packet\n")); - ARPReceive(Adapter->Context, &IPPacket); - default: - break; + case ETYPE_IPv4: + case ETYPE_IPv6: + TI_DbgPrint(MID_TRACE,("Received IP Packet\n")); + IPReceive(Adapter->Context, &IPPacket); + break; + case ETYPE_ARP: + TI_DbgPrint(MID_TRACE,("Received ARP Packet\n")); + ARPReceive(Adapter->Context, &IPPacket); + default: + break; } FreeNdisPacket( Packet ); @@ -363,6 +366,8 @@ VOID LanSubmitReceiveWork( PLAN_ADAPTER Adapter = (PLAN_ADAPTER)BindingContext; KIRQL OldIrql; + TI_DbgPrint(DEBUG_DATALINK,("called\n")); + TcpipAcquireSpinLock( &LanWorkLock, &OldIrql ); WQItem = ExAllocatePool( NonPagedPool, sizeof(LAN_WQ_ITEM) ); @@ -405,6 +410,8 @@ VOID STDCALL ProtocolTransferDataComplete( { ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); + TI_DbgPrint(DEBUG_DATALINK,("called\n")); + TransferDataCompleteCalled++; ASSERT(TransferDataCompleteCalled <= TransferDataCalled); @@ -599,10 +606,10 @@ VOID STDCALL ProtocolBindAdapter( * SystemSpecific2: Unused & must not be touched */ { - /* XXX confirm that this is still true, or re-word the following comment */ - /* we get to ignore BindContext because we will never pend an operation with NDIS */ - TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName)); - *Status = LANRegisterAdapter(DeviceName, SystemSpecific1); + /* XXX confirm that this is still true, or re-word the following comment */ + /* we get to ignore BindContext because we will never pend an operation with NDIS */ + TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName)); + *Status = LANRegisterAdapter(DeviceName, SystemSpecific1); } @@ -664,25 +671,25 @@ VOID LANTransmit( RtlCopyMemory(EHeader->SrcAddr, Adapter->HWAddress, IEEE_802_ADDR_LENGTH); switch (Type) { - case LAN_PROTO_IPv4: - EHeader->EType = ETYPE_IPv4; - break; - case LAN_PROTO_ARP: - EHeader->EType = ETYPE_ARP; - break; - case LAN_PROTO_IPv6: - EHeader->EType = ETYPE_IPv6; - break; - default: + case LAN_PROTO_IPv4: + EHeader->EType = ETYPE_IPv4; + break; + case LAN_PROTO_ARP: + EHeader->EType = ETYPE_ARP; + break; + case LAN_PROTO_IPv6: + EHeader->EType = ETYPE_IPv6; + break; + default: #ifdef DBG - /* Should not happen */ - TI_DbgPrint(MIN_TRACE, ("Unknown LAN protocol.\n")); + /* Should not happen */ + TI_DbgPrint(MIN_TRACE, ("Unknown LAN protocol.\n")); - ProtocolSendComplete((NDIS_HANDLE)Context, - NdisPacket, - NDIS_STATUS_FAILURE); + ProtocolSendComplete((NDIS_HANDLE)Context, + NdisPacket, + NDIS_STATUS_FAILURE); #endif - return; + return; } break; @@ -729,63 +736,10 @@ OpenRegistryKey( PNDIS_STRING RegistryPath, PHANDLE RegHandle ) { NTSTATUS Status; InitializeObjectAttributes(&Attributes, RegistryPath, OBJ_CASE_INSENSITIVE, 0, 0); - Status = ZwOpenKey(RegHandle, GENERIC_READ, &Attributes); + Status = ZwOpenKey(RegHandle, KEY_ALL_ACCESS, &Attributes); return Status; } -static NTSTATUS ReadIPAddressFromRegistry( HANDLE RegHandle, - PWCHAR RegistryValue, - PIP_ADDRESS Address ) { - UNICODE_STRING ValueName; - UNICODE_STRING UnicodeAddress; - NTSTATUS Status; - ULONG ResultLength; - UCHAR buf[1024]; - PKEY_VALUE_PARTIAL_INFORMATION Information = (PKEY_VALUE_PARTIAL_INFORMATION)buf; - ANSI_STRING AnsiAddress; - ULONG AnsiLen; - - RtlInitUnicodeString(&ValueName, RegistryValue); - Status = - ZwQueryValueKey(RegHandle, - &ValueName, - KeyValuePartialInformation, - Information, - sizeof(buf), - &ResultLength); - - if (!NT_SUCCESS(Status)) - return Status; - /* IP address is stored as a REG_MULTI_SZ - we only pay attention to the first one though */ - TI_DbgPrint(MIN_TRACE, ("Information DataLength: 0x%x\n", Information->DataLength)); - - UnicodeAddress.Buffer = (PWCHAR)&Information->Data; - UnicodeAddress.Length = Information->DataLength; - UnicodeAddress.MaximumLength = Information->DataLength; - - AnsiLen = RtlUnicodeStringToAnsiSize(&UnicodeAddress); - if(!AnsiLen) - return STATUS_NO_MEMORY; - - AnsiAddress.Buffer = exAllocatePoolWithTag(PagedPool, AnsiLen, 0x01020304); - if(!AnsiAddress.Buffer) - return STATUS_NO_MEMORY; - - AnsiAddress.Length = AnsiLen; - AnsiAddress.MaximumLength = AnsiLen; - - Status = RtlUnicodeStringToAnsiString(&AnsiAddress, &UnicodeAddress, FALSE); - if (!NT_SUCCESS(Status)) { - exFreePool(AnsiAddress.Buffer); - return STATUS_UNSUCCESSFUL; - } - - AnsiAddress.Buffer[AnsiAddress.Length] = 0; - AddrInitIPv4(Address, inet_addr(AnsiAddress.Buffer)); - - return STATUS_SUCCESS; -} - static NTSTATUS ReadStringFromRegistry( HANDLE RegHandle, PWCHAR RegistryValue, PUNICODE_STRING String ) { @@ -811,7 +765,7 @@ static NTSTATUS ReadStringFromRegistry( HANDLE RegHandle, TI_DbgPrint(MIN_TRACE, ("Information DataLength: 0x%x\n", Information->DataLength)); UnicodeString.Buffer = (PWCHAR)&Information->Data; - UnicodeString.Length = Information->DataLength; + UnicodeString.Length = Information->DataLength - sizeof(WCHAR); UnicodeString.MaximumLength = Information->DataLength; String->Buffer = @@ -826,32 +780,161 @@ static NTSTATUS ReadStringFromRegistry( HANDLE RegHandle, return STATUS_SUCCESS; } -static VOID GetSimpleAdapterNameFromRegistryPath -( PUNICODE_STRING TargetString, - PUNICODE_STRING RegistryPath ) { - PWCHAR i, LastSlash = NULL; - UINT NewStringLength = 0; +/* + * Utility to copy and append two unicode strings. + * + * IN OUT PUNICODE_STRING ResultFirst -> First string and result + * IN PUNICODE_STRING Second -> Second string to append + * IN BOOL Deallocate -> TRUE: Deallocate First string before + * overwriting. + * + * Returns NTSTATUS. + */ - for( i = RegistryPath->Buffer; - i < RegistryPath->Buffer + - (RegistryPath->Length / sizeof(WCHAR)); - i++ ) if( *i == '\\' ) LastSlash = i; +NTSTATUS NTAPI AppendUnicodeString(PUNICODE_STRING ResultFirst, + PUNICODE_STRING Second, + BOOL Deallocate) { + NTSTATUS Status; + UNICODE_STRING Ustr = *ResultFirst; + PWSTR new_string = ExAllocatePoolWithTag + (PagedPool, + (ResultFirst->Length + Second->Length + sizeof(WCHAR)), TAG_STRING); + if( !new_string ) { + return STATUS_NO_MEMORY; + } + memcpy( new_string, ResultFirst->Buffer, ResultFirst->Length ); + memcpy( new_string + ResultFirst->Length / sizeof(WCHAR), + Second->Buffer, Second->Length ); + if( Deallocate ) RtlFreeUnicodeString(ResultFirst); + ResultFirst->Length = Ustr.Length + Second->Length; + ResultFirst->MaximumLength = ResultFirst->Length; + new_string[ResultFirst->Length / sizeof(WCHAR)] = 0; + Status = RtlCreateUnicodeString(ResultFirst,new_string) ? + STATUS_SUCCESS : STATUS_NO_MEMORY; + ExFreePool(new_string); + return Status; +} - if( LastSlash ) LastSlash++; else LastSlash = RegistryPath->Buffer; +static NTSTATUS CheckForDeviceDesc( PUNICODE_STRING EnumKeyName, + PUNICODE_STRING TargetKeyName, + PUNICODE_STRING ShortName, + PUNICODE_STRING OutName ) { + UNICODE_STRING RootDevice = { 0 }, LinkageKeyName = { 0 }; + UNICODE_STRING DescKeyName = { 0 }, Linkage = { 0 }; + UNICODE_STRING BackSlash = { 0 }; + HANDLE DescKey = NULL, LinkageKey = NULL; + NTSTATUS Status; - NewStringLength = RegistryPath->MaximumLength - - ((LastSlash - RegistryPath->Buffer) * sizeof(WCHAR)); + TI_DbgPrint(DEBUG_DATALINK,("EnumKeyName %wZ\n", EnumKeyName)); - TargetString->Buffer = - (PWCHAR)exAllocatePool( NonPagedPool, NewStringLength ); + RtlInitUnicodeString(&BackSlash, L"\\"); + RtlInitUnicodeString(&Linkage, L"\\Linkage"); - if( !TargetString->Buffer ) { - TargetString->Length = TargetString->MaximumLength = 0; - return; + RtlInitUnicodeString(&DescKeyName, L""); + AppendUnicodeString( &DescKeyName, EnumKeyName, FALSE ); + AppendUnicodeString( &DescKeyName, &BackSlash, TRUE ); + AppendUnicodeString( &DescKeyName, TargetKeyName, TRUE ); + + RtlInitUnicodeString(&LinkageKeyName, L""); + AppendUnicodeString( &LinkageKeyName, &DescKeyName, FALSE ); + AppendUnicodeString( &LinkageKeyName, &Linkage, TRUE ); + + Status = OpenRegistryKey( &LinkageKeyName, &LinkageKey ); + if( !NT_SUCCESS(Status) ) goto cleanup; + + Status = ReadStringFromRegistry( LinkageKey, L"RootDevice", &RootDevice ); + if( !NT_SUCCESS(Status) ) goto cleanup; + + if( RtlCompareUnicodeString( &RootDevice, ShortName, TRUE ) == 0 ) { + Status = OpenRegistryKey( &DescKeyName, &DescKey ); + if( !NT_SUCCESS(Status) ) goto cleanup; + + Status = ReadStringFromRegistry( DescKey, L"DriverDesc", OutName ); + if( !NT_SUCCESS(Status) ) goto cleanup; + + TI_DbgPrint(DEBUG_DATALINK,("ADAPTER NAME: %wZ\n", OutName)); + } else Status = STATUS_UNSUCCESSFUL; + +cleanup: + RtlFreeUnicodeString( &RootDevice ); + RtlFreeUnicodeString( &LinkageKeyName ); + RtlFreeUnicodeString( &DescKeyName ); + if( LinkageKey ) NtClose( LinkageKey ); + if( DescKey ) NtClose( DescKey ); + + TI_DbgPrint(DEBUG_DATALINK,("Returning %x\n", Status)); + + return Status; +} + +static NTSTATUS FindDeviceNameForAdapter( PUNICODE_STRING ShortName, + PUNICODE_STRING OutName ) { + UNICODE_STRING EnumKeyName, TargetKeyName; + HANDLE EnumKey; + NTSTATUS Status; + ULONG i; + KEY_BASIC_INFORMATION *Kbio = + ExAllocatePool(NonPagedPool, sizeof(KEY_BASIC_INFORMATION)); + ULONG KbioLength = sizeof(KEY_BASIC_INFORMATION), ResultLength; + + RtlInitUnicodeString + (&EnumKeyName, CCS_ROOT L"\\Control\\Class\\" TCPIP_GUID); + + Status = OpenRegistryKey( &EnumKeyName, &EnumKey ); + + if( !NT_SUCCESS(Status) ) + TI_DbgPrint(DEBUG_DATALINK,("Couldn't open Enum key %wZ: %x\n", + &EnumKeyName, Status)); + + for( i = 0; NT_SUCCESS(Status); i++ ) { + Status = ZwEnumerateKey( EnumKey, i, KeyBasicInformation, + Kbio, KbioLength, &ResultLength ); + + if( Status == STATUS_BUFFER_TOO_SMALL ) { + ExFreePool( Kbio ); + KbioLength = ResultLength; + Kbio = ExAllocatePool( NonPagedPool, KbioLength ); + + Status = ZwEnumerateKey( EnumKey, i, KeyBasicInformation, + Kbio, KbioLength, &ResultLength ); + + TI_DbgPrint(DEBUG_DATALINK,("Couldn't enum key child %d\n", i)); + return Status; + } + + if( NT_SUCCESS(Status) ) { + TargetKeyName.Length = TargetKeyName.MaximumLength = + Kbio->NameLength; + TargetKeyName.Buffer = Kbio->Name; + + Status = CheckForDeviceDesc + ( &EnumKeyName, &TargetKeyName, ShortName, OutName ); + if( NT_SUCCESS(Status) ) { + NtClose( EnumKey ); + return Status; + } else Status = STATUS_SUCCESS; + } } - TargetString->Length = TargetString->MaximumLength = NewStringLength; - RtlCopyMemory( TargetString->Buffer, LastSlash, NewStringLength ); + RtlInitUnicodeString( OutName, L"" ); + AppendUnicodeString( OutName, &TargetKeyName, FALSE ); + NtClose( EnumKey ); + return STATUS_UNSUCCESSFUL; +} + +VOID GetShortName( PUNICODE_STRING RegistryKey, + PUNICODE_STRING ShortNameOut ) { + PWCHAR Ptr; + ShortNameOut->Buffer = + RegistryKey->Buffer + wcslen(CCS_ROOT L"\\Services\\"); + Ptr = ShortNameOut->Buffer; + + while( *Ptr != L'\\' && + ((PCHAR)Ptr) < ((PCHAR)RegistryKey->Buffer) + RegistryKey->Length ) + Ptr++; + + ShortNameOut->Length = ShortNameOut->MaximumLength = + (Ptr - ShortNameOut->Buffer) * sizeof(WCHAR); } VOID BindAdapter( @@ -869,22 +952,25 @@ VOID BindAdapter( PIP_INTERFACE IF; NDIS_STATUS NdisStatus; LLIP_BIND_INFO BindInfo; - IP_ADDRESS DefaultGateway, DefaultMask = { 0 }; + IP_ADDRESS DefaultMask = { 0 }; ULONG Lookahead = LOOKAHEAD_SIZE; NTSTATUS Status; HANDLE RegHandle = 0; + UNICODE_STRING ShortName; TI_DbgPrint(DEBUG_DATALINK, ("Called.\n")); Adapter->State = LAN_STATE_OPENING; + GetShortName( RegistryPath, &ShortName ); + NdisStatus = NDISCall(Adapter, NdisRequestSetInformation, OID_GEN_CURRENT_LOOKAHEAD, &Lookahead, sizeof(ULONG)); if (NdisStatus != NDIS_STATUS_SUCCESS) { - TI_DbgPrint(MID_TRACE, ("Could not set lookahead buffer size (0x%X).\n", NdisStatus)); + TI_DbgPrint(DEBUG_DATALINK, ("Could not set lookahead buffer size (0x%X).\n", NdisStatus)); return; } @@ -915,77 +1001,22 @@ VOID BindAdapter( Status = OpenRegistryKey( RegistryPath, &RegHandle ); - if(NT_SUCCESS(Status)) - Status = ReadIPAddressFromRegistry( RegHandle, L"DefaultGateway", - &DefaultGateway ); - if(!NT_SUCCESS(Status)) { - Status = STATUS_SUCCESS; - RtlZeroMemory( &DefaultGateway, sizeof(DefaultGateway) ); + if(NT_SUCCESS(Status)) { + Status = FindDeviceNameForAdapter( &ShortName, &IF->Name ); + TI_DbgPrint(DEBUG_DATALINK,("Adapter Name: %wZ\n", &IF->Name)); } - if(NT_SUCCESS(Status)) - Status = ReadIPAddressFromRegistry( RegHandle, L"IPAddress", - &IF->Unicast ); - if(NT_SUCCESS(Status)) - Status = ReadIPAddressFromRegistry( RegHandle, L"SubnetMask", - &IF->Netmask ); + DefaultMask.Type = IP_ADDRESS_V4; + + IF->Unicast = DefaultMask; + IF->Netmask = DefaultMask; IF->Broadcast.Type = IP_ADDRESS_V4; IF->Broadcast.Address.IPv4Address = IF->Unicast.Address.IPv4Address | ~IF->Netmask.Address.IPv4Address; - TI_DbgPrint(MID_TRACE,("BCAST(IF) %s\n", A2S(&IF->Broadcast))); - - if(NT_SUCCESS(Status)) { - RtlZeroMemory( &IF->Name, sizeof(IF->Name) ); - Status = ReadStringFromRegistry( RegHandle, L"DeviceDesc", - &IF->Name ); - - /* I think that not getting a devicedesc is not a fatal error */ - if( !NT_SUCCESS(Status) ) { - if( IF->Name.Buffer ) exFreePool( IF->Name.Buffer ); - GetSimpleAdapterNameFromRegistryPath( &IF->Name, RegistryPath ); - } - Status = STATUS_SUCCESS; - } - - TI_DbgPrint(MID_TRACE,("Adapter Name: %wZ\n", &IF->Name)); - - if(!NT_SUCCESS(Status)) - { - TI_DbgPrint(MIN_TRACE, ("Unable to open protocol-specific registry key: 0x%x\n", Status)); - - /* XXX how do we proceed? No ip address, no parameters... do we guess? */ - if(RegHandle) - ZwClose(RegHandle); - IPDestroyInterface(IF); - return; - } - - TI_DbgPrint - (MID_TRACE, - ("--> Our IP address on this interface: '%s'\n", - A2S(&IF->Unicast))); - - TI_DbgPrint - (MID_TRACE, - ("--> Our net mask on this interface: '%s'\n", - A2S(&IF->Netmask))); - - if( DefaultGateway.Address.IPv4Address ) { - TI_DbgPrint - (MID_TRACE, - ("--> Our gateway is: '%s'\n", - A2S(&DefaultGateway))); - - /* Create a default route */ - RouterCreateRoute( &DefaultMask, /* Zero */ - &DefaultMask, /* Zero */ - &DefaultGateway, - IF, - 1 ); - } + TI_DbgPrint(DEBUG_DATALINK,("BCAST(IF) %s\n", A2S(&IF->Broadcast))); /* Get maximum link speed */ NdisStatus = NDISCall(Adapter, @@ -1008,7 +1039,7 @@ VOID BindAdapter( sizeof(UINT)); if (NdisStatus != NDIS_STATUS_SUCCESS) { - TI_DbgPrint(MID_TRACE, ("Could not set packet filter (0x%X).\n", NdisStatus)); + TI_DbgPrint(DEBUG_DATALINK, ("Could not set packet filter (0x%X).\n", NdisStatus)); IPDestroyInterface(IF); return; } @@ -1232,10 +1263,10 @@ NDIS_STATUS LANUnregisterAdapter( NdisCloseAdapter(&NdisStatus, NdisHandle); if (NdisStatus == NDIS_STATUS_PENDING) { TcpipWaitForSingleObject(&Adapter->Event, - UserRequest, - KernelMode, - FALSE, - NULL); + UserRequest, + KernelMode, + FALSE, + NULL); NdisStatus = Adapter->NdisStatus; } } else @@ -1284,16 +1315,16 @@ NTSTATUS LANRegisterProtocol( ProtChars.StatusCompleteHandler = ProtocolStatusComplete; ProtChars.BindAdapterHandler = ProtocolBindAdapter; - /* Try to register protocol */ + /* Try to register protocol */ NdisRegisterProtocol(&NdisStatus, &NdisProtocolHandle, &ProtChars, sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); if (NdisStatus != NDIS_STATUS_SUCCESS) - { - TI_DbgPrint(MID_TRACE, ("NdisRegisterProtocol failed, status 0x%x\n", NdisStatus)); + { + TI_DbgPrint(DEBUG_DATALINK, ("NdisRegisterProtocol failed, status 0x%x\n", NdisStatus)); return (NTSTATUS)NdisStatus; - } + } ProtocolRegistered = TRUE; @@ -1323,7 +1354,7 @@ VOID LANUnregisterProtocol( CurrentEntry = AdapterListHead.Flink; while (CurrentEntry != &AdapterListHead) { NextEntry = CurrentEntry->Flink; - Current = CONTAINING_RECORD(CurrentEntry, LAN_ADAPTER, ListEntry); + Current = CONTAINING_RECORD(CurrentEntry, LAN_ADAPTER, ListEntry); /* Unregister it */ LANUnregisterAdapter(Current); CurrentEntry = NextEntry; diff --git a/reactos/drivers/net/tcpip/include/debug.h b/reactos/drivers/net/tcpip/include/debug.h index 95f649cf380..8b8419cdfca 100644 --- a/reactos/drivers/net/tcpip/include/debug.h +++ b/reactos/drivers/net/tcpip/include/debug.h @@ -32,6 +32,7 @@ #define DEBUG_NCACHE 0x00400000 #define DEBUG_CPOINT 0x00800000 #define DEBUG_LOCK 0x01000000 +#define DEBUG_INFO 0x02000000 #define DEBUG_ULTRA 0xFFFFFFFF #ifdef DBG diff --git a/reactos/drivers/net/tcpip/include/info.h b/reactos/drivers/net/tcpip/include/info.h index cc27ac1d69e..61d57447c75 100644 --- a/reactos/drivers/net/tcpip/include/info.h +++ b/reactos/drivers/net/tcpip/include/info.h @@ -74,11 +74,13 @@ typedef struct IFENTRY { ULONG LastChange; ULONG InOctets; ULONG InUcastPackets; + ULONG InNUcastPackets; ULONG InDiscards; ULONG InErrors; ULONG InUnknownProtos; ULONG OutOctets; ULONG OutUcastPackets; + ULONG OutNUcastPackets; ULONG OutDiscards; ULONG OutErrors; ULONG OutQLen; diff --git a/reactos/drivers/net/tcpip/include/ip.h b/reactos/drivers/net/tcpip/include/ip.h index 68950cebcee..98c8f39b483 100644 --- a/reactos/drivers/net/tcpip/include/ip.h +++ b/reactos/drivers/net/tcpip/include/ip.h @@ -207,6 +207,12 @@ PIP_PACKET IPInitializePacket( PIP_INTERFACE IPCreateInterface( PLLIP_BIND_INFO BindInfo); +VOID IPAddInterfaceRoute( + PIP_INTERFACE IF); + +VOID IPRemoveInterfaceRoute( + PIP_INTERFACE IF); + VOID IPDestroyInterface( PIP_INTERFACE IF); diff --git a/reactos/drivers/net/tcpip/include/tcp.h b/reactos/drivers/net/tcpip/include/tcp.h index 8279db48685..14914bc4f5b 100644 --- a/reactos/drivers/net/tcpip/include/tcp.h +++ b/reactos/drivers/net/tcpip/include/tcp.h @@ -156,6 +156,8 @@ NTSTATUS TCPClose( PCONNECTION_ENDPOINT Connection ); PVOID TCPPrepareInterface( PIP_INTERFACE IF ); +VOID TCPDisposeInterfaceData( PVOID Data ); + NTSTATUS TCPTranslateError( int OskitError ); VOID TCPTimeout(); diff --git a/reactos/drivers/net/tcpip/include/tcpip.h b/reactos/drivers/net/tcpip/include/tcpip.h index b40f568132c..c6c8a380267 100644 --- a/reactos/drivers/net/tcpip/include/tcpip.h +++ b/reactos/drivers/net/tcpip/include/tcpip.h @@ -30,6 +30,7 @@ #include +#define TAG_STRING TAG('S', 'T', 'R', ' ') /* string */ /* Define _NTTEST_ to make test version. Device names are prefixed with 'NT' to allow the driver to run side by side with MS TCP/IP driver */ diff --git a/reactos/drivers/net/tcpip/tcpip/dispatch.c b/reactos/drivers/net/tcpip/tcpip/dispatch.c index 0f25e9e41a5..efd261fa28e 100644 --- a/reactos/drivers/net/tcpip/tcpip/dispatch.c +++ b/reactos/drivers/net/tcpip/tcpip/dispatch.c @@ -1483,10 +1483,20 @@ NTSTATUS DispTdiSetIPAddress( PIRP Irp, PIO_STACK_LOCATION IrpSp ) { break; } if( IF->Index == IpAddrChange->NteIndex ) { + IPRemoveInterfaceRoute( IF ); + IF->Unicast.Type = IP_ADDRESS_V4; IF->Unicast.Address.IPv4Address = IpAddrChange->Address; IF->Netmask.Type = IP_ADDRESS_V4; IF->Netmask.Address.IPv4Address = IpAddrChange->Netmask; + + TI_DbgPrint(MID_TRACE,("New Unicast Address: %x\n", + IF->Unicast.Address.IPv4Address)); + TI_DbgPrint(MID_TRACE,("New Netmask : %x\n", + IF->Netmask.Address.IPv4Address)); + + IPAddInterfaceRoute( IF ); + IpAddrChange->Address = IF->Index; Status = STATUS_SUCCESS; Irp->IoStatus.Information = IF->Index; diff --git a/reactos/drivers/net/tcpip/tcpip/iinfo.c b/reactos/drivers/net/tcpip/tcpip/iinfo.c index 2c14402f29e..54225c563d6 100644 --- a/reactos/drivers/net/tcpip/tcpip/iinfo.c +++ b/reactos/drivers/net/tcpip/tcpip/iinfo.c @@ -21,7 +21,7 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID, ULONG Size; UINT DescrLenMax = MAX_IFDESCR_LEN - 1; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n", Interface, IF, ID->tei_entity, ID->tei_instance)); @@ -38,7 +38,7 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID, OutData->Type = Interface == Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET; OutData->Mtu = Interface->MTU; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Getting interface speed\n")); OutData->PhysAddrLen = Interface->AddressLength; OutData->AdminStatus = MIB_IF_ADMIN_STATUS_UP; @@ -53,27 +53,28 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID, if( IF ) { GetInterfaceSpeed( Interface, (PUINT)&OutData->Speed ); - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("IF Speed = %d * 100bps\n", OutData->Speed)); memcpy(OutData->PhysAddr,Interface->Address,Interface->AddressLength); - TI_DbgPrint(MAX_TRACE, ("Got HWAddr\n")); - GetInterfaceName( Interface, IFDescr, MAX_IFDESCR_LEN - 1 ); - DescrLenMax = strlen( IFDescr ) + 1; + TI_DbgPrint(DEBUG_INFO, ("Got HWAddr\n")); } - IFDescr[DescrLenMax] = 0; /* Terminate ifdescr string */ + GetInterfaceName( Interface, IFDescr, MAX_IFDESCR_LEN - 1 ); + DescrLenMax = strlen( IFDescr ) + 1; - TI_DbgPrint(MAX_TRACE, ("Copied in name %s\n", IFDescr)); + TI_DbgPrint(DEBUG_INFO, ("Copied in name %s\n", IFDescr)); OutData->DescrLen = DescrLenMax; IFDescr += DescrLenMax; Size = IFDescr - (PCHAR)OutData + 1; - TI_DbgPrint(MAX_TRACE, ("Finished IFEntry MIB (%04x:%d) size %d\n", + TI_DbgPrint(DEBUG_INFO, ("Finished IFEntry MIB (%04x:%d) size %d\n", ID->tei_entity, ID->tei_instance, Size)); Status = InfoCopyOut( (PCHAR)OutData, Size, Buffer, BufferSize ); ExFreePool( OutData ); + TI_DbgPrint(DEBUG_INFO,("Returning %x\n", Status)); + return Status; } @@ -104,7 +105,7 @@ TDI_STATUS InfoInterfaceTdiSetEx( UINT InfoClass, TDIEntityID *id, PCHAR Buffer, UINT BufferSize ) { - TI_DbgPrint(MAX_TRACE, ("Got Request: Class %x Type %x Id %x, EntityID %x:%x\n", + TI_DbgPrint(DEBUG_INFO, ("Got Request: Class %x Type %x Id %x, EntityID %x:%x\n", InfoClass, InfoId, id->tei_entity, id->tei_instance)); return TDI_INVALID_REQUEST; } diff --git a/reactos/drivers/net/tcpip/tcpip/info.c b/reactos/drivers/net/tcpip/tcpip/info.c index 42f042ee292..dd50c97334c 100644 --- a/reactos/drivers/net/tcpip/tcpip/info.c +++ b/reactos/drivers/net/tcpip/tcpip/info.c @@ -28,7 +28,7 @@ VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ) { KIRQL OldIrql; UINT Count = 0, i; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Inserting interface %08x (%d entities already)\n", Interface, EntityCount)); @@ -38,7 +38,7 @@ VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ) { for( i = 0; i < EntityCount; i++ ) if( EntityList[i].tei_entity == IF_ENTITY ) { Count++; - TI_DbgPrint(MAX_TRACE, ("Entity %d is an IF. Found %d\n", + TI_DbgPrint(DEBUG_INFO, ("Entity %d is an IF. Found %d\n", i, Count)); } @@ -80,7 +80,7 @@ TDI_STATUS InfoTdiQueryListEntities(PNDIS_BUFFER Buffer, UINT Count, Size, BufSize = *BufferSize; KIRQL OldIrql; - TI_DbgPrint(MAX_TRACE,("About to copy %d TDIEntityIDs to user\n", + TI_DbgPrint(DEBUG_INFO,("About to copy %d TDIEntityIDs to user\n", EntityCount)); TcpipAcquireSpinLock(&EntityListLock, &OldIrql); @@ -134,7 +134,7 @@ TDI_STATUS InfoTdiQueryInformationEx( BOOL FoundEntity = FALSE; InfoRequest_f InfoRequest = NULL; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("InfoEx Req: %x %x %x!%04x:%d\n", ID->toi_class, ID->toi_type, @@ -148,7 +148,7 @@ TDI_STATUS InfoTdiQueryInformationEx( if ((ID->toi_class != INFO_CLASS_GENERIC) || (ID->toi_type != INFO_TYPE_PROVIDER) || (ID->toi_id != ENTITY_LIST_ID)) { - TI_DbgPrint(MAX_TRACE,("Invalid parameter\n")); + TI_DbgPrint(DEBUG_INFO,("Invalid parameter\n")); Status = TDI_INVALID_PARAMETER; } else Status = InfoTdiQueryListEntities(Buffer, BufferSize); @@ -168,7 +168,7 @@ TDI_STATUS InfoTdiQueryInformationEx( TcpipReleaseSpinLock( &EntityListLock, OldIrql ); if( FoundEntity ) { - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Calling Entity %d (%04x:%d) InfoEx (%x,%x,%x)\n", i, ID->toi_entity.tei_entity, ID->toi_entity.tei_instance, @@ -183,7 +183,7 @@ TDI_STATUS InfoTdiQueryInformationEx( } } - TI_DbgPrint(MAX_TRACE,("Status: %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO,("Status: %08x\n", Status)); return Status; } diff --git a/reactos/drivers/net/tcpip/tcpip/main.c b/reactos/drivers/net/tcpip/tcpip/main.c index e98a7ad01b9..e20878ff456 100644 --- a/reactos/drivers/net/tcpip/tcpip/main.c +++ b/reactos/drivers/net/tcpip/tcpip/main.c @@ -9,7 +9,7 @@ */ #include "precomp.h" -//#define NDEBUG +#define NDEBUG #ifndef NDEBUG DWORD DebugTraceLevel = DEBUG_ULTRA & ~(DEBUG_LOCK | DEBUG_PBUFFER); diff --git a/reactos/drivers/net/tcpip/tcpip/ninfo.c b/reactos/drivers/net/tcpip/tcpip/ninfo.c index 85409b37694..ddc8c5df1e1 100644 --- a/reactos/drivers/net/tcpip/tcpip/ninfo.c +++ b/reactos/drivers/net/tcpip/tcpip/ninfo.c @@ -25,12 +25,12 @@ TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer, ExAllocatePool( NonPagedPool, sizeof( IPADDR_ENTRY ) * IfCount ); PIPADDR_ENTRY IpCurrent = IpAddress; - TI_DbgPrint(MAX_TRACE, ("Called.\n")); + TI_DbgPrint(DEBUG_INFO, ("Called.\n")); TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql); ForEachInterface(CurrentIF) { - IpCurrent->Index = Count; + IpCurrent->Index = CurrentIF->Index; IpCurrent->Addr = 0; IpCurrent->BcastAddr = 0; IpCurrent->Mask = 0; @@ -56,7 +56,7 @@ TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer, ExFreePool( IpAddress ); - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -73,7 +73,7 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) { PIPROUTE_ENTRY RouteEntries = ExAllocatePool( NonPagedPool, Size ), RtCurrent = RouteEntries; - TI_DbgPrint(MAX_TRACE, ("Called, routes = %d, RCache = %08x\n", + TI_DbgPrint(DEBUG_INFO, ("Called, routes = %d, RCache = %08x\n", RtCount, RCache)); if( !RCache || !RouteEntries ) { @@ -106,7 +106,7 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) { RtCurrent->Type = TDI_ADDRESS_TYPE_IP; TI_DbgPrint - (MAX_TRACE, + (DEBUG_INFO, ("%d: NA %08x NM %08x GW %08x MT %x\n", RtCurrent - RouteEntries, RtCurrent->Dest, @@ -132,7 +132,7 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) { ExFreePool( RouteEntries ); ExFreePool( RCache ); - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -144,7 +144,7 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( PNDIS_BUFFER Buffer, UINT RouteCount = CountFIBs( NULL ); TDI_STATUS Status = TDI_INVALID_REQUEST; - TI_DbgPrint(MAX_TRACE, ("Called.\n")); + TI_DbgPrint(DEBUG_INFO, ("Called.\n")); RtlZeroMemory(&SnmpInfo, sizeof(IPSNMP_INFO)); @@ -155,7 +155,7 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( PNDIS_BUFFER Buffer, Status = InfoCopyOut( (PCHAR)&SnmpInfo, sizeof(SnmpInfo), Buffer, BufferSize ); - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -169,7 +169,7 @@ TDI_STATUS InfoNetworkLayerTdiQueryEx( UINT InfoClass, PUINT BufferSize ) { TDI_STATUS Status = TDI_INVALID_REQUEST; - TI_DbgPrint(MAX_TRACE, ("Called.\n")); + TI_DbgPrint(DEBUG_INFO, ("Called.\n")); switch( InfoClass ) { case INFO_CLASS_GENERIC: @@ -200,7 +200,7 @@ TDI_STATUS InfoNetworkLayerTdiQueryEx( UINT InfoClass, } } - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -218,7 +218,7 @@ TDI_STATUS InfoNetworkLayerTdiSetEx( UINT InfoClass, IP_ADDRESS Router; PNEIGHBOR_CACHE_ENTRY NCE; - TI_DbgPrint(MID_TRACE,("Called\n")); + TI_DbgPrint(DEBUG_INFO,("Called\n")); OskitDumpBuffer( (OSK_PCHAR)Buffer, BufferSize ); @@ -232,7 +232,7 @@ TDI_STATUS InfoNetworkLayerTdiSetEx( UINT InfoClass, AddrInitIPv4( &Router, Route->Gw ); if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */ - TI_DbgPrint(MID_TRACE,("Adding route (%s)\n", A2S(&Address))); + TI_DbgPrint(DEBUG_INFO,("Adding route (%s)\n", A2S(&Address))); /* Find the existing route this belongs to */ NCE = RouterGetRoute( &Router ); /* Really add the route */ @@ -243,12 +243,12 @@ TDI_STATUS InfoNetworkLayerTdiSetEx( UINT InfoClass, else Status = STATUS_UNSUCCESSFUL; } else if( Route->Type == IP_ROUTE_TYPE_DEL ) { - TI_DbgPrint(MID_TRACE,("Removing route (%s)\n", A2S(&Address))); + TI_DbgPrint(DEBUG_INFO,("Removing route (%s)\n", A2S(&Address))); Status = RouterRemoveRoute( &Address, &Router ); } else Status = TDI_INVALID_REQUEST; } - TI_DbgPrint(MID_TRACE,("Returning %x\n", Status)); + TI_DbgPrint(DEBUG_INFO,("Returning %x\n", Status)); return Status; } diff --git a/reactos/drivers/storage/diskdump/diskdump.c b/reactos/drivers/storage/diskdump/diskdump.c index 927af75911f..29c578c764d 100644 --- a/reactos/drivers/storage/diskdump/diskdump.c +++ b/reactos/drivers/storage/diskdump/diskdump.c @@ -41,6 +41,7 @@ #undef VERSION #define VERSION "0.0.1" +#undef KeGetCurrentIrql /* PROTOTYPES ***************************************************************/ NTSTATUS STDCALL diff --git a/reactos/drivers/storage/floppy/GNUmakefile b/reactos/drivers/storage/floppy/GNUmakefile index e0e702133ce..87f3ce55c40 100644 --- a/reactos/drivers/storage/floppy/GNUmakefile +++ b/reactos/drivers/storage/floppy/GNUmakefile @@ -30,6 +30,8 @@ TARGET_CFLAGS = -Wall -Werror TARGET_OBJECTS = floppy.o csqrtns.o hardware.o readwrite.o ioctl.o TARGET_DDKLIBS = csq.a +DEP_OBJECTS = $(TARGET_OBJECTS) + include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk - +include $(TOOLS_PATH)/depend.mk diff --git a/reactos/drivers/storage/floppy/hardware.c b/reactos/drivers/storage/floppy/hardware.c index ec340e99b83..e7421d164a2 100644 --- a/reactos/drivers/storage/floppy/hardware.c +++ b/reactos/drivers/storage/floppy/hardware.c @@ -991,7 +991,7 @@ NTSTATUS NTAPI HwSpecify(PCONTROLLER_INFO ControllerInfo, Buffer[1] = (StepRateTime << 4) + HeadUnloadTime; Buffer[2] = (HeadLoadTime << 1) + (NonDma ? 1 : 0); */ - Buffer[1] = 0xd1; + Buffer[1] = 0xdf; Buffer[2] = 0x2; //KdPrint(("HwSpecify: sending 0x%x 0x%x 0x%x to FIFO\n", Buffer[0], Buffer[1], Buffer[2])); diff --git a/reactos/drivers/storage/floppy/readwrite.c b/reactos/drivers/storage/floppy/readwrite.c index c703b23cd1b..5cea9bbb325 100644 --- a/reactos/drivers/storage/floppy/readwrite.c +++ b/reactos/drivers/storage/floppy/readwrite.c @@ -430,6 +430,7 @@ VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, NTSTATUS Status; BOOLEAN DiskChanged; ULONG_PTR TransferByteOffset; + UCHAR Gap; PAGED_CODE(); @@ -522,6 +523,15 @@ VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, WriteToDevice = TRUE; } + /* + * FIXME: + * FloppyDeviceData.ReadWriteGapLength specify the value for the physical drive. + * We should set this value depend on the format of the inserted disk and possible + * depend on the request (read or write). A value of 0 results in one rotation + * between the sectors (7.2sec for reading a track). + */ + Gap = DriveInfo->FloppyDeviceData.ReadWriteGapLength; + /* * Set up DMA transfer * @@ -703,7 +713,7 @@ VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, /* Issue the read/write command to the controller. Note that it expects the opposite of WriteToDevice. */ if(HwReadWriteData(DriveInfo->ControllerInfo, !WriteToDevice, DriveInfo->UnitNumber, Cylinder, Head, StartSector, - DriveInfo->BytesPerSectorCode, DriveInfo->DiskGeometry.SectorsPerTrack, 0, 0xff) != STATUS_SUCCESS) + DriveInfo->BytesPerSectorCode, DriveInfo->DiskGeometry.SectorsPerTrack, Gap, 0xff) != STATUS_SUCCESS) { KdPrint(("floppy: ReadWritePassive(): HwReadWriteData returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n")); RWFreeAdapterChannel(DriveInfo->ControllerInfo->AdapterObject); diff --git a/reactos/drivers/storage/scsiport/scsiport.c b/reactos/drivers/storage/scsiport/scsiport.c index 9ee1cc17361..331f96650ac 100644 --- a/reactos/drivers/storage/scsiport/scsiport.c +++ b/reactos/drivers/storage/scsiport/scsiport.c @@ -2146,7 +2146,7 @@ SpiGetInquiryData(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, UnitInfo = (PSCSI_INQUIRY_DATA) ((PUCHAR)AdapterBusInfo + sizeof(SCSI_ADAPTER_BUS_INFO) + (sizeof(SCSI_BUS_DATA) * (AdapterBusInfo->NumberOfBuses - 1))); - + for (Bus = 0; Bus < AdapterBusInfo->NumberOfBuses; Bus++) { AdapterBusInfo->BusData[Bus].InitiatorBusId = @@ -2169,7 +2169,7 @@ SpiGetInquiryData(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, { DPRINT("(Bus %lu Target %lu Lun %lu)\n", Bus, Target, Lun); - + RtlZeroMemory(UnitInfo, sizeof(*UnitInfo)); UnitInfo->PathId = Bus; UnitInfo->TargetId = Target; UnitInfo->Lun = Lun; diff --git a/reactos/drivers/usb/cromwell/Makefile b/reactos/drivers/usb/cromwell/Makefile index b38e31bc053..1f124735144 100644 --- a/reactos/drivers/usb/cromwell/Makefile +++ b/reactos/drivers/usb/cromwell/Makefile @@ -6,7 +6,7 @@ PATH_TO_TOP = ../../.. include $(PATH_TO_TOP)/rules.mak -DRIVERS = core host +DRIVERS = core host uhci all: $(DRIVERS) diff --git a/reactos/drivers/usb/cromwell/core/usb.c b/reactos/drivers/usb/cromwell/core/usb.c index be494fb39a4..a7726177e56 100644 --- a/reactos/drivers/usb/cromwell/core/usb.c +++ b/reactos/drivers/usb/cromwell/core/usb.c @@ -688,7 +688,7 @@ struct usb_device STDCALL *usb_alloc_dev(struct usb_device *parent, struct usb_b * * A pointer to the device with the incremented reference counter is returned. */ -struct usb_device *usb_get_dev (struct usb_device *dev) +struct usb_device STDCALL *usb_get_dev (struct usb_device *dev) { struct device *tmp; diff --git a/reactos/drivers/usb/cromwell/core/usbcore.def b/reactos/drivers/usb/cromwell/core/usbcore.def index ae73cc2a560..25446cd4fff 100644 --- a/reactos/drivers/usb/cromwell/core/usbcore.def +++ b/reactos/drivers/usb/cromwell/core/usbcore.def @@ -8,6 +8,7 @@ usb_init_urb@4 usb_alloc_urb@8 usb_free_urb@4 usb_get_urb@4 +usb_get_dev@4 usb_submit_urb@8 usb_unlink_urb@4 usb_bus_init@4 diff --git a/reactos/drivers/usb/cromwell/linux/linux_wrapper.h b/reactos/drivers/usb/cromwell/linux/linux_wrapper.h index 3de8596de67..382f186d60f 100644 --- a/reactos/drivers/usb/cromwell/linux/linux_wrapper.h +++ b/reactos/drivers/usb/cromwell/linux/linux_wrapper.h @@ -443,6 +443,8 @@ int my_pci_module_init(struct pci_driver *x); #define pci_unregister_driver(a) do {} while(0) +#define pci_write_config_word(a,b,c) my_pci_write_config_word(a,b,c) + #define bus_register(a) do {} while(0) #define bus_unregister(a) do {} while(0) @@ -540,7 +542,7 @@ kmem_cache_t *my_kmem_cache_create(const char *tag, size_t alloc_size, void *ctor, void *dtor); -void my_kmem_cache_destroy(kmem_cache_t *co); +BOOLEAN my_kmem_cache_destroy(kmem_cache_t *co); void *my_kmem_cache_alloc(kmem_cache_t *co, int flags); void my_kmem_cache_free(kmem_cache_t *co, void *ptr); diff --git a/reactos/drivers/usb/cromwell/linux/pci_ids.h b/reactos/drivers/usb/cromwell/linux/pci_ids.h index 77a15698745..5d0f0185c54 100644 --- a/reactos/drivers/usb/cromwell/linux/pci_ids.h +++ b/reactos/drivers/usb/cromwell/linux/pci_ids.h @@ -2,12 +2,14 @@ #define PCI_IDS__H #define PCI_VENDOR_ID_NS 0x100b -#define PCI_DEVICE_ID_NS_87560_LIO 0x000e #define PCI_VENDOR_ID_AMD 0x1022 #define PCI_VENDOR_ID_OPTI 0x1045 #define PCI_VENDOR_ID_VIA 0x1106 #define PCI_VENDOR_ID_INTEL 0x8086 +#define PCI_DEVICE_ID_NS_87560_LIO 0x000e +#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 + #define PCI_CLASS_SERIAL_USB (PCI_CLASS_SERIAL_BUS_CTLR << 8 + PCI_SUBCLASS_SB_USB) #endif diff --git a/reactos/drivers/usb/cromwell/linux/usb.h b/reactos/drivers/usb/cromwell/linux/usb.h index 530d7ad1f7b..0e3d67ff5a3 100644 --- a/reactos/drivers/usb/cromwell/linux/usb.h +++ b/reactos/drivers/usb/cromwell/linux/usb.h @@ -272,7 +272,7 @@ struct usb_device { #define to_usb_device(d) container_of(d, struct usb_device, dev) extern struct usb_device STDCALL *usb_alloc_dev(struct usb_device *parent, struct usb_bus *); -extern struct usb_device *usb_get_dev(struct usb_device *dev); +extern struct usb_device STDCALL *usb_get_dev(struct usb_device *dev); extern void STDCALL usb_put_dev(struct usb_device *dev); /* mostly for devices emulating SCSI over USB */ diff --git a/reactos/drivers/usb/cromwell/sys/linuxwrapper.c b/reactos/drivers/usb/cromwell/sys/linuxwrapper.c index 39791eaf2d2..616cbd79a74 100644 --- a/reactos/drivers/usb/cromwell/sys/linuxwrapper.c +++ b/reactos/drivers/usb/cromwell/sys/linuxwrapper.c @@ -290,6 +290,16 @@ struct pci_dev *my_pci_find_slot(int a,int b) return NULL; } /*------------------------------------------------------------------------*/ +int my_pci_write_config_word(struct pci_dev *dev, int where, u16 val) +{ + //dev->bus, dev->devfn, where, val + OHCI_DEVICE_EXTENSION *dev_ext = (OHCI_DEVICE_EXTENSION *)dev->dev_ext; + + //FIXME: Is returning this value correct? + //FIXME: Mixing pci_dev and win structs isn't a good thing at all + return HalSetBusDataByOffset(PCIConfiguration, dev->bus->number, dev_ext->SystemIoSlotNumber, &val, where, sizeof(val)); +} +/*------------------------------------------------------------------------*/ int my_request_irq(unsigned int irq, int (*handler)(int,void *, struct pt_regs *), unsigned long mode, const char *desc, void *data) @@ -337,11 +347,12 @@ kmem_cache_t *my_kmem_cache_create(const char *tag, size_t alloc_size, return (kmem_cache_t *)Lookaside; } /*------------------------------------------------------------------------*/ -void my_kmem_cache_destroy(kmem_cache_t *co) +BOOLEAN my_kmem_cache_destroy(kmem_cache_t *co) { ExDeleteNPagedLookasideList((PNPAGED_LOOKASIDE_LIST)co); - ExFreePool(co); + ExFreePool(co); + return FALSE; } /*------------------------------------------------------------------------*/ void *my_kmem_cache_alloc(kmem_cache_t *co, int flags) diff --git a/reactos/drivers/usb/cromwell/uhci/makefile b/reactos/drivers/usb/cromwell/uhci/makefile new file mode 100644 index 00000000000..b1170524da6 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/makefile @@ -0,0 +1,16 @@ +PATH_TO_TOP = ../../../.. + +TARGET_TYPE = export_driver + +TARGET_NAME = uhci + +TARGET_DDKLIBS = ntoskrnl.a usbcore.a + +TARGET_CFLAGS = -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -DDEBUG_MODE + +TARGET_OBJECTS = \ + uhci-hcd.o uhci_main.o ../sys/ros_wrapper.o ../sys/linuxwrapper.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/usb/cromwell/uhci/uhci-debug.c b/reactos/drivers/usb/cromwell/uhci/uhci-debug.c new file mode 100644 index 00000000000..c2577597608 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci-debug.c @@ -0,0 +1,616 @@ +/* + * UHCI-specific debugging code. Invaluable when something + * goes wrong, but don't get in my face. + * + * Kernel visible pointers are surrounded in []'s and bus + * visible pointers are surrounded in ()'s + * + * (C) Copyright 1999 Linus Torvalds + * (C) Copyright 1999-2001 Johannes Erdfelt + */ + +#if 0 +#include +#include +#include +#include +#include +#endif + +#include "uhci-hcd.h" + +/* Handle REALLY large printk's so we don't overflow buffers */ +static inline void lprintk(char *buf) +{ + char *p; + + /* Just write one line at a time */ + while (buf) { + p = strchr(buf, '\n'); + if (p) + *p = 0; + printk(KERN_DEBUG "%s\n", buf); + buf = p; + if (buf) + buf++; + } +} + +static inline int uhci_is_skeleton_qh(struct uhci_hcd *uhci, struct uhci_qh *qh) +{ + int i; + + for (i = 0; i < UHCI_NUM_SKELQH; i++) + if (qh == uhci->skelqh[i]) + return 1; + + return 0; +} + +static int uhci_show_td(struct uhci_td *td, char *buf, int len, int space) +{ + char *out = buf; + char *spid; + u32 status, token; + + /* Try to make sure there's enough memory */ + if (len < 160) + return 0; + + status = td_status(td); + out += sprintf(out, "%*s[%p] link (%08x) ", space, "", td, le32_to_cpu(td->link)); + out += sprintf(out, "e%d %s%s%s%s%s%s%s%s%s%sLength=%x ", + ((status >> 27) & 3), + (status & TD_CTRL_SPD) ? "SPD " : "", + (status & TD_CTRL_LS) ? "LS " : "", + (status & TD_CTRL_IOC) ? "IOC " : "", + (status & TD_CTRL_ACTIVE) ? "Active " : "", + (status & TD_CTRL_STALLED) ? "Stalled " : "", + (status & TD_CTRL_DBUFERR) ? "DataBufErr " : "", + (status & TD_CTRL_BABBLE) ? "Babble " : "", + (status & TD_CTRL_NAK) ? "NAK " : "", + (status & TD_CTRL_CRCTIMEO) ? "CRC/Timeo " : "", + (status & TD_CTRL_BITSTUFF) ? "BitStuff " : "", + status & 0x7ff); + + token = td_token(td); + switch (uhci_packetid(token)) { + case USB_PID_SETUP: + spid = "SETUP"; + break; + case USB_PID_OUT: + spid = "OUT"; + break; + case USB_PID_IN: + spid = "IN"; + break; + default: + spid = "?"; + break; + } + + out += sprintf(out, "MaxLen=%x DT%d EndPt=%x Dev=%x, PID=%x(%s) ", + token >> 21, + ((token >> 19) & 1), + (token >> 15) & 15, + (token >> 8) & 127, + (token & 0xff), + spid); + out += sprintf(out, "(buf=%08x)\n", le32_to_cpu(td->buffer)); + + return out - buf; +} + +static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) +{ + char *out = buf; + struct urb_priv *urbp; + struct list_head *head, *tmp; + struct uhci_td *td; + int i = 0, checked = 0, prevactive = 0; + + /* Try to make sure there's enough memory */ + if (len < 80 * 6) + return 0; + + out += sprintf(out, "%*s[%p] link (%08x) element (%08x)\n", space, "", + qh, le32_to_cpu(qh->link), le32_to_cpu(qh->element)); + + if (qh->element & UHCI_PTR_QH) + out += sprintf(out, "%*s Element points to QH (bug?)\n", space, ""); + + if (qh->element & UHCI_PTR_DEPTH) + out += sprintf(out, "%*s Depth traverse\n", space, ""); + + if (qh->element & cpu_to_le32(8)) + out += sprintf(out, "%*s Bit 3 set (bug?)\n", space, ""); + + if (!(qh->element & ~(UHCI_PTR_QH | UHCI_PTR_DEPTH))) + out += sprintf(out, "%*s Element is NULL (bug?)\n", space, ""); + + if (!qh->urbp) { + out += sprintf(out, "%*s urbp == NULL\n", space, ""); + goto out; + } + + urbp = qh->urbp; + + head = &urbp->td_list; + tmp = head->next; + + td = list_entry(tmp, struct uhci_td, list); + + if (cpu_to_le32(td->dma_handle) != (qh->element & ~UHCI_PTR_BITS)) + out += sprintf(out, "%*s Element != First TD\n", space, ""); + + while (tmp != head) { + struct uhci_td *td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + out += sprintf(out, "%*s%d: ", space + 2, "", i++); + out += uhci_show_td(td, out, len - (out - buf), 0); + + if (i > 10 && !checked && prevactive && tmp != head && + debug <= 2) { + struct list_head *ntmp = tmp; + struct uhci_td *ntd = td; + int active = 1, ni = i; + + checked = 1; + + while (ntmp != head && ntmp->next != head && active) { + ntd = list_entry(ntmp, struct uhci_td, list); + + ntmp = ntmp->next; + + active = td_status(ntd) & TD_CTRL_ACTIVE; + + ni++; + } + + if (active && ni > i) { + out += sprintf(out, "%*s[skipped %d active TD's]\n", space, "", ni - i); + tmp = ntmp; + td = ntd; + i = ni; + } + } + + prevactive = td_status(td) & TD_CTRL_ACTIVE; + } + + if (list_empty(&urbp->queue_list) || urbp->queued) + goto out; + + out += sprintf(out, "%*sQueued QH's:\n", -space, "--"); + + head = &urbp->queue_list; + tmp = head->next; + + while (tmp != head) { + struct urb_priv *nurbp = list_entry(tmp, struct urb_priv, + queue_list); + tmp = tmp->next; + + out += uhci_show_qh(nurbp->qh, out, len - (out - buf), space); + } + +out: + return out - buf; +} + +#define show_frame_num() \ + if (!shown) { \ + shown = 1; \ + out += sprintf(out, "- Frame %d\n", i); \ + } + +#ifdef CONFIG_PROC_FS +static const char *qh_names[] = { + "skel_int128_qh", "skel_int64_qh", + "skel_int32_qh", "skel_int16_qh", + "skel_int8_qh", "skel_int4_qh", + "skel_int2_qh", "skel_int1_qh", + "skel_ls_control_qh", "skel_fs_control_qh", + "skel_bulk_qh", "skel_term_qh" +}; + +#define show_qh_name() \ + if (!shown) { \ + shown = 1; \ + out += sprintf(out, "- %s\n", qh_names[i]); \ + } + +static int uhci_show_sc(int port, unsigned short status, char *buf, int len) +{ + char *out = buf; + + /* Try to make sure there's enough memory */ + if (len < 160) + return 0; + + out += sprintf(out, " stat%d = %04x %s%s%s%s%s%s%s%s%s%s\n", + port, + status, + (status & USBPORTSC_SUSP) ? " Suspend" : "", + (status & USBPORTSC_OCC) ? " OverCurrentChange" : "", + (status & USBPORTSC_OC) ? " OverCurrent" : "", + (status & USBPORTSC_PR) ? " Reset" : "", + (status & USBPORTSC_LSDA) ? " LowSpeed" : "", + (status & USBPORTSC_RD) ? " ResumeDetect" : "", + (status & USBPORTSC_PEC) ? " EnableChange" : "", + (status & USBPORTSC_PE) ? " Enabled" : "", + (status & USBPORTSC_CSC) ? " ConnectChange" : "", + (status & USBPORTSC_CCS) ? " Connected" : ""); + + return out - buf; +} + +static int uhci_show_status(struct uhci_hcd *uhci, char *buf, int len) +{ + char *out = buf; + unsigned int io_addr = uhci->io_addr; + unsigned short usbcmd, usbstat, usbint, usbfrnum; + unsigned int flbaseadd; + unsigned char sof; + unsigned short portsc1, portsc2; + + /* Try to make sure there's enough memory */ + if (len < 80 * 6) + return 0; + + usbcmd = inw(io_addr + 0); + usbstat = inw(io_addr + 2); + usbint = inw(io_addr + 4); + usbfrnum = inw(io_addr + 6); + flbaseadd = inl(io_addr + 8); + sof = inb(io_addr + 12); + portsc1 = inw(io_addr + 16); + portsc2 = inw(io_addr + 18); + + out += sprintf(out, " usbcmd = %04x %s%s%s%s%s%s%s%s\n", + usbcmd, + (usbcmd & USBCMD_MAXP) ? "Maxp64 " : "Maxp32 ", + (usbcmd & USBCMD_CF) ? "CF " : "", + (usbcmd & USBCMD_SWDBG) ? "SWDBG " : "", + (usbcmd & USBCMD_FGR) ? "FGR " : "", + (usbcmd & USBCMD_EGSM) ? "EGSM " : "", + (usbcmd & USBCMD_GRESET) ? "GRESET " : "", + (usbcmd & USBCMD_HCRESET) ? "HCRESET " : "", + (usbcmd & USBCMD_RS) ? "RS " : ""); + + out += sprintf(out, " usbstat = %04x %s%s%s%s%s%s\n", + usbstat, + (usbstat & USBSTS_HCH) ? "HCHalted " : "", + (usbstat & USBSTS_HCPE) ? "HostControllerProcessError " : "", + (usbstat & USBSTS_HSE) ? "HostSystemError " : "", + (usbstat & USBSTS_RD) ? "ResumeDetect " : "", + (usbstat & USBSTS_ERROR) ? "USBError " : "", + (usbstat & USBSTS_USBINT) ? "USBINT " : ""); + + out += sprintf(out, " usbint = %04x\n", usbint); + out += sprintf(out, " usbfrnum = (%d)%03x\n", (usbfrnum >> 10) & 1, + 0xfff & (4*(unsigned int)usbfrnum)); + out += sprintf(out, " flbaseadd = %08x\n", flbaseadd); + out += sprintf(out, " sof = %02x\n", sof); + out += uhci_show_sc(1, portsc1, out, len - (out - buf)); + out += uhci_show_sc(2, portsc2, out, len - (out - buf)); + + return out - buf; +} + +static int uhci_show_urbp(struct uhci_hcd *uhci, struct urb_priv *urbp, char *buf, int len) +{ + struct list_head *tmp; + char *out = buf; + int count = 0; + + if (len < 200) + return 0; + + out += sprintf(out, "urb_priv [%p] ", urbp); + out += sprintf(out, "urb [%p] ", urbp->urb); + out += sprintf(out, "qh [%p] ", urbp->qh); + out += sprintf(out, "Dev=%d ", usb_pipedevice(urbp->urb->pipe)); + out += sprintf(out, "EP=%x(%s) ", usb_pipeendpoint(urbp->urb->pipe), (usb_pipein(urbp->urb->pipe) ? "IN" : "OUT")); + + switch (usb_pipetype(urbp->urb->pipe)) { + case PIPE_ISOCHRONOUS: out += sprintf(out, "ISO "); break; + case PIPE_INTERRUPT: out += sprintf(out, "INT "); break; + case PIPE_BULK: out += sprintf(out, "BLK "); break; + case PIPE_CONTROL: out += sprintf(out, "CTL "); break; + } + + out += sprintf(out, "%s", (urbp->fsbr ? "FSBR " : "")); + out += sprintf(out, "%s", (urbp->fsbr_timeout ? "FSBR_TO " : "")); + + if (urbp->urb->status != -EINPROGRESS) + out += sprintf(out, "Status=%d ", urbp->urb->status); + //out += sprintf(out, "Inserttime=%lx ",urbp->inserttime); + //out += sprintf(out, "FSBRtime=%lx ",urbp->fsbrtime); + + count = 0; + list_for_each(tmp, &urbp->td_list) + count++; + out += sprintf(out, "TDs=%d ",count); + + if (urbp->queued) + out += sprintf(out, "queued\n"); + else { + count = 0; + list_for_each(tmp, &urbp->queue_list) + count++; + out += sprintf(out, "queued URBs=%d\n", count); + } + + return out - buf; +} + +static int uhci_show_lists(struct uhci_hcd *uhci, char *buf, int len) +{ + char *out = buf; + struct list_head *head, *tmp; + int count; + + out += sprintf(out, "Main list URBs:"); + if (list_empty(&uhci->urb_list)) + out += sprintf(out, " Empty\n"); + else { + out += sprintf(out, "\n"); + count = 0; + head = &uhci->urb_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *urbp = list_entry(tmp, struct urb_priv, urb_list); + + out += sprintf(out, " %d: ", ++count); + out += uhci_show_urbp(uhci, urbp, out, len - (out - buf)); + tmp = tmp->next; + } + } + + out += sprintf(out, "Remove list URBs:"); + if (list_empty(&uhci->urb_remove_list)) + out += sprintf(out, " Empty\n"); + else { + out += sprintf(out, "\n"); + count = 0; + head = &uhci->urb_remove_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *urbp = list_entry(tmp, struct urb_priv, urb_list); + + out += sprintf(out, " %d: ", ++count); + out += uhci_show_urbp(uhci, urbp, out, len - (out - buf)); + tmp = tmp->next; + } + } + + out += sprintf(out, "Complete list URBs:"); + if (list_empty(&uhci->complete_list)) + out += sprintf(out, " Empty\n"); + else { + out += sprintf(out, "\n"); + count = 0; + head = &uhci->complete_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *urbp = list_entry(tmp, struct urb_priv, urb_list); + + out += sprintf(out, " %d: ", ++count); + out += uhci_show_urbp(uhci, urbp, out, len - (out - buf)); + tmp = tmp->next; + } + } + + return out - buf; +} + +static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) +{ + unsigned long flags; + char *out = buf; + int i, j; + struct uhci_qh *qh; + struct uhci_td *td; + struct list_head *tmp, *head; + + spin_lock_irqsave(&uhci->schedule_lock, flags); + + out += sprintf(out, "HC status\n"); + out += uhci_show_status(uhci, out, len - (out - buf)); + + out += sprintf(out, "Frame List\n"); + for (i = 0; i < UHCI_NUMFRAMES; ++i) { + int shown = 0; + td = uhci->fl->frame_cpu[i]; + if (!td) + continue; + + if (td->dma_handle != (dma_addr_t)uhci->fl->frame[i]) { + show_frame_num(); + out += sprintf(out, " frame list does not match td->dma_handle!\n"); + } + show_frame_num(); + + head = &td->fl_list; + tmp = head; + do { + td = list_entry(tmp, struct uhci_td, fl_list); + tmp = tmp->next; + out += uhci_show_td(td, out, len - (out - buf), 4); + } while (tmp != head); + } + + out += sprintf(out, "Skeleton QH's\n"); + + for (i = 0; i < UHCI_NUM_SKELQH; ++i) { + int shown = 0; + + qh = uhci->skelqh[i]; + + if (debug > 1) { + show_qh_name(); + out += uhci_show_qh(qh, out, len - (out - buf), 4); + } + + /* Last QH is the Terminating QH, it's different */ + if (i == UHCI_NUM_SKELQH - 1) { + if (qh->link != UHCI_PTR_TERM) + out += sprintf(out, " bandwidth reclamation on!\n"); + + if (qh->element != cpu_to_le32(uhci->term_td->dma_handle)) + out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); + + continue; + } + + j = (i < 7) ? 7 : i+1; /* Next skeleton */ + if (list_empty(&qh->list)) { + if (i < UHCI_NUM_SKELQH - 1) { + if (qh->link != + (cpu_to_le32(uhci->skelqh[j]->dma_handle) | UHCI_PTR_QH)) { + show_qh_name(); + out += sprintf(out, " skeleton QH not linked to next skeleton QH!\n"); + } + } + + continue; + } + + show_qh_name(); + + head = &qh->list; + tmp = head->next; + + while (tmp != head) { + qh = list_entry(tmp, struct uhci_qh, list); + + tmp = tmp->next; + + out += uhci_show_qh(qh, out, len - (out - buf), 4); + } + + if (i < UHCI_NUM_SKELQH - 1) { + if (qh->link != + (cpu_to_le32(uhci->skelqh[j]->dma_handle) | UHCI_PTR_QH)) + out += sprintf(out, " last QH not linked to next skeleton!\n"); + } + } + + if (debug > 2) + out += uhci_show_lists(uhci, out, len - (out - buf)); + + spin_unlock_irqrestore(&uhci->schedule_lock, flags); + + return out - buf; +} + +#define MAX_OUTPUT (64 * 1024) + +static struct proc_dir_entry *uhci_proc_root = NULL; + +struct uhci_proc { + int size; + char *data; + struct uhci_hcd *uhci; +}; + +static int uhci_proc_open(struct inode *inode, struct file *file) +{ + const struct proc_dir_entry *dp = PDE(inode); + struct uhci_hcd *uhci = dp->data; + struct uhci_proc *up; + int ret = -ENOMEM; + + lock_kernel(); + up = kmalloc(sizeof(*up), GFP_KERNEL); + if (!up) + goto out; + + up->data = kmalloc(MAX_OUTPUT, GFP_KERNEL); + if (!up->data) { + kfree(up); + goto out; + } + + up->size = uhci_sprint_schedule(uhci, up->data, MAX_OUTPUT); + + file->private_data = up; + + ret = 0; +out: + unlock_kernel(); + return ret; +} + +static loff_t uhci_proc_lseek(struct file *file, loff_t off, int whence) +{ + struct uhci_proc *up; + loff_t new = -1; + + lock_kernel(); + up = file->private_data; + + switch (whence) { + case 0: + new = off; + break; + case 1: + new = file->f_pos + off; + break; + } + if (new < 0 || new > up->size) { + unlock_kernel(); + return -EINVAL; + } + unlock_kernel(); + return (file->f_pos = new); +} + +static ssize_t uhci_proc_read(struct file *file, char *buf, size_t nbytes, + loff_t *ppos) +{ + struct uhci_proc *up = file->private_data; + unsigned int pos; + unsigned int size; + + pos = *ppos; + size = up->size; + if (pos >= size) + return 0; + if (nbytes >= size) + nbytes = size; + if (pos + nbytes > size) + nbytes = size - pos; + + if (!access_ok(VERIFY_WRITE, buf, nbytes)) + return -EINVAL; + + if (copy_to_user(buf, up->data + pos, nbytes)) + return -EFAULT; + + *ppos += nbytes; + + return nbytes; +} + +static int uhci_proc_release(struct inode *inode, struct file *file) +{ + struct uhci_proc *up = file->private_data; + + kfree(up->data); + kfree(up); + + return 0; +} + +static struct file_operations uhci_proc_operations = { + .open = uhci_proc_open, + .llseek = uhci_proc_lseek, + .read = uhci_proc_read, +// write: uhci_proc_write, + .release = uhci_proc_release, +}; +#endif diff --git a/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c b/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c new file mode 100644 index 00000000000..6cc1599e4cf --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c @@ -0,0 +1,2617 @@ +/* + * Universal Host Controller Interface driver for USB. + * + * Maintainer: Johannes Erdfelt + * + * (C) Copyright 1999 Linus Torvalds + * (C) Copyright 1999-2002 Johannes Erdfelt, johannes@erdfelt.com + * (C) Copyright 1999 Randy Dunlap + * (C) Copyright 1999 Georg Acher, acher@in.tum.de + * (C) Copyright 1999 Deti Fliegl, deti@fliegl.de + * (C) Copyright 1999 Thomas Sailer, sailer@ife.ee.ethz.ch + * (C) Copyright 1999 Roman Weissgaerber, weissg@vienna.at + * (C) Copyright 2000 Yggdrasil Computing, Inc. (port of new PCI interface + * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com). + * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c) + * + * Intel documents this fairly well, and as far as I know there + * are no royalties or anything like that, but even so there are + * people who decided that they want to do the same thing in a + * completely different way. + * + * WARNING! The USB documentation is downright evil. Most of it + * is just crap, written by a committee. You're better off ignoring + * most of it, the important stuff is: + * - the low-level protocol (fairly simple but lots of small details) + * - working around the horridness of the rest + */ + +#if 0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_USB_DEBUG +#define DEBUG +#else +#undef DEBUG +#endif +#include + +#include +#include +#include +#include +#endif + +#include "uhci_config.h" +#include "../usb_wrapper.h" +#include "../core/hcd.h" +#include "uhci-hcd.h" + +#if 0 +#include +#endif + +/* + * Version Information + */ +#define DRIVER_VERSION "v2.1" +#define DRIVER_AUTHOR "Linus 'Frodo Rabbit' Torvalds, Johannes Erdfelt, Randy Dunlap, Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber" +#define DRIVER_DESC "USB Universal Host Controller Interface driver" + +/* + * debug = 0, no debugging messages + * debug = 1, dump failed URB's except for stalls + * debug = 2, dump all failed URB's (including stalls) + * show all queues in /proc/driver/uhci/[pci_addr] + * debug = 3, show all TD's in URB's when dumping + */ +#ifdef DEBUG +static int debug = 1; +#else +static int debug = 0; +#endif +MODULE_PARM(debug, "i"); +MODULE_PARM_DESC(debug, "Debug level"); +static char *errbuf; +#define ERRBUF_LEN (PAGE_SIZE * 8) + +#include "uhci-hub.c" +#include "uhci-debug.c" + +static kmem_cache_t *uhci_up_cachep; /* urb_priv */ + +static int uhci_get_current_frame_number(struct uhci_hcd *uhci); +static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb); +static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb); + +static void hc_state_transitions(struct uhci_hcd *uhci); + +/* If a transfer is still active after this much time, turn off FSBR */ +#define IDLE_TIMEOUT (HZ / 20) /* 50 ms */ +#define FSBR_DELAY (HZ / 20) /* 50 ms */ + +/* When we timeout an idle transfer for FSBR, we'll switch it over to */ +/* depth first traversal. We'll do it in groups of this number of TD's */ +/* to make sure it doesn't hog all of the bandwidth */ +#define DEPTH_INTERVAL 5 + +/* + * Technically, updating td->status here is a race, but it's not really a + * problem. The worst that can happen is that we set the IOC bit again + * generating a spurious interrupt. We could fix this by creating another + * QH and leaving the IOC bit always set, but then we would have to play + * games with the FSBR code to make sure we get the correct order in all + * the cases. I don't think it's worth the effort + */ +static inline void uhci_set_next_interrupt(struct uhci_hcd *uhci) +{ + unsigned long flags; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + uhci->term_td->status |= cpu_to_le32(TD_CTRL_IOC); + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci) +{ + unsigned long flags; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + uhci->term_td->status &= ~cpu_to_le32(TD_CTRL_IOC); + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +static inline void uhci_add_complete(struct uhci_hcd *uhci, struct urb *urb) +{ + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + unsigned long flags; + + spin_lock_irqsave(&uhci->complete_list_lock, flags); + list_add_tail(&urbp->complete_list, &uhci->complete_list); + spin_unlock_irqrestore(&uhci->complete_list_lock, flags); +} + +static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci, struct usb_device *dev) +{ + dma_addr_t dma_handle; + struct uhci_td *td; + + td = pci_pool_alloc(uhci->td_pool, GFP_ATOMIC, &dma_handle); + if (!td) + return NULL; + + td->dma_handle = dma_handle; + + td->link = UHCI_PTR_TERM; + td->buffer = 0; + + td->frame = -1; + td->dev = dev; + + INIT_LIST_HEAD(&td->list); + INIT_LIST_HEAD(&td->fl_list); + + usb_get_dev(dev); + + return td; +} + +static inline void uhci_fill_td(struct uhci_td *td, __u32 status, + __u32 token, __u32 buffer) +{ + td->status = cpu_to_le32(status); + td->token = cpu_to_le32(token); + td->buffer = cpu_to_le32(buffer); +} + +/* + * We insert Isochronous URB's directly into the frame list at the beginning + */ +static void uhci_insert_td_frame_list(struct uhci_hcd *uhci, struct uhci_td *td, unsigned framenum) +{ + unsigned long flags; + + framenum %= UHCI_NUMFRAMES; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + + td->frame = framenum; + + /* Is there a TD already mapped there? */ + if (uhci->fl->frame_cpu[framenum]) { + struct uhci_td *ftd, *ltd; + + ftd = uhci->fl->frame_cpu[framenum]; + ltd = list_entry(ftd->fl_list.prev, struct uhci_td, fl_list); + + list_add_tail(&td->fl_list, &ftd->fl_list); + + td->link = ltd->link; + mb(); + ltd->link = cpu_to_le32(td->dma_handle); + } else { + td->link = uhci->fl->frame[framenum]; + mb(); + uhci->fl->frame[framenum] = cpu_to_le32(td->dma_handle); + uhci->fl->frame_cpu[framenum] = td; + } + + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +static void uhci_remove_td(struct uhci_hcd *uhci, struct uhci_td *td) +{ + unsigned long flags; + + /* If it's not inserted, don't remove it */ + spin_lock_irqsave(&uhci->frame_list_lock, flags); + if (td->frame == -1 && list_empty(&td->fl_list)) + goto out; + + if (td->frame != -1 && uhci->fl->frame_cpu[td->frame] == td) { + if (list_empty(&td->fl_list)) { + uhci->fl->frame[td->frame] = td->link; + uhci->fl->frame_cpu[td->frame] = NULL; + } else { + struct uhci_td *ntd; + + ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list); + uhci->fl->frame[td->frame] = cpu_to_le32(ntd->dma_handle); + uhci->fl->frame_cpu[td->frame] = ntd; + } + } else { + struct uhci_td *ptd; + + ptd = list_entry(td->fl_list.prev, struct uhci_td, fl_list); + ptd->link = td->link; + } + + mb(); + td->link = UHCI_PTR_TERM; + + list_del_init(&td->fl_list); + td->frame = -1; + +out: + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +/* + * Inserts a td into qh list at the top. + */ +static void uhci_insert_tds_in_qh(struct uhci_qh *qh, struct urb *urb, u32 breadth) +{ + struct list_head *tmp, *head; + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + struct uhci_td *td, *ptd; + + if (list_empty(&urbp->td_list)) + return; + + head = &urbp->td_list; + tmp = head->next; + + /* Ordering isn't important here yet since the QH hasn't been */ + /* inserted into the schedule yet */ + td = list_entry(tmp, struct uhci_td, list); + + /* Add the first TD to the QH element pointer */ + qh->element = cpu_to_le32(td->dma_handle) | breadth; + + ptd = td; + + /* Then link the rest of the TD's */ + tmp = tmp->next; + while (tmp != head) { + td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + ptd->link = cpu_to_le32(td->dma_handle) | breadth; + + ptd = td; + } + + ptd->link = UHCI_PTR_TERM; +} + +static void uhci_free_td(struct uhci_hcd *uhci, struct uhci_td *td) +{ + if (!list_empty(&td->list)) + dbg("td %p is still in list!", td); + if (!list_empty(&td->fl_list)) + dbg("td %p is still in fl_list!", td); + + if (td->dev) + usb_put_dev(td->dev); + + pci_pool_free(uhci->td_pool, td, td->dma_handle); +} + +static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci, struct usb_device *dev) +{ + dma_addr_t dma_handle; + struct uhci_qh *qh; + + qh = pci_pool_alloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle); + if (!qh) + return NULL; + + qh->dma_handle = dma_handle; + + qh->element = UHCI_PTR_TERM; + qh->link = UHCI_PTR_TERM; + + qh->dev = dev; + qh->urbp = NULL; + + INIT_LIST_HEAD(&qh->list); + INIT_LIST_HEAD(&qh->remove_list); + + usb_get_dev(dev); + + return qh; +} + +static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh) +{ + if (!list_empty(&qh->list)) + dbg("qh %p list not empty!", qh); + if (!list_empty(&qh->remove_list)) + dbg("qh %p still in remove_list!", qh); + + if (qh->dev) + usb_put_dev(qh->dev); + + pci_pool_free(uhci->qh_pool, qh, qh->dma_handle); +} + +/* + * Append this urb's qh after the last qh in skelqh->list + * MUST be called with uhci->frame_list_lock acquired + * + * Note that urb_priv.queue_list doesn't have a separate queue head; + * it's a ring with every element "live". + */ +static void _uhci_insert_qh(struct uhci_hcd *uhci, struct uhci_qh *skelqh, struct urb *urb) +{ + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + struct list_head *tmp; + struct uhci_qh *lqh; + + /* Grab the last QH */ + lqh = list_entry(skelqh->list.prev, struct uhci_qh, list); + + /* + * Patch this endpoint's URB's QHs to point to the next skelqh: + * skelqh --> ... lqh --> newqh --> next skelqh + * Do this first, so the HC always sees the right QH after this one. + */ + list_for_each (tmp, &urbp->queue_list) { + struct urb_priv *turbp = + list_entry(tmp, struct urb_priv, queue_list); + + turbp->qh->link = lqh->link; + } + urbp->qh->link = lqh->link; + wmb(); /* Ordering is important */ + + /* + * Patch QHs for previous endpoint's queued URBs? HC goes + * here next, not to the next skelqh it now points to. + * + * lqh --> td ... --> qh ... --> td --> qh ... --> td + * | | | + * v v v + * +<----------------+-----------------+ + * v + * newqh --> td ... --> td + * | + * v + * ... + * + * The HC could see (and use!) any of these as we write them. + */ + if (lqh->urbp) { + list_for_each (tmp, &lqh->urbp->queue_list) { + struct urb_priv *turbp = + list_entry(tmp, struct urb_priv, queue_list); + + turbp->qh->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH; + } + } + lqh->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH; + + list_add_tail(&urbp->qh->list, &skelqh->list); +} + +static void uhci_insert_qh(struct uhci_hcd *uhci, struct uhci_qh *skelqh, struct urb *urb) +{ + unsigned long flags; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + _uhci_insert_qh(uhci, skelqh, urb); + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +/* + * Start removal of QH from schedule; it finishes next frame. + * TDs should be unlinked before this is called. + */ +static void uhci_remove_qh(struct uhci_hcd *uhci, struct uhci_qh *qh) +{ + unsigned long flags; + struct uhci_qh *pqh; + + if (!qh) + return; + + qh->urbp = NULL; + + /* + * Only go through the hoops if it's actually linked in + * Queued QHs are removed in uhci_delete_queued_urb, + * since (for queued URBs) the pqh is pointed to the next + * QH in the queue, not the next endpoint's QH. + */ + spin_lock_irqsave(&uhci->frame_list_lock, flags); + if (!list_empty(&qh->list)) { + pqh = list_entry(qh->list.prev, struct uhci_qh, list); + + if (pqh->urbp) { + struct list_head *head, *tmp; + + head = &pqh->urbp->queue_list; + tmp = head->next; + while (head != tmp) { + struct urb_priv *turbp = + list_entry(tmp, struct urb_priv, queue_list); + + tmp = tmp->next; + + turbp->qh->link = qh->link; + } + } + + pqh->link = qh->link; + mb(); + /* Leave qh->link in case the HC is on the QH now, it will */ + /* continue the rest of the schedule */ + qh->element = UHCI_PTR_TERM; + + list_del_init(&qh->list); + } + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); + + spin_lock_irqsave(&uhci->qh_remove_list_lock, flags); + + /* Check to see if the remove list is empty. Set the IOC bit */ + /* to force an interrupt so we can remove the QH */ + if (list_empty(&uhci->qh_remove_list)) + uhci_set_next_interrupt(uhci); + + list_add(&qh->remove_list, &uhci->qh_remove_list); + + spin_unlock_irqrestore(&uhci->qh_remove_list_lock, flags); +} + +static int uhci_fixup_toggle(struct urb *urb, unsigned int toggle) +{ + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + struct list_head *head, *tmp; + + head = &urbp->td_list; + tmp = head->next; + while (head != tmp) { + struct uhci_td *td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + if (toggle) + td->token |= cpu_to_le32(TD_TOKEN_TOGGLE); + else + td->token &= ~cpu_to_le32(TD_TOKEN_TOGGLE); + + + toggle ^= 1; + } + + return toggle; +} + +/* This function will append one URB's QH to another URB's QH. This is for */ +/* queuing interrupt, control or bulk transfers */ +static void uhci_append_queued_urb(struct uhci_hcd *uhci, struct urb *eurb, struct urb *urb) +{ + struct urb_priv *eurbp, *urbp, *furbp, *lurbp; + struct list_head *tmp; + struct uhci_td *lltd; + unsigned long flags; + + eurbp = eurb->hcpriv; + urbp = urb->hcpriv; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + + /* Find the first URB in the queue */ + if (eurbp->queued) { + struct list_head *head = &eurbp->queue_list; + + tmp = head->next; + while (tmp != head) { + struct urb_priv *turbp = + list_entry(tmp, struct urb_priv, queue_list); + + if (!turbp->queued) + break; + + tmp = tmp->next; + } + } else + tmp = &eurbp->queue_list; + + furbp = list_entry(tmp, struct urb_priv, queue_list); + lurbp = list_entry(furbp->queue_list.prev, struct urb_priv, queue_list); + + lltd = list_entry(lurbp->td_list.prev, struct uhci_td, list); + + usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), + uhci_fixup_toggle(urb, uhci_toggle(td_token(lltd)) ^ 1)); + + /* All qh's in the queue need to link to the next queue */ + urbp->qh->link = eurbp->qh->link; + + mb(); /* Make sure we flush everything */ + + lltd->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH; + + list_add_tail(&urbp->queue_list, &furbp->queue_list); + + urbp->queued = 1; + + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +static void uhci_delete_queued_urb(struct uhci_hcd *uhci, struct urb *urb) +{ + struct urb_priv *urbp, *nurbp; + struct list_head *head, *tmp; + struct urb_priv *purbp; + struct uhci_td *pltd; + unsigned int toggle; + unsigned long flags; + + urbp = urb->hcpriv; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + + if (list_empty(&urbp->queue_list)) + goto out; + + nurbp = list_entry(urbp->queue_list.next, struct urb_priv, queue_list); + + /* Fix up the toggle for the next URB's */ + if (!urbp->queued) + /* We just set the toggle in uhci_unlink_generic */ + toggle = usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)); + else { + /* If we're in the middle of the queue, grab the toggle */ + /* from the TD previous to us */ + purbp = list_entry(urbp->queue_list.prev, struct urb_priv, + queue_list); + + pltd = list_entry(purbp->td_list.prev, struct uhci_td, list); + + toggle = uhci_toggle(td_token(pltd)) ^ 1; + } + + head = &urbp->queue_list; + tmp = head->next; + while (head != tmp) { + struct urb_priv *turbp; + + turbp = list_entry(tmp, struct urb_priv, queue_list); + + tmp = tmp->next; + + if (!turbp->queued) + break; + + toggle = uhci_fixup_toggle(turbp->urb, toggle); + } + + usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), + usb_pipeout(urb->pipe), toggle); + + if (!urbp->queued) { + struct uhci_qh *pqh; + + nurbp->queued = 0; + + /* + * Fixup the previous QH's queue to link to the new head + * of this queue. + */ + pqh = list_entry(urbp->qh->list.prev, struct uhci_qh, list); + + if (pqh->urbp) { + struct list_head *head, *tmp; + + head = &pqh->urbp->queue_list; + tmp = head->next; + while (head != tmp) { + struct urb_priv *turbp = + list_entry(tmp, struct urb_priv, queue_list); + + tmp = tmp->next; + + turbp->qh->link = cpu_to_le32(nurbp->qh->dma_handle) | UHCI_PTR_QH; + } + } + + pqh->link = cpu_to_le32(nurbp->qh->dma_handle) | UHCI_PTR_QH; + + list_add_tail(&nurbp->qh->list, &urbp->qh->list); + list_del_init(&urbp->qh->list); + } else { + /* We're somewhere in the middle (or end). A bit trickier */ + /* than the head scenario */ + purbp = list_entry(urbp->queue_list.prev, struct urb_priv, + queue_list); + + pltd = list_entry(purbp->td_list.prev, struct uhci_td, list); + if (nurbp->queued) + pltd->link = cpu_to_le32(nurbp->qh->dma_handle) | UHCI_PTR_QH; + else + /* The next URB happens to be the beginning, so */ + /* we're the last, end the chain */ + pltd->link = UHCI_PTR_TERM; + } + + list_del_init(&urbp->queue_list); + +out: + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +static struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci, struct urb *urb) +{ + struct urb_priv *urbp; + + urbp = kmem_cache_alloc(uhci_up_cachep, SLAB_ATOMIC); + if (!urbp) { + err("uhci_alloc_urb_priv: couldn't allocate memory for urb_priv\n"); + return NULL; + } + + memset((void *)urbp, 0, sizeof(*urbp)); + + urbp->inserttime = jiffies; + urbp->fsbrtime = jiffies; + urbp->urb = urb; + urbp->dev = urb->dev; + + INIT_LIST_HEAD(&urbp->td_list); + INIT_LIST_HEAD(&urbp->queue_list); + INIT_LIST_HEAD(&urbp->complete_list); + INIT_LIST_HEAD(&urbp->urb_list); + + list_add_tail(&urbp->urb_list, &uhci->urb_list); + + urb->hcpriv = urbp; + + return urbp; +} + +/* + * MUST be called with urb->lock acquired + */ +static void uhci_add_td_to_urb(struct urb *urb, struct uhci_td *td) +{ + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + + td->urb = urb; + + list_add_tail(&td->list, &urbp->td_list); +} + +/* + * MUST be called with urb->lock acquired + */ +static void uhci_remove_td_from_urb(struct uhci_td *td) +{ + if (list_empty(&td->list)) + return; + + list_del_init(&td->list); + + td->urb = NULL; +} + +/* + * MUST be called with urb->lock acquired + */ +static void uhci_destroy_urb_priv(struct uhci_hcd *uhci, struct urb *urb) +{ + struct list_head *head, *tmp; + struct urb_priv *urbp; + + urbp = (struct urb_priv *)urb->hcpriv; + if (!urbp) + return; + + if (!list_empty(&urbp->urb_list)) + warn("uhci_destroy_urb_priv: urb %p still on uhci->urb_list or uhci->remove_list", urb); + + if (!list_empty(&urbp->complete_list)) + warn("uhci_destroy_urb_priv: urb %p still on uhci->complete_list", urb); + + head = &urbp->td_list; + tmp = head->next; + while (tmp != head) { + struct uhci_td *td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + uhci_remove_td_from_urb(td); + uhci_remove_td(uhci, td); + uhci_free_td(uhci, td); + } + + urb->hcpriv = NULL; + kmem_cache_free(uhci_up_cachep, urbp); +} + +static void uhci_inc_fsbr(struct uhci_hcd *uhci, struct urb *urb) +{ + unsigned long flags; + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + + if ((!(urb->transfer_flags & URB_NO_FSBR)) && !urbp->fsbr) { + urbp->fsbr = 1; + if (!uhci->fsbr++ && !uhci->fsbrtimeout) + uhci->skel_term_qh->link = cpu_to_le32(uhci->skel_hs_control_qh->dma_handle) | UHCI_PTR_QH; + } + + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +static void uhci_dec_fsbr(struct uhci_hcd *uhci, struct urb *urb) +{ + unsigned long flags; + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + + spin_lock_irqsave(&uhci->frame_list_lock, flags); + + if ((!(urb->transfer_flags & URB_NO_FSBR)) && urbp->fsbr) { + urbp->fsbr = 0; + if (!--uhci->fsbr) + uhci->fsbrtimeout = jiffies + FSBR_DELAY; + } + + spin_unlock_irqrestore(&uhci->frame_list_lock, flags); +} + +/* + * Map status to standard result codes + * + * is (td->status & 0xFE0000) [a.k.a. uhci_status_bits(td->status)] + * is True for output TDs and False for input TDs. + */ +static int uhci_map_status(int status, int dir_out) +{ + if (!status) + return 0; + if (status & TD_CTRL_BITSTUFF) /* Bitstuff error */ + return -EPROTO; + if (status & TD_CTRL_CRCTIMEO) { /* CRC/Timeout */ + if (dir_out) + return -ETIMEDOUT; + else + return -EILSEQ; + } + if (status & TD_CTRL_NAK) /* NAK */ + return -ETIMEDOUT; + if (status & TD_CTRL_BABBLE) /* Babble */ + return -EOVERFLOW; + if (status & TD_CTRL_DBUFERR) /* Buffer error */ + return -ENOSR; + if (status & TD_CTRL_STALLED) /* Stalled */ + return -EPIPE; + if (status & TD_CTRL_ACTIVE) /* Active */ + return 0; + + return -EINVAL; +} + +/* + * Control transfers + */ +static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb) +{ + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + struct uhci_td *td; + struct uhci_qh *qh, *skelqh; + unsigned long destination, status; + int maxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); + int len = urb->transfer_buffer_length; + dma_addr_t data = urb->transfer_dma; + + /* The "pipe" thing contains the destination in bits 8--18 */ + destination = (urb->pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP; + + /* 3 errors */ + status = TD_CTRL_ACTIVE | uhci_maxerr(3); + if (urb->dev->speed == USB_SPEED_LOW) + status |= TD_CTRL_LS; + + /* + * Build the TD for the control request + */ + td = uhci_alloc_td(uhci, urb->dev); + if (!td) + return -ENOMEM; + + uhci_add_td_to_urb(urb, td); + uhci_fill_td(td, status, destination | uhci_explen(7), + urb->setup_dma); + + /* + * If direction is "send", change the frame from SETUP (0x2D) + * to OUT (0xE1). Else change it from SETUP to IN (0x69). + */ + destination ^= (USB_PID_SETUP ^ usb_packetid(urb->pipe)); + + if (!(urb->transfer_flags & URB_SHORT_NOT_OK)) + status |= TD_CTRL_SPD; + + /* + * Build the DATA TD's + */ + while (len > 0) { + int pktsze = len; + + if (pktsze > maxsze) + pktsze = maxsze; + + td = uhci_alloc_td(uhci, urb->dev); + if (!td) + return -ENOMEM; + + /* Alternate Data0/1 (start with Data1) */ + destination ^= TD_TOKEN_TOGGLE; + + uhci_add_td_to_urb(urb, td); + uhci_fill_td(td, status, destination | uhci_explen(pktsze - 1), + data); + + data += pktsze; + len -= pktsze; + } + + /* + * Build the final TD for control status + */ + td = uhci_alloc_td(uhci, urb->dev); + if (!td) + return -ENOMEM; + + /* + * It's IN if the pipe is an output pipe or we're not expecting + * data back. + */ + destination &= ~TD_TOKEN_PID_MASK; + if (usb_pipeout(urb->pipe) || !urb->transfer_buffer_length) + destination |= USB_PID_IN; + else + destination |= USB_PID_OUT; + + destination |= TD_TOKEN_TOGGLE; /* End in Data1 */ + + status &= ~TD_CTRL_SPD; + + uhci_add_td_to_urb(urb, td); + uhci_fill_td(td, status | TD_CTRL_IOC, + destination | uhci_explen(UHCI_NULL_DATA_SIZE), 0); + + qh = uhci_alloc_qh(uhci, urb->dev); + if (!qh) + return -ENOMEM; + + urbp->qh = qh; + qh->urbp = urbp; + + uhci_insert_tds_in_qh(qh, urb, UHCI_PTR_BREADTH); + + /* Low speed transfers get a different queue, and won't hog the bus */ + if (urb->dev->speed == USB_SPEED_LOW) + skelqh = uhci->skel_ls_control_qh; + else { + skelqh = uhci->skel_hs_control_qh; + uhci_inc_fsbr(uhci, urb); + } + + if (eurb) + uhci_append_queued_urb(uhci, eurb, urb); + else + uhci_insert_qh(uhci, skelqh, urb); + + return -EINPROGRESS; +} + +/* + * If control was short, then end status packet wasn't sent, so this + * reorganize s so it's sent to finish the transfer. The original QH is + * removed from the skel and discarded; all TDs except the last (status) + * are deleted; the last (status) TD is put on a new QH which is reinserted + * into the skel. Since the last TD and urb_priv are reused, the TD->link + * and urb_priv maintain any queued QHs. + */ +static int usb_control_retrigger_status(struct uhci_hcd *uhci, struct urb *urb) +{ + struct list_head *tmp, *head; + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + + urbp->short_control_packet = 1; + + /* Create a new QH to avoid pointer overwriting problems */ + uhci_remove_qh(uhci, urbp->qh); + + /* Delete all of the TD's except for the status TD at the end */ + head = &urbp->td_list; + tmp = head->next; + while (tmp != head && tmp->next != head) { + struct uhci_td *td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + uhci_remove_td_from_urb(td); + uhci_remove_td(uhci, td); + uhci_free_td(uhci, td); + } + + urbp->qh = uhci_alloc_qh(uhci, urb->dev); + if (!urbp->qh) { + err("unable to allocate new QH for control retrigger"); + return -ENOMEM; + } + + urbp->qh->urbp = urbp; + + /* One TD, who cares about Breadth first? */ + uhci_insert_tds_in_qh(urbp->qh, urb, UHCI_PTR_DEPTH); + + /* Low speed transfers get a different queue */ + if (urb->dev->speed == USB_SPEED_LOW) + uhci_insert_qh(uhci, uhci->skel_ls_control_qh, urb); + else + uhci_insert_qh(uhci, uhci->skel_hs_control_qh, urb); + + return -EINPROGRESS; +} + + +static int uhci_result_control(struct uhci_hcd *uhci, struct urb *urb) +{ + struct list_head *tmp, *head; + struct urb_priv *urbp = urb->hcpriv; + struct uhci_td *td; + unsigned int status; + int ret = 0; + + if (list_empty(&urbp->td_list)) + return -EINVAL; + + head = &urbp->td_list; + + if (urbp->short_control_packet) { + tmp = head->prev; + goto status_phase; + } + + tmp = head->next; + td = list_entry(tmp, struct uhci_td, list); + + /* The first TD is the SETUP phase, check the status, but skip */ + /* the count */ + status = uhci_status_bits(td_status(td)); + if (status & TD_CTRL_ACTIVE) + return -EINPROGRESS; + + if (status) + goto td_error; + + urb->actual_length = 0; + + /* The rest of the TD's (but the last) are data */ + tmp = tmp->next; + while (tmp != head && tmp->next != head) { + td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + status = uhci_status_bits(td_status(td)); + if (status & TD_CTRL_ACTIVE) + return -EINPROGRESS; + + urb->actual_length += uhci_actual_length(td_status(td)); + + if (status) + goto td_error; + + /* Check to see if we received a short packet */ + if (uhci_actual_length(td_status(td)) < uhci_expected_length(td_token(td))) { + if (urb->transfer_flags & URB_SHORT_NOT_OK) { + ret = -EREMOTEIO; + goto err; + } + + if (uhci_packetid(td_token(td)) == USB_PID_IN) + return usb_control_retrigger_status(uhci, urb); + else + return 0; + } + } + +status_phase: + td = list_entry(tmp, struct uhci_td, list); + + /* Control status phase */ + status = td_status(td); + +#ifdef I_HAVE_BUGGY_APC_BACKUPS + /* APC BackUPS Pro kludge */ + /* It tries to send all of the descriptor instead of the amount */ + /* we requested */ + if (status & TD_CTRL_IOC && /* IOC is masked out by uhci_status_bits */ + status & TD_CTRL_ACTIVE && + status & TD_CTRL_NAK) + return 0; +#endif + + if (status & TD_CTRL_ACTIVE) + return -EINPROGRESS; + + if (uhci_status_bits(status)) + goto td_error; + + return 0; + +td_error: + ret = uhci_map_status(status, uhci_packetout(td_token(td))); + +err: + if ((debug == 1 && ret != -EPIPE) || debug > 1) { + /* Some debugging code */ + dbg("uhci_result_control() failed with status %x", status); + + if (errbuf) { + /* Print the chain for debugging purposes */ + uhci_show_qh(urbp->qh, errbuf, ERRBUF_LEN, 0); + + lprintk(errbuf); + } + } + + return ret; +} + +/* + * Common submit for bulk and interrupt + */ +static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb, struct uhci_qh *skelqh) +{ + struct uhci_td *td; + struct uhci_qh *qh; + unsigned long destination, status; + int maxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); + int len = urb->transfer_buffer_length; + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + dma_addr_t data = urb->transfer_dma; + + if (len < 0) + return -EINVAL; + + /* The "pipe" thing contains the destination in bits 8--18 */ + destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe); + + status = uhci_maxerr(3) | TD_CTRL_ACTIVE; + if (urb->dev->speed == USB_SPEED_LOW) + status |= TD_CTRL_LS; + if (!(urb->transfer_flags & URB_SHORT_NOT_OK)) + status |= TD_CTRL_SPD; + + /* + * Build the DATA TD's + */ + do { /* Allow zero length packets */ + int pktsze = len; + + if (pktsze > maxsze) + pktsze = maxsze; + + td = uhci_alloc_td(uhci, urb->dev); + if (!td) + return -ENOMEM; + + uhci_add_td_to_urb(urb, td); + uhci_fill_td(td, status, destination | uhci_explen(pktsze - 1) | + (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), + usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT), + data); + + data += pktsze; + len -= maxsze; + + usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe), + usb_pipeout(urb->pipe)); + } while (len > 0); + + /* + * URB_ZERO_PACKET means adding a 0-length packet, if direction + * is OUT and the transfer_length was an exact multiple of maxsze, + * hence (len = transfer_length - N * maxsze) == 0 + * however, if transfer_length == 0, the zero packet was already + * prepared above. + */ + if (usb_pipeout(urb->pipe) && (urb->transfer_flags & URB_ZERO_PACKET) && + !len && urb->transfer_buffer_length) { + td = uhci_alloc_td(uhci, urb->dev); + if (!td) + return -ENOMEM; + + uhci_add_td_to_urb(urb, td); + uhci_fill_td(td, status, destination | uhci_explen(UHCI_NULL_DATA_SIZE) | + (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), + usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT), + data); + + usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe), + usb_pipeout(urb->pipe)); + } + + /* Set the flag on the last packet */ + td->status |= cpu_to_le32(TD_CTRL_IOC); + + qh = uhci_alloc_qh(uhci, urb->dev); + if (!qh) + return -ENOMEM; + + urbp->qh = qh; + qh->urbp = urbp; + + /* Always breadth first */ + uhci_insert_tds_in_qh(qh, urb, UHCI_PTR_BREADTH); + + if (eurb) + uhci_append_queued_urb(uhci, eurb, urb); + else + uhci_insert_qh(uhci, skelqh, urb); + + return -EINPROGRESS; +} + +/* + * Common result for bulk and interrupt + */ +static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) +{ + struct list_head *tmp, *head; + struct urb_priv *urbp = urb->hcpriv; + struct uhci_td *td; + unsigned int status = 0; + int ret = 0; + + urb->actual_length = 0; + + head = &urbp->td_list; + tmp = head->next; + while (tmp != head) { + td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + status = uhci_status_bits(td_status(td)); + if (status & TD_CTRL_ACTIVE) + return -EINPROGRESS; + + urb->actual_length += uhci_actual_length(td_status(td)); + + if (status) + goto td_error; + + if (uhci_actual_length(td_status(td)) < uhci_expected_length(td_token(td))) { + if (urb->transfer_flags & URB_SHORT_NOT_OK) { + ret = -EREMOTEIO; + goto err; + } else + return 0; + } + } + + return 0; + +td_error: + ret = uhci_map_status(status, uhci_packetout(td_token(td))); + if (ret == -EPIPE) + /* endpoint has stalled - mark it halted */ + usb_endpoint_halt(urb->dev, uhci_endpoint(td_token(td)), + uhci_packetout(td_token(td))); + +err: + /* + * Enable this chunk of code if you want to see some more debugging. + * But be careful, it has the tendancy to starve out khubd and prevent + * disconnects from happening successfully if you have a slow debug + * log interface (like a serial console. + */ +#if 0 + if ((debug == 1 && ret != -EPIPE) || debug > 1) { + /* Some debugging code */ + dbg("uhci_result_common() failed with status %x", status); + + if (errbuf) { + /* Print the chain for debugging purposes */ + uhci_show_qh(urbp->qh, errbuf, ERRBUF_LEN, 0); + + lprintk(errbuf); + } + } +#endif + return ret; +} + +static inline int uhci_submit_bulk(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb) +{ + int ret; + + /* Can't have low speed bulk transfers */ + if (urb->dev->speed == USB_SPEED_LOW) + return -EINVAL; + + ret = uhci_submit_common(uhci, urb, eurb, uhci->skel_bulk_qh); + if (ret == -EINPROGRESS) + uhci_inc_fsbr(uhci, urb); + + return ret; +} + +static inline int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb) +{ + /* USB 1.1 interrupt transfers only involve one packet per interval; + * that's the uhci_submit_common() "breadth first" policy. Drivers + * can submit urbs of any length, but longer ones might need many + * intervals to complete. + */ + return uhci_submit_common(uhci, urb, eurb, uhci->skelqh[__interval_to_skel(urb->interval)]); +} + +/* + * Bulk and interrupt use common result + */ +#define uhci_result_bulk uhci_result_common +#define uhci_result_interrupt uhci_result_common + +/* + * Isochronous transfers + */ +static int isochronous_find_limits(struct uhci_hcd *uhci, struct urb *urb, unsigned int *start, unsigned int *end) +{ + struct urb *last_urb = NULL; + struct list_head *tmp, *head; + int ret = 0; + + head = &uhci->urb_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *up = list_entry(tmp, struct urb_priv, urb_list); + struct urb *u = up->urb; + + tmp = tmp->next; + + /* look for pending URB's with identical pipe handle */ + if ((urb->pipe == u->pipe) && (urb->dev == u->dev) && + (u->status == -EINPROGRESS) && (u != urb)) { + if (!last_urb) + *start = u->start_frame; + last_urb = u; + } + } + + if (last_urb) { + *end = (last_urb->start_frame + last_urb->number_of_packets * + last_urb->interval) & (UHCI_NUMFRAMES-1); + ret = 0; + } else + ret = -1; /* no previous urb found */ + + return ret; +} + +static int isochronous_find_start(struct uhci_hcd *uhci, struct urb *urb) +{ + int limits; + unsigned int start = 0, end = 0; + + if (urb->number_of_packets > 900) /* 900? Why? */ + return -EFBIG; + + limits = isochronous_find_limits(uhci, urb, &start, &end); + + if (urb->transfer_flags & URB_ISO_ASAP) { + if (limits) { + int curframe; + + curframe = uhci_get_current_frame_number(uhci) % UHCI_NUMFRAMES; + urb->start_frame = (curframe + 10) % UHCI_NUMFRAMES; + } else + urb->start_frame = end; + } else { + urb->start_frame %= UHCI_NUMFRAMES; + /* FIXME: Sanity check */ + } + + return 0; +} + +/* + * Isochronous transfers + */ +static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb) +{ + struct uhci_td *td; + int i, ret, frame; + int status, destination; + + status = TD_CTRL_ACTIVE | TD_CTRL_IOS; + destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe); + + ret = isochronous_find_start(uhci, urb); + if (ret) + return ret; + + frame = urb->start_frame; + for (i = 0; i < urb->number_of_packets; i++, frame += urb->interval) { + if (!urb->iso_frame_desc[i].length) + continue; + + td = uhci_alloc_td(uhci, urb->dev); + if (!td) + return -ENOMEM; + + uhci_add_td_to_urb(urb, td); + uhci_fill_td(td, status, destination | uhci_explen(urb->iso_frame_desc[i].length - 1), + urb->transfer_dma + urb->iso_frame_desc[i].offset); + + if (i + 1 >= urb->number_of_packets) + td->status |= cpu_to_le32(TD_CTRL_IOC); + + uhci_insert_td_frame_list(uhci, td, frame); + } + + return -EINPROGRESS; +} + +static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb) +{ + struct list_head *tmp, *head; + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + int status; + int i, ret = 0; + + urb->actual_length = 0; + + i = 0; + head = &urbp->td_list; + tmp = head->next; + while (tmp != head) { + struct uhci_td *td = list_entry(tmp, struct uhci_td, list); + int actlength; + + tmp = tmp->next; + + if (td_status(td) & TD_CTRL_ACTIVE) + return -EINPROGRESS; + + actlength = uhci_actual_length(td_status(td)); + urb->iso_frame_desc[i].actual_length = actlength; + urb->actual_length += actlength; + + status = uhci_map_status(uhci_status_bits(td_status(td)), usb_pipeout(urb->pipe)); + urb->iso_frame_desc[i].status = status; + if (status) { + urb->error_count++; + ret = status; + } + + i++; + } + + return ret; +} + +/* + * MUST be called with uhci->urb_list_lock acquired + */ +static struct urb *uhci_find_urb_ep(struct uhci_hcd *uhci, struct urb *urb) +{ + struct list_head *tmp, *head; + + /* We don't match Isoc transfers since they are special */ + if (usb_pipeisoc(urb->pipe)) + return NULL; + + head = &uhci->urb_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *up = list_entry(tmp, struct urb_priv, urb_list); + struct urb *u = up->urb; + + tmp = tmp->next; + + if (u->dev == urb->dev && u->status == -EINPROGRESS) { + /* For control, ignore the direction */ + if (usb_pipecontrol(urb->pipe) && + (u->pipe & ~USB_DIR_IN) == (urb->pipe & ~USB_DIR_IN)) + return u; + else if (u->pipe == urb->pipe) + return u; + } + } + + return NULL; +} + +static int uhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, int mem_flags) +{ + int ret = -EINVAL; + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + unsigned long flags; + struct urb *eurb; + int bustime; + + spin_lock_irqsave(&uhci->urb_list_lock, flags); + + eurb = uhci_find_urb_ep(uhci, urb); + + if (!uhci_alloc_urb_priv(uhci, urb)) { + spin_unlock_irqrestore(&uhci->urb_list_lock, flags); + return -ENOMEM; + } + + switch (usb_pipetype(urb->pipe)) { + case PIPE_CONTROL: + ret = uhci_submit_control(uhci, urb, eurb); + break; + case PIPE_INTERRUPT: + if (!eurb) { + bustime = usb_check_bandwidth(urb->dev, urb); + if (bustime < 0) + ret = bustime; + else { + ret = uhci_submit_interrupt(uhci, urb, eurb); + if (ret == -EINPROGRESS) + usb_claim_bandwidth(urb->dev, urb, bustime, 0); + } + } else { /* inherit from parent */ + urb->bandwidth = eurb->bandwidth; + ret = uhci_submit_interrupt(uhci, urb, eurb); + } + break; + case PIPE_BULK: + ret = uhci_submit_bulk(uhci, urb, eurb); + break; + case PIPE_ISOCHRONOUS: + bustime = usb_check_bandwidth(urb->dev, urb); + if (bustime < 0) { + ret = bustime; + break; + } + + ret = uhci_submit_isochronous(uhci, urb); + if (ret == -EINPROGRESS) + usb_claim_bandwidth(urb->dev, urb, bustime, 1); + break; + } + + if (ret != -EINPROGRESS) { + /* Submit failed, so delete it from the urb_list */ + struct urb_priv *urbp = urb->hcpriv; + + list_del_init(&urbp->urb_list); + spin_unlock_irqrestore(&uhci->urb_list_lock, flags); + uhci_destroy_urb_priv (uhci, urb); + + return ret; + } + + spin_unlock_irqrestore(&uhci->urb_list_lock, flags); + + return 0; +} + +/* + * Return the result of a transfer + * + * MUST be called with urb_list_lock acquired + */ +static void uhci_transfer_result(struct uhci_hcd *uhci, struct urb *urb) +{ + int ret = -EINVAL; + unsigned long flags; + struct urb_priv *urbp; + + spin_lock_irqsave(&urb->lock, flags); + + urbp = (struct urb_priv *)urb->hcpriv; + + if (urb->status != -EINPROGRESS) { + info("uhci_transfer_result: called for URB %p not in flight?", urb); + goto out; + } + + switch (usb_pipetype(urb->pipe)) { + case PIPE_CONTROL: + ret = uhci_result_control(uhci, urb); + break; + case PIPE_INTERRUPT: + ret = uhci_result_interrupt(uhci, urb); + break; + case PIPE_BULK: + ret = uhci_result_bulk(uhci, urb); + break; + case PIPE_ISOCHRONOUS: + ret = uhci_result_isochronous(uhci, urb); + break; + } + + urbp->status = ret; + + if (ret == -EINPROGRESS) + goto out; + + switch (usb_pipetype(urb->pipe)) { + case PIPE_CONTROL: + case PIPE_BULK: + case PIPE_ISOCHRONOUS: + /* Release bandwidth for Interrupt or Isoc. transfers */ + /* Spinlock needed ? */ + if (urb->bandwidth) + usb_release_bandwidth(urb->dev, urb, 1); + uhci_unlink_generic(uhci, urb); + break; + case PIPE_INTERRUPT: + /* Release bandwidth for Interrupt or Isoc. transfers */ + /* Make sure we don't release if we have a queued URB */ + spin_lock(&uhci->frame_list_lock); + /* Spinlock needed ? */ + if (list_empty(&urbp->queue_list) && urb->bandwidth) + usb_release_bandwidth(urb->dev, urb, 0); + else + /* bandwidth was passed on to queued URB, */ + /* so don't let usb_unlink_urb() release it */ + urb->bandwidth = 0; + spin_unlock(&uhci->frame_list_lock); + uhci_unlink_generic(uhci, urb); + break; + default: + info("uhci_transfer_result: unknown pipe type %d for urb %p\n", + usb_pipetype(urb->pipe), urb); + } + + /* Remove it from uhci->urb_list */ + list_del_init(&urbp->urb_list); + + uhci_add_complete(uhci, urb); + +out: + spin_unlock_irqrestore(&urb->lock, flags); +} + +/* + * MUST be called with urb->lock acquired + */ +static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb) +{ + struct list_head *head, *tmp; + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + int prevactive = 1; + + /* We can get called when urbp allocation fails, so check */ + if (!urbp) + return; + + uhci_dec_fsbr(uhci, urb); /* Safe since it checks */ + + /* + * Now we need to find out what the last successful toggle was + * so we can update the local data toggle for the next transfer + * + * There's 3 way's the last successful completed TD is found: + * + * 1) The TD is NOT active and the actual length < expected length + * 2) The TD is NOT active and it's the last TD in the chain + * 3) The TD is active and the previous TD is NOT active + * + * Control and Isochronous ignore the toggle, so this is safe + * for all types + */ + head = &urbp->td_list; + tmp = head->next; + while (tmp != head) { + struct uhci_td *td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + if (!(td_status(td) & TD_CTRL_ACTIVE) && + (uhci_actual_length(td_status(td)) < uhci_expected_length(td_token(td)) || + tmp == head)) + usb_settoggle(urb->dev, uhci_endpoint(td_token(td)), + uhci_packetout(td_token(td)), + uhci_toggle(td_token(td)) ^ 1); + else if ((td_status(td) & TD_CTRL_ACTIVE) && !prevactive) + usb_settoggle(urb->dev, uhci_endpoint(td_token(td)), + uhci_packetout(td_token(td)), + uhci_toggle(td_token(td))); + + prevactive = td_status(td) & TD_CTRL_ACTIVE; + } + + uhci_delete_queued_urb(uhci, urb); + + /* The interrupt loop will reclaim the QH's */ + uhci_remove_qh(uhci, urbp->qh); + urbp->qh = NULL; +} + +static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + unsigned long flags; + struct urb_priv *urbp = urb->hcpriv; + + /* If this is an interrupt URB that is being killed in urb->complete, */ + /* then just set its status and return */ + if (!urbp) { + urb->status = -ECONNRESET; + return 0; + } + + spin_lock_irqsave(&uhci->urb_list_lock, flags); + + list_del_init(&urbp->urb_list); + + uhci_unlink_generic(uhci, urb); + + spin_lock(&uhci->urb_remove_list_lock); + + /* If we're the first, set the next interrupt bit */ + if (list_empty(&uhci->urb_remove_list)) + uhci_set_next_interrupt(uhci); + list_add(&urbp->urb_list, &uhci->urb_remove_list); + + spin_unlock(&uhci->urb_remove_list_lock); + spin_unlock_irqrestore(&uhci->urb_list_lock, flags); + return 0; +} + +static int uhci_fsbr_timeout(struct uhci_hcd *uhci, struct urb *urb) +{ + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + struct list_head *head, *tmp; + int count = 0; + + uhci_dec_fsbr(uhci, urb); + + urbp->fsbr_timeout = 1; + + /* + * Ideally we would want to fix qh->element as well, but it's + * read/write by the HC, so that can introduce a race. It's not + * really worth the hassle + */ + + head = &urbp->td_list; + tmp = head->next; + while (tmp != head) { + struct uhci_td *td = list_entry(tmp, struct uhci_td, list); + + tmp = tmp->next; + + /* + * Make sure we don't do the last one (since it'll have the + * TERM bit set) as well as we skip every so many TD's to + * make sure it doesn't hog the bandwidth + */ + if (tmp != head && (count % DEPTH_INTERVAL) == (DEPTH_INTERVAL - 1)) + td->link |= UHCI_PTR_DEPTH; + + count++; + } + + return 0; +} + +/* + * uhci_get_current_frame_number() + * + * returns the current frame number for a USB bus/controller. + */ +static int uhci_get_current_frame_number(struct uhci_hcd *uhci) +{ + return inw(uhci->io_addr + USBFRNUM); +} + +static int init_stall_timer(struct usb_hcd *hcd); + +static void stall_callback(unsigned long ptr) +{ + struct usb_hcd *hcd = (struct usb_hcd *)ptr; + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + struct list_head list, *tmp, *head; + unsigned long flags; + + INIT_LIST_HEAD(&list); + + spin_lock_irqsave(&uhci->urb_list_lock, flags); + head = &uhci->urb_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *up = list_entry(tmp, struct urb_priv, urb_list); + struct urb *u = up->urb; + + tmp = tmp->next; + + spin_lock(&u->lock); + + /* Check if the FSBR timed out */ + if (up->fsbr && !up->fsbr_timeout && time_after_eq(jiffies, up->fsbrtime + IDLE_TIMEOUT)) + uhci_fsbr_timeout(uhci, u); + + /* Check if the URB timed out */ + if (u->timeout && time_after_eq(jiffies, up->inserttime + u->timeout)) + list_move_tail(&up->urb_list, &list); + + spin_unlock(&u->lock); + } + spin_unlock_irqrestore(&uhci->urb_list_lock, flags); + + head = &list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *up = list_entry(tmp, struct urb_priv, urb_list); + struct urb *u = up->urb; + + tmp = tmp->next; + + uhci_urb_dequeue(hcd, u); + } + + /* Really disable FSBR */ + if (!uhci->fsbr && uhci->fsbrtimeout && time_after_eq(jiffies, uhci->fsbrtimeout)) { + uhci->fsbrtimeout = 0; + uhci->skel_term_qh->link = UHCI_PTR_TERM; + } + + /* Poll for and perform state transitions */ + hc_state_transitions(uhci); + + init_stall_timer(hcd); +} + +static int init_stall_timer(struct usb_hcd *hcd) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + + init_timer(&uhci->stall_timer); + uhci->stall_timer.function = stall_callback; + uhci->stall_timer.data = (unsigned long)hcd; + uhci->stall_timer.expires = jiffies + (HZ / 10); + add_timer(&uhci->stall_timer); + + return 0; +} + +static void uhci_free_pending_qhs(struct uhci_hcd *uhci) +{ + struct list_head *tmp, *head; + unsigned long flags; + + spin_lock_irqsave(&uhci->qh_remove_list_lock, flags); + head = &uhci->qh_remove_list; + tmp = head->next; + while (tmp != head) { + struct uhci_qh *qh = list_entry(tmp, struct uhci_qh, remove_list); + + tmp = tmp->next; + + list_del_init(&qh->remove_list); + + uhci_free_qh(uhci, qh); + } + spin_unlock_irqrestore(&uhci->qh_remove_list_lock, flags); +} + +static void uhci_finish_urb(struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs) +{ + struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + int status; + unsigned long flags; + + spin_lock_irqsave(&urb->lock, flags); + status = urbp->status; + uhci_destroy_urb_priv(uhci, urb); + + if (urb->status != -ENOENT && urb->status != -ECONNRESET) + urb->status = status; + spin_unlock_irqrestore(&urb->lock, flags); + + usb_hcd_giveback_urb(hcd, urb, regs); +} + +static void uhci_finish_completion(struct usb_hcd *hcd, struct pt_regs *regs) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + struct list_head *tmp, *head; + unsigned long flags; + + spin_lock_irqsave(&uhci->complete_list_lock, flags); + head = &uhci->complete_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *urbp = list_entry(tmp, struct urb_priv, complete_list); + struct urb *urb = urbp->urb; + + list_del_init(&urbp->complete_list); + spin_unlock_irqrestore(&uhci->complete_list_lock, flags); + + uhci_finish_urb(hcd, urb, regs); + + spin_lock_irqsave(&uhci->complete_list_lock, flags); + head = &uhci->complete_list; + tmp = head->next; + } + spin_unlock_irqrestore(&uhci->complete_list_lock, flags); +} + +static void uhci_remove_pending_qhs(struct uhci_hcd *uhci) +{ + struct list_head *tmp, *head; + unsigned long flags; + + spin_lock_irqsave(&uhci->urb_remove_list_lock, flags); + head = &uhci->urb_remove_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *urbp = list_entry(tmp, struct urb_priv, urb_list); + struct urb *urb = urbp->urb; + + tmp = tmp->next; + + list_del_init(&urbp->urb_list); + + urbp->status = urb->status = -ECONNRESET; + + uhci_add_complete(uhci, urb); + } + spin_unlock_irqrestore(&uhci->urb_remove_list_lock, flags); +} + +static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + unsigned int io_addr = uhci->io_addr; + unsigned short status; + struct list_head *tmp, *head; + + /* + * Read the interrupt status, and write it back to clear the + * interrupt cause + */ + status = inw(io_addr + USBSTS); + if (!status) /* shared interrupt, not mine */ + return; + outw(status, io_addr + USBSTS); /* Clear it */ + + if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) { + if (status & USBSTS_HSE) + err("%x: host system error, PCI problems?", io_addr); + if (status & USBSTS_HCPE) + err("%x: host controller process error. something bad happened", io_addr); + if ((status & USBSTS_HCH) && uhci->state > 0) { + err("%x: host controller halted. very bad", io_addr); + /* FIXME: Reset the controller, fix the offending TD */ + } + } + + if (status & USBSTS_RD) + uhci->resume_detect = 1; + + uhci_free_pending_qhs(uhci); + + uhci_remove_pending_qhs(uhci); + + uhci_clear_next_interrupt(uhci); + + /* Walk the list of pending URB's to see which ones completed */ + spin_lock(&uhci->urb_list_lock); + head = &uhci->urb_list; + tmp = head->next; + while (tmp != head) { + struct urb_priv *urbp = list_entry(tmp, struct urb_priv, urb_list); + struct urb *urb = urbp->urb; + + tmp = tmp->next; + + /* Checks the status and does all of the magic necessary */ + uhci_transfer_result(uhci, urb); + } + spin_unlock(&uhci->urb_list_lock); + + uhci_finish_completion(hcd, regs); +} + +static void reset_hc(struct uhci_hcd *uhci) +{ + unsigned int io_addr = uhci->io_addr; + + /* Global reset for 50ms */ + uhci->state = UHCI_RESET; + outw(USBCMD_GRESET, io_addr + USBCMD); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout((HZ*50+999) / 1000); + set_current_state(TASK_RUNNING); + outw(0, io_addr + USBCMD); + + /* Another 10ms delay */ + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout((HZ*10+999) / 1000); + set_current_state(TASK_RUNNING); + uhci->resume_detect = 0; +} + +static void suspend_hc(struct uhci_hcd *uhci) +{ + unsigned int io_addr = uhci->io_addr; + + dbg("%x: suspend_hc", io_addr); + uhci->state = UHCI_SUSPENDED; + uhci->resume_detect = 0; + outw(USBCMD_EGSM, io_addr + USBCMD); +} + +static void wakeup_hc(struct uhci_hcd *uhci) +{ + unsigned int io_addr = uhci->io_addr; + + switch (uhci->state) { + case UHCI_SUSPENDED: /* Start the resume */ + dbg("%x: wakeup_hc", io_addr); + + /* Global resume for >= 20ms */ + outw(USBCMD_FGR | USBCMD_EGSM, io_addr + USBCMD); + uhci->state = UHCI_RESUMING_1; + uhci->state_end = jiffies + (20*HZ+999) / 1000; + break; + + case UHCI_RESUMING_1: /* End global resume */ + uhci->state = UHCI_RESUMING_2; + outw(0, io_addr + USBCMD); + /* Falls through */ + + case UHCI_RESUMING_2: /* Wait for EOP to be sent */ + if (inw(io_addr + USBCMD) & USBCMD_FGR) + break; + + /* Run for at least 1 second, and + * mark it configured with a 64-byte max packet */ + uhci->state = UHCI_RUNNING_GRACE; + uhci->state_end = jiffies + HZ; + outw(USBCMD_RS | USBCMD_CF | USBCMD_MAXP, + io_addr + USBCMD); + break; + + case UHCI_RUNNING_GRACE: /* Now allowed to suspend */ + uhci->state = UHCI_RUNNING; + break; + + default: + break; + } +} + +static int ports_active(struct uhci_hcd *uhci) +{ + unsigned int io_addr = uhci->io_addr; + int connection = 0; + int i; + + for (i = 0; i < uhci->rh_numports; i++) + connection |= (inw(io_addr + USBPORTSC1 + i * 2) & USBPORTSC_CCS); + + return connection; +} + +static int suspend_allowed(struct uhci_hcd *uhci) +{ + unsigned int io_addr = uhci->io_addr; + int i; + + if (!uhci->hcd.pdev || + uhci->hcd.pdev->vendor != PCI_VENDOR_ID_INTEL || + uhci->hcd.pdev->device != PCI_DEVICE_ID_INTEL_82371AB_2) + return 1; + + /* This is a 82371AB/EB/MB USB controller which has a bug that + * causes false resume indications if any port has an + * over current condition. To prevent problems, we will not + * allow a global suspend if any ports are OC. + * + * Some motherboards using the 82371AB/EB/MB (but not the USB portion) + * appear to hardwire the over current inputs active to disable + * the USB ports. + */ + + /* check for over current condition on any port */ + for (i = 0; i < uhci->rh_numports; i++) { + if (inw(io_addr + USBPORTSC1 + i * 2) & USBPORTSC_OC) + return 0; + } + + return 1; +} + +static void hc_state_transitions(struct uhci_hcd *uhci) +{ + switch (uhci->state) { + case UHCI_RUNNING: + + /* global suspend if nothing connected for 1 second */ + if (!ports_active(uhci) && suspend_allowed(uhci)) { + uhci->state = UHCI_SUSPENDING_GRACE; + uhci->state_end = jiffies + HZ; + } + break; + + case UHCI_SUSPENDING_GRACE: + if (ports_active(uhci)) + uhci->state = UHCI_RUNNING; + else if (time_after_eq(jiffies, uhci->state_end)) + suspend_hc(uhci); + break; + + case UHCI_SUSPENDED: + + /* wakeup if requested by a device */ + if (uhci->resume_detect) + wakeup_hc(uhci); + break; + + case UHCI_RESUMING_1: + case UHCI_RESUMING_2: + case UHCI_RUNNING_GRACE: + if (time_after_eq(jiffies, uhci->state_end)) + wakeup_hc(uhci); + break; + + default: + break; + } +} + +static void start_hc(struct uhci_hcd *uhci) +{ + unsigned int io_addr = uhci->io_addr; + int timeout = 1000; + + /* + * Reset the HC - this will force us to get a + * new notification of any already connected + * ports due to the virtual disconnect that it + * implies. + */ + outw(USBCMD_HCRESET, io_addr + USBCMD); + while (inw(io_addr + USBCMD) & USBCMD_HCRESET) { + if (!--timeout) { + printk(KERN_ERR "uhci: USBCMD_HCRESET timed out!\n"); + break; + } + } + + /* Turn on all interrupts */ + outw(USBINTR_TIMEOUT | USBINTR_RESUME | USBINTR_IOC | USBINTR_SP, + io_addr + USBINTR); + + /* Start at frame 0 */ + outw(0, io_addr + USBFRNUM); + outl(uhci->fl->dma_handle, io_addr + USBFLBASEADD); + + /* Run and mark it configured with a 64-byte max packet */ + uhci->state = UHCI_RUNNING_GRACE; + uhci->state_end = jiffies + HZ; + outw(USBCMD_RS | USBCMD_CF | USBCMD_MAXP, io_addr + USBCMD); + + uhci->hcd.state = USB_STATE_READY; +} + +/* + * De-allocate all resources.. + */ +static void release_uhci(struct uhci_hcd *uhci) +{ + int i; + + for (i = 0; i < UHCI_NUM_SKELQH; i++) + if (uhci->skelqh[i]) { + uhci_free_qh(uhci, uhci->skelqh[i]); + uhci->skelqh[i] = NULL; + } + + if (uhci->term_td) { + uhci_free_td(uhci, uhci->term_td); + uhci->term_td = NULL; + } + + if (uhci->qh_pool) { + pci_pool_destroy(uhci->qh_pool); + uhci->qh_pool = NULL; + } + + if (uhci->td_pool) { + pci_pool_destroy(uhci->td_pool); + uhci->td_pool = NULL; + } + + if (uhci->fl) { + pci_free_consistent(uhci->hcd.pdev, sizeof(*uhci->fl), uhci->fl, uhci->fl->dma_handle); + uhci->fl = NULL; + } + +#ifdef CONFIG_PROC_FS + if (uhci->proc_entry) { + remove_proc_entry(uhci->hcd.self.bus_name, uhci_proc_root); + uhci->proc_entry = NULL; + } +#endif +} + +/* + * Allocate a frame list, and then setup the skeleton + * + * The hardware doesn't really know any difference + * in the queues, but the order does matter for the + * protocols higher up. The order is: + * + * - any isochronous events handled before any + * of the queues. We don't do that here, because + * we'll create the actual TD entries on demand. + * - The first queue is the interrupt queue. + * - The second queue is the control queue, split into low and high speed + * - The third queue is bulk queue. + * - The fourth queue is the bandwidth reclamation queue, which loops back + * to the high speed control queue. + */ +static int __devinit uhci_start(struct usb_hcd *hcd) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + int retval = -EBUSY; + int i, port; + unsigned io_size; + dma_addr_t dma_handle; + struct usb_device *udev; +#ifdef CONFIG_PROC_FS + struct proc_dir_entry *ent; +#endif + + uhci->io_addr = (unsigned long) hcd->regs; + io_size = pci_resource_len(hcd->pdev, hcd->region); + +#ifdef CONFIG_PROC_FS + ent = create_proc_entry(hcd->self.bus_name, S_IFREG|S_IRUGO|S_IWUSR, uhci_proc_root); + if (!ent) { + err("couldn't create uhci proc entry"); + retval = -ENOMEM; + goto err_create_proc_entry; + } + + ent->data = uhci; + ent->proc_fops = &uhci_proc_operations; + ent->size = 0; + uhci->proc_entry = ent; +#endif + + /* Reset here so we don't get any interrupts from an old setup */ + /* or broken setup */ + reset_hc(uhci); + + uhci->fsbr = 0; + uhci->fsbrtimeout = 0; + + spin_lock_init(&uhci->qh_remove_list_lock); + INIT_LIST_HEAD(&uhci->qh_remove_list); + + spin_lock_init(&uhci->urb_remove_list_lock); + INIT_LIST_HEAD(&uhci->urb_remove_list); + + spin_lock_init(&uhci->urb_list_lock); + INIT_LIST_HEAD(&uhci->urb_list); + + spin_lock_init(&uhci->complete_list_lock); + INIT_LIST_HEAD(&uhci->complete_list); + + spin_lock_init(&uhci->frame_list_lock); + + uhci->fl = pci_alloc_consistent(hcd->pdev, sizeof(*uhci->fl), &dma_handle); + if (!uhci->fl) { + err("unable to allocate consistent memory for frame list"); + goto err_alloc_fl; + } + + memset((void *)uhci->fl, 0, sizeof(*uhci->fl)); + + uhci->fl->dma_handle = dma_handle; + + uhci->td_pool = pci_pool_create("uhci_td", hcd->pdev, + sizeof(struct uhci_td), 16, 0); + if (!uhci->td_pool) { + err("unable to create td pci_pool"); + goto err_create_td_pool; + } + + uhci->qh_pool = pci_pool_create("uhci_qh", hcd->pdev, + sizeof(struct uhci_qh), 16, 0); + if (!uhci->qh_pool) { + err("unable to create qh pci_pool"); + goto err_create_qh_pool; + } + + /* Initialize the root hub */ + + /* UHCI specs says devices must have 2 ports, but goes on to say */ + /* they may have more but give no way to determine how many they */ + /* have. However, according to the UHCI spec, Bit 7 is always set */ + /* to 1. So we try to use this to our advantage */ + for (port = 0; port < (io_size - 0x10) / 2; port++) { + unsigned int portstatus; + + portstatus = inw(uhci->io_addr + 0x10 + (port * 2)); + if (!(portstatus & 0x0080)) + break; + } + if (debug) + info("detected %d ports", port); + + /* This is experimental so anything less than 2 or greater than 8 is */ + /* something weird and we'll ignore it */ + if (port < 2 || port > 8) { + info("port count misdetected? forcing to 2 ports"); + port = 2; + } + + uhci->rh_numports = port; + + hcd->self.root_hub = udev = usb_alloc_dev(NULL, &hcd->self); + if (!udev) { + err("unable to allocate root hub"); + goto err_alloc_root_hub; + } + + uhci->term_td = uhci_alloc_td(uhci, udev); + if (!uhci->term_td) { + err("unable to allocate terminating TD"); + goto err_alloc_term_td; + } + + for (i = 0; i < UHCI_NUM_SKELQH; i++) { + uhci->skelqh[i] = uhci_alloc_qh(uhci, udev); + if (!uhci->skelqh[i]) { + err("unable to allocate QH %d", i); + goto err_alloc_skelqh; + } + } + + /* + * 8 Interrupt queues; link int2 to int1, int4 to int2, etc + * then link int1 to control and control to bulk + */ + uhci->skel_int128_qh->link = cpu_to_le32(uhci->skel_int64_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_int64_qh->link = cpu_to_le32(uhci->skel_int32_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_int32_qh->link = cpu_to_le32(uhci->skel_int16_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_int16_qh->link = cpu_to_le32(uhci->skel_int8_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_int8_qh->link = cpu_to_le32(uhci->skel_int4_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_int4_qh->link = cpu_to_le32(uhci->skel_int2_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_int2_qh->link = cpu_to_le32(uhci->skel_int1_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_int1_qh->link = cpu_to_le32(uhci->skel_ls_control_qh->dma_handle) | UHCI_PTR_QH; + + uhci->skel_ls_control_qh->link = cpu_to_le32(uhci->skel_hs_control_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_hs_control_qh->link = cpu_to_le32(uhci->skel_bulk_qh->dma_handle) | UHCI_PTR_QH; + uhci->skel_bulk_qh->link = cpu_to_le32(uhci->skel_term_qh->dma_handle) | UHCI_PTR_QH; + + /* This dummy TD is to work around a bug in Intel PIIX controllers */ + uhci_fill_td(uhci->term_td, 0, (UHCI_NULL_DATA_SIZE << 21) | + (0x7f << TD_TOKEN_DEVADDR_SHIFT) | USB_PID_IN, 0); + uhci->term_td->link = cpu_to_le32(uhci->term_td->dma_handle); + + uhci->skel_term_qh->link = UHCI_PTR_TERM; + uhci->skel_term_qh->element = cpu_to_le32(uhci->term_td->dma_handle); + + /* + * Fill the frame list: make all entries point to + * the proper interrupt queue. + * + * This is probably silly, but it's a simple way to + * scatter the interrupt queues in a way that gives + * us a reasonable dynamic range for irq latencies. + */ + for (i = 0; i < UHCI_NUMFRAMES; i++) { + int irq = 0; + + if (i & 1) { + irq++; + if (i & 2) { + irq++; + if (i & 4) { + irq++; + if (i & 8) { + irq++; + if (i & 16) { + irq++; + if (i & 32) { + irq++; + if (i & 64) + irq++; + } + } + } + } + } + } + + /* Only place we don't use the frame list routines */ + uhci->fl->frame[i] = cpu_to_le32(uhci->skelqh[7 - irq]->dma_handle); + } + + start_hc(uhci); + + init_stall_timer(hcd); + + /* disable legacy emulation */ + pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT); + + usb_connect(udev); + udev->speed = USB_SPEED_FULL; + + if (usb_register_root_hub(udev, &hcd->pdev->dev) != 0) { + err("unable to start root hub"); + retval = -ENOMEM; + goto err_start_root_hub; + } + + return 0; + +/* + * error exits: + */ +err_start_root_hub: + reset_hc(uhci); + + del_timer_sync(&uhci->stall_timer); + +err_alloc_skelqh: + for (i = 0; i < UHCI_NUM_SKELQH; i++) + if (uhci->skelqh[i]) { + uhci_free_qh(uhci, uhci->skelqh[i]); + uhci->skelqh[i] = NULL; + } + + uhci_free_td(uhci, uhci->term_td); + uhci->term_td = NULL; + +err_alloc_term_td: + usb_put_dev(udev); + hcd->self.root_hub = NULL; + +err_alloc_root_hub: + pci_pool_destroy(uhci->qh_pool); + uhci->qh_pool = NULL; + +err_create_qh_pool: + pci_pool_destroy(uhci->td_pool); + uhci->td_pool = NULL; + +err_create_td_pool: + pci_free_consistent(hcd->pdev, sizeof(*uhci->fl), uhci->fl, uhci->fl->dma_handle); + uhci->fl = NULL; + +err_alloc_fl: +#ifdef CONFIG_PROC_FS + remove_proc_entry(hcd->self.bus_name, uhci_proc_root); + uhci->proc_entry = NULL; + +err_create_proc_entry: +#endif + + return retval; +} + +static void uhci_stop(struct usb_hcd *hcd) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + + del_timer_sync(&uhci->stall_timer); + + /* + * At this point, we're guaranteed that no new connects can be made + * to this bus since there are no more parents + */ + uhci_free_pending_qhs(uhci); + uhci_remove_pending_qhs(uhci); + + reset_hc(uhci); + + uhci_free_pending_qhs(uhci); + + release_uhci(uhci); +} + +#ifdef CONFIG_PM +static int uhci_suspend(struct usb_hcd *hcd, u32 state) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + + /* Don't try to suspend broken motherboards, reset instead */ + if (suspend_allowed(uhci)) + suspend_hc(uhci); + else + reset_hc(uhci); + return 0; +} + +static int uhci_resume(struct usb_hcd *hcd) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + + pci_set_master(uhci->hcd.pdev); + + if (uhci->state == UHCI_SUSPENDED) + uhci->resume_detect = 1; + else { + reset_hc(uhci); + start_hc(uhci); + } + uhci->hcd.state = USB_STATE_READY; + return 0; +} +#endif + +static struct usb_hcd *uhci_hcd_alloc(void) +{ + struct uhci_hcd *uhci; + + uhci = (struct uhci_hcd *)kmalloc(sizeof(*uhci), GFP_KERNEL); + if (!uhci) + return NULL; + + memset(uhci, 0, sizeof(*uhci)); + return &uhci->hcd; +} + +static void uhci_hcd_free(struct usb_hcd *hcd) +{ + kfree(hcd_to_uhci(hcd)); +} + +static int uhci_hcd_get_frame_number(struct usb_hcd *hcd) +{ + return uhci_get_current_frame_number(hcd_to_uhci(hcd)); +} + +static const char hcd_name[] = "uhci-hcd"; + +static const struct hc_driver uhci_driver = { + .description = hcd_name, + + /* Generic hardware linkage */ + .irq = uhci_irq, + .flags = HCD_USB11, + + /* Basic lifecycle operations */ + .start = uhci_start, +#ifdef CONFIG_PM + .suspend = uhci_suspend, + .resume = uhci_resume, +#endif + .stop = uhci_stop, + + .hcd_alloc = uhci_hcd_alloc, + .hcd_free = uhci_hcd_free, + + .urb_enqueue = uhci_urb_enqueue, + .urb_dequeue = uhci_urb_dequeue, + + .get_frame_number = uhci_hcd_get_frame_number, + + .hub_status_data = uhci_hub_status_data, + .hub_control = uhci_hub_control, +}; + +const struct pci_device_id __devinitdata uhci_pci_ids[] = { { + + /* handle any USB UHCI controller */ + .class = ((PCI_CLASS_SERIAL_USB << 8) | 0x00), + .class_mask = ~0, + .driver_data = (unsigned long) &uhci_driver, + + /* no matter who makes it */ + .vendor = PCI_ANY_ID, + .device = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + + }, { /* end: all zeroes */ } +}; + +MODULE_DEVICE_TABLE(pci, uhci_pci_ids); + +struct pci_driver uhci_pci_driver = { + .name = (char *)hcd_name, + .id_table = uhci_pci_ids, + + .probe = usb_hcd_pci_probe, + .remove = usb_hcd_pci_remove, + +#ifdef CONFIG_PM + .suspend = usb_hcd_pci_suspend, + .resume = usb_hcd_pci_resume, +#endif /* PM */ +}; + +int __init uhci_hcd_init(void) +{ + int retval = -ENOMEM; + + info(DRIVER_DESC " " DRIVER_VERSION); + + if (usb_disabled()) + return -ENODEV; + + if (debug) { + errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL); + if (!errbuf) + goto errbuf_failed; + } + +#ifdef CONFIG_PROC_FS + uhci_proc_root = create_proc_entry("driver/uhci", S_IFDIR, 0); + if (!uhci_proc_root) + goto proc_failed; +#endif + + uhci_up_cachep = kmem_cache_create("uhci_urb_priv", + sizeof(struct urb_priv), 0, 0, NULL, NULL); + if (!uhci_up_cachep) + goto up_failed; + + retval = pci_module_init(&uhci_pci_driver); + if (retval) + goto init_failed; + + return 0; + +init_failed: + if (kmem_cache_destroy(uhci_up_cachep)) + printk(KERN_INFO "uhci: not all urb_priv's were freed\n"); + +up_failed: + +#ifdef CONFIG_PROC_FS + remove_proc_entry("driver/uhci", 0); + +proc_failed: +#endif + if (errbuf) + kfree(errbuf); + +errbuf_failed: + + return retval; +} + +void __exit uhci_hcd_cleanup(void) +{ + pci_unregister_driver(&uhci_pci_driver); + + if (kmem_cache_destroy(uhci_up_cachep)) + printk(KERN_INFO "uhci: not all urb_priv's were freed\n"); + +#ifdef CONFIG_PROC_FS + remove_proc_entry("driver/uhci", 0); +#endif + + if (errbuf) + kfree(errbuf); +} + +module_init(uhci_hcd_init); +module_exit(uhci_hcd_cleanup); + +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); + diff --git a/reactos/drivers/usb/cromwell/uhci/uhci-hcd.h b/reactos/drivers/usb/cromwell/uhci/uhci-hcd.h new file mode 100644 index 00000000000..19036389901 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci-hcd.h @@ -0,0 +1,419 @@ +#ifndef __LINUX_UHCI_HCD_H +#define __LINUX_UHCI_HCD_H + +#if 0 +#include +#include +#endif + +#define usb_packetid(pipe) (usb_pipein(pipe) ? USB_PID_IN : USB_PID_OUT) +#define PIPE_DEVEP_MASK 0x0007ff00 + +/* + * Universal Host Controller Interface data structures and defines + */ + +/* Command register */ +#define USBCMD 0 +#define USBCMD_RS 0x0001 /* Run/Stop */ +#define USBCMD_HCRESET 0x0002 /* Host reset */ +#define USBCMD_GRESET 0x0004 /* Global reset */ +#define USBCMD_EGSM 0x0008 /* Global Suspend Mode */ +#define USBCMD_FGR 0x0010 /* Force Global Resume */ +#define USBCMD_SWDBG 0x0020 /* SW Debug mode */ +#define USBCMD_CF 0x0040 /* Config Flag (sw only) */ +#define USBCMD_MAXP 0x0080 /* Max Packet (0 = 32, 1 = 64) */ + +/* Status register */ +#define USBSTS 2 +#define USBSTS_USBINT 0x0001 /* Interrupt due to IOC */ +#define USBSTS_ERROR 0x0002 /* Interrupt due to error */ +#define USBSTS_RD 0x0004 /* Resume Detect */ +#define USBSTS_HSE 0x0008 /* Host System Error - basically PCI problems */ +#define USBSTS_HCPE 0x0010 /* Host Controller Process Error - the scripts were buggy */ +#define USBSTS_HCH 0x0020 /* HC Halted */ + +/* Interrupt enable register */ +#define USBINTR 4 +#define USBINTR_TIMEOUT 0x0001 /* Timeout/CRC error enable */ +#define USBINTR_RESUME 0x0002 /* Resume interrupt enable */ +#define USBINTR_IOC 0x0004 /* Interrupt On Complete enable */ +#define USBINTR_SP 0x0008 /* Short packet interrupt enable */ + +#define USBFRNUM 6 +#define USBFLBASEADD 8 +#define USBSOF 12 + +/* USB port status and control registers */ +#define USBPORTSC1 16 +#define USBPORTSC2 18 +#define USBPORTSC_CCS 0x0001 /* Current Connect Status ("device present") */ +#define USBPORTSC_CSC 0x0002 /* Connect Status Change */ +#define USBPORTSC_PE 0x0004 /* Port Enable */ +#define USBPORTSC_PEC 0x0008 /* Port Enable Change */ +#define USBPORTSC_LS 0x0030 /* Line Status */ +#define USBPORTSC_RD 0x0040 /* Resume Detect */ +#define USBPORTSC_LSDA 0x0100 /* Low Speed Device Attached */ +#define USBPORTSC_PR 0x0200 /* Port Reset */ +#define USBPORTSC_OC 0x0400 /* Over Current condition */ +#define USBPORTSC_SUSP 0x1000 /* Suspend */ + +/* Legacy support register */ +#define USBLEGSUP 0xc0 +#define USBLEGSUP_DEFAULT 0x2000 /* only PIRQ enable set */ + +#define UHCI_NULL_DATA_SIZE 0x7FF /* for UHCI controller TD */ + +#define UHCI_PTR_BITS cpu_to_le32(0x000F) +#define UHCI_PTR_TERM cpu_to_le32(0x0001) +#define UHCI_PTR_QH cpu_to_le32(0x0002) +#define UHCI_PTR_DEPTH cpu_to_le32(0x0004) +#define UHCI_PTR_BREADTH cpu_to_le32(0x0000) + +#define UHCI_NUMFRAMES 1024 /* in the frame list [array] */ +#define UHCI_MAX_SOF_NUMBER 2047 /* in an SOF packet */ +#define CAN_SCHEDULE_FRAMES 1000 /* how far future frames can be scheduled */ + +struct uhci_frame_list { + __u32 frame[UHCI_NUMFRAMES]; + + void *frame_cpu[UHCI_NUMFRAMES]; + + dma_addr_t dma_handle; +}; + +struct urb_priv; + +/* + * One role of a QH is to hold a queue of TDs for some endpoint. Each QH is + * used with one URB, and qh->element (updated by the HC) is either: + * - the next unprocessed TD for the URB, or + * - UHCI_PTR_TERM (when there's no more traffic for this endpoint), or + * - the QH for the next URB queued to the same endpoint. + * + * The other role of a QH is to serve as a "skeleton" framelist entry, so we + * can easily splice a QH for some endpoint into the schedule at the right + * place. Then qh->element is UHCI_PTR_TERM. + * + * In the frame list, qh->link maintains a list of QHs seen by the HC: + * skel1 --> ep1-qh --> ep2-qh --> ... --> skel2 --> ... + */ +struct uhci_qh { + /* Hardware fields */ + __u32 link; /* Next queue */ + __u32 element; /* Queue element pointer */ + + /* Software fields */ + dma_addr_t dma_handle; + + struct usb_device *dev; + struct urb_priv *urbp; + + struct list_head list; /* P: uhci->frame_list_lock */ + struct list_head remove_list; /* P: uhci->remove_list_lock */ +} __attribute__((aligned(16))); + +/* + * for TD : + */ +#define td_status(td) le32_to_cpu((td)->status) +#define TD_CTRL_SPD (1 << 29) /* Short Packet Detect */ +#define TD_CTRL_C_ERR_MASK (3 << 27) /* Error Counter bits */ +#define TD_CTRL_C_ERR_SHIFT 27 +#define TD_CTRL_LS (1 << 26) /* Low Speed Device */ +#define TD_CTRL_IOS (1 << 25) /* Isochronous Select */ +#define TD_CTRL_IOC (1 << 24) /* Interrupt on Complete */ +#define TD_CTRL_ACTIVE (1 << 23) /* TD Active */ +#define TD_CTRL_STALLED (1 << 22) /* TD Stalled */ +#define TD_CTRL_DBUFERR (1 << 21) /* Data Buffer Error */ +#define TD_CTRL_BABBLE (1 << 20) /* Babble Detected */ +#define TD_CTRL_NAK (1 << 19) /* NAK Received */ +#define TD_CTRL_CRCTIMEO (1 << 18) /* CRC/Time Out Error */ +#define TD_CTRL_BITSTUFF (1 << 17) /* Bit Stuff Error */ +#define TD_CTRL_ACTLEN_MASK 0x7FF /* actual length, encoded as n - 1 */ + +#define TD_CTRL_ANY_ERROR (TD_CTRL_STALLED | TD_CTRL_DBUFERR | \ + TD_CTRL_BABBLE | TD_CTRL_CRCTIME | TD_CTRL_BITSTUFF) + +#define uhci_maxerr(err) ((err) << TD_CTRL_C_ERR_SHIFT) +#define uhci_status_bits(ctrl_sts) ((ctrl_sts) & 0xFE0000) +#define uhci_actual_length(ctrl_sts) (((ctrl_sts) + 1) & TD_CTRL_ACTLEN_MASK) /* 1-based */ + +/* + * for TD : (a.k.a. Token) + */ +#define td_token(td) le32_to_cpu((td)->token) +#define TD_TOKEN_DEVADDR_SHIFT 8 +#define TD_TOKEN_TOGGLE_SHIFT 19 +#define TD_TOKEN_TOGGLE (1 << 19) +#define TD_TOKEN_EXPLEN_SHIFT 21 +#define TD_TOKEN_EXPLEN_MASK 0x7FF /* expected length, encoded as n - 1 */ +#define TD_TOKEN_PID_MASK 0xFF + +#define uhci_explen(len) ((len) << TD_TOKEN_EXPLEN_SHIFT) + +#define uhci_expected_length(token) ((((token) >> 21) + 1) & TD_TOKEN_EXPLEN_MASK) +#define uhci_toggle(token) (((token) >> TD_TOKEN_TOGGLE_SHIFT) & 1) +#define uhci_endpoint(token) (((token) >> 15) & 0xf) +#define uhci_devaddr(token) (((token) >> TD_TOKEN_DEVADDR_SHIFT) & 0x7f) +#define uhci_devep(token) (((token) >> TD_TOKEN_DEVADDR_SHIFT) & 0x7ff) +#define uhci_packetid(token) ((token) & TD_TOKEN_PID_MASK) +#define uhci_packetout(token) (uhci_packetid(token) != USB_PID_IN) +#define uhci_packetin(token) (uhci_packetid(token) == USB_PID_IN) + +/* + * The documentation says "4 words for hardware, 4 words for software". + * + * That's silly, the hardware doesn't care. The hardware only cares that + * the hardware words are 16-byte aligned, and we can have any amount of + * sw space after the TD entry as far as I can tell. + * + * But let's just go with the documentation, at least for 32-bit machines. + * On 64-bit machines we probably want to take advantage of the fact that + * hw doesn't really care about the size of the sw-only area. + * + * Alas, not anymore, we have more than 4 words for software, woops. + * Everything still works tho, surprise! -jerdfelt + * + * td->link points to either another TD (not necessarily for the same urb or + * even the same endpoint), or nothing (PTR_TERM), or a QH (for queued urbs) + */ +struct uhci_td { + /* Hardware fields */ + __u32 link; + __u32 status; + __u32 token; + __u32 buffer; + + /* Software fields */ + dma_addr_t dma_handle; + + struct usb_device *dev; + struct urb *urb; + + struct list_head list; /* P: urb->lock */ + + int frame; /* for iso: what frame? */ + struct list_head fl_list; /* P: uhci->frame_list_lock */ +} __attribute__((aligned(16))); + +/* + * The UHCI driver places Interrupt, Control and Bulk into QH's both + * to group together TD's for one transfer, and also to faciliate queuing + * of URB's. To make it easy to insert entries into the schedule, we have + * a skeleton of QH's for each predefined Interrupt latency, low speed + * control, high speed control and terminating QH (see explanation for + * the terminating QH below). + * + * When we want to add a new QH, we add it to the end of the list for the + * skeleton QH. + * + * For instance, the queue can look like this: + * + * skel int128 QH + * dev 1 interrupt QH + * dev 5 interrupt QH + * skel int64 QH + * skel int32 QH + * ... + * skel int1 QH + * skel low speed control QH + * dev 5 control QH + * skel high speed control QH + * skel bulk QH + * dev 1 bulk QH + * dev 2 bulk QH + * skel terminating QH + * + * The terminating QH is used for 2 reasons: + * - To place a terminating TD which is used to workaround a PIIX bug + * (see Intel errata for explanation) + * - To loop back to the high speed control queue for full speed bandwidth + * reclamation + * + * Isochronous transfers are stored before the start of the skeleton + * schedule and don't use QH's. While the UHCI spec doesn't forbid the + * use of QH's for Isochronous, it doesn't use them either. Since we don't + * need to use them either, we follow the spec diagrams in hope that it'll + * be more compatible with future UHCI implementations. + */ + +#define UHCI_NUM_SKELQH 12 +#define skel_int128_qh skelqh[0] +#define skel_int64_qh skelqh[1] +#define skel_int32_qh skelqh[2] +#define skel_int16_qh skelqh[3] +#define skel_int8_qh skelqh[4] +#define skel_int4_qh skelqh[5] +#define skel_int2_qh skelqh[6] +#define skel_int1_qh skelqh[7] +#define skel_ls_control_qh skelqh[8] +#define skel_hs_control_qh skelqh[9] +#define skel_bulk_qh skelqh[10] +#define skel_term_qh skelqh[11] + +/* + * Search tree for determining where fits in the skelqh[] + * skeleton. + * + * An interrupt request should be placed into the slowest skelqh[] + * which meets the interval/period/frequency requirement. + * An interrupt request is allowed to be faster than but not slower. + * + * For a given , this function returns the appropriate/matching + * skelqh[] index value. + */ +static inline int __interval_to_skel(int interval) +{ + if (interval < 16) { + if (interval < 4) { + if (interval < 2) + return 7; /* int1 for 0-1 ms */ + return 6; /* int2 for 2-3 ms */ + } + if (interval < 8) + return 5; /* int4 for 4-7 ms */ + return 4; /* int8 for 8-15 ms */ + } + if (interval < 64) { + if (interval < 32) + return 3; /* int16 for 16-31 ms */ + return 2; /* int32 for 32-63 ms */ + } + if (interval < 128) + return 1; /* int64 for 64-127 ms */ + return 0; /* int128 for 128-255 ms (Max.) */ +} + +/* + * Device states for the host controller. + * + * To prevent "bouncing" in the presence of electrical noise, + * we insist on a 1-second "grace" period, before switching to + * the RUNNING or SUSPENDED states, during which the state is + * not allowed to change. + * + * The resume process is divided into substates in order to avoid + * potentially length delays during the timer handler. + * + * States in which the host controller is halted must have values <= 0. + */ +enum uhci_state { + UHCI_RESET, + UHCI_RUNNING_GRACE, /* Before RUNNING */ + UHCI_RUNNING, /* The normal state */ + UHCI_SUSPENDING_GRACE, /* Before SUSPENDED */ + UHCI_SUSPENDED = -10, /* When no devices are attached */ + UHCI_RESUMING_1, + UHCI_RESUMING_2 +}; + +#define hcd_to_uhci(hcd_ptr) container_of(hcd_ptr, struct uhci_hcd, hcd) + +/* + * This describes the full uhci information. + * + * Note how the "proper" USB information is just + * a subset of what the full implementation needs. + */ +struct uhci_hcd { + struct usb_hcd hcd; + +#ifdef CONFIG_PROC_FS + /* procfs */ + struct proc_dir_entry *proc_entry; +#endif + + /* Grabbed from PCI */ + unsigned long io_addr; + + struct pci_pool *qh_pool; + struct pci_pool *td_pool; + + struct usb_bus *bus; + + struct uhci_td *term_td; /* Terminating TD, see UHCI bug */ + struct uhci_qh *skelqh[UHCI_NUM_SKELQH]; /* Skeleton QH's */ + + spinlock_t frame_list_lock; + struct uhci_frame_list *fl; /* P: uhci->frame_list_lock */ + int fsbr; /* Full speed bandwidth reclamation */ + unsigned long fsbrtimeout; /* FSBR delay */ + + enum uhci_state state; /* FIXME: needs a spinlock */ + unsigned long state_end; /* Time of next transition */ + int resume_detect; /* Need a Global Resume */ + + /* Main list of URB's currently controlled by this HC */ + spinlock_t urb_list_lock; + struct list_head urb_list; /* P: uhci->urb_list_lock */ + + /* List of QH's that are done, but waiting to be unlinked (race) */ + spinlock_t qh_remove_list_lock; + struct list_head qh_remove_list; /* P: uhci->qh_remove_list_lock */ + + /* List of asynchronously unlinked URB's */ + spinlock_t urb_remove_list_lock; + struct list_head urb_remove_list; /* P: uhci->urb_remove_list_lock */ + + /* List of URB's awaiting completion callback */ + spinlock_t complete_list_lock; + struct list_head complete_list; /* P: uhci->complete_list_lock */ + + int rh_numports; + + struct timer_list stall_timer; +}; + +struct urb_priv { + struct list_head urb_list; + + struct urb *urb; + struct usb_device *dev; + + struct uhci_qh *qh; /* QH for this URB */ + struct list_head td_list; /* P: urb->lock */ + + int fsbr : 1; /* URB turned on FSBR */ + int fsbr_timeout : 1; /* URB timed out on FSBR */ + int queued : 1; /* QH was queued (not linked in) */ + int short_control_packet : 1; /* If we get a short packet during */ + /* a control transfer, retrigger */ + /* the status phase */ + + int status; /* Final status */ + + unsigned long inserttime; /* In jiffies */ + unsigned long fsbrtime; /* In jiffies */ + + struct list_head queue_list; /* P: uhci->frame_list_lock */ + struct list_head complete_list; /* P: uhci->complete_list_lock */ +}; + +/* + * Locking in uhci.c + * + * spinlocks are used extensively to protect the many lists and data + * structures we have. It's not that pretty, but it's necessary. We + * need to be done with all of the locks (except complete_list_lock) when + * we call urb->complete. I've tried to make it simple enough so I don't + * have to spend hours racking my brain trying to figure out if the + * locking is safe. + * + * Here's the safe locking order to prevent deadlocks: + * + * #1 uhci->urb_list_lock + * #2 urb->lock + * #3 uhci->urb_remove_list_lock, uhci->frame_list_lock, + * uhci->qh_remove_list_lock + * #4 uhci->complete_list_lock + * + * If you're going to grab 2 or more locks at once, ALWAYS grab the lock + * at the lowest level FIRST and NEVER grab locks at the same level at the + * same time. + * + * So, if you need uhci->urb_list_lock, grab it before you grab urb->lock + */ + +#endif + diff --git a/reactos/drivers/usb/cromwell/uhci/uhci-hub.c b/reactos/drivers/usb/cromwell/uhci/uhci-hub.c new file mode 100644 index 00000000000..559b81586c0 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci-hub.c @@ -0,0 +1,184 @@ +/* + * Universal Host Controller Interface driver for USB. + * + * Maintainer: Johannes Erdfelt + * + * (C) Copyright 1999 Linus Torvalds + * (C) Copyright 1999-2002 Johannes Erdfelt, johannes@erdfelt.com + * (C) Copyright 1999 Randy Dunlap + * (C) Copyright 1999 Georg Acher, acher@in.tum.de + * (C) Copyright 1999 Deti Fliegl, deti@fliegl.de + * (C) Copyright 1999 Thomas Sailer, sailer@ife.ee.ethz.ch + */ + +static __u8 root_hub_hub_des[] = +{ + 0x09, /* __u8 bLength; */ + 0x29, /* __u8 bDescriptorType; Hub-descriptor */ + 0x02, /* __u8 bNbrPorts; */ + 0x00, /* __u16 wHubCharacteristics; */ + 0x00, + 0x01, /* __u8 bPwrOn2pwrGood; 2ms */ + 0x00, /* __u8 bHubContrCurrent; 0 mA */ + 0x00, /* __u8 DeviceRemovable; *** 7 Ports max *** */ + 0xff /* __u8 PortPwrCtrlMask; *** 7 ports max *** */ +}; + +static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + unsigned int io_addr = uhci->io_addr; + int i, len = 1; + + *buf = 0; + for (i = 0; i < uhci->rh_numports; i++) { + *buf |= ((inw(io_addr + USBPORTSC1 + i * 2) & 0xa) > 0 ? (1 << (i + 1)) : 0); + len = (i + 1) / 8 + 1; + } + + return !!*buf; +} + +#define OK(x) len = (x); break + +#define CLR_RH_PORTSTAT(x) \ + status = inw(io_addr + USBPORTSC1 + 2 * (wIndex-1)); \ + status = (status & 0xfff5) & ~(x); \ + outw(status, io_addr + USBPORTSC1 + 2 * (wIndex-1)) + +#define SET_RH_PORTSTAT(x) \ + status = inw(io_addr + USBPORTSC1 + 2 * (wIndex-1)); \ + status = (status & 0xfff5) | (x); \ + outw(status, io_addr + USBPORTSC1 + 2 * (wIndex-1)) + + +/* size of returned buffer is part of USB spec */ +static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + u16 wIndex, char *buf, u16 wLength) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + int i, status, retval = 0, len = 0; + unsigned int io_addr = uhci->io_addr; + __u16 cstatus; + char c_p_r[8]; + + for (i = 0; i < 8; i++) + c_p_r[i] = 0; + + switch (typeReq) { + /* Request Destination: + without flags: Device, + RH_INTERFACE: interface, + RH_ENDPOINT: endpoint, + RH_CLASS means HUB here, + RH_OTHER | RH_CLASS almost ever means HUB_PORT here + */ + + case GetHubStatus: + *(__u32 *)buf = cpu_to_le32(0); + OK(4); /* hub power */ + case GetPortStatus: + status = inw(io_addr + USBPORTSC1 + 2 * (wIndex - 1)); + cstatus = ((status & USBPORTSC_CSC) >> (1 - 0)) | + ((status & USBPORTSC_PEC) >> (3 - 1)) | + (c_p_r[wIndex - 1] << (0 + 4)); + status = (status & USBPORTSC_CCS) | + ((status & USBPORTSC_PE) >> (2 - 1)) | + ((status & USBPORTSC_SUSP) >> (12 - 2)) | + ((status & USBPORTSC_PR) >> (9 - 4)) | + (1 << 8) | /* power on */ + ((status & USBPORTSC_LSDA) << (-8 + 9)); + + *(__u16 *)buf = cpu_to_le16(status); + *(__u16 *)(buf + 2) = cpu_to_le16(cstatus); + OK(4); + case SetHubFeature: + switch (wValue) { + case C_HUB_OVER_CURRENT: + case C_HUB_LOCAL_POWER: + break; + default: + goto err; + } + break; + case ClearHubFeature: + switch (wValue) { + case C_HUB_OVER_CURRENT: + OK(0); /* hub power over current */ + default: + goto err; + } + break; + case SetPortFeature: + if (!wIndex || wIndex > uhci->rh_numports) + goto err; + + switch (wValue) { + case USB_PORT_FEAT_SUSPEND: + SET_RH_PORTSTAT(USBPORTSC_SUSP); + OK(0); + case USB_PORT_FEAT_RESET: + SET_RH_PORTSTAT(USBPORTSC_PR); + mdelay(50); /* USB v1.1 7.1.7.3 */ + c_p_r[wIndex - 1] = 1; + CLR_RH_PORTSTAT(USBPORTSC_PR); + udelay(10); + SET_RH_PORTSTAT(USBPORTSC_PE); + mdelay(10); + SET_RH_PORTSTAT(0xa); + OK(0); + case USB_PORT_FEAT_POWER: + OK(0); /* port power ** */ + case USB_PORT_FEAT_ENABLE: + SET_RH_PORTSTAT(USBPORTSC_PE); + OK(0); + default: + goto err; + } + break; + case ClearPortFeature: + if (!wIndex || wIndex > uhci->rh_numports) + goto err; + + switch (wValue) { + case USB_PORT_FEAT_ENABLE: + CLR_RH_PORTSTAT(USBPORTSC_PE); + OK(0); + case USB_PORT_FEAT_C_ENABLE: + SET_RH_PORTSTAT(USBPORTSC_PEC); + OK(0); + case USB_PORT_FEAT_SUSPEND: + CLR_RH_PORTSTAT(USBPORTSC_SUSP); + OK(0); + case USB_PORT_FEAT_C_SUSPEND: + /*** WR_RH_PORTSTAT(RH_PS_PSSC); */ + OK(0); + case USB_PORT_FEAT_POWER: + OK(0); /* port power */ + case USB_PORT_FEAT_C_CONNECTION: + SET_RH_PORTSTAT(USBPORTSC_CSC); + OK(0); + case USB_PORT_FEAT_C_OVER_CURRENT: + OK(0); /* port power over current */ + case USB_PORT_FEAT_C_RESET: + c_p_r[wIndex - 1] = 0; + OK(0); + default: + goto err; + } + break; + case GetHubDescriptor: + len = min_t(unsigned int, wLength, + min_t(unsigned int, sizeof(root_hub_hub_des), wLength)); + memcpy(buf, root_hub_hub_des, len); + if (len > 2) + buf[2] = uhci->rh_numports; + OK(len); + default: +err: + retval = -EPIPE; + } + + return retval; +} + diff --git a/reactos/drivers/usb/cromwell/uhci/uhci.def b/reactos/drivers/usb/cromwell/uhci/uhci.def new file mode 100644 index 00000000000..b0ec75808f2 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci.def @@ -0,0 +1,2 @@ +LIBRARY uhci.sys +EXPORTS diff --git a/reactos/drivers/usb/cromwell/uhci/uhci.rc b/reactos/drivers/usb/cromwell/uhci/uhci.rc new file mode 100644 index 00000000000..d5eb940f114 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "USB UHCI Device Driver\0" +#define REACTOS_STR_INTERNAL_NAME "uhci\0" +#define REACTOS_STR_ORIGINAL_FILENAME "uhci.sys\0" +#include diff --git a/reactos/drivers/usb/cromwell/uhci/uhci_config.h b/reactos/drivers/usb/cromwell/uhci/uhci_config.h new file mode 100644 index 00000000000..cd59c84d5b7 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci_config.h @@ -0,0 +1,5 @@ +/* + * Configs for UHCI + */ + +#define CONFIG_PCI diff --git a/reactos/drivers/usb/cromwell/uhci/uhci_main.c b/reactos/drivers/usb/cromwell/uhci/uhci_main.c new file mode 100644 index 00000000000..be10f686fa6 --- /dev/null +++ b/reactos/drivers/usb/cromwell/uhci/uhci_main.c @@ -0,0 +1,309 @@ +/* + ReactOS specific functions for UHCI module + by Aleksey Bragin (aleksey@reactos.com) + Some parts of code are inspired (or even just copied) from ReactOS Videoport driver +*/ + +#include +#include +#include "../linux/linux_wrapper.h" +#include "../host/ohci_main.h" + +// declare basic init funcs +void init_wrapper(struct pci_dev *probe_dev); +int uhci_hcd_init(void); +void uhci_hcd_cleanup(void); +int STDCALL usb_init(void); +void STDCALL usb_exit(void); +extern struct pci_driver uhci_pci_driver; +extern const struct pci_device_id uhci_pci_ids[]; + + + +// This should be removed, but for testing purposes it's here +struct pci_dev *dev; +//struct pci_device_id *dev_id; + + +#define USB_UHCI_TAG TAG('u','s','b','u') + +NTSTATUS STDCALL AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo) +{ + PDEVICE_OBJECT fdo; + NTSTATUS Status; + WCHAR DeviceBuffer[20]; + UNICODE_STRING DeviceName; + POHCI_DRIVER_EXTENSION DriverExtension; + POHCI_DEVICE_EXTENSION DeviceExtension; + ULONG Size, DeviceNumber; + + DPRINT1("uhci: AddDevice called\n"); + + // Allocate driver extension now + DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); + if (DriverExtension == NULL) + { + Status = IoAllocateDriverObjectExtension( + DriverObject, + DriverObject, + sizeof(OHCI_DRIVER_EXTENSION), + (PVOID *)&DriverExtension); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Allocating DriverObjectExtension failed.\n"); + return Status; + } + } + + // Create a unicode device name + DeviceNumber = 0; //TODO: Allocate new device number every time + swprintf(DeviceBuffer, L"\\Device\\USBFDO-%lu", DeviceNumber); + RtlInitUnicodeString(&DeviceName, DeviceBuffer); + + Status = IoCreateDevice(DriverObject, + sizeof(OHCI_DEVICE_EXTENSION)/* + DriverExtension->InitializationData.HwDeviceExtensionSize*/, + &DeviceName, + FILE_DEVICE_CONTROLLER, + 0, + FALSE, + &fdo); + + if (!NT_SUCCESS(Status)) + { + DPRINT("IoCreateDevice call failed with status 0x%08x\n", Status); + return Status; + } + + // zerofill device extension + DeviceExtension = (POHCI_DEVICE_EXTENSION)pdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(OHCI_DEVICE_EXTENSION)); + DeviceExtension->NextDeviceObject = IoAttachDeviceToDeviceStack(fdo, pdo); + + fdo->Flags &= ~DO_DEVICE_INITIALIZING; + + // Initialize device extension + DeviceExtension->DeviceNumber = DeviceNumber; + DeviceExtension->PhysicalDeviceObject = pdo; + DeviceExtension->FunctionalDeviceObject = fdo; + DeviceExtension->DriverExtension = DriverExtension; + + /* Get bus number from the upper level bus driver. */ + Size = sizeof(ULONG); + Status = IoGetDeviceProperty( + pdo, + DevicePropertyBusNumber, + Size, + &DeviceExtension->SystemIoBusNumber, + &Size); + + if (!NT_SUCCESS(Status)) + { + DPRINT("Couldn't get an information from bus driver. Panic!!!\n"); + return Status; + } + + DPRINT("Done AddDevice\n"); + return STATUS_SUCCESS; +} + +VOID STDCALL DriverUnload(PDRIVER_OBJECT DriverObject) +{ + DPRINT1("DriverUnload()\n"); + + // Exit usb device + usb_exit(); + + // Remove device (ohci_pci_driver.remove) + uhci_pci_driver.remove(dev); + + ExFreePool(dev->slot_name); + ExFreePool(dev); + + // Perform some cleanup + uhci_hcd_cleanup(); +} + +NTSTATUS InitLinuxWrapper(PDEVICE_OBJECT DeviceObject) +{ + NTSTATUS Status; + POHCI_DEVICE_EXTENSION DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + // Fill generic linux structs + dev = ExAllocatePoolWithTag(PagedPool, sizeof(struct pci_dev), USB_UHCI_TAG); + + init_wrapper(dev); + dev->irq = DeviceExtension->InterruptLevel; + dev->dev_ext = (PVOID)DeviceExtension; + dev->slot_name = ExAllocatePoolWithTag(NonPagedPool, 128, USB_UHCI_TAG); // 128 max len for slot name + + strcpy(dev->dev.name, "UnivHCI PCI-USB Controller"); + strcpy(dev->slot_name, "UHCD PCI Slot"); + + // Init the OHCI HCD. Probe will be called automatically, but will fail because id=NULL + Status = uhci_hcd_init(); + //FIXME: Check status returned value + + // Init core usb + usb_init(); + + // Probe device with real id now + uhci_pci_driver.probe(dev, uhci_pci_ids); + + DPRINT("InitLinuxWrapper() done\n"); + + return STATUS_SUCCESS; +} + +NTSTATUS STDCALL +OHCD_PnPStartDevice(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PDRIVER_OBJECT DriverObject; + POHCI_DRIVER_EXTENSION DriverExtension; + POHCI_DEVICE_EXTENSION DeviceExtension; + PCM_RESOURCE_LIST AllocatedResources; + + /* + * Get the initialization data we saved in VideoPortInitialize. + */ + DriverObject = DeviceObject->DriverObject; + DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); + DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + /* + * Store some resources in the DeviceExtension. + */ + AllocatedResources = Stack->Parameters.StartDevice.AllocatedResources; + if (AllocatedResources != NULL) + { + CM_FULL_RESOURCE_DESCRIPTOR *FullList; + CM_PARTIAL_RESOURCE_DESCRIPTOR *Descriptor; + ULONG ResourceCount; + ULONG ResourceListSize; + + /* Save the resource list */ + ResourceCount = AllocatedResources->List[0].PartialResourceList.Count; + ResourceListSize = + FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList. + PartialDescriptors[ResourceCount]); + DeviceExtension->AllocatedResources = ExAllocatePool(PagedPool, ResourceListSize); + if (DeviceExtension->AllocatedResources == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlCopyMemory(DeviceExtension->AllocatedResources, + AllocatedResources, + ResourceListSize); + + /* Get the interrupt level/vector - needed by HwFindAdapter sometimes */ + for (FullList = AllocatedResources->List; + FullList < AllocatedResources->List + AllocatedResources->Count; + FullList++) + { + /* FIXME: Is this ASSERT ok for resources from the PNP manager? */ + /*ASSERT(FullList->InterfaceType == PCIBus && + FullList->BusNumber == DeviceExtension->SystemIoBusNumber && + 1 == FullList->PartialResourceList.Version && + 1 == FullList->PartialResourceList.Revision);*/ + for (Descriptor = FullList->PartialResourceList.PartialDescriptors; + Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count; + Descriptor++) + { + if (Descriptor->Type == CmResourceTypeInterrupt) + { + DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level; + DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector; + } + else if (Descriptor->Type == CmResourceTypeMemory) + { + DeviceExtension->BaseAddress = Descriptor->u.Memory.Start; + DeviceExtension->BaseAddrLength = Descriptor->u.Memory.Length; + } + } + } + } + DPRINT1("Interrupt level: 0x%x Interrupt Vector: 0x%x\n", + DeviceExtension->InterruptLevel, + DeviceExtension->InterruptVector); + + /* + * Init wrapper with this object + */ + return InitLinuxWrapper(DeviceObject); +} + +// Dispatch PNP +NTSTATUS STDCALL DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION IrpSp; + NTSTATUS Status; + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + switch (IrpSp->MinorFunction) + { + case IRP_MN_START_DEVICE: + //Status = IntVideoPortForwardIrpAndWait(DeviceObject, Irp); + //if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status)) + + Status = OHCD_PnPStartDevice(DeviceObject, Irp); + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + break; + + + case IRP_MN_REMOVE_DEVICE: + case IRP_MN_QUERY_REMOVE_DEVICE: + case IRP_MN_CANCEL_REMOVE_DEVICE: + case IRP_MN_SURPRISE_REMOVAL: + + case IRP_MN_STOP_DEVICE: + //Status = IntVideoPortForwardIrpAndWait(DeviceObject, Irp); + //if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status)) + Status = STATUS_SUCCESS; + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + IoDeleteDevice(DeviceObject); // just delete device for now + break; + + case IRP_MN_QUERY_STOP_DEVICE: + case IRP_MN_CANCEL_STOP_DEVICE: + Status = STATUS_SUCCESS; + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + break; + + default: + return STATUS_NOT_IMPLEMENTED; + break; + } + + return Status; +} + +NTSTATUS STDCALL DispatchPower(PDEVICE_OBJECT fido, PIRP Irp) +{ + DbgPrint("IRP_MJ_POWER dispatch\n"); + return STATUS_SUCCESS; +} + +/* + * Standard DriverEntry method. + */ +NTSTATUS STDCALL +DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath) +{ + DriverObject->DriverUnload = DriverUnload; + DriverObject->DriverExtension->AddDevice = AddDevice; + DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp; + DriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower; + + return STATUS_SUCCESS; +} diff --git a/reactos/drivers/usb/usbd/usbd.c b/reactos/drivers/usb/usbd/usbd.c index 66ae4a1fb4c..d33d67fd0b4 100644 --- a/reactos/drivers/usb/usbd/usbd.c +++ b/reactos/drivers/usb/usbd/usbd.c @@ -351,15 +351,17 @@ USBD_GetInterfaceLength( PUCHAR BufferEnd ) { + ULONG_PTR Current; PUSB_INTERFACE_DESCRIPTOR CurrentDescriptor = InterfaceDescriptor; DWORD Length = CurrentDescriptor->bLength; // USB_ENDPOINT_DESCRIPTOR_TYPE if (CurrentDescriptor->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE) { - for (; - (PUCHAR)CurrentDescriptor < BufferEnd; - (PVOID)CurrentDescriptor += CurrentDescriptor->bLength) + for (Current = (ULONG_PTR)CurrentDescriptor; + Current < (ULONG_PTR)BufferEnd; + Current += CurrentDescriptor->bLength) + CurrentDescriptor = (PUSB_INTERFACE_DESCRIPTOR)Current; Length += CurrentDescriptor->bLength; } diff --git a/reactos/drivers/video/displays/framebuf/surface.c b/reactos/drivers/video/displays/framebuf/surface.c index 5067da0d895..c9cedf60df3 100644 --- a/reactos/drivers/video/displays/framebuf/surface.c +++ b/reactos/drivers/video/displays/framebuf/surface.c @@ -172,13 +172,19 @@ DrvAssertMode( if (bEnable) { + BOOLEAN Result; /* * Reinitialize the device to a clean state. */ + Result = EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_SET_CURRENT_MODE, + &(ppdev->ModeIndex), sizeof(ULONG), NULL, 0, + &ulTemp); + if (ppdev->BitsPerPixel == 8) + { + IntSetPalette(dhpdev, ppdev->PaletteEntries, 0, 256); + } + return Result; - return !EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_SET_CURRENT_MODE, - &(ppdev->ModeIndex), sizeof(ULONG), NULL, 0, - &ulTemp); } else { diff --git a/reactos/drivers/video/displays/vga/objects/copybits.c b/reactos/drivers/video/displays/vga/objects/copybits.c index ebd64c69b2f..7c274b01979 100644 --- a/reactos/drivers/video/displays/vga/objects/copybits.c +++ b/reactos/drivers/video/displays/vga/objects/copybits.c @@ -1,7 +1,5 @@ #include "../vgaddi.h" #include "../vgavideo/vgavideo.h" - -#define DBG #include BOOL STDCALL diff --git a/reactos/drivers/video/miniport/vga/vgamp.c b/reactos/drivers/video/miniport/vga/vgamp.c index 4117b824f37..ecc790a79cb 100644 --- a/reactos/drivers/video/miniport/vga/vgamp.c +++ b/reactos/drivers/video/miniport/vga/vgamp.c @@ -3,63 +3,9 @@ * */ -#include -#include -#include +// ------------------------------------------------------- Includes -#define UNIMPLEMENTED do {DbgPrint("%s:%d: Function not implemented", __FILE__, __LINE__); for(;;);} while (0) - -#define VERSION "0.0.0" -void InitVGAMode(); -// ---------------------------------------------------- Forward Declarations -static VP_STATUS STDCALL -VGAFindAdapter(PVOID DeviceExtension, - PVOID Context, - PWSTR ArgumentString, - PVIDEO_PORT_CONFIG_INFO ConfigInfo, - PUCHAR Again); -static BOOLEAN STDCALL -VGAInitialize(PVOID DeviceExtension); -static BOOLEAN STDCALL -VGAStartIO(PVOID DeviceExtension, - PVIDEO_REQUEST_PACKET RequestPacket); -/* -static BOOLEAN STDCALL -VGAInterrupt(PVOID DeviceExtension);*/ -static BOOLEAN STDCALL -VGAResetHw(PVOID DeviceExtension, - ULONG Columns, - ULONG Rows); -/*static VOID STDCALL -VGATimer(PVOID DeviceExtension); -*/ - -/* Mandatory IoControl routines */ -VOID VGAMapVideoMemory(IN PVOID DeviceExtension, - IN PVIDEO_MEMORY RequestedAddress, - OUT PVIDEO_MEMORY_INFORMATION MapInformation, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGAQueryAvailModes(OUT PVIDEO_MODE_INFORMATION ReturnedModes, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGAQueryCurrentMode(OUT PVIDEO_MODE_INFORMATION CurrentMode, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGAQueryNumAvailModes(OUT PVIDEO_NUM_MODES NumberOfModes, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGAResetDevice(OUT PSTATUS_BLOCK StatusBlock); -VOID VGASetColorRegisters(IN PVIDEO_CLUT ColorLookUpTable, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGASetPaletteRegisters(IN PWORD PaletteRegisters, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGASetCurrentMode(IN PVIDEO_MODE RequestedMode, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGAShareVideoMemory(IN PVIDEO_SHARE_MEMORY RequestedMemory, - OUT PVIDEO_MEMORY_INFORMATION ReturnedMemory, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGAUnmapVideoMemory(IN PVOID DeviceExtension, - IN PVIDEO_MEMORY MemoryToUnmap, - OUT PSTATUS_BLOCK StatusBlock); -VOID VGAUnshareVideoMemory(IN PVIDEO_MEMORY MemoryToUnshare, - OUT PSTATUS_BLOCK StatusBlock); +#include "vgamp.h" // ------------------------------------------------------- Public Interface @@ -219,63 +165,117 @@ static BOOLEAN STDCALL VGAStartIO(PVOID DeviceExtension, PVIDEO_REQUEST_PACKET RequestPacket) { + BOOL Result; + + RequestPacket->StatusBlock->Status = STATUS_UNSUCCESSFUL; + switch (RequestPacket->IoControlCode) { case IOCTL_VIDEO_MAP_VIDEO_MEMORY: - VGAMapVideoMemory(DeviceExtension, + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION) || + RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGAMapVideoMemory(DeviceExtension, (PVIDEO_MEMORY) RequestPacket->InputBuffer, - (PVIDEO_MEMORY_INFORMATION) - RequestPacket->OutputBuffer, - RequestPacket->StatusBlock); + (PVIDEO_MEMORY_INFORMATION) + RequestPacket->OutputBuffer, + RequestPacket->StatusBlock); break; case IOCTL_VIDEO_QUERY_AVAIL_MODES: - VGAQueryAvailModes((PVIDEO_MODE_INFORMATION) RequestPacket->OutputBuffer, + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGAQueryAvailModes((PVIDEO_MODE_INFORMATION) RequestPacket->OutputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_QUERY_CURRENT_MODE: - VGAQueryCurrentMode((PVIDEO_MODE_INFORMATION) RequestPacket->OutputBuffer, + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGAQueryCurrentMode((PVIDEO_MODE_INFORMATION) RequestPacket->OutputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES: - VGAQueryNumAvailModes((PVIDEO_NUM_MODES) RequestPacket->OutputBuffer, + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_NUM_MODES)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGAQueryNumAvailModes((PVIDEO_NUM_MODES) RequestPacket->OutputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_RESET_DEVICE: - VGAResetDevice(RequestPacket->StatusBlock); + Result = VGAResetDevice(RequestPacket->StatusBlock); break; case IOCTL_VIDEO_SET_COLOR_REGISTERS: - VGASetColorRegisters((PVIDEO_CLUT) RequestPacket->InputBuffer, + if (RequestPacket->InputBufferLength < sizeof(VIDEO_CLUT) || + RequestPacket->InputBufferLength < + (((PVIDEO_CLUT)RequestPacket->InputBuffer)->NumEntries * sizeof(ULONG)) + + sizeof(VIDEO_CLUT)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGASetColorRegisters((PVIDEO_CLUT) RequestPacket->InputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_SET_CURRENT_MODE: - VGASetCurrentMode((PVIDEO_MODE) RequestPacket->InputBuffer, + if (RequestPacket->InputBufferLength < sizeof(VIDEO_MODE)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGASetCurrentMode((PVIDEO_MODE) RequestPacket->InputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_SHARE_VIDEO_MEMORY: - VGAShareVideoMemory((PVIDEO_SHARE_MEMORY) RequestPacket->InputBuffer, + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION) || + RequestPacket->InputBufferLength < sizeof(VIDEO_SHARE_MEMORY)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGAShareVideoMemory((PVIDEO_SHARE_MEMORY) RequestPacket->InputBuffer, (PVIDEO_MEMORY_INFORMATION) RequestPacket->OutputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_UNMAP_VIDEO_MEMORY: - VGAUnmapVideoMemory(DeviceExtension, + if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGAUnmapVideoMemory(DeviceExtension, (PVIDEO_MEMORY) RequestPacket->InputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY: - VGAUnshareVideoMemory((PVIDEO_MEMORY) RequestPacket->InputBuffer, + if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return TRUE; + } + Result = VGAUnshareVideoMemory((PVIDEO_MEMORY) RequestPacket->InputBuffer, RequestPacket->StatusBlock); break; case IOCTL_VIDEO_SET_PALETTE_REGISTERS: - VGASetPaletteRegisters((PWORD) RequestPacket->InputBuffer, + Result = VGASetPaletteRegisters((PWORD) RequestPacket->InputBuffer, RequestPacket->StatusBlock); break; @@ -319,8 +319,11 @@ VGAStartIO(PVOID DeviceExtension, default: RequestPacket->StatusBlock->Status = STATUS_NOT_IMPLEMENTED; - break; + return FALSE; } + + if (Result) + RequestPacket->StatusBlock->Status = STATUS_SUCCESS; return TRUE; } @@ -362,7 +365,7 @@ VGAInterrupt(PVOID DeviceExtension) // ULONG Rows to reset to. // RETURNS: // BOOLEAN TRUE if no further action is necessary, FALSE if the system -// needs to still do a BOIS int 10 reset. +// needs to still do a BIOS int 10 reset. static BOOLEAN STDCALL VGAResetHw(PVOID DeviceExtension, @@ -394,7 +397,7 @@ VGATimer(PVOID DeviceExtension) #endif -VOID VGAMapVideoMemory(IN PVOID DeviceExtension, +BOOL VGAMapVideoMemory(IN PVOID DeviceExtension, IN PVIDEO_MEMORY RequestedAddress, OUT PVIDEO_MEMORY_INFORMATION MapInformation, OUT PSTATUS_BLOCK StatusBlock) @@ -415,34 +418,62 @@ VOID VGAMapVideoMemory(IN PVOID DeviceExtension, if (StatusBlock->Status != 0) { StatusBlock->Information = 0; - return; + return TRUE; } MapInformation->VideoRamBase = MapInformation->FrameBufferBase = ReturnedAddress; MapInformation->VideoRamLength = MapInformation->FrameBufferLength = ReturnedLength; StatusBlock->Information = sizeof(VIDEO_MEMORY_INFORMATION); + return TRUE; } -VOID VGAQueryAvailModes(OUT PVIDEO_MODE_INFORMATION ReturnedModes, +BOOL VGAQueryAvailModes(OUT PVIDEO_MODE_INFORMATION ReturnedModes, OUT PSTATUS_BLOCK StatusBlock) { - UNIMPLEMENTED; + /* Only one mode exists in VGA (640x480), so use VGAQueryCurrentMode */ + return VGAQueryCurrentMode(ReturnedModes, StatusBlock); } -VOID VGAQueryCurrentMode(OUT PVIDEO_MODE_INFORMATION CurrentMode, +BOOL VGAQueryCurrentMode(OUT PVIDEO_MODE_INFORMATION CurrentMode, OUT PSTATUS_BLOCK StatusBlock) { - UNIMPLEMENTED; + CurrentMode->Length = sizeof(VIDEO_MODE_INFORMATION); + CurrentMode->ModeIndex = 12; + CurrentMode->VisScreenWidth = 640; + CurrentMode->VisScreenHeight = 480; + CurrentMode->ScreenStride = 320; + CurrentMode->NumberOfPlanes = 1; + CurrentMode->BitsPerPlane = 4; + CurrentMode->Frequency = 60; + CurrentMode->XMillimeter = 0; /* FIXME */ + CurrentMode->YMillimeter = 0; /* FIXME */ + CurrentMode->NumberRedBits = + CurrentMode->NumberGreenBits = + CurrentMode->NumberBlueBits = 6; + CurrentMode->RedMask = + CurrentMode->GreenMask = + CurrentMode->BlueMask = 0; /* FIXME */ + CurrentMode->VideoMemoryBitmapWidth = 640; + CurrentMode->VideoMemoryBitmapHeight = 480; + CurrentMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | + VIDEO_MODE_NO_OFF_SCREEN; + CurrentMode->DriverSpecificAttributeFlags = 0; + + StatusBlock->Information = sizeof(VIDEO_MODE_INFORMATION); + return TRUE; } -VOID VGAQueryNumAvailModes(OUT PVIDEO_NUM_MODES NumberOfModes, +BOOL VGAQueryNumAvailModes(OUT PVIDEO_NUM_MODES NumberOfModes, OUT PSTATUS_BLOCK StatusBlock) { - UNIMPLEMENTED; + NumberOfModes->NumModes = 1; + NumberOfModes->ModeInformationLength = sizeof(VIDEO_MODE_INFORMATION); + StatusBlock->Information = sizeof(VIDEO_NUM_MODES); + return TRUE; } -VOID VGASetPaletteRegisters(IN PWORD PaletteRegisters, +BOOL VGASetPaletteRegisters(IN PWORD PaletteRegisters, OUT PSTATUS_BLOCK StatusBlock) { ; @@ -468,9 +499,10 @@ VOID VGASetPaletteRegisters(IN PWORD PaletteRegisters, tmp = VideoPortReadPortUchar(0x03da); VideoPortWritePortUchar(0x03d0, v | 0x20); */ + return TRUE; } -VOID VGASetColorRegisters(IN PVIDEO_CLUT ColorLookUpTable, +BOOL VGASetColorRegisters(IN PVIDEO_CLUT ColorLookUpTable, OUT PSTATUS_BLOCK StatusBlock) { int i; @@ -482,37 +514,50 @@ VOID VGASetColorRegisters(IN PVIDEO_CLUT ColorLookUpTable, VideoPortWritePortUchar((PUCHAR)0x03c9, ColorLookUpTable->LookupTable[i].RgbArray.Green); VideoPortWritePortUchar((PUCHAR)0x03c9, ColorLookUpTable->LookupTable[i].RgbArray.Blue); } + + return TRUE; } -VOID VGASetCurrentMode(IN PVIDEO_MODE RequestedMode, +BOOL VGASetCurrentMode(IN PVIDEO_MODE RequestedMode, OUT PSTATUS_BLOCK StatusBlock) { if(RequestedMode->RequestedMode == 12) { InitVGAMode(); + return TRUE; } else { - DbgPrint("Unrecognised mode for VGASetCurrentMode\n"); + DPRINT1("Unrecognised mode for VGASetCurrentMode\n"); + return FALSE; } } -VOID VGAShareVideoMemory(IN PVIDEO_SHARE_MEMORY RequestedMemory, +BOOL VGAShareVideoMemory(IN PVIDEO_SHARE_MEMORY RequestedMemory, OUT PVIDEO_MEMORY_INFORMATION ReturnedMemory, OUT PSTATUS_BLOCK StatusBlock) { UNIMPLEMENTED; + + StatusBlock->Status = STATUS_NOT_IMPLEMENTED; + return FALSE; } -VOID VGAUnmapVideoMemory(IN PVOID DeviceExtension, +BOOL VGAUnmapVideoMemory(IN PVOID DeviceExtension, IN PVIDEO_MEMORY MemoryToUnmap, OUT PSTATUS_BLOCK StatusBlock) { - VideoPortUnmapMemory(DeviceExtension, + if (VideoPortUnmapMemory(DeviceExtension, MemoryToUnmap->RequestedVirtualAddress, - 0); + 0) == NO_ERROR) + return TRUE; + else + return FALSE; } -VOID VGAUnshareVideoMemory(IN PVIDEO_MEMORY MemoryToUnshare, +BOOL VGAUnshareVideoMemory(IN PVIDEO_MEMORY MemoryToUnshare, OUT PSTATUS_BLOCK StatusBlock) { UNIMPLEMENTED; + + StatusBlock->Status = STATUS_NOT_IMPLEMENTED; + return FALSE; } diff --git a/reactos/drivers/video/miniport/vga/vgamp.h b/reactos/drivers/video/miniport/vga/vgamp.h new file mode 100644 index 00000000000..c5b907e360b --- /dev/null +++ b/reactos/drivers/video/miniport/vga/vgamp.h @@ -0,0 +1,124 @@ +/* + * ReactOS VGA miniport video driver + * + * Copyright (C) 2004 Filip Navara, Herve Poussineau + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef VGAMP_H +#define VGAMP_H + +/* INCLUDES *******************************************************************/ + +#include +#include +#include +#include + +void +InitVGAMode(); + +static VP_STATUS STDCALL +VGAFindAdapter( + PVOID DeviceExtension, + PVOID Context, + PWSTR ArgumentString, + PVIDEO_PORT_CONFIG_INFO ConfigInfo, + PUCHAR Again); + +static BOOLEAN STDCALL +VGAInitialize( + PVOID DeviceExtension); + +static BOOLEAN STDCALL +VGAStartIO( + PVOID DeviceExtension, + PVIDEO_REQUEST_PACKET RequestPacket); + +/*static BOOLEAN STDCALL +VGAInterrupt(PVOID DeviceExtension);*/ + +static BOOLEAN STDCALL +VGAResetHw( + PVOID DeviceExtension, + ULONG Columns, + ULONG Rows); + +/*static VOID STDCALL +VGATimer(PVOID DeviceExtension);*/ + +/* Mandatory IoControl routines */ +BOOL +VGAMapVideoMemory( + IN PVOID DeviceExtension, + IN PVIDEO_MEMORY RequestedAddress, + OUT PVIDEO_MEMORY_INFORMATION MapInformation, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGAQueryAvailModes( + OUT PVIDEO_MODE_INFORMATION ReturnedModes, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGAQueryCurrentMode( + OUT PVIDEO_MODE_INFORMATION CurrentMode, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGAQueryNumAvailModes( + OUT PVIDEO_NUM_MODES NumberOfModes, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGAResetDevice(OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGASetColorRegisters( + IN PVIDEO_CLUT ColorLookUpTable, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGASetPaletteRegisters( + IN PWORD PaletteRegisters, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGASetCurrentMode( + IN PVIDEO_MODE RequestedMode, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGAShareVideoMemory( + IN PVIDEO_SHARE_MEMORY RequestedMemory, + OUT PVIDEO_MEMORY_INFORMATION ReturnedMemory, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGAUnmapVideoMemory( + IN PVOID DeviceExtension, + IN PVIDEO_MEMORY MemoryToUnmap, + OUT PSTATUS_BLOCK StatusBlock); + +BOOL +VGAUnshareVideoMemory( + IN PVIDEO_MEMORY MemoryToUnshare, + OUT PSTATUS_BLOCK StatusBlock); + +/* Optional IoControl routines */ +/* None actually */ + +#endif /* VGAMP_H */ diff --git a/reactos/drivers/video/videoprt/videoprt.c b/reactos/drivers/video/videoprt/videoprt.c index 19c69f06160..493c4092314 100644 --- a/reactos/drivers/video/videoprt/videoprt.c +++ b/reactos/drivers/video/videoprt/videoprt.c @@ -152,10 +152,13 @@ IntVideoPortAllocateDeviceNumber(VOID) DeviceNumber++; continue; } - else if (Status == STATUS_NOT_FOUND || Status == STATUS_UNSUCCESSFUL) + else if (Status == STATUS_OBJECT_NAME_NOT_FOUND) break; else + { + DPRINT1("ZwOpenSymbolicLinkObject() returned unexpected status: 0x%08lx\n", Status); return 0xFFFFFFFF; + } } return DeviceNumber; diff --git a/reactos/hal/hal/hal.c b/reactos/hal/hal/hal.c index 9208b3c5295..38af3f9a8b3 100644 --- a/reactos/hal/hal/hal.c +++ b/reactos/hal/hal/hal.c @@ -785,7 +785,7 @@ KeFlushWriteBuffer(VOID) UNIMPLEMENTED; } - +#undef KeGetCurrentIrql KIRQL STDCALL KeGetCurrentIrql(VOID) diff --git a/reactos/hal/halx86/generic/adapter.c b/reactos/hal/halx86/generic/adapter.c index 5debe5d853c..80df33e4f17 100644 --- a/reactos/hal/halx86/generic/adapter.c +++ b/reactos/hal/halx86/generic/adapter.c @@ -19,6 +19,9 @@ #include #include +/* Hmm, needed for KDBG := 1. Why? */ +#undef KeGetCurrentIrql + /* FUNCTIONS *****************************************************************/ /* NOTE: IoAllocateAdapterChannel in NTOSKRNL.EXE */ diff --git a/reactos/hal/halx86/generic/fmutex.c b/reactos/hal/halx86/generic/fmutex.c index b31e6b8f200..fc6f61f9eab 100644 --- a/reactos/hal/halx86/generic/fmutex.c +++ b/reactos/hal/halx86/generic/fmutex.c @@ -18,6 +18,8 @@ /* FUNCTIONS *****************************************************************/ +#undef KeEnterCriticalRegion +#undef KeLeaveCriticalRegion VOID FASTCALL ExAcquireFastMutex (PFAST_MUTEX FastMutex) { diff --git a/reactos/hal/halx86/generic/irql.c b/reactos/hal/halx86/generic/irql.c index b9a3ae159ed..bca26a93b1f 100644 --- a/reactos/hal/halx86/generic/irql.c +++ b/reactos/hal/halx86/generic/irql.c @@ -65,6 +65,7 @@ KiInterruptDispatch2 (ULONG Irq, KIRQL old_level); /* FUNCTIONS ****************************************************************/ +#undef KeGetCurrentIrql KIRQL STDCALL KeGetCurrentIrql (VOID) /* * PURPOSE: Returns the current irq level diff --git a/reactos/hal/halx86/generic/spinlock.c b/reactos/hal/halx86/generic/spinlock.c index 553e51c9d94..6d02d7c1c47 100644 --- a/reactos/hal/halx86/generic/spinlock.c +++ b/reactos/hal/halx86/generic/spinlock.c @@ -21,6 +21,9 @@ #include +/* Hmm, needed for KDBG := 1. Why? */ +#undef KeGetCurrentIrql + /* FUNCTIONS ***************************************************************/ VOID STDCALL diff --git a/reactos/hal/halx86/include/mps.h b/reactos/hal/halx86/include/mps.h index b25a415df53..bcd6a3392e1 100644 --- a/reactos/hal/halx86/include/mps.h +++ b/reactos/hal/halx86/include/mps.h @@ -84,7 +84,7 @@ typedef struct __attribute__((packed)) _MP_CONFIGURATION_BUS { UCHAR Type; /* 1 */ UCHAR BusId; /* Bus ID */ - UCHAR BusType[6]; /* Bus type */ + CHAR BusType[6]; /* Bus type */ } __attribute__((packed)) MP_CONFIGURATION_BUS, *PMP_CONFIGURATION_BUS; #define MAX_BUS 32 diff --git a/reactos/hal/halx86/mp/mpsirql.c b/reactos/hal/halx86/mp/mpsirql.c index 9c13f46a497..f25f40d7c0b 100644 --- a/reactos/hal/halx86/mp/mpsirql.c +++ b/reactos/hal/halx86/mp/mpsirql.c @@ -29,6 +29,7 @@ /* FUNCTIONS ****************************************************************/ +#undef KeGetCurrentIrql KIRQL STDCALL KeGetCurrentIrql (VOID) /* * PURPOSE: Returns the current irq level @@ -55,6 +56,7 @@ KIRQL STDCALL KeGetCurrentIrql (VOID) } +#undef KeSetCurrentIrql VOID KeSetCurrentIrql (KIRQL NewIrql) /* * PURPOSE: Sets the current irq level without taking any action diff --git a/reactos/include/ddk/defines.h b/reactos/include/ddk/defines.h index 3b173eea85e..a01f62800cb 100644 --- a/reactos/include/ddk/defines.h +++ b/reactos/include/ddk/defines.h @@ -28,7 +28,8 @@ enum OBJ_CASE_INSENSITIVE = 0x40, OBJ_OPENIF = 0x80, OBJ_OPENLINK = 0x100, - OBJ_VALID_ATTRIBUTES = 0x1F2, + OBJ_KERNEL_HANDLE = 0x200, + OBJ_VALID_ATTRIBUTES = 0x3F2, }; /* diff --git a/reactos/include/ddk/exfuncs.h b/reactos/include/ddk/exfuncs.h index 5370d4e09ee..d7994f448d0 100644 --- a/reactos/include/ddk/exfuncs.h +++ b/reactos/include/ddk/exfuncs.h @@ -215,6 +215,13 @@ ExFreePool ( PVOID block ); +void +STDCALL +ExFreePoolWithTag ( + PVOID block, + ULONG tag + ); + /* * PVOID * ExFreeToZone ( diff --git a/reactos/include/ddk/iotypes.h b/reactos/include/ddk/iotypes.h index 379cfc88a5a..755c305f6d0 100644 --- a/reactos/include/ddk/iotypes.h +++ b/reactos/include/ddk/iotypes.h @@ -645,6 +645,13 @@ typedef struct _IO_COMPLETION_CONTEXT #define FO_OPENED_CASE_SENSITIVE 0x00020000 #define FO_HANDLE_CREATED 0x00040000 #define FO_FILE_FAST_IO_READ 0x00080000 +#define FO_RANDOM_ACCESS 0x00100000 +#define FO_FILE_OPEN_CANCELLED 0x00200000 +#define FO_VOLUME_OPEN 0x00400000 +#define FO_FILE_OBJECT_HAS_EXTENSION 0x00800000 +#define FO_REMOTE_ORIGIN 0x01000000 + +#define IO_ATTACH_DEVICE_API 0x80000000 typedef struct _FILE_OBJECT { @@ -677,6 +684,34 @@ typedef struct _FILE_OBJECT PIO_COMPLETION_CONTEXT CompletionContext; } FILE_OBJECT, *PFILE_OBJECT; +typedef IO_ALLOCATION_ACTION STDCALL_FUNC +(*PDRIVER_CONTROL)(struct _DEVICE_OBJECT *DeviceObject, + struct _IRP *Irp, + PVOID MapRegisterBase, + PVOID Context); +#if (_WIN32_WINNT >= 0x0400) +typedef VOID STDCALL_FUNC +(*PFSDNOTIFICATIONPROC)(IN struct _DEVICE_OBJECT *PtrTargetFileSystemDeviceObject, + IN BOOLEAN DriverActive); +#endif // (_WIN32_WINNT >= 0x0400) + +typedef struct _KDEVICE_QUEUE_ENTRY +{ + LIST_ENTRY DeviceListEntry; + ULONG SortKey; + BOOLEAN Inserted; +} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY; + +typedef struct _WAIT_CONTEXT_BLOCK +{ + KDEVICE_QUEUE_ENTRY WaitQueueEntry; + PDRIVER_CONTROL DeviceRoutine; + PVOID DeviceContext; + ULONG NumberOfMapRegisters; + PVOID DeviceObject; + PVOID CurrentIrp; + PKDPC BufferChainingDpc; +} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK; typedef struct _IRP { @@ -750,7 +785,6 @@ typedef struct _VPB WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH]; } VPB, *PVPB; - typedef struct _DEVICE_OBJECT { CSHORT Type; @@ -885,8 +919,19 @@ struct _FAST_IO_DISPATCH_TABLE } FAST_IO_DISPATCH_TABLE, * PFAST_IO_DISPATCH_TABLE; #endif -#define IO_TYPE_DRIVER 4L -#define IO_TYPE_FILE 0x0F5L +#define IO_TYPE_ADAPTER 0x1L +#define IO_TYPE_CONTROLLER 0x2L +#define IO_TYPE_DEVICE 0x3L +#define IO_TYPE_DRIVER 0x4L +#define IO_TYPE_FILE 0x0F5L /* Temp Hack */ +#define IO_TYPE_IRP 0x6L +#define IO_TYPE_MASTER_ADAPTER 0x7L +#define IO_TYPE_OPEN_PACKET 0x8L +#define IO_TYPE_TIMER 0x9L +#define IO_TYPE_VPB 0xaL +#define IO_TYPE_ERROR_LOG 0xbL +#define IO_TYPE_ERROR_MESSAGE 0xcL +#define IO_TYPE_DEVICE_OBJECT_EXTENSION 0xdL #define DRVO_UNLOAD_INVOKED 0x1L #define DRVO_LEGACY_DRIVER 0x2L @@ -896,6 +941,12 @@ struct _FAST_IO_DISPATCH_TABLE #define DRVO_BOOTREINIT_REGISTERED 0x20L #define DRVO_LEGACY_RESOURCES 0x40L +#define DOE_UNLOAD_PENDING 0x1 +#define DOE_DELETE_PENDING 0x2 +#define DOE_REMOVE_PENDING 0x4 +#define DOE_REMOVE_PROCESSED 0x8 +#define DOE_START_PENDING 0x10 + typedef struct _DRIVER_OBJECT { CSHORT Type; @@ -946,7 +997,6 @@ typedef VOID STDCALL_FUNC /* * PURPOSE: Special timer associated with each device */ - #define IO_TYPE_TIMER 9 typedef struct _IO_TIMER { USHORT Type; /* Every IO Object has a Type */ USHORT TimerEnabled; /* Tells us if the Timer is enabled or not */ @@ -1110,18 +1160,6 @@ typedef struct _DRIVER_LAYOUT_INFORMATION } DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION; -typedef IO_ALLOCATION_ACTION STDCALL_FUNC -(*PDRIVER_CONTROL)(PDEVICE_OBJECT DeviceObject, - PIRP Irp, - PVOID MapRegisterBase, - PVOID Context); -#if (_WIN32_WINNT >= 0x0400) -typedef VOID STDCALL_FUNC -(*PFSDNOTIFICATIONPROC)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject, - IN BOOLEAN DriverActive); -#endif // (_WIN32_WINNT >= 0x0400) - - typedef struct _NAMED_PIPE_CREATE_PARAMETERS { ULONG NamedPipeType; diff --git a/reactos/include/ddk/kedef.h b/reactos/include/ddk/kedef.h index c1212f8a5d0..36be542f3f9 100644 --- a/reactos/include/ddk/kedef.h +++ b/reactos/include/ddk/kedef.h @@ -56,7 +56,7 @@ typedef enum _KWAIT_REASON WrPageOut, WrRendezvous, Spare2, - Spare3, + WrGuardedMutex, Spare4, Spare5, Spare6, diff --git a/reactos/include/ddk/kefuncs.h b/reactos/include/ddk/kefuncs.h index 2559e460276..72ddd012076 100644 --- a/reactos/include/ddk/kefuncs.h +++ b/reactos/include/ddk/kefuncs.h @@ -22,13 +22,17 @@ KeSaveFloatingPointState( VOID STDCALL KeAttachProcess(struct _KPROCESS *Process); +BOOLEAN +STDCALL +KeIsAttachedProcess(VOID); + VOID FASTCALL KiAcquireSpinLock(PKSPIN_LOCK SpinLock); VOID FASTCALL KiReleaseSpinLock(PKSPIN_LOCK SpinLock); VOID KeDrainApcQueue(VOID); -struct _KPROCESS* KeGetCurrentProcess(VOID); +struct _KPROCESS* STDCALL KeGetCurrentProcess(VOID); /* * FUNCTION: Acquires a spinlock so the caller can synchronize access to @@ -379,9 +383,6 @@ KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount ); ULONG STDCALL KeRosGetStackFrames ( PULONG Frames, ULONG FrameCount ); -BOOLEAN STDCALL -KeRosPrintAddress(PVOID address); - NTSTATUS STDCALL KeSetAffinityThread(PKTHREAD Thread, KAFFINITY Affinity); @@ -809,4 +810,48 @@ KeRaiseUserException( IN NTSTATUS ExceptionCode ); +VOID +FASTCALL +KeAcquireGuardedMutex( + PKGUARDED_MUTEX GuardedMutex +); + +VOID +FASTCALL +KeAcquireGuardedMutexUnsafe( + PKGUARDED_MUTEX GuardedMutex +); + +VOID +STDCALL +KeEnterGuardedRegion(VOID); + +VOID +STDCALL +KeLeaveGuardedRegion(VOID); + +VOID +FASTCALL +KeInitializeGuardedMutex( + PKGUARDED_MUTEX GuardedMutex +); + +VOID +FASTCALL +KeReleaseGuardedMutexUnsafe( + PKGUARDED_MUTEX GuardedMutex +); + +VOID +FASTCALL +KeReleaseGuardedMutex( + PKGUARDED_MUTEX GuardedMutex +); + +BOOL +FASTCALL +KeTryToAcquireGuardedMutex( + PKGUARDED_MUTEX GuardedMutex +); + #endif /* __INCLUDE_DDK_KEFUNCS_H */ diff --git a/reactos/include/ddk/ketypes.h b/reactos/include/ddk/ketypes.h index b938fc6c0b4..1cf8ddd28a2 100644 --- a/reactos/include/ddk/ketypes.h +++ b/reactos/include/ddk/ketypes.h @@ -88,6 +88,11 @@ typedef struct _KQUEUE LIST_ENTRY ThreadListHead; } KQUEUE, *PKQUEUE; +typedef struct _KGATE +{ + DISPATCHER_HEADER Header; +} KGATE, *PKGATE; + struct _KDPC; typedef struct _KTIMER @@ -175,6 +180,21 @@ typedef struct _KMUTEX UCHAR ApcDisable; } KMUTEX, *PKMUTEX, KMUTANT, *PKMUTANT; +typedef struct _KGUARDED_MUTEX +{ + LONG Count; + struct _KTHREAD* Owner; + ULONG Contention; + KGATE Gate; + union { + struct { + SHORT KernelApcDisable; + SHORT SpecialApcDisable; + }; + ULONG CombinedApcDisable; + }; +} KGUARDED_MUTEX, *PKGUARDED_MUTEX; + #include typedef struct _KSEMAPHORE @@ -265,37 +285,6 @@ typedef struct _KDPC_DATA { ULONG DpcCount; } KDPC_DATA, *PKDPC_DATA; -typedef struct _KDEVICE_QUEUE_ENTRY -{ - LIST_ENTRY DeviceListEntry; - ULONG SortKey; - BOOLEAN Inserted; -} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY; - -typedef struct _WAIT_CONTEXT_BLOCK -{ - KDEVICE_QUEUE_ENTRY WaitQueueEntry; - /* - * XXX THIS IS WRONG XXX - * - * Our headers have enough circular dependancies that - * I can't figure out, given 5 minutes of testing, what - * order to include them in to get PDRIVER_CONTROL to be - * defined here. The proper definition of the next item - * is: - * - * PDRIVER_CONTROL DeviceRoutine; - * - * but instead we use PVOID until headers are fixed. - */ - PVOID DeviceRoutine; - PVOID DeviceContext; - ULONG NumberOfMapRegisters; - PVOID DeviceObject; - PVOID CurrentIrp; - PKDPC BufferChainingDpc; -} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK; - typedef enum _KBUGCHECK_CALLBACK_REASON { KbCallbackInvalid, KbCallbackReserved1, diff --git a/reactos/include/ddk/ntdd8042.h b/reactos/include/ddk/ntdd8042.h index a0441fe3096..4bcace955ac 100644 --- a/reactos/include/ddk/ntdd8042.h +++ b/reactos/include/ddk/ntdd8042.h @@ -204,18 +204,18 @@ typedef struct _INTERNAL_I8042_HOOK_KEYBOARD { // // Write function // - //UNIMPLEMENTED IN PI8042_ISR_WRITE_PORT IsrWritePort; + IN PI8042_ISR_WRITE_PORT IsrWritePort; // // Queue the current packet (ie the one passed into the isr callback hook) // to be reported to the class driver // - //UNIMPLEMENTED IN PI8042_QUEUE_PACKET QueueKeyboardPacket; + IN PI8042_QUEUE_PACKET QueueKeyboardPacket; // // Context for IsrWritePort, QueueKeyboardPacket // - //UNIMPLEMENTED IN PVOID CallContext; + IN PVOID CallContext; } INTERNAL_I8042_HOOK_KEYBOARD, *PINTERNAL_I8042_HOOK_KEYBOARD; diff --git a/reactos/include/ddk/pnptypes.h b/reactos/include/ddk/pnptypes.h index a6a4489b9e2..19724d43729 100644 --- a/reactos/include/ddk/pnptypes.h +++ b/reactos/include/ddk/pnptypes.h @@ -147,6 +147,9 @@ typedef enum _IO_NOTIFICATION_EVENT_CATEGORY { EventCategoryTargetDeviceChange } IO_NOTIFICATION_EVENT_CATEGORY; +/* EventCategoryFlags for IoRegisterPlugPlayNotification */ +#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001 + /* CallbackRoutine for IoRegisterPlugPlayNotification */ typedef NTSTATUS STDCALL_FUNC (*PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)( diff --git a/reactos/include/defines.h b/reactos/include/defines.h index 7a9868022d5..913ae402613 100644 --- a/reactos/include/defines.h +++ b/reactos/include/defines.h @@ -4056,72 +4056,226 @@ extern "C" { #define MDM_V23_OVERRIDE (1024) /* Languages */ -#define LANG_BULGARIAN (2) -#define LANG_CHINESE (4) -#define LANG_CROATIAN (26) -#define LANG_CZECH (5) -#define LANG_DANISH (6) -#define LANG_DUTCH (19) -#define LANG_ENGLISH (9) -#define LANG_FINNISH (11) -#define LANG_FRENCH (12) -#define LANG_GERMAN (7) -#define LANG_GREEK (8) -#define LANG_HUNGARIAN (14) -#define LANG_ICELANDIC (15) -#define LANG_ITALIAN (16) -#define LANG_JAPANESE (17) -#define LANG_KOREAN (18) -#define LANG_NEUTRAL (0) -#define LANG_NORWEGIAN (20) -#define LANG_POLISH (21) -#define LANG_PORTUGUESE (22) -#define LANG_ROMANIAN (24) -#define LANG_RUSSIAN (25) -#define LANG_SLOVAK (27) -#define LANG_SLOVENIAN (36) -#define LANG_SPANISH (10) -#define LANG_SWEDISH (29) -#define LANG_TURKISH (31) -#define SUBLANG_CHINESE_SIMPLIFIED (2) -#define SUBLANG_CHINESE_TRADITIONAL (1) -#define SUBLANG_CHINESE_HONGKONG (3) -#define SUBLANG_CHINESE_SINGAPORE (4) -#define SUBLANG_DEFAULT (1) -#define SUBLANG_DUTCH (1) -#define SUBLANG_DUTCH_BELGIAN (2) -#define SUBLANG_ENGLISH_AUS (3) -#define SUBLANG_ENGLISH_CAN (4) -#define SUBLANG_ENGLISH_EIRE (6) -#define SUBLANG_ENGLISH_NZ (5) -#define SUBLANG_ENGLISH_UK (2) -#define SUBLANG_ENGLISH_US (1) -#define SUBLANG_FRENCH (1) -#define SUBLANG_FRENCH_BELGIAN (2) -#define SUBLANG_FRENCH_CANADIAN (3) -#define SUBLANG_FRENCH_SWISS (4) -#define SUBLANG_GERMAN (1) -#define SUBLANG_GERMAN_AUSTRIAN (3) -#define SUBLANG_GERMAN_SWISS (2) -#define SUBLANG_ITALIAN (1) -#define SUBLANG_ITALIAN_SWISS (2) -#define SUBLANG_NEUTRAL (0) -#define SUBLANG_NORWEGIAN_BOKMAL (1) -#define SUBLANG_NORWEGIAN_NYNORSK (2) -#define SUBLANG_PORTUGUESE (2) -#define SUBLANG_PORTUGUESE_BRAZILIAN (1) -#define SUBLANG_SPANISH (1) -#define SUBLANG_SPANISH_MEXICAN (2) -#define SUBLANG_SPANISH_MODERN (3) -#define SUBLANG_SYS_DEFAULT (2) +#define LANG_NEUTRAL 0x00 +#define LANG_INVARIANT 0x7f + +#define LANG_AFRIKAANS 0x36 +#define LANG_ALBANIAN 0x1c +#define LANG_ARABIC 0x01 +#define LANG_ARMENIAN 0x2b +#define LANG_ASSAMESE 0x4d +#define LANG_AZERI 0x2c +#define LANG_BASQUE 0x2d +#define LANG_BELARUSIAN 0x23 +#define LANG_BENGALI 0x45 +#define LANG_BULGARIAN 0x02 +#define LANG_CATALAN 0x03 +#define LANG_CHINESE 0x04 +#define LANG_CROATIAN 0x1a +#define LANG_CZECH 0x05 +#define LANG_DANISH 0x06 +#define LANG_DIVEHI 0x65 +#define LANG_DUTCH 0x13 +#define LANG_ENGLISH 0x09 +#define LANG_ESTONIAN 0x25 +#define LANG_FAEROESE 0x38 +#define LANG_FARSI 0x29 +#define LANG_FINNISH 0x0b +#define LANG_FRENCH 0x0c +#define LANG_GALICIAN 0x56 +#define LANG_GEORGIAN 0x37 +#define LANG_GERMAN 0x07 +#define LANG_GREEK 0x08 +#define LANG_GUJARATI 0x47 +#define LANG_HEBREW 0x0d +#define LANG_HINDI 0x39 +#define LANG_HUNGARIAN 0x0e +#define LANG_ICELANDIC 0x0f +#define LANG_INDONESIAN 0x21 +#define LANG_ITALIAN 0x10 +#define LANG_JAPANESE 0x11 +#define LANG_KANNADA 0x4b +#define LANG_KASHMIRI 0x60 +#define LANG_KAZAK 0x3f +#define LANG_KONKANI 0x57 +#define LANG_KOREAN 0x12 +#define LANG_KYRGYZ 0x40 +#define LANG_LATVIAN 0x26 +#define LANG_LITHUANIAN 0x27 +#define LANG_MACEDONIAN 0x2f +#define LANG_MALAY 0x3e +#define LANG_MALAYALAM 0x4c +#define LANG_MANIPURI 0x58 +#define LANG_MARATHI 0x4e +#define LANG_MONGOLIAN 0x50 +#define LANG_NEPALI 0x61 +#define LANG_NORWEGIAN 0x14 +#define LANG_ORIYA 0x48 +#define LANG_POLISH 0x15 +#define LANG_PORTUGUESE 0x16 +#define LANG_PUNJABI 0x46 +#define LANG_ROMANIAN 0x18 +#define LANG_RUSSIAN 0x19 +#define LANG_SANSKRIT 0x4f +#define LANG_SERBIAN 0x1a +#define LANG_SINDHI 0x59 +#define LANG_SLOVAK 0x1b +#define LANG_SLOVENIAN 0x24 +#define LANG_SPANISH 0x0a +#define LANG_SWAHILI 0x41 +#define LANG_SWEDISH 0x1d +#define LANG_SYRIAC 0x5a +#define LANG_TAMIL 0x49 +#define LANG_TATAR 0x44 +#define LANG_TELUGU 0x4a +#define LANG_THAI 0x1e +#define LANG_TURKISH 0x1f +#define LANG_UKRAINIAN 0x22 +#define LANG_URDU 0x20 +#define LANG_UZBEK 0x43 +#define LANG_VIETNAMESE 0x2a + +/* FIXME: these are not in the Windows header */ +#define LANG_GAELIC 0x3c +#define LANG_MALTESE 0x3a +#define LANG_MAORI 0x28 +#define LANG_RHAETO_ROMANCE 0x17 +#define LANG_SAAMI 0x3b +#define LANG_SORBIAN 0x2e +#define LANG_SUTU 0x30 +#define LANG_TSONGA 0x31 +#define LANG_TSWANA 0x32 +#define LANG_VENDA 0x33 +#define LANG_XHOSA 0x34 +#define LANG_ZULU 0x35 + +/* non standard; keep the number high enough (but < 0xff) */ +#define LANG_ESPERANTO 0x8f +#define LANG_WALON 0x90 +#define LANG_CORNISH 0x91 +#define LANG_WELSH 0x92 +#define LANG_BRETON 0x93 + +/* Sublanguage definitions */ +#define SUBLANG_NEUTRAL 0x00 /* language neutral */ +#define SUBLANG_DEFAULT 0x01 /* user default */ +#define SUBLANG_SYS_DEFAULT 0x02 /* system default */ + +#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define SUBLANG_ARABIC_IRAQ 0x02 +#define SUBLANG_ARABIC_EGYPT 0x03 +#define SUBLANG_ARABIC_LIBYA 0x04 +#define SUBLANG_ARABIC_ALGERIA 0x05 +#define SUBLANG_ARABIC_MOROCCO 0x06 +#define SUBLANG_ARABIC_TUNISIA 0x07 +#define SUBLANG_ARABIC_OMAN 0x08 +#define SUBLANG_ARABIC_YEMEN 0x09 +#define SUBLANG_ARABIC_SYRIA 0x0a +#define SUBLANG_ARABIC_JORDAN 0x0b +#define SUBLANG_ARABIC_LEBANON 0x0c +#define SUBLANG_ARABIC_KUWAIT 0x0d +#define SUBLANG_ARABIC_UAE 0x0e +#define SUBLANG_ARABIC_BAHRAIN 0x0f +#define SUBLANG_ARABIC_QATAR 0x10 +#define SUBLANG_AZERI_LATIN 0x01 +#define SUBLANG_AZERI_CYRILLIC 0x02 +#define SUBLANG_CHINESE_TRADITIONAL 0x01 +#define SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define SUBLANG_CHINESE_HONGKONG 0x03 +#define SUBLANG_CHINESE_SINGAPORE 0x04 +#define SUBLANG_CHINESE_MACAU 0x05 +#define SUBLANG_DUTCH 0x01 +#define SUBLANG_DUTCH_BELGIAN 0x02 +#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_ENGLISH_UK 0x02 +#define SUBLANG_ENGLISH_AUS 0x03 +#define SUBLANG_ENGLISH_CAN 0x04 +#define SUBLANG_ENGLISH_NZ 0x05 +#define SUBLANG_ENGLISH_EIRE 0x06 +#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define SUBLANG_ENGLISH_JAMAICA 0x08 +#define SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define SUBLANG_ENGLISH_BELIZE 0x0a +#define SUBLANG_ENGLISH_TRINIDAD 0x0b +#define SUBLANG_ENGLISH_ZIMBABWE 0x0c +#define SUBLANG_ENGLISH_PHILIPPINES 0x0d +#define SUBLANG_FRENCH 0x01 +#define SUBLANG_FRENCH_BELGIAN 0x02 +#define SUBLANG_FRENCH_CANADIAN 0x03 +#define SUBLANG_FRENCH_SWISS 0x04 +#define SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define SUBLANG_FRENCH_MONACO 0x06 +#define SUBLANG_GERMAN 0x01 +#define SUBLANG_GERMAN_SWISS 0x02 +#define SUBLANG_GERMAN_AUSTRIAN 0x03 +#define SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define SUBLANG_ITALIAN 0x01 +#define SUBLANG_ITALIAN_SWISS 0x02 +#define SUBLANG_KASHMIRI_SASIA 0x02 +#define SUBLANG_KASHMIRI_INDIA 0x02 +#define SUBLANG_KOREAN 0x01 +#define SUBLANG_LITHUANIAN 0x01 +#define SUBLANG_MALAY_MALAYSIA 0x01 +#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define SUBLANG_NEPALI_INDIA 0x02 +#define SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define SUBLANG_PORTUGUESE 0x02 +#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 +#define SUBLANG_SERBIAN_LATIN 0x02 +#define SUBLANG_SERBIAN_CYRILLIC 0x03 +#define SUBLANG_SPANISH 0x01 +#define SUBLANG_SPANISH_MEXICAN 0x02 +#define SUBLANG_SPANISH_MODERN 0x03 +#define SUBLANG_SPANISH_GUATEMALA 0x04 +#define SUBLANG_SPANISH_COSTA_RICA 0x05 +#define SUBLANG_SPANISH_PANAMA 0x06 +#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define SUBLANG_SPANISH_VENEZUELA 0x08 +#define SUBLANG_SPANISH_COLOMBIA 0x09 +#define SUBLANG_SPANISH_PERU 0x0a +#define SUBLANG_SPANISH_ARGENTINA 0x0b +#define SUBLANG_SPANISH_ECUADOR 0x0c +#define SUBLANG_SPANISH_CHILE 0x0d +#define SUBLANG_SPANISH_URUGUAY 0x0e +#define SUBLANG_SPANISH_PARAGUAY 0x0f +#define SUBLANG_SPANISH_BOLIVIA 0x10 +#define SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define SUBLANG_SPANISH_HONDURAS 0x12 +#define SUBLANG_SPANISH_NICARAGUA 0x13 +#define SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define SUBLANG_SWEDISH 0x01 +#define SUBLANG_SWEDISH_FINLAND 0x02 +#define SUBLANG_URDU_PAKISTAN 0x01 +#define SUBLANG_URDU_INDIA 0x02 +#define SUBLANG_UZBEK_LATIN 0x01 +#define SUBLANG_UZBEK_CYRILLIC 0x02 + +/* FIXME: these are not in the Windows header */ +#define SUBLANG_DUTCH_SURINAM 0x03 +#define SUBLANG_ROMANIAN 0x01 +#define SUBLANG_ROMANIAN_MOLDAVIA 0x02 +#define SUBLANG_RUSSIAN 0x01 +#define SUBLANG_RUSSIAN_MOLDAVIA 0x02 +#define SUBLANG_CROATIAN 0x01 +#define SUBLANG_LITHUANIAN_CLASSIC 0x02 +#define SUBLANG_GAELIC 0x01 +#define SUBLANG_GAELIC_SCOTTISH 0x02 +#define SUBLANG_GAELIC_MANX 0x03 + +/* + * Sort definitions + */ +#define SORT_DEFAULT 0x0 +#define SORT_JAPANESE_XJIS 0x0 +#define SORT_JAPANESE_UNICODE 0x1 +#define SORT_CHINESE_BIG5 0x0 +#define SORT_CHINESE_UNICODE 0x1 +#define SORT_KOREAN_KSC 0x0 +#define SORT_KOREAN_UNICODE 0x1 + #define NLS_VALID_LOCALE_MASK (1048575) -#define SORT_DEFAULT (0) -#define SORT_JAPANESE_XJIS (0) -#define SORT_JAPANESE_UNICODE (1) -#define SORT_CHINESE_BIG5 (0) -#define SORT_CHINESE_UNICODE (1) -#define SORT_KOREAN_KSC (0) -#define SORT_KOREAN_UNICODE (1) /* SYSTEM_INFO structure */ #define PROCESSOR_ARCHITECTURE_IA64 (6) diff --git a/reactos/include/epsapi.h b/reactos/include/epsapi.h index bca16aca890..6e7cecfaa94 100644 --- a/reactos/include/epsapi.h +++ b/reactos/include/epsapi.h @@ -32,10 +32,10 @@ /* OBJECTS */ /* TYPES */ -typedef NTSTATUS (NTAPI *PPROC_ENUM_ROUTINE)(IN PSYSTEM_PROCESSES CurrentProcess, +typedef NTSTATUS (NTAPI *PPROC_ENUM_ROUTINE)(IN PSYSTEM_PROCESS_INFORMATION CurrentProcess, IN OUT PVOID CallbackContext); -typedef NTSTATUS (NTAPI *PTHREAD_ENUM_ROUTINE)(IN PSYSTEM_THREADS CurrentThread, +typedef NTSTATUS (NTAPI *PTHREAD_ENUM_ROUTINE)(IN PSYSTEM_THREAD_INFORMATION CurrentThread, IN OUT PVOID CallbackContext); typedef NTSTATUS (NTAPI *PSYSMOD_ENUM_ROUTINE)(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, @@ -67,36 +67,36 @@ PsaEnumerateThreads(IN PTHREAD_ENUM_ROUTINE Callback, /* capturing & walking */ NTSTATUS NTAPI -PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESSES * ProcessesAndThreads); +PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESS_INFORMATION * ProcessesAndThreads); NTSTATUS NTAPI -PsaWalkProcessesAndThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, +PsaWalkProcessesAndThreads(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads, IN PPROC_ENUM_ROUTINE ProcessCallback, IN OUT PVOID ProcessCallbackContext, IN PTHREAD_ENUM_ROUTINE ThreadCallback, IN OUT PVOID ThreadCallbackContext); NTSTATUS NTAPI -PsaWalkProcesses(IN PSYSTEM_PROCESSES ProcessesAndThreads, +PsaWalkProcesses(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads, IN PPROC_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext); NTSTATUS NTAPI -PsaWalkThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, +PsaWalkThreads(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads, IN PTHREAD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext); -PSYSTEM_PROCESSES FASTCALL -PsaWalkFirstProcess(IN PSYSTEM_PROCESSES ProcessesAndThreads); +PSYSTEM_PROCESS_INFORMATION FASTCALL +PsaWalkFirstProcess(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads); -PSYSTEM_PROCESSES FASTCALL -PsaWalkNextProcess(IN PSYSTEM_PROCESSES CurrentProcess); +PSYSTEM_PROCESS_INFORMATION FASTCALL +PsaWalkNextProcess(IN PSYSTEM_PROCESS_INFORMATION CurrentProcess); -PSYSTEM_THREADS FASTCALL -PsaWalkFirstThread(IN PSYSTEM_PROCESSES CurrentProcess); +PSYSTEM_THREAD_INFORMATION FASTCALL +PsaWalkFirstThread(IN PSYSTEM_PROCESS_INFORMATION CurrentProcess); -PSYSTEM_THREADS FASTCALL -PsaWalkNextThread(IN PSYSTEM_THREADS CurrentThread); +PSYSTEM_THREAD_INFORMATION FASTCALL +PsaWalkNextThread(IN PSYSTEM_THREAD_INFORMATION CurrentThread); /* System modules */ /* enumeration */ diff --git a/reactos/include/idl/idl.xml b/reactos/include/idl/idl.xml index 57f5d458fde..3febc40eb56 100644 --- a/reactos/include/idl/idl.xml +++ b/reactos/include/idl/idl.xml @@ -10,3 +10,15 @@ pnp.idl + + . + w32api/include + + svcctl.idl + + + . + w32api/include + + svcctl.idl + diff --git a/reactos/include/idl/svcctl.idl b/reactos/include/idl/svcctl.idl new file mode 100644 index 00000000000..1bd65c06709 --- /dev/null +++ b/reactos/include/idl/svcctl.idl @@ -0,0 +1,127 @@ +/* + * Service Control Manager (SCM) interface definition + */ + +//#include +//#include + +#define DWORD unsigned long +#define BOOL unsigned long +#define SC_HANDLE unsigned int +#define SC_LOCK unsigned int +#define LPCSTR char* +#define LPCWSTR wchar_t* +#define LPDWORD unsigned long* + +[ + uuid(367abb81-9844-35f1-ad32-98f038001003), + version(2.0), + pointer_default(unique), + explicit_handle +] +interface svcctl +{ +cpp_quote("#if 0") + typedef struct _SERVICE_STATUS + { + DWORD dwServiceType; + DWORD dwCurrentState; + DWORD dwControlsAccepted; + DWORD dwWin32ExitCode; + DWORD dwServiceSpecificExitCode; + DWORD dwCheckPoint; + DWORD dwWaitHint; + } SERVICE_STATUS, *LPSERVICE_STATUS; +cpp_quote("#endif") + + /* Function 0 */ + DWORD ScmrCloseServiceHandle([in] handle_t BindingHandle, + [in] SC_HANDLE hSCObject); + + /* Function 1 */ + BOOL ScmrControlService([in] handle_t BindingHandle, + [in] SC_HANDLE hService, + [in] DWORD dwControl, + [out] LPSERVICE_STATUS lpServiceStatus); + + /* Function 2 */ + DWORD ScmrDeleteService([in] handle_t BindingHandle, + [in] SC_HANDLE hService); + + /* Function 3 */ + DWORD ScmrLockServiceDatabase([in] handle_t BindingHandle, + [in] SC_HANDLE hSCManager, + [out] SC_LOCK *hLock); + + /* Function 4 */ + DWORD ScmrQueryServiceObjectSecurity([in] handle_t BindingHandle); /* FIXME */ + + /* Function 5 */ + DWORD ScmrSetServiceObjectSecurity([in] handle_t BindingHandle); /* FIXME */ + + /* Function 6 */ + DWORD ScmrQueryServiceStatus([in] handle_t BindingHandle, + [in] SC_HANDLE hSCManager, + [out] LPSERVICE_STATUS lpServiceStatus); + + /* Function 7 */ + DWORD ScmrSetServiceStatus([in] handle_t BindingHandle); /* FIXME */ + + /* Function 8 */ + DWORD ScmrUnlockServiceDatabase([in] handle_t BindingHandle, + [in] SC_LOCK hLock); + + /* Function 9 */ + DWORD ScmrNotifyBootConfigStatus([in] handle_t BindingHandle, + [in] BOOL BootAcceptable); + + + /* Function 12 */ +// DWORD ScmrCreateServiceW([in] handle_t BindingHandle, +// [in] SC_HANDLE hSCManager, +// [in, string, ref] LPCWSTR lpServiceName, +// [in, string, ref] LPCWSTR lpDisplayName, +// [in] DWORD dwDesiredAccess, +// [in] DWORD dwServiceType, +// [in] DWORD dwStartType, +// [in] DWORD dwErrorControl, +// [in, string, ref] LPCWSTR lpBinaryPathName, +// [in, string, unique] LPCWSTR lpLoadOrderGroup, +// [out] LPDWORD lpdwTagId, +// [in, size_is(dwDepwndenciesLength), unique] LPCWSTR lpDependencies, +// [in] DWORD dwDependenciesLength, +// [in, string, unique] LPCWSTR lpServiceStartName, +// [in, size_is(dwPasswordLength), unique] LPCWSTR lpPassword, +// [in] DWORD dwPasswordLength, +// [out] SC_HANDLE *hService); + + + /* Function 15 */ + DWORD ScmrOpenSCManagerW([in] handle_t BindingHandle, + [in, string, unique] LPCWSTR lpMachineName, + [in, string, unique] LPCWSTR lpDatabaseName, + [in] DWORD dwDesiredAccess, + [out] SC_HANDLE *hScm); + + /* Function 16 */ + SC_HANDLE ScmrOpenServiceW([in] handle_t BindingHandle, + [in] SC_HANDLE hSCManager, + [in, string] LPCWSTR lpServiceName, + [in] DWORD dwDesiredAccess, + [out] SC_HANDLE *hScm); + + + /* Function 27 */ + DWORD ScmrOpenSCManagerA([in] handle_t BindingHandle, + [in, string, unique] LPCSTR lpMachineName, + [in, string, unique] LPCSTR lpDatabaseName, + [in] DWORD dwDesiredAccess, + [out] SC_HANDLE *hScm); + + /* Function 28 */ + SC_HANDLE ScmrOpenServiceA([in] handle_t BindingHandle, + [in] SC_HANDLE hSCManager, + [in, string] LPCSTR lpServiceName, + [in] DWORD dwDesiredAccess, + [out] SC_HANDLE *hScm); +} diff --git a/reactos/include/napi/teb.h b/reactos/include/napi/teb.h index b980f2b05b9..d9d2c0ad1f7 100644 --- a/reactos/include/napi/teb.h +++ b/reactos/include/napi/teb.h @@ -86,6 +86,7 @@ typedef struct _PEB_FREE_BLOCK /* RTL_USER_PROCESS_PARAMETERS.Flags */ #define PPF_NORMALIZED (1) +#define TEB_BASE (0x7FFDE000) #define PEB_BASE (0x7FFDF000) typedef struct _PEB_LDR_DATA diff --git a/reactos/include/ntos/ntpnp.h b/reactos/include/ntos/ntpnp.h index bf551f71e08..7e51fe7a3d9 100644 --- a/reactos/include/ntos/ntpnp.h +++ b/reactos/include/ntos/ntpnp.h @@ -38,6 +38,7 @@ DEFINE_GUID(GUID_DEVICE_REMOVAL_VETOED, 0x60DBD5FA, 0xDDD2, 0x11D2, 0x97, 0xB8, DEFINE_GUID(GUID_DEVICE_HIBERNATE_VETOED, 0x61173AD9, 0x194F, 0x11D3, 0x97, 0xDC, 0x00, 0xA0, 0xC9, 0x40, 0x52, 0x2E); DEFINE_GUID(GUID_DEVICE_BATTERY, 0x72631E54, 0x78A4, 0x11D0, 0xBC, 0xF7, 0x00, 0xAA, 0x00, 0xB7, 0xB3, 0x2A); DEFINE_GUID(GUID_DEVICE_SAFE_REMOVAL, 0x8FBEF967, 0xD6C5, 0x11D2, 0x97, 0xB5, 0x00, 0xA0, 0xC9, 0x40, 0x52, 0x2E); +/* These GUIDs are documented, and they are defined in wdmguid.h */ /* DEFINE_GUID(GUID_DEVICE_INTERFACE_ARRIVAL, 0xCB3A4004, 0x46F0, 0x11D0, 0xB0, 0x8F, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3F); */ /* DEFINE_GUID(GUID_DEVICE_INTERFACE_REMOVAL, 0xCB3A4005, 0x46F0, 0x11D0, 0xB0, 0x8F, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3F); */ DEFINE_GUID(GUID_DEVICE_ARRIVAL, 0xCB3A4009, 0x46F0, 0x11D0, 0xB0, 0x8F, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3F); diff --git a/reactos/include/ntos/ps.h b/reactos/include/ntos/ps.h index 9bdfad8e866..f3b0502df3e 100644 --- a/reactos/include/ntos/ps.h +++ b/reactos/include/ntos/ps.h @@ -70,7 +70,7 @@ #define PROCESS_SET_QUOTA (0x0100L) #define PROCESS_SET_INFORMATION (0x0200L) #define PROCESS_QUERY_INFORMATION (0x0400L) -#define PROCESS_SET_PORT (0x0800L) +#define PROCESS_SUSPEND_RESUME (0x0800L) #define PROCESS_ALL_ACCESS (0x1f0fffL) diff --git a/reactos/include/ntos/rtltypes.h b/reactos/include/ntos/rtltypes.h index 7674f095b38..71d1628e284 100755 --- a/reactos/include/ntos/rtltypes.h +++ b/reactos/include/ntos/rtltypes.h @@ -297,7 +297,7 @@ typedef struct _RTL_MESSAGE_RESOURCE_ENTRY { USHORT Length; USHORT Flags; - UCHAR Text[1]; + CHAR Text[1]; } RTL_MESSAGE_RESOURCE_ENTRY, *PRTL_MESSAGE_RESOURCE_ENTRY; typedef struct _RTL_MESSAGE_RESOURCE_BLOCK diff --git a/reactos/include/ntos/tss.h b/reactos/include/ntos/tss.h index 566651a450d..c48b43663b5 100755 --- a/reactos/include/ntos/tss.h +++ b/reactos/include/ntos/tss.h @@ -6,6 +6,7 @@ #define __INCLUDE_DDK_I386_TSS_H #define KTSS_ESP0 (0x4) +#define KTSS_CR3 (0x1C) #define KTSS_EFLAGS (0x24) #define KTSS_IOMAPBASE (0x66) diff --git a/reactos/include/ntos/zw.h b/reactos/include/ntos/zw.h index 8063bb5e5e0..89dd4ba9f75 100755 --- a/reactos/include/ntos/zw.h +++ b/reactos/include/ntos/zw.h @@ -3713,6 +3713,20 @@ ZwResumeThread( IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL ); + + +NTSTATUS +STDCALL +NtResumeProcess( + IN HANDLE ProcessHandle + ); + +NTSTATUS +STDCALL +ZwResumeProcess( + IN HANDLE ProcessHandle + ); + /* * FUNCTION: Writes the content of a registry key to ascii file * ARGUMENTS: @@ -4879,6 +4893,18 @@ ZwSuspendThread( OUT PULONG PreviousSuspendCount OPTIONAL ); +NTSTATUS +STDCALL +NtSuspendProcess( + IN HANDLE ProcessHandle + ); + +NTSTATUS +STDCALL +ZwSuspendProcess( + IN HANDLE ProcessHandle + ); + /* * FUNCTION: Terminates the execution of a thread. * ARGUMENTS: diff --git a/reactos/include/ntos/zwtypes.h b/reactos/include/ntos/zwtypes.h index 3a88cd6c78d..1b771a08de4 100755 --- a/reactos/include/ntos/zwtypes.h +++ b/reactos/include/ntos/zwtypes.h @@ -31,17 +31,6 @@ typedef struct _LDT_ENTRY { } HighWord; } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY; -typedef enum _THREAD_STATE { - StateInitialized, - StateReady, - StateRunning, - StateStandby, - StateTerminated, - StateWait, - StateTransition, - StateUnknown -} THREAD_STATE; - typedef enum _DEBUG_CONTROL_CODE { DebugGetTraceInformation = 1, @@ -337,53 +326,73 @@ typedef struct _SYSTEM_PERFORMANCE_INFORMATION { ULONG SystemCalls; } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION; +#ifndef __USE_W32API + // SystemProcessThreadInfo (5) -typedef struct _SYSTEM_THREAD_INFORMATION +typedef struct _SYSTEM_THREAD_INFORMATION { - TIME KernelTime; - TIME UserTime; - TIME CreateTime; - ULONG WaitTime; - PVOID StartAddress; - CLIENT_ID ClientId; - KPRIORITY Priority; - LONG BasePriority; - ULONG ContextSwitches; - ULONG ThreadState; - KWAIT_REASON WaitReason; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER CreateTime; + ULONG WaitTime; + PVOID StartAddress; + CLIENT_ID ClientId; + KPRIORITY Priority; + LONG BasePriority; + ULONG ContextSwitches; + ULONG ThreadState; + ULONG WaitReason; } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION; -typedef struct SYSTEM_PROCESS_INFORMATION +typedef struct _SYSTEM_PROCESS_INFORMATION { - ULONG NextEntryOffset; - ULONG NumberOfThreads; - LARGE_INTEGER SpareLi1; - LARGE_INTEGER SpareLi2; - LARGE_INTEGER SpareLi3; - TIME CreateTime; - TIME UserTime; - TIME KernelTime; - UNICODE_STRING ImageName; - ULONG BasePriority; - HANDLE UniqueProcessId; - HANDLE InheritedFromUniqueProcessId; - ULONG HandleCount; - ULONG SessionId; - ULONG SpareUl3; - ULONG PeakVirtualSize; - ULONG VirtualSize; - ULONG PageFaultCount; - ULONG PeakWorkingSetSize; - ULONG WorkingSetSize; - ULONG QuotaPeakPagedPoolUsage; - ULONG QuotaPagedPoolUsage; - ULONG QuotaPeakNonPagedPoolUsage; - ULONG QuotaNonPagedPoolUsage; - ULONG PagefileUsage; - ULONG PeakPagefileUsage; - ULONG PrivatePageCount; + ULONG NextEntryOffset; + ULONG NumberOfThreads; + LARGE_INTEGER SpareLi1; + LARGE_INTEGER SpareLi2; + LARGE_INTEGER SpareLi3; + LARGE_INTEGER CreateTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER KernelTime; + UNICODE_STRING ImageName; + KPRIORITY BasePriority; + HANDLE UniqueProcessId; + HANDLE InheritedFromUniqueProcessId; + ULONG HandleCount; + ULONG SessionId; + ULONG PageDirectoryFrame; + + /* + * This part corresponds to VM_COUNTERS_EX. + * NOTE: *NOT* THE SAME AS VM_COUNTERS! + */ + ULONG PeakVirtualSize; + ULONG VirtualSize; + ULONG PageFaultCount; + ULONG PeakWorkingSetSize; + ULONG WorkingSetSize; + ULONG QuotaPeakPagedPoolUsage; + ULONG QuotaPagedPoolUsage; + ULONG QuotaPeakNonPagedPoolUsage; + ULONG QuotaNonPagedPoolUsage; + ULONG PagefileUsage; + ULONG PeakPagefileUsage; + ULONG PrivateUsage; + + /* This part corresponds to IO_COUNTERS */ + LARGE_INTEGER ReadOperationCount; + LARGE_INTEGER WriteOperationCount; + LARGE_INTEGER OtherOperationCount; + LARGE_INTEGER ReadTransferCount; + LARGE_INTEGER WriteTransferCount; + LARGE_INTEGER OtherTransferCount; + + /* Finally, the array of Threads */ + SYSTEM_THREAD_INFORMATION TH[1]; } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION; +#endif + // SystemModuleInformation (11) typedef struct _SYSTEM_MODULE_INFORMATION_ENTRY { ULONG Unknown1; @@ -1311,69 +1320,6 @@ struct _SYSTEM_PATH_INFORMATION } SYSTEM_PATH_INFORMATION, * PSYSTEM_PATH_INFORMATION; -// SystemProcessInformation (5) - -#ifndef __USE_W32API - -typedef struct _SYSTEM_THREADS { - LARGE_INTEGER KernelTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER CreateTime; - ULONG WaitTime; - PVOID StartAddress; - CLIENT_ID ClientId; - KPRIORITY Priority; - KPRIORITY BasePriority; - ULONG ContextSwitchCount; - THREAD_STATE State; - KWAIT_REASON WaitReason; -} SYSTEM_THREADS, *PSYSTEM_THREADS; - -#endif /* __USE_W32API */ - -typedef struct _SYSTEM_PROCESSES_NT4 -{ - SIZE_T NextEntryDelta; - ULONG ThreadCount; - ULONG Reserved1[6]; - LARGE_INTEGER CreateTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER KernelTime; - UNICODE_STRING ProcessName; - KPRIORITY BasePriority; - HANDLE ProcessId; - HANDLE InheritedFromProcessId; - ULONG HandleCount; - ULONG Reserved2[2]; - VM_COUNTERS VmCounters; - SYSTEM_THREADS Threads[ANYSIZE_ARRAY]; -} SYSTEM_PROCESSES_NT4, *PSYSTEM_PROCESSES_NT4; - -typedef struct _SYSTEM_PROCESSES_NT5 -{ - SIZE_T NextEntryDelta; - ULONG ThreadCount; - ULONG Reserved1[6]; - LARGE_INTEGER CreateTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER KernelTime; - UNICODE_STRING ProcessName; - KPRIORITY BasePriority; - HANDLE ProcessId; - HANDLE InheritedFromProcessId; - ULONG HandleCount; - ULONG Reserved2[2]; - VM_COUNTERS VmCounters; - IO_COUNTERS IoCounters; - SYSTEM_THREADS Threads[ANYSIZE_ARRAY]; -} SYSTEM_PROCESSES_NT5, *PSYSTEM_PROCESSES_NT5; - -#ifndef __USE_W32API - -/* Not sure. What version are we emulating? */ -typedef SYSTEM_PROCESSES_NT5 SYSTEM_PROCESSES, *PSYSTEM_PROCESSES; - -#endif /* __USE_W32API */ // SystemCallCountInformation (6) typedef diff --git a/reactos/include/pseh/framebased.h b/reactos/include/pseh/framebased.h index d039b2f3e3c..7e2f020023e 100644 --- a/reactos/include/pseh/framebased.h +++ b/reactos/include/pseh/framebased.h @@ -294,7 +294,7 @@ static __declspec(noreturn) __inline void __stdcall _SEHCompilerSpecificHandler \ default: \ { \ - switch(state) \ + switch(_SEH2State) \ { \ case _SEH2_STATE_INIT_EXCEPT: _SEH2Filter = NULL; break; \ case _SEH2_STATE_INIT_FINALLY: _SEH2Finally = NULL; break; \ diff --git a/reactos/include/rosdhcp_public.h b/reactos/include/rosdhcp_public.h new file mode 100644 index 00000000000..c732e7f9ede --- /dev/null +++ b/reactos/include/rosdhcp_public.h @@ -0,0 +1,46 @@ +#ifndef ROSDHCP_PUBLIC_H +#define ROSDHCP_PUBLIC_H + +enum { + DhcpReqLeaseIpAddress, + DhcpReqQueryHWInfo, + DhcpReqReleaseIpAddress, + DhcpReqRenewIpAddress, + DhcpReqStaticRefreshParams, +}; + +typedef struct _COMM_DHCP_REQ { + UINT Type; + DWORD AdapterIndex; + union { + struct { + BOOL Inserted; + } PnpEvent; + struct { + LPWSTR AdapterName; + DHCPCAPI_PARAMS_ARRAY Params; + } RegisterParamChange; + struct { + LPWSTR AdapterName; + LPWSTR RequestId; + } RequestParams, UndoRequestParams; + struct { + DWORD IPAddress; + DWORD Netmask; + } StaticRefreshParams; + } Body; +} COMM_DHCP_REQ; + +typedef union _COMM_DHCP_REPLY { + DWORD Reply; + struct { + DWORD AdapterIndex; + DWORD MediaType; + DWORD Mtu; + DWORD Speed; + } QueryHWInfo; +} COMM_DHCP_REPLY; + +#define DHCP_PIPE_NAME "\\\\.\\pipe\\dhcpclient" + +#endif/*ROSDHCP_PUBLIC_H*/ diff --git a/reactos/include/sm/api.h b/reactos/include/sm/api.h index ecca2b89d0c..9b4944b5f5f 100644 --- a/reactos/include/sm/api.h +++ b/reactos/include/sm/api.h @@ -12,15 +12,16 @@ #pragma pack(push,4) -/* SmConnectApiPort */ +/* SmConnectApiPort (SS->SM) */ typedef struct _SM_CONNECT_DATA { - ULONG Subsystem; + USHORT SubSystemId; + WORD Unused; WCHAR SbName [SM_SB_NAME_MAX_LENGTH]; } SM_CONNECT_DATA, *PSM_CONNECT_DATA; -/* SmpConnectSbApiPort */ +/* SmpConnectSbApiPort (SM->SS) */ typedef struct _SB_CONNECT_DATA { ULONG SmApiMax; @@ -65,6 +66,47 @@ typedef struct _SM_PORT_MESSAGE_EXECPGM } SM_PORT_MESSAGE_EXECPGM, *PSM_PORT_MESSAGE_EXECPGM; +/*** 5 ****************************************************************/ + +#define SM_API_QUERY_INFORMATION 5 /* ask SM to send back some data */ + /* Note: this is not in NT */ +#define SM_QRYINFO_MAX_SS_COUNT 8 +#define SM_QRYINFO_MAX_ROOT_NODE 30 + +typedef enum { + SmBasicInformation = 0, + SmSubSystemInformation = 1, +} SM_INFORMATION_CLASS; + +typedef struct _SM_BASIC_INFORMATION +{ + USHORT SubSystemCount; + WORD Unused; + struct { + WORD Id; + WORD Flags; + DWORD ProcessId; + } SubSystem [SM_QRYINFO_MAX_SS_COUNT]; +} SM_BASIC_INFORMATION, *PSM_BASIC_INFORMATION; + +typedef struct _SM_SUBSYSTEM_INFORMATION +{ + WORD SubSystemId; + WORD Flags; + DWORD ProcessId; + WCHAR NameSpaceRootNode [SM_QRYINFO_MAX_ROOT_NODE]; +} SM_SUBSYSTEM_INFORMATION, *PSM_SUBSYSTEM_INFORMATION; + +typedef struct _SM_PORT_MESSAGE_QRYINFO +{ + SM_INFORMATION_CLASS SmInformationClass; + ULONG DataLength; + union { + SM_BASIC_INFORMATION BasicInformation; + SM_SUBSYSTEM_INFORMATION SubSystemInformation; + }; +} SM_PORT_MESSAGE_QRYINFO, * PSM_PORT_MESSAGE_QRYINFO; + /*** | ****************************************************************/ typedef struct _SM_PORT_MESSAGE @@ -72,12 +114,22 @@ typedef struct _SM_PORT_MESSAGE /*** LPC common header ***/ LPC_MESSAGE Header; /*** SM common header ***/ - DWORD ApiIndex; - NTSTATUS Status; + struct { + DWORD ApiIndex; + NTSTATUS Status; + } SmHeader; /*** SM per API arguments ***/ union { - SM_PORT_MESSAGE_COMPSES CompSes; - SM_PORT_MESSAGE_EXECPGM ExecPgm; + union { + SM_PORT_MESSAGE_COMPSES CompSes; + SM_PORT_MESSAGE_EXECPGM ExecPgm; + SM_PORT_MESSAGE_QRYINFO QryInfo; + } Request; + union { + SM_PORT_MESSAGE_COMPSES CompSes; + SM_PORT_MESSAGE_EXECPGM ExecPgm; + SM_PORT_MESSAGE_QRYINFO QryInfo; + } Reply; }; } SM_PORT_MESSAGE, * PSM_PORT_MESSAGE; @@ -86,7 +138,7 @@ typedef struct _SM_PORT_MESSAGE /*** MACRO ***********************************************************/ -#define SM_CONNECT_DATA_SIZE(m) ((m).Header.DataSize-sizeof(ULONG)) +#define SM_CONNECT_DATA_SIZE(m) ((m).Header.DataSize-sizeof(USHORT)-sizeof(WORD)) #define SM_PORT_DATA_SIZE(c) (sizeof(DWORD)+sizeof(NTSTATUS)+sizeof(c)) #define SM_PORT_MESSAGE_SIZE (sizeof(SM_PORT_MESSAGE)) diff --git a/reactos/include/sm/helper.h b/reactos/include/sm/helper.h index aca5158bddf..3ca42dfcbe6 100644 --- a/reactos/include/sm/helper.h +++ b/reactos/include/sm/helper.h @@ -1,13 +1,17 @@ #if !defined(INCLUDE_SM_HELPER_H) #define INCLUDE_SM_HELPER_H +#if !defined(__SM_API_H) +#include +#endif + /* $Id$ */ /* smlib/connect.c */ NTSTATUS STDCALL SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL, IN HANDLE hSbApiPort OPTIONAL, - IN DWORD dwSubsystem OPTIONAL, /* pe.h */ + IN WORD wSubsystem OPTIONAL, /* pe.h */ IN OUT PHANDLE phSmApiPort); /* smlib/compses.c */ NTSTATUS STDCALL @@ -20,14 +24,11 @@ SmExecuteProgram (IN HANDLE hSmApiPort, IN PUNICODE_STRING Pgm ); /* smdll/query.c */ -typedef enum { - SM_BASE_INFORMATION -} SM_INFORMATION_CLASS, *PSM_INFORMATION_CLASS; - NTSTATUS STDCALL -SmQuery (IN HANDLE SmApiPort, - IN SM_INFORMATION_CLASS SmInformationClass, - IN OUT PVOID Data, - IN OUT PULONG DataLength); +SmQueryInformation (IN HANDLE SmApiPort, + IN SM_INFORMATION_CLASS SmInformationClass, + IN OUT PVOID Data, + IN ULONG DataLength, + IN OUT PULONG ReturnedDataLength OPTIONAL); #endif /* ndef INCLUDE_SM_HELPER_H */ diff --git a/reactos/include/tchar.h b/reactos/include/tchar.h index 9225bf2babd..fe0c94b8770 100644 --- a/reactos/include/tchar.h +++ b/reactos/include/tchar.h @@ -6,7 +6,7 @@ #ifdef _UNICODE - #define __TEXT(q) L##q + #define __T(q) L##q #ifndef _TCHAR_DEFINED #ifndef RC_INVOKED @@ -203,7 +203,7 @@ #else - #define __TEXT(q) q + #define __T(q) q #ifndef _TCHAR_DEFINED #ifndef RC_INVOKED @@ -403,8 +403,8 @@ -#define _TEXT(x) __TEXT(x) -#define _T(x) __TEXT(x) +#define _TEXT(x) __T(x) +#define _T(x) __T(x) #endif /* _TCHAR_H_ */ diff --git a/reactos/include/win32k/driver.h b/reactos/include/win32k/driver.h index a18ff7d7648..a7cf14ce426 100644 --- a/reactos/include/win32k/driver.h +++ b/reactos/include/win32k/driver.h @@ -21,9 +21,12 @@ typedef VOID (STDCALL *PGD_DISABLEPDEV)(DHPDEV); typedef HSURF (STDCALL *PGD_ENABLESURFACE)(DHPDEV); typedef VOID (STDCALL *PGD_DISABLESURFACE)(DHPDEV); typedef BOOL (STDCALL *PGD_ASSERTMODE)(DHPDEV, BOOL); +typedef BOOL (STDCALL *PGD_OFFSET)(SURFOBJ*, LONG, LONG, FLONG); typedef BOOL (STDCALL *PGD_RESETPDEV)(DHPDEV, DHPDEV); +typedef VOID (STDCALL *PGD_DISABLEDRIVER)(VOID); typedef HBITMAP (STDCALL *PGD_CREATEDEVICEBITMAP)(DHPDEV, SIZEL, ULONG); typedef VOID (STDCALL *PGD_DELETEDEVICEBITMAP)(DHSURF); +typedef BOOL (STDCALL *PGD_ALPHABLEND)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, BLENDOBJ*); typedef BOOL (STDCALL *PGD_REALIZEBRUSH)(BRUSHOBJ*, SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*, ULONG); typedef ULONG (STDCALL *PGD_DITHERCOLOR)(DHPDEV, ULONG, ULONG, PULONG); @@ -38,12 +41,17 @@ typedef BOOL (STDCALL *PGD_PAINT)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, POINTL*, MIX); typedef BOOL (STDCALL *PGD_BITBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, POINTL*, POINTL*, BRUSHOBJ*, POINTL*, ROP4); -typedef BOOL (STDCALL *PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, ULONG, ULONG); +typedef BOOL (STDCALL *PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, + RECTL*, RECTL*, ULONG, ULONG); typedef BOOL (STDCALL *PGD_COPYBITS)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, POINTL*); typedef BOOL (STDCALL *PGD_STRETCHBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, COLORADJUSTMENT*, POINTL*, - RECTL*, RECTL*, POINTL*, ULONG); + RECTL*, RECTL*, POINTL*, ULONG); +typedef BOOL (STDCALL *PGD_STRETCHBLTROP)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, + XLATEOBJ*, COLORADJUSTMENT*, POINTL*, + RECTL*, RECTL*, POINTL*, ULONG, + BRUSHOBJ*, DWORD); typedef BOOL (STDCALL *PGD_SETPALETTE)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG); typedef BOOL (STDCALL *PGD_TEXTOUT)(SURFOBJ*, STROBJ*, FONTOBJ*, CLIPOBJ*, RECTL*, RECTL*, BRUSHOBJ*, BRUSHOBJ*, POINTL*, MIX); @@ -108,7 +116,9 @@ typedef struct _DRIVER_FUNCTIONS PGD_ENABLESURFACE EnableSurface; PGD_DISABLESURFACE DisableSurface; PGD_ASSERTMODE AssertMode; + PGD_OFFSET Offset; PGD_RESETPDEV ResetPDEV; + PGD_DISABLEDRIVER DisableDriver; PGD_CREATEDEVICEBITMAP CreateDeviceBitmap; PGD_DELETEDEVICEBITMAP DeleteDeviceBitmap; PGD_REALIZEBRUSH RealizeBrush; @@ -121,6 +131,7 @@ typedef struct _DRIVER_FUNCTIONS PGD_TRANSPARENTBLT TransparentBlt; PGD_COPYBITS CopyBits; PGD_STRETCHBLT StretchBlt; + PGD_STRETCHBLTROP StretchBltROP; PGD_SETPALETTE SetPalette; PGD_TEXTOUT TextOut; PGD_ESCAPE Escape; @@ -161,6 +172,7 @@ typedef struct _DRIVER_FUNCTIONS PGD_QUERYSPOOLTYPE QuerySpoolType; PGD_GRADIENTFILL GradientFill; PGD_SYNCHRONIZESURFACE SynchronizeSurface; + PGD_ALPHABLEND AlphaBlend; } DRIVER_FUNCTIONS, *PDRIVER_FUNCTIONS; BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver); diff --git a/reactos/include/wine/commctrl.h b/reactos/include/wine/commctrl.h index b7f8ff630b4..b1d0f1a9680 100644 --- a/reactos/include/wine/commctrl.h +++ b/reactos/include/wine/commctrl.h @@ -61,6 +61,16 @@ typedef LPFINDINFOW LPLVFINDINFOW; #define SB_SETBORDERS (WM_USER+5) #define FLATSB_CLASSA "flatsb_class32" +#if defined(__GNUC__) +# define FLATSB_CLASSW (const WCHAR []){ 'f','l','a','t','s','b','_', \ + 'c','l','a','s','s','3','2',0 } +#elif defined(_MSC_VER) +# define FLATSB_CLASSW L"flatsb_class32" +#else +static const WCHAR FLATSB_CLASSW[] = { 'f','l','a','t','s','b','_', + 'c','l','a','s','s','3','2',0 }; +#endif + #define DRAGLISTMSGSTRINGA "commctrl_DragListMsg" #if defined(__GNUC__) # define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \ diff --git a/reactos/include/wine/msidefs.h b/reactos/include/wine/msidefs.h index 45d4f20969b..f266b32172c 100644 --- a/reactos/include/wine/msidefs.h +++ b/reactos/include/wine/msidefs.h @@ -103,6 +103,49 @@ enum msidbComponentAttributes msidbComponentAttributes64bit = 0x00000100 }; +/* + * Windows SDK braindamage alert + * + * PID_DICTIONARY and PID_CODEPAGE are defined by propidl.h too + * PID_SECURITY is defined in propidl.h with a different value! + * So these need to be undefined first. + */ +#ifdef PID_DICTIONARY +#undef PID_DICTIONARY +#endif + +#ifdef PID_CODEPAGE +#undef PID_CODEPAGE +#endif + +#ifdef PID_SECURITY +#undef PID_SECURITY +#endif + +#define PID_DICTIONARY 0 +#define PID_CODEPAGE 1 +#define PID_TITLE 2 +#define PID_SUBJECT 3 +#define PID_AUTHOR 4 +#define PID_KEYWORDS 5 +#define PID_COMMENTS 6 +#define PID_TEMPLATE 7 +#define PID_LASTAUTHOR 8 +#define PID_REVNUMBER 9 +#define PID_EDITTINE 10 +#define PID_LASTPRINTED 11 +#define PID_CREATE_DTM 12 +#define PID_LASTSAVE_DTM 13 +#define PID_PAGECOUNT 14 +#define PID_WORDCOUNT 15 +#define PID_CHARCOUNT 16 +#define PID_THUMBNAIL 17 +#define PID_APPNAME 18 +#define PID_SECURITY 19 +#define PID_MSIVERSION PID_PAGECOUNT +#define PID_MSISOURCE PID_WORDCOUNT +#define PID_MSIRESTRICT PID_CHARCOUNT + #ifdef __cplusplus } #endif diff --git a/reactos/include/wine/wininet.h b/reactos/include/wine/wininet.h new file mode 100644 index 00000000000..e1fc0a3a3be --- /dev/null +++ b/reactos/include/wine/wininet.h @@ -0,0 +1,1552 @@ +/* + * Copyright (C) 2000 Ulrich Czekalla + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _WINE_WININET_H_ +#define _WINE_WININET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define INTERNETAPI +#define BOOLAPI INTERNETAPI BOOL WINAPI + +typedef LPVOID HINTERNET; +typedef HINTERNET * LPHINTERNET; + +typedef WORD INTERNET_PORT; +typedef INTERNET_PORT * LPINTERNET_PORT; + + +#define INTERNET_INVALID_PORT_NUMBER 0 + +#define INTERNET_DEFAULT_FTP_PORT 21 +#define INTERNET_DEFAULT_GOPHER_PORT 70 +#define INTERNET_DEFAULT_HTTP_PORT 80 +#define INTERNET_DEFAULT_HTTPS_PORT 443 +#define INTERNET_DEFAULT_SOCKS_PORT 1080 + +#define INTERNET_MAX_HOST_NAME_LENGTH 256 +#define INTERNET_MAX_USER_NAME_LENGTH 128 +#define INTERNET_MAX_PASSWORD_LENGTH 128 +#define INTERNET_MAX_PORT_NUMBER_LENGTH 5 +#define INTERNET_MAX_PORT_NUMBER_VALUE 65535 +#define INTERNET_MAX_PATH_LENGTH 2048 +#define INTERNET_MAX_SCHEME_LENGTH 32 +#define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH + sizeof("://")+ INTERNET_MAX_PATH_LENGTH) +#define INTERNET_KEEP_ALIVE_UNKNOWN ((DWORD)-1) +#define INTERNET_KEEP_ALIVE_ENABLED 1 +#define INTERNET_KEEP_ALIVE_DISABLED 0 +#define INTERNET_REQFLAG_FROM_CACHE 0x00000001 +#define INTERNET_REQFLAG_ASYNC 0x00000002 +#define INTERNET_REQFLAG_VIA_PROXY 0x00000004 +#define INTERNET_REQFLAG_NO_HEADERS 0x00000008 +#define INTERNET_REQFLAG_PASSIVE 0x00000010 +#define INTERNET_REQFLAG_CACHE_WRITE_DISABLED 0x00000040 +#define INTERNET_FLAG_RELOAD 0x80000000 +#define INTERNET_FLAG_RAW_DATA 0x40000000 +#define INTERNET_FLAG_EXISTING_CONNECT 0x20000000 +#define INTERNET_FLAG_ASYNC 0x10000000 +#define INTERNET_FLAG_PASSIVE 0x08000000 +#define INTERNET_FLAG_NO_CACHE_WRITE 0x04000000 +#define INTERNET_FLAG_DONT_CACHE INTERNET_FLAG_NO_CACHE_WRITE +#define INTERNET_FLAG_MAKE_PERSISTENT 0x02000000 +#define INTERNET_FLAG_FROM_CACHE 0x01000000 +#define INTERNET_FLAG_OFFLINE INTERNET_FLAG_FROM_CACHE +#define INTERNET_FLAG_SECURE 0x00800000 +#define INTERNET_FLAG_KEEP_CONNECTION 0x00400000 +#define INTERNET_FLAG_NO_AUTO_REDIRECT 0x00200000 +#define INTERNET_FLAG_READ_PREFETCH 0x00100000 +#define INTERNET_FLAG_NO_COOKIES 0x00080000 +#define INTERNET_FLAG_NO_AUTH 0x00040000 +#define INTERNET_FLAG_CACHE_IF_NET_FAIL 0x00010000 +#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP 0x00008000 +#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 0x00004000 +#define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000 +#define INTERNET_FLAG_IGNORE_CERT_CN_INVALID 0x00001000 +#define INTERNET_FLAG_RESYNCHRONIZE 0x00000800 +#define INTERNET_FLAG_HYPERLINK 0x00000400 +#define INTERNET_FLAG_NO_UI 0x00000200 +#define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100 +#define INTERNET_FLAG_CACHE_ASYNC 0x00000080 +#define INTERNET_FLAG_FORMS_SUBMIT 0x00000040 +#define INTERNET_FLAG_NEED_FILE 0x00000010 +#define INTERNET_FLAG_MUST_CACHE_REQUEST INTERNET_FLAG_NEED_FILE +#define INTERNET_FLAG_TRANSFER_ASCII FTP_TRANSFER_TYPE_ASCII +#define INTERNET_FLAG_TRANSFER_BINARY FTP_TRANSFER_TYPE_BINARY +#define SECURITY_INTERNET_MASK (INTERNET_FLAG_IGNORE_CERT_CN_INVALID|\ +INTERNET_FLAG_IGNORE_CERT_DATE_INVALID|\ +INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|\ +INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP) + +#define INTERNET_FLAGS_MASK (INTERNET_FLAG_RELOAD \ + | INTERNET_FLAG_RAW_DATA \ + | INTERNET_FLAG_EXISTING_CONNECT \ + | INTERNET_FLAG_ASYNC \ + | INTERNET_FLAG_PASSIVE \ + | INTERNET_FLAG_NO_CACHE_WRITE \ + | INTERNET_FLAG_MAKE_PERSISTENT \ + | INTERNET_FLAG_FROM_CACHE \ + | INTERNET_FLAG_SECURE \ + | INTERNET_FLAG_KEEP_CONNECTION \ + | INTERNET_FLAG_NO_AUTO_REDIRECT \ + | INTERNET_FLAG_READ_PREFETCH \ + | INTERNET_FLAG_NO_COOKIES \ + | INTERNET_FLAG_NO_AUTH \ + | INTERNET_FLAG_CACHE_IF_NET_FAIL \ + | SECURITY_INTERNET_MASK \ + | INTERNET_FLAG_RESYNCHRONIZE \ + | INTERNET_FLAG_HYPERLINK \ + | INTERNET_FLAG_NO_UI \ + | INTERNET_FLAG_PRAGMA_NOCACHE \ + | INTERNET_FLAG_CACHE_ASYNC \ + | INTERNET_FLAG_FORMS_SUBMIT \ + | INTERNET_FLAG_NEED_FILE \ + | INTERNET_FLAG_TRANSFER_BINARY \ + | INTERNET_FLAG_TRANSFER_ASCII \ + ) + +#define INTERNET_ERROR_MASK_INSERT_CDROM 0x1 + +#define INTERNET_OPTIONS_MASK (~INTERNET_FLAGS_MASK) +#define WININET_API_FLAG_ASYNC 0x00000001 +#define WININET_API_FLAG_SYNC 0x00000004 +#define WININET_API_FLAG_USE_CONTEXT 0x00000008 +#define INTERNET_NO_CALLBACK 0 + +typedef enum { + INTERNET_SCHEME_PARTIAL = -2, + INTERNET_SCHEME_UNKNOWN = -1, + INTERNET_SCHEME_DEFAULT = 0, + INTERNET_SCHEME_FTP, + INTERNET_SCHEME_GOPHER, + INTERNET_SCHEME_HTTP, + INTERNET_SCHEME_HTTPS, + INTERNET_SCHEME_FILE, + INTERNET_SCHEME_NEWS, + INTERNET_SCHEME_MAILTO, + INTERNET_SCHEME_SOCKS, + INTERNET_SCHEME_JAVASCRIPT, + INTERNET_SCHEME_VBSCRIPT, + INTERNET_SCHEME_RES, + INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP, + INTERNET_SCHEME_LAST = INTERNET_SCHEME_RES +} INTERNET_SCHEME,* LPINTERNET_SCHEME; + +typedef struct { + DWORD dwResult; + DWORD dwError; +} INTERNET_ASYNC_RESULT,* LPINTERNET_ASYNC_RESULT; + +typedef struct { + DWORD dwAccessType; + LPCSTR lpszProxy; + LPCSTR lpszProxyBypass; +} INTERNET_PROXY_INFOA,* LPINTERNET_PROXY_INFOA; + +typedef struct { + DWORD dwAccessType; + LPCWSTR lpszProxy; + LPCWSTR lpszProxyBypass; +} INTERNET_PROXY_INFOW,* LPINTERNET_PROXY_INFOW; + + +DECL_WINELIB_TYPE_AW(INTERNET_PROXY_INFO) +DECL_WINELIB_TYPE_AW(LPINTERNET_PROXY_INFO) + +typedef struct { + DWORD dwMajorVersion; + DWORD dwMinorVersion; +} INTERNET_VERSION_INFO,* LPINTERNET_VERSION_INFO; + +typedef struct { + DWORD dwMajorVersion; + DWORD dwMinorVersion; +} HTTP_VERSION_INFO,* LPHTTP_VERSION_INFO; + +typedef struct { + DWORD dwConnectedState; + DWORD dwFlags; +} INTERNET_CONNECTED_INFO,* LPINTERNET_CONNECTED_INFO; + +#define ISO_FORCE_DISCONNECTED 0x00000001 + +typedef struct { + DWORD dwStructSize; + LPSTR lpszScheme; + DWORD dwSchemeLength; + INTERNET_SCHEME nScheme; + LPSTR lpszHostName; + DWORD dwHostNameLength; + INTERNET_PORT nPort; + LPSTR lpszUserName; + DWORD dwUserNameLength; + LPSTR lpszPassword; + DWORD dwPasswordLength; + LPSTR lpszUrlPath; + DWORD dwUrlPathLength; + LPSTR lpszExtraInfo; + DWORD dwExtraInfoLength; +} URL_COMPONENTSA,* LPURL_COMPONENTSA; + +typedef struct { + DWORD dwStructSize; + LPWSTR lpszScheme; + DWORD dwSchemeLength; + INTERNET_SCHEME nScheme; + LPWSTR lpszHostName; + DWORD dwHostNameLength; + INTERNET_PORT nPort; + LPWSTR lpszUserName; + DWORD dwUserNameLength; + LPWSTR lpszPassword; + DWORD dwPasswordLength; + LPWSTR lpszUrlPath; + DWORD dwUrlPathLength; + LPWSTR lpszExtraInfo; + DWORD dwExtraInfoLength; +} URL_COMPONENTSW,* LPURL_COMPONENTSW; + +DECL_WINELIB_TYPE_AW(URL_COMPONENTS) +DECL_WINELIB_TYPE_AW(LPURL_COMPONENTS) + +typedef struct { + FILETIME ftExpiry; + FILETIME ftStart; + LPSTR lpszSubjectInfo; + LPSTR lpszIssuerInfo; + LPSTR lpszProtocolName; + LPSTR lpszSignatureAlgName; + LPSTR lpszEncryptionAlgName; + DWORD dwKeySize; + +} INTERNET_CERTIFICATE_INFOA,* LPINTERNET_CERTIFICATE_INFOA; + +typedef struct { + FILETIME ftExpiry; + FILETIME ftStart; + LPWSTR lpszSubjectInfo; + LPWSTR lpszIssuerInfo; + LPWSTR lpszProtocolName; + LPWSTR lpszSignatureAlgName; + LPWSTR lpszEncryptionAlgName; + DWORD dwKeySize; + +} INTERNET_CERTIFICATE_INFOW,* LPINTERNET_CERTIFICATE_INFOW; + +DECL_WINELIB_TYPE_AW(INTERNET_CERTIFICATE_INFO) +DECL_WINELIB_TYPE_AW(LPINTERNET_CERTIFICATE_INFO) + +typedef struct _INTERNET_BUFFERSA { + DWORD dwStructSize; + struct _INTERNET_BUFFERSA * Next; + LPCSTR lpcszHeader; + DWORD dwHeadersLength; + DWORD dwHeadersTotal; + LPVOID lpvBuffer; + DWORD dwBufferLength; + DWORD dwBufferTotal; + DWORD dwOffsetLow; + DWORD dwOffsetHigh; +} INTERNET_BUFFERSA,* LPINTERNET_BUFFERSA; + +typedef struct _INTERNET_BUFFERSW { + DWORD dwStructSize; + struct _INTERNET_BUFFERSW * Next; + LPCWSTR lpcszHeader; + DWORD dwHeadersLength; + DWORD dwHeadersTotal; + LPVOID lpvBuffer; + DWORD dwBufferLength; + DWORD dwBufferTotal; + DWORD dwOffsetLow; + DWORD dwOffsetHigh; +} INTERNET_BUFFERSW,* LPINTERNET_BUFFERSW; + +DECL_WINELIB_TYPE_AW(INTERNET_BUFFERS) +DECL_WINELIB_TYPE_AW(LPINTERNET_BUFFERS) + +#define GROUP_OWNER_STORAGE_SIZE 4 +#define GROUPNAME_MAX_LENGTH 120 + +typedef struct _INTERNET_CACHE_GROUP_INFOA { + DWORD dwGroupSize; + DWORD dwGroupFlags; + DWORD dwGroupType; + DWORD dwDiskUsage; + DWORD dwDiskQuota; + DWORD dwOwnerStorage[GROUP_OWNER_STORAGE_SIZE]; + CHAR szGroupName[GROUPNAME_MAX_LENGTH]; +} INTERNET_CACHE_GROUP_INFOA, * LPINTERNET_CACHE_GROUP_INFOA; + +typedef struct _INTERNET_CACHE_GROUP_INFOW { + DWORD dwGroupSize; + DWORD dwGroupFlags; + DWORD dwGroupType; + DWORD dwDiskUsage; + DWORD dwDiskQuota; + DWORD dwOwnerStorage[GROUP_OWNER_STORAGE_SIZE]; + WCHAR szGroupName[GROUPNAME_MAX_LENGTH]; +} INTERNET_CACHE_GROUP_INFOW, *LPINTERNET_CACHE_GROUP_INFOW; + +DECL_WINELIB_TYPE_AW(INTERNET_CACHE_GROUP_INFO) +DECL_WINELIB_TYPE_AW(LPINTERNET_CACHE_GROUP_INFO) + +BOOLAPI InternetTimeFromSystemTimeA(CONST SYSTEMTIME *,DWORD ,LPSTR ,DWORD); +BOOLAPI InternetTimeFromSystemTimeW(CONST SYSTEMTIME *,DWORD ,LPWSTR ,DWORD); +#define InternetTimeFromSystemTime WINELIB_NAME_AW(InternetTimeFromSystemTime) + +#define INTERNET_RFC1123_FORMAT 0 +#define INTERNET_RFC1123_BUFSIZE 30 + +BOOLAPI InternetTimeToSystemTimeA(LPCSTR ,SYSTEMTIME *,DWORD); +BOOLAPI InternetTimeToSystemTimeW(LPCWSTR ,SYSTEMTIME *,DWORD); +#define InternetTimeToSystemTime WINELIB_NAME_AW(InternetTimeToSystemTime) + +BOOLAPI InternetCrackUrlA(LPCSTR ,DWORD ,DWORD ,LPURL_COMPONENTSA); +BOOLAPI InternetCrackUrlW(LPCWSTR ,DWORD ,DWORD ,LPURL_COMPONENTSW); +#define InternetCrackUrl WINELIB_NAME_AW(InternetCrackUrl) + +BOOLAPI InternetCreateUrlA(LPURL_COMPONENTSA ,DWORD ,LPSTR ,LPDWORD); +BOOLAPI InternetCreateUrlW(LPURL_COMPONENTSW ,DWORD ,LPWSTR ,LPDWORD); +#define InternetCreateUrl WINELIB_NAME_AW(InternetCreateUrl) + +BOOLAPI InternetCanonicalizeUrlA(LPCSTR ,LPSTR ,LPDWORD ,DWORD); +BOOLAPI InternetCanonicalizeUrlW(LPCWSTR ,LPWSTR ,LPDWORD ,DWORD); +#define InternetCanonicalizeUrl WINELIB_NAME_AW(InternetCanonicalizeUrl) + +BOOLAPI InternetCombineUrlA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD ,DWORD); +BOOLAPI InternetCombineUrlW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD ,DWORD); +#define InternetCombineUrl WINELIB_NAME_AW(InternetCombineUrl) + +#define ICU_ESCAPE 0x80000000 +#define ICU_USERNAME 0x40000000 +#define ICU_NO_ENCODE 0x20000000 +#define ICU_DECODE 0x10000000 +#define ICU_NO_META 0x08000000 +#define ICU_ENCODE_SPACES_ONLY 0x04000000 +#define ICU_BROWSER_MODE 0x02000000 + +INTERNETAPI HINTERNET WINAPI InternetOpenA(LPCSTR ,DWORD ,LPCSTR lpszProxy ,LPCSTR lpszProxyBypass ,DWORD); +INTERNETAPI HINTERNET WINAPI InternetOpenW(LPCWSTR ,DWORD ,LPCWSTR lpszProxy ,LPCWSTR lpszProxyBypass ,DWORD); +#define InternetOpen WINELIB_NAME_AW(InternetOpen) + +#define INTERNET_OPEN_TYPE_PRECONFIG 0 +#define INTERNET_OPEN_TYPE_DIRECT 1 +#define INTERNET_OPEN_TYPE_PROXY 3 +#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 +#define PRE_CONFIG_INTERNET_ACCESS INTERNET_OPEN_TYPE_PRECONFIG +#define LOCAL_INTERNET_ACCESS INTERNET_OPEN_TYPE_DIRECT +#define CERN_PROXY_INTERNET_ACCESS INTERNET_OPEN_TYPE_PROXY + +BOOLAPI InternetCloseHandle(HINTERNET); + +INTERNETAPI HINTERNET WINAPI InternetConnectA(HINTERNET ,LPCSTR ,INTERNET_PORT , + LPCSTR lpszUserName ,LPCSTR lpszPassword ,DWORD ,DWORD ,DWORD ); +INTERNETAPI HINTERNET WINAPI InternetConnectW(HINTERNET ,LPCWSTR ,INTERNET_PORT , + LPCWSTR lpszUserName ,LPCWSTR lpszPassword ,DWORD ,DWORD ,DWORD ); +#define InternetConnect WINELIB_NAME_AW(InternetConnect) + +#define INTERNET_SERVICE_URL 0 +#define INTERNET_SERVICE_FTP 1 +#define INTERNET_SERVICE_GOPHER 2 +#define INTERNET_SERVICE_HTTP 3 + +#define InternetConnectUrl(hInternet,lpszUrl,dwFlags,dwContext) \ + InternetConnect(hInternet,\ + lpszUrl,\ + INTERNET_INVALID_PORT_NUMBER,\ + NULL,\ + NULL,\ + INTERNET_SERVICE_URL,\ + dwFlags,\ + dwContext \ + ) + +INTERNETAPI HINTERNET WINAPI InternetOpenUrlA(HINTERNET ,LPCSTR ,LPCSTR lpszHeaders ,DWORD ,DWORD ,DWORD); +INTERNETAPI HINTERNET WINAPI InternetOpenUrlW(HINTERNET ,LPCWSTR ,LPCWSTR lpszHeaders ,DWORD ,DWORD ,DWORD); +#define InternetOpenUrl WINELIB_NAME_AW(InternetOpenUrl) + +BOOLAPI InternetReadFile( HINTERNET ,LPVOID ,DWORD ,LPDWORD ); +INTERNETAPI BOOL WINAPI InternetReadFileExA( HINTERNET ,LPINTERNET_BUFFERSA ,DWORD ,DWORD ); +INTERNETAPI BOOL WINAPI InternetReadFileExW( HINTERNET ,LPINTERNET_BUFFERSW ,DWORD ,DWORD ); +#define InternetReadFileEx WINELIB_NAME_AW(InternetReadFileEx) + +#define IRF_ASYNC WININET_API_FLAG_ASYNC +#define IRF_SYNC WININET_API_FLAG_SYNC +#define IRF_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT +#define IRF_NO_WAIT 0x00000008 + +INTERNETAPI DWORD WINAPI InternetSetFilePointer(HINTERNET ,LONG ,PVOID ,DWORD ,DWORD); +BOOLAPI InternetWriteFile(HINTERNET ,LPCVOID ,DWORD ,LPDWORD); +BOOLAPI InternetQueryDataAvailable(HINTERNET ,LPDWORD lpdwNumberOfBytesAvailable ,DWORD ,DWORD); +BOOLAPI InternetFindNextFileA(HINTERNET ,LPVOID); +BOOLAPI InternetFindNextFileW(HINTERNET ,LPVOID); +#define InternetFindNextFile WINELIB_NAME_AW(InternetFindNextFile) + +BOOLAPI InternetQueryOptionA(HINTERNET hInternet ,DWORD ,LPVOID lpBuffer ,LPDWORD); +BOOLAPI InternetQueryOptionW(HINTERNET hInternet ,DWORD ,LPVOID lpBuffer ,LPDWORD); +#define InternetQueryOption WINELIB_NAME_AW(InternetQueryOption) + +BOOLAPI InternetSetOptionA(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD); +BOOLAPI InternetSetOptionW(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD); +#define InternetSetOption WINELIB_NAME_AW(InternetSetOption) + +BOOLAPI InternetSetOptionExA(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD ,DWORD); +BOOLAPI InternetSetOptionExW(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD ,DWORD); +#define InternetSetOptionEx WINELIB_NAME_AW(InternetSetOptionEx) + +BOOLAPI InternetLockRequestFile(HINTERNET ,HANDLE *); +BOOLAPI InternetUnlockRequestFile(HANDLE); + +#define ISO_GLOBAL 0x00000001 +#define ISO_REGISTRY 0x00000002 + +#define ISO_VALID_FLAGS (ISO_GLOBAL | ISO_REGISTRY) +#define INTERNET_OPTION_CALLBACK 1 +#define INTERNET_OPTION_CONNECT_TIMEOUT 2 +#define INTERNET_OPTION_CONNECT_RETRIES 3 +#define INTERNET_OPTION_CONNECT_BACKOFF 4 +#define INTERNET_OPTION_SEND_TIMEOUT 5 +#define INTERNET_OPTION_CONTROL_SEND_TIMEOUT INTERNET_OPTION_SEND_TIMEOUT +#define INTERNET_OPTION_RECEIVE_TIMEOUT 6 +#define INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT INTERNET_OPTION_RECEIVE_TIMEOUT +#define INTERNET_OPTION_DATA_SEND_TIMEOUT 7 +#define INTERNET_OPTION_DATA_RECEIVE_TIMEOUT 8 +#define INTERNET_OPTION_HANDLE_TYPE 9 +#define INTERNET_OPTION_LISTEN_TIMEOUT 11 +#define INTERNET_OPTION_READ_BUFFER_SIZE 12 +#define INTERNET_OPTION_WRITE_BUFFER_SIZE 13 +#define INTERNET_OPTION_ASYNC_ID 15 +#define INTERNET_OPTION_ASYNC_PRIORITY 16 +#define INTERNET_OPTION_PARENT_HANDLE 21 +#define INTERNET_OPTION_KEEP_CONNECTION 22 +#define INTERNET_OPTION_REQUEST_FLAGS 23 +#define INTERNET_OPTION_EXTENDED_ERROR 24 +#define INTERNET_OPTION_OFFLINE_MODE 26 +#define INTERNET_OPTION_CACHE_STREAM_HANDLE 27 +#define INTERNET_OPTION_USERNAME 28 +#define INTERNET_OPTION_PASSWORD 29 +#define INTERNET_OPTION_ASYNC 30 +#define INTERNET_OPTION_SECURITY_FLAGS 31 +#define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT 32 +#define INTERNET_OPTION_DATAFILE_NAME 33 +#define INTERNET_OPTION_URL 34 +#define INTERNET_OPTION_SECURITY_CERTIFICATE 35 +#define INTERNET_OPTION_SECURITY_KEY_BITNESS 36 +#define INTERNET_OPTION_REFRESH 37 +#define INTERNET_OPTION_PROXY 38 +#define INTERNET_OPTION_SETTINGS_CHANGED 39 +#define INTERNET_OPTION_VERSION 40 +#define INTERNET_OPTION_USER_AGENT 41 +#define INTERNET_OPTION_END_BROWSER_SESSION 42 +#define INTERNET_OPTION_PROXY_USERNAME 43 +#define INTERNET_OPTION_PROXY_PASSWORD 44 +#define INTERNET_OPTION_CONTEXT_VALUE 45 +#define INTERNET_OPTION_CONNECT_LIMIT 46 +#define INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT 47 +#define INTERNET_OPTION_POLICY 48 +#define INTERNET_OPTION_DISCONNECTED_TIMEOUT 49 +#define INTERNET_OPTION_CONNECTED_STATE 50 +#define INTERNET_OPTION_IDLE_STATE 51 +#define INTERNET_OPTION_OFFLINE_SEMANTICS 52 +#define INTERNET_OPTION_SECONDARY_CACHE_KEY 53 +#define INTERNET_OPTION_CALLBACK_FILTER 54 +#define INTERNET_OPTION_CONNECT_TIME 55 +#define INTERNET_OPTION_SEND_THROUGHPUT 56 +#define INTERNET_OPTION_RECEIVE_THROUGHPUT 57 +#define INTERNET_OPTION_REQUEST_PRIORITY 58 +#define INTERNET_OPTION_HTTP_VERSION 59 +#define INTERNET_OPTION_RESET_URLCACHE_SESSION 60 +#define INTERNET_OPTION_ERROR_MASK 62 +#define INTERNET_OPTION_CODEPAGE 68 +#define INTERNET_OPTION_COOKIES_3RD_PARTY 86 +#define INTERNET_OPTION_PROXY_SETTINGS_CHANGED 95 +#define INTERNET_FIRST_OPTION INTERNET_OPTION_CALLBACK +#define INTERNET_LAST_OPTION INTERNET_OPTION_PROXY_SETTINGS_CHANGED + +#define INTERNET_PRIORITY_FOREGROUND 1000 +#define INTERNET_HANDLE_TYPE_INTERNET 1 +#define INTERNET_HANDLE_TYPE_CONNECT_FTP 2 +#define INTERNET_HANDLE_TYPE_CONNECT_GOPHER 3 +#define INTERNET_HANDLE_TYPE_CONNECT_HTTP 4 +#define INTERNET_HANDLE_TYPE_FTP_FIND 5 +#define INTERNET_HANDLE_TYPE_FTP_FIND_HTML 6 +#define INTERNET_HANDLE_TYPE_FTP_FILE 7 +#define INTERNET_HANDLE_TYPE_FTP_FILE_HTML 8 +#define INTERNET_HANDLE_TYPE_GOPHER_FIND 9 +#define INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML 10 +#define INTERNET_HANDLE_TYPE_GOPHER_FILE 11 +#define INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML 12 +#define INTERNET_HANDLE_TYPE_HTTP_REQUEST 13 +#define SECURITY_FLAG_SECURE 0x00000001 +#define SECURITY_FLAG_STRENGTH_WEAK 0x10000000 +#define SECURITY_FLAG_STRENGTH_MEDIUM 0x40000000 +#define SECURITY_FLAG_STRENGTH_STRONG 0x20000000 +#define SECURITY_FLAG_UNKNOWNBIT 0x80000000 +#define SECURITY_FLAG_NORMALBITNESS SECURITY_FLAG_STRENGTH_WEAK +#define SECURITY_FLAG_SSL 0x00000002 +#define SECURITY_FLAG_SSL3 0x00000004 +#define SECURITY_FLAG_PCT 0x00000008 +#define SECURITY_FLAG_PCT4 0x00000010 +#define SECURITY_FLAG_IETFSSL4 0x00000020 +#define SECURITY_FLAG_40BIT SECURITY_FLAG_STRENGTH_WEAK +#define SECURITY_FLAG_128BIT SECURITY_FLAG_STRENGTH_STRONG +#define SECURITY_FLAG_56BIT SECURITY_FLAG_STRENGTH_MEDIUM +#define SECURITY_FLAG_IGNORE_REVOCATION 0x00000080 +#define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100 +#define SECURITY_FLAG_IGNORE_WRONG_USAGE 0x00000200 +#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID INTERNET_FLAG_IGNORE_CERT_CN_INVALID +#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID INTERNET_FLAG_IGNORE_CERT_DATE_INVALID +#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS +#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP +#define SECURITY_SET_MASK (SECURITY_FLAG_IGNORE_REVOCATION |\ + SECURITY_FLAG_IGNORE_UNKNOWN_CA |\ + SECURITY_FLAG_IGNORE_CERT_CN_INVALID |\ + SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |\ + SECURITY_FLAG_IGNORE_WRONG_USAGE) + + + +BOOLAPI InternetGetLastResponseInfoA(LPDWORD ,LPSTR lpszBuffer ,LPDWORD); +BOOLAPI InternetGetLastResponseInfoW(LPDWORD ,LPWSTR lpszBuffer ,LPDWORD); +#define InternetGetLastResponseInfo WINELIB_NAME_AW(InternetGetLastResponseInfo) + +typedef VOID (CALLBACK *INTERNET_STATUS_CALLBACK)(HINTERNET ,DWORD ,DWORD , + LPVOID lpvStatusInformation ,DWORD); + +typedef INTERNET_STATUS_CALLBACK * LPINTERNET_STATUS_CALLBACK; + +INTERNETAPI INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(HINTERNET ,INTERNET_STATUS_CALLBACK); +INTERNETAPI INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET ,INTERNET_STATUS_CALLBACK); +#define InternetSetStatusCallback WINELIB_NAME_AW(InternetSetStatusCallback) + +#define INTERNET_STATUS_RESOLVING_NAME 10 +#define INTERNET_STATUS_NAME_RESOLVED 11 +#define INTERNET_STATUS_CONNECTING_TO_SERVER 20 +#define INTERNET_STATUS_CONNECTED_TO_SERVER 21 +#define INTERNET_STATUS_SENDING_REQUEST 30 +#define INTERNET_STATUS_REQUEST_SENT 31 +#define INTERNET_STATUS_RECEIVING_RESPONSE 40 +#define INTERNET_STATUS_RESPONSE_RECEIVED 41 +#define INTERNET_STATUS_CTL_RESPONSE_RECEIVED 42 +#define INTERNET_STATUS_PREFETCH 43 +#define INTERNET_STATUS_CLOSING_CONNECTION 50 +#define INTERNET_STATUS_CONNECTION_CLOSED 51 +#define INTERNET_STATUS_HANDLE_CREATED 60 +#define INTERNET_STATUS_HANDLE_CLOSING 70 +#define INTERNET_STATUS_REQUEST_COMPLETE 100 +#define INTERNET_STATUS_REDIRECT 110 +#define INTERNET_STATUS_INTERMEDIATE_RESPONSE 120 +#define INTERNET_STATUS_USER_INPUT_REQUIRED 140 +#define INTERNET_STATUS_STATE_CHANGE 200 +#define INTERNET_STATUS_COOKIE_SENT 320 +#define INTERNET_STATUS_COOKIE_RECEIVED 321 +#define INTERNET_STATUS_PRIVACY_IMPACTED 324 +#define INTERNET_STATUS_P3P_HEADER 325 +#define INTERNET_STATUS_P3P_POLICYREF 326 +#define INTERNET_STATUS_COOKIE_HISTORY 327 +#define INTERNET_STATE_CONNECTED 0x00000001 +#define INTERNET_STATE_DISCONNECTED 0x00000002 +#define INTERNET_STATE_DISCONNECTED_BY_USER 0x00000010 +#define INTERNET_STATE_IDLE 0x00000100 +#define INTERNET_STATE_BUSY 0x00000200 + +#define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1L)) + +#define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000 +#define FTP_TRANSFER_TYPE_ASCII 0x00000001 +#define FTP_TRANSFER_TYPE_BINARY 0x00000002 +#define FTP_TRANSFER_TYPE_MASK (FTP_TRANSFER_TYPE_ASCII | FTP_TRANSFER_TYPE_BINARY) + + +INTERNETAPI HINTERNET WINAPI FtpFindFirstFileA(HINTERNET ,LPCSTR lpszSearchFile , + LPWIN32_FIND_DATAA lpFindFileData ,DWORD ,DWORD); +INTERNETAPI HINTERNET WINAPI FtpFindFirstFileW(HINTERNET ,LPCWSTR lpszSearchFile , + LPWIN32_FIND_DATAW lpFindFileData ,DWORD ,DWORD); +#define FtpFindFirstFile WINELIB_NAME_AW(FtpFindFirstFile) + +BOOLAPI FtpGetFileA(HINTERNET ,LPCSTR ,LPCSTR ,BOOL ,DWORD ,DWORD ,DWORD); +BOOLAPI FtpGetFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,BOOL ,DWORD ,DWORD ,DWORD); +#define FtpGetFile WINELIB_NAME_AW(FtpGetFile) + +BOOLAPI FtpPutFileA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD); +BOOLAPI FtpPutFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD); +#define FtpPutFile WINELIB_NAME_AW(FtpPutFile) + +BOOLAPI FtpDeleteFileA(HINTERNET ,LPCSTR); +BOOLAPI FtpDeleteFileW(HINTERNET ,LPCWSTR); +#define FtpDeleteFile WINELIB_NAME_AW(FtpDeleteFile) + +BOOLAPI FtpRenameFileA(HINTERNET ,LPCSTR ,LPCSTR); +BOOLAPI FtpRenameFileW(HINTERNET ,LPCWSTR ,LPCWSTR); +#define FtpRenameFile WINELIB_NAME_AW(FtpRenameFile) + +INTERNETAPI HINTERNET WINAPI FtpOpenFileA(HINTERNET ,LPCSTR ,DWORD ,DWORD ,DWORD); +INTERNETAPI HINTERNET WINAPI FtpOpenFileW(HINTERNET ,LPCWSTR ,DWORD ,DWORD ,DWORD); +#define FtpOpenFile WINELIB_NAME_AW(FtpOpenFile) + +BOOLAPI FtpCreateDirectoryA(HINTERNET ,LPCSTR); +BOOLAPI FtpCreateDirectoryW(HINTERNET ,LPCWSTR); +#define FtpCreateDirectory WINELIB_NAME_AW(FtpCreateDirectory) + +BOOLAPI FtpRemoveDirectoryA(HINTERNET ,LPCSTR); +BOOLAPI FtpRemoveDirectoryW(HINTERNET ,LPCWSTR); +#define FtpRemoveDirectory WINELIB_NAME_AW(FtpRemoveDirectory) + +BOOLAPI FtpSetCurrentDirectoryA(HINTERNET ,LPCSTR); +BOOLAPI FtpSetCurrentDirectoryW(HINTERNET ,LPCWSTR); +#define FtpSetCurrentDirectory WINELIB_NAME_AW(FtpSetCurrentDirectory) + +BOOLAPI FtpGetCurrentDirectoryA(HINTERNET ,LPSTR ,LPDWORD); +BOOLAPI FtpGetCurrentDirectoryW(HINTERNET ,LPWSTR ,LPDWORD); +#define FtpGetCurrentDirectory WINELIB_NAME_AW(FtpGetCurrentDirectory) + +#define MAX_GOPHER_DISPLAY_TEXT 128 +#define MAX_GOPHER_SELECTOR_TEXT 256 +#define MAX_GOPHER_HOST_NAME INTERNET_MAX_HOST_NAME_LENGTH +#define MAX_GOPHER_LOCATOR_LENGTH (1 \ + + MAX_GOPHER_DISPLAY_TEXT \ + + 1 \ + + MAX_GOPHER_SELECTOR_TEXT \ + + 1 \ + + MAX_GOPHER_HOST_NAME \ + + 1 \ + + INTERNET_MAX_PORT_NUMBER_LENGTH \ + + 1 \ + + 1 \ + + 2 \ + ) + + +typedef struct { + CHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1]; + DWORD GopherType; + DWORD SizeLow; + DWORD SizeHigh; + FILETIME LastModificationTime; + CHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1]; +} GOPHER_FIND_DATAA,* LPGOPHER_FIND_DATAA; + +typedef struct { + WCHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1]; + DWORD GopherType; + DWORD SizeLow; + DWORD SizeHigh; + FILETIME LastModificationTime; + WCHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1]; +} GOPHER_FIND_DATAW,* LPGOPHER_FIND_DATAW; + +DECL_WINELIB_TYPE_AW(GOPHER_FIND_DATA) +DECL_WINELIB_TYPE_AW(LPGOPHER_FIND_DATA) + +#define GOPHER_TYPE_TEXT_FILE 0x00000001 +#define GOPHER_TYPE_DIRECTORY 0x00000002 +#define GOPHER_TYPE_CSO 0x00000004 +#define GOPHER_TYPE_ERROR 0x00000008 +#define GOPHER_TYPE_MAC_BINHEX 0x00000010 +#define GOPHER_TYPE_DOS_ARCHIVE 0x00000020 +#define GOPHER_TYPE_UNIX_UUENCODED 0x00000040 +#define GOPHER_TYPE_INDEX_SERVER 0x00000080 +#define GOPHER_TYPE_TELNET 0x00000100 +#define GOPHER_TYPE_BINARY 0x00000200 +#define GOPHER_TYPE_REDUNDANT 0x00000400 +#define GOPHER_TYPE_TN3270 0x00000800 +#define GOPHER_TYPE_GIF 0x00001000 +#define GOPHER_TYPE_IMAGE 0x00002000 +#define GOPHER_TYPE_BITMAP 0x00004000 +#define GOPHER_TYPE_MOVIE 0x00008000 +#define GOPHER_TYPE_SOUND 0x00010000 +#define GOPHER_TYPE_HTML 0x00020000 +#define GOPHER_TYPE_PDF 0x00040000 +#define GOPHER_TYPE_CALENDAR 0x00080000 +#define GOPHER_TYPE_INLINE 0x00100000 +#define GOPHER_TYPE_UNKNOWN 0x20000000 +#define GOPHER_TYPE_ASK 0x40000000 +#define GOPHER_TYPE_GOPHER_PLUS 0x80000000 + +#define IS_GOPHER_FILE(type) (BOOL)(((type) & GOPHER_TYPE_FILE_MASK) ? TRUE : FALSE) +#define IS_GOPHER_DIRECTORY(type) (BOOL)(((type) & GOPHER_TYPE_DIRECTORY) ? TRUE : FALSE) +#define IS_GOPHER_PHONE_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_CSO) ? TRUE : FALSE) +#define IS_GOPHER_ERROR(type) (BOOL)(((type) & GOPHER_TYPE_ERROR) ? TRUE : FALSE) +#define IS_GOPHER_INDEX_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_INDEX_SERVER) ? TRUE : FALSE) +#define IS_GOPHER_TELNET_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TELNET) ? TRUE : FALSE) +#define IS_GOPHER_BACKUP_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_REDUNDANT) ? TRUE : FALSE) +#define IS_GOPHER_TN3270_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TN3270) ? TRUE : FALSE) +#define IS_GOPHER_ASK(type) (BOOL)(((type) & GOPHER_TYPE_ASK) ? TRUE : FALSE) +#define IS_GOPHER_PLUS(type) (BOOL)(((type) & GOPHER_TYPE_GOPHER_PLUS) ? TRUE : FALSE) +#define IS_GOPHER_TYPE_KNOWN(type) (BOOL)(((type) & GOPHER_TYPE_UNKNOWN) ? FALSE : TRUE) +#define GOPHER_TYPE_FILE_MASK (GOPHER_TYPE_TEXT_FILE \ + | GOPHER_TYPE_MAC_BINHEX \ + | GOPHER_TYPE_DOS_ARCHIVE \ + | GOPHER_TYPE_UNIX_UUENCODED \ + | GOPHER_TYPE_BINARY \ + | GOPHER_TYPE_GIF \ + | GOPHER_TYPE_IMAGE \ + | GOPHER_TYPE_BITMAP \ + | GOPHER_TYPE_MOVIE \ + | GOPHER_TYPE_SOUND \ + | GOPHER_TYPE_HTML \ + | GOPHER_TYPE_PDF \ + | GOPHER_TYPE_CALENDAR \ + | GOPHER_TYPE_INLINE \ + ) + + +typedef struct { + LPCSTR Comment; + LPCSTR EmailAddress; +} GOPHER_ADMIN_ATTRIBUTE_TYPEA,* LPGOPHER_ADMIN_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR Comment; + LPCWSTR EmailAddress; +} GOPHER_ADMIN_ATTRIBUTE_TYPEW,* LPGOPHER_ADMIN_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_ADMIN_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_ADMIN_ATTRIBUTE_TYPE) + +typedef struct { + FILETIME DateAndTime; +} GOPHER_MOD_DATE_ATTRIBUTE_TYPE,* LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE; + +typedef struct { + DWORD Ttl; +} GOPHER_TTL_ATTRIBUTE_TYPE,* LPGOPHER_TTL_ATTRIBUTE_TYPE; + +typedef struct { + INT Score; +} GOPHER_SCORE_ATTRIBUTE_TYPE,* LPGOPHER_SCORE_ATTRIBUTE_TYPE; + +typedef struct { + INT LowerBound; + INT UpperBound; +} GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE,* LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE; + +typedef struct { + LPCSTR Site; +} GOPHER_SITE_ATTRIBUTE_TYPEA,* LPGOPHER_SITE_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR Site; +} GOPHER_SITE_ATTRIBUTE_TYPEW,* LPGOPHER_SITE_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_SITE_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_SITE_ATTRIBUTE_TYPE) + +typedef struct { + LPCSTR Organization; +} GOPHER_ORGANIZATION_ATTRIBUTE_TYPEA,* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR Organization; +} GOPHER_ORGANIZATION_ATTRIBUTE_TYPEW,* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_ORGANIZATION_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE) + +typedef struct { + LPCSTR Location; +} GOPHER_LOCATION_ATTRIBUTE_TYPEA,* LPGOPHER_LOCATION_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR Location; +} GOPHER_LOCATION_ATTRIBUTE_TYPEW,* LPGOPHER_LOCATION_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_LOCATION_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_LOCATION_ATTRIBUTE_TYPE) + +typedef struct { + INT DegreesNorth; + INT MinutesNorth; + INT SecondsNorth; + INT DegreesEast; + INT MinutesEast; + INT SecondsEast; +} GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE,* LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE; + +typedef struct { + INT Zone; +} GOPHER_TIMEZONE_ATTRIBUTE_TYPE,* LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE; + +typedef struct { + LPCSTR Provider; +} GOPHER_PROVIDER_ATTRIBUTE_TYPEA,* LPGOPHER_PROVIDER_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR Provider; +} GOPHER_PROVIDER_ATTRIBUTE_TYPEW,* LPGOPHER_PROVIDER_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_PROVIDER_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_PROVIDER_ATTRIBUTE_TYPE) + +typedef struct { + LPCSTR Version; +} GOPHER_VERSION_ATTRIBUTE_TYPEA,* LPGOPHER_VERSION_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR Version; +} GOPHER_VERSION_ATTRIBUTE_TYPEW,* LPGOPHER_VERSION_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_VERSION_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_VERSION_ATTRIBUTE_TYPE) + +typedef struct { + LPCSTR ShortAbstract; + LPCSTR AbstractFile; +} GOPHER_ABSTRACT_ATTRIBUTE_TYPEA,* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR ShortAbstract; + LPCWSTR AbstractFile; +} GOPHER_ABSTRACT_ATTRIBUTE_TYPEW,* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_ABSTRACT_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE) + +typedef struct { + LPCSTR ContentType; + LPCSTR Language; + DWORD Size; +} GOPHER_VIEW_ATTRIBUTE_TYPEA,* LPGOPHER_VIEW_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR ContentType; + LPCWSTR Language; + DWORD Size; +} GOPHER_VIEW_ATTRIBUTE_TYPEW,* LPGOPHER_VIEW_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_VIEW_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_VIEW_ATTRIBUTE_TYPE) + +typedef struct { + BOOL TreeWalk; +} GOPHER_VERONICA_ATTRIBUTE_TYPE,* LPGOPHER_VERONICA_ATTRIBUTE_TYPE; + +typedef struct { + LPCSTR QuestionType; + LPCSTR QuestionText; +} GOPHER_ASK_ATTRIBUTE_TYPEA,* LPGOPHER_ASK_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR QuestionType; + LPCWSTR QuestionText; +} GOPHER_ASK_ATTRIBUTE_TYPEW,* LPGOPHER_ASK_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_ASK_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_ASK_ATTRIBUTE_TYPE) + +typedef struct { + LPCSTR Text; +} GOPHER_UNKNOWN_ATTRIBUTE_TYPEA,* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEA; + +typedef struct { + LPCWSTR Text; +} GOPHER_UNKNOWN_ATTRIBUTE_TYPEW,* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_UNKNOWN_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE) + +typedef struct { + DWORD CategoryId; + DWORD AttributeId; + union { + GOPHER_ADMIN_ATTRIBUTE_TYPEA Admin; + GOPHER_MOD_DATE_ATTRIBUTE_TYPE ModDate; + GOPHER_TTL_ATTRIBUTE_TYPE Ttl; + GOPHER_SCORE_ATTRIBUTE_TYPE Score; + GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE ScoreRange; + GOPHER_SITE_ATTRIBUTE_TYPEA Site; + GOPHER_ORGANIZATION_ATTRIBUTE_TYPEA Organization; + GOPHER_LOCATION_ATTRIBUTE_TYPEA Location; + GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE GeographicalLocation; + GOPHER_TIMEZONE_ATTRIBUTE_TYPE TimeZone; + GOPHER_PROVIDER_ATTRIBUTE_TYPEA Provider; + GOPHER_VERSION_ATTRIBUTE_TYPEA Version; + GOPHER_ABSTRACT_ATTRIBUTE_TYPEA Abstract; + GOPHER_VIEW_ATTRIBUTE_TYPEA View; + GOPHER_VERONICA_ATTRIBUTE_TYPE Veronica; + GOPHER_ASK_ATTRIBUTE_TYPEA Ask; + GOPHER_UNKNOWN_ATTRIBUTE_TYPEA Unknown; + } AttributeType; +} GOPHER_ATTRIBUTE_TYPEA, *LPGOPHER_ATTRIBUTE_TYPEA; + +typedef struct { + DWORD CategoryId; + DWORD AttributeId; + union { + GOPHER_ADMIN_ATTRIBUTE_TYPEW Admin; + GOPHER_MOD_DATE_ATTRIBUTE_TYPE ModDate; + GOPHER_TTL_ATTRIBUTE_TYPE Ttl; + GOPHER_SCORE_ATTRIBUTE_TYPE Score; + GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE ScoreRange; + GOPHER_SITE_ATTRIBUTE_TYPEW Site; + GOPHER_ORGANIZATION_ATTRIBUTE_TYPEW Organization; + GOPHER_LOCATION_ATTRIBUTE_TYPEW Location; + GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE GeographicalLocation; + GOPHER_TIMEZONE_ATTRIBUTE_TYPE TimeZone; + GOPHER_PROVIDER_ATTRIBUTE_TYPEW Provider; + GOPHER_VERSION_ATTRIBUTE_TYPEW Version; + GOPHER_ABSTRACT_ATTRIBUTE_TYPEW Abstract; + GOPHER_VIEW_ATTRIBUTE_TYPEW View; + GOPHER_VERONICA_ATTRIBUTE_TYPE Veronica; + GOPHER_ASK_ATTRIBUTE_TYPEW Ask; + GOPHER_UNKNOWN_ATTRIBUTE_TYPEW Unknown; + } AttributeType; +} GOPHER_ATTRIBUTE_TYPEW, *LPGOPHER_ATTRIBUTE_TYPEW; + +DECL_WINELIB_TYPE_AW(GOPHER_ATTRIBUTE_TYPE) +DECL_WINELIB_TYPE_AW(LPGOPHER_ATTRIBUTE_TYPE) + +#define MAX_GOPHER_CATEGORY_NAME 128 +#define MAX_GOPHER_ATTRIBUTE_NAME 128 +#define MIN_GOPHER_ATTRIBUTE_LENGTH 256 + +#define GOPHER_INFO_CATEGORY TEXT("+INFO") +#define GOPHER_ADMIN_CATEGORY TEXT("+ADMIN") +#define GOPHER_VIEWS_CATEGORY TEXT("+VIEWS") +#define GOPHER_ABSTRACT_CATEGORY TEXT("+ABSTRACT") +#define GOPHER_VERONICA_CATEGORY TEXT("+VERONICA") +#define GOPHER_ADMIN_ATTRIBUTE TEXT("Admin") +#define GOPHER_MOD_DATE_ATTRIBUTE TEXT("Mod-Date") +#define GOPHER_TTL_ATTRIBUTE TEXT("TTL") +#define GOPHER_SCORE_ATTRIBUTE TEXT("Score") +#define GOPHER_RANGE_ATTRIBUTE TEXT("Score-range") +#define GOPHER_SITE_ATTRIBUTE TEXT("Site") +#define GOPHER_ORG_ATTRIBUTE TEXT("Org") +#define GOPHER_LOCATION_ATTRIBUTE TEXT("Loc") +#define GOPHER_GEOG_ATTRIBUTE TEXT("Geog") +#define GOPHER_TIMEZONE_ATTRIBUTE TEXT("TZ") +#define GOPHER_PROVIDER_ATTRIBUTE TEXT("Provider") +#define GOPHER_VERSION_ATTRIBUTE TEXT("Version") +#define GOPHER_ABSTRACT_ATTRIBUTE TEXT("Abstract") +#define GOPHER_VIEW_ATTRIBUTE TEXT("View") +#define GOPHER_TREEWALK_ATTRIBUTE TEXT("treewalk") + +#define GOPHER_ATTRIBUTE_ID_BASE 0xabcccc00 + +#define GOPHER_CATEGORY_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 1) +#define GOPHER_CATEGORY_ID_INFO (GOPHER_ATTRIBUTE_ID_BASE + 2) +#define GOPHER_CATEGORY_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 3) +#define GOPHER_CATEGORY_ID_VIEWS (GOPHER_ATTRIBUTE_ID_BASE + 4) +#define GOPHER_CATEGORY_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 5) +#define GOPHER_CATEGORY_ID_VERONICA (GOPHER_ATTRIBUTE_ID_BASE + 6) +#define GOPHER_CATEGORY_ID_ASK (GOPHER_ATTRIBUTE_ID_BASE + 7) +#define GOPHER_CATEGORY_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 8) + +#define GOPHER_ATTRIBUTE_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 9) +#define GOPHER_ATTRIBUTE_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 10) +#define GOPHER_ATTRIBUTE_ID_MOD_DATE (GOPHER_ATTRIBUTE_ID_BASE + 11) +#define GOPHER_ATTRIBUTE_ID_TTL (GOPHER_ATTRIBUTE_ID_BASE + 12) +#define GOPHER_ATTRIBUTE_ID_SCORE (GOPHER_ATTRIBUTE_ID_BASE + 13) +#define GOPHER_ATTRIBUTE_ID_RANGE (GOPHER_ATTRIBUTE_ID_BASE + 14) +#define GOPHER_ATTRIBUTE_ID_SITE (GOPHER_ATTRIBUTE_ID_BASE + 15) +#define GOPHER_ATTRIBUTE_ID_ORG (GOPHER_ATTRIBUTE_ID_BASE + 16) +#define GOPHER_ATTRIBUTE_ID_LOCATION (GOPHER_ATTRIBUTE_ID_BASE + 17) +#define GOPHER_ATTRIBUTE_ID_GEOG (GOPHER_ATTRIBUTE_ID_BASE + 18) +#define GOPHER_ATTRIBUTE_ID_TIMEZONE (GOPHER_ATTRIBUTE_ID_BASE + 19) +#define GOPHER_ATTRIBUTE_ID_PROVIDER (GOPHER_ATTRIBUTE_ID_BASE + 20) +#define GOPHER_ATTRIBUTE_ID_VERSION (GOPHER_ATTRIBUTE_ID_BASE + 21) +#define GOPHER_ATTRIBUTE_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 22) +#define GOPHER_ATTRIBUTE_ID_VIEW (GOPHER_ATTRIBUTE_ID_BASE + 23) +#define GOPHER_ATTRIBUTE_ID_TREEWALK (GOPHER_ATTRIBUTE_ID_BASE + 24) +#define GOPHER_ATTRIBUTE_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 25) + +BOOLAPI GopherCreateLocatorA(LPCSTR ,INTERNET_PORT ,LPCSTR lpszDisplayString , + LPCSTR lpszSelectorString ,DWORD ,LPSTR lpszLocator ,LPDWORD); +BOOLAPI GopherCreateLocatorW(LPCWSTR ,INTERNET_PORT ,LPCWSTR lpszDisplayString , + LPCWSTR lpszSelectorString ,DWORD ,LPWSTR lpszLocator ,LPDWORD); +#define GopherCreateLocator WINELIB_NAME_AW(GopherCreateLocator) + +BOOLAPI GopherGetLocatorTypeA(LPCSTR ,LPDWORD); +BOOLAPI GopherGetLocatorTypeW(LPCWSTR ,LPDWORD); +#define GopherGetLocatorType WINELIB_NAME_AW(GopherGetLocatorType) + +INTERNETAPI HINTERNET WINAPI GopherFindFirstFileA(HINTERNET ,LPCSTR lpszLocator , + LPCSTR lpszSearchString ,LPGOPHER_FIND_DATAA lpFindData ,DWORD ,DWORD); +INTERNETAPI HINTERNET WINAPI GopherFindFirstFileW(HINTERNET ,LPCWSTR lpszLocator , + LPCWSTR lpszSearchString ,LPGOPHER_FIND_DATAW lpFindData ,DWORD ,DWORD); +#define GopherFindFirstFile WINELIB_NAME_AW(GopherFindFirstFile) + +INTERNETAPI HINTERNET WINAPI GopherOpenFileA(HINTERNET ,LPCSTR ,LPCSTR lpszView ,DWORD ,DWORD); +INTERNETAPI HINTERNET WINAPI GopherOpenFileW(HINTERNET ,LPCWSTR ,LPCWSTR lpszView ,DWORD ,DWORD); +#define GopherOpenFile WINELIB_NAME_AW(GopherOpenFile) + +typedef BOOL (CALLBACK *GOPHER_ATTRIBUTE_ENUMERATORA)(LPGOPHER_ATTRIBUTE_TYPEA ,DWORD); +typedef BOOL (CALLBACK *GOPHER_ATTRIBUTE_ENUMERATORW)(LPGOPHER_ATTRIBUTE_TYPEW ,DWORD); + +DECL_WINELIB_TYPE_AW(GOPHER_ATTRIBUTE_ENUMERATOR) + +BOOLAPI GopherGetAttributeA(HINTERNET ,LPCSTR ,LPCSTR lpszAttributeName ,LPBYTE , + DWORD ,LPDWORD ,GOPHER_ATTRIBUTE_ENUMERATORA lpfnEnumerator ,DWORD); +BOOLAPI GopherGetAttributeW(HINTERNET ,LPCWSTR ,LPCWSTR lpszAttributeName ,LPBYTE , + DWORD ,LPDWORD ,GOPHER_ATTRIBUTE_ENUMERATORW lpfnEnumerator ,DWORD); +#define GopherGetAttribute WINELIB_NAME_AW(GopherGetAttribute) + +#define HTTP_MAJOR_VERSION 1 +#define HTTP_MINOR_VERSION 0 +#define HTTP_VERSION TEXT("HTTP/1.0") +#define HTTP_QUERY_MIME_VERSION 0 +#define HTTP_QUERY_CONTENT_TYPE 1 +#define HTTP_QUERY_CONTENT_TRANSFER_ENCODING 2 +#define HTTP_QUERY_CONTENT_ID 3 +#define HTTP_QUERY_CONTENT_DESCRIPTION 4 +#define HTTP_QUERY_CONTENT_LENGTH 5 +#define HTTP_QUERY_CONTENT_LANGUAGE 6 +#define HTTP_QUERY_ALLOW 7 +#define HTTP_QUERY_PUBLIC 8 +#define HTTP_QUERY_DATE 9 +#define HTTP_QUERY_EXPIRES 10 +#define HTTP_QUERY_LAST_MODIFIED 11 +#define HTTP_QUERY_MESSAGE_ID 12 +#define HTTP_QUERY_URI 13 +#define HTTP_QUERY_DERIVED_FROM 14 +#define HTTP_QUERY_COST 15 +#define HTTP_QUERY_LINK 16 +#define HTTP_QUERY_PRAGMA 17 +#define HTTP_QUERY_VERSION 18 +#define HTTP_QUERY_STATUS_CODE 19 +#define HTTP_QUERY_STATUS_TEXT 20 +#define HTTP_QUERY_RAW_HEADERS 21 +#define HTTP_QUERY_RAW_HEADERS_CRLF 22 +#define HTTP_QUERY_CONNECTION 23 +#define HTTP_QUERY_ACCEPT 24 +#define HTTP_QUERY_ACCEPT_CHARSET 25 +#define HTTP_QUERY_ACCEPT_ENCODING 26 +#define HTTP_QUERY_ACCEPT_LANGUAGE 27 +#define HTTP_QUERY_AUTHORIZATION 28 +#define HTTP_QUERY_CONTENT_ENCODING 29 +#define HTTP_QUERY_FORWARDED 30 +#define HTTP_QUERY_FROM 31 +#define HTTP_QUERY_IF_MODIFIED_SINCE 32 +#define HTTP_QUERY_LOCATION 33 +#define HTTP_QUERY_ORIG_URI 34 +#define HTTP_QUERY_REFERER 35 +#define HTTP_QUERY_RETRY_AFTER 36 +#define HTTP_QUERY_SERVER 37 +#define HTTP_QUERY_TITLE 38 +#define HTTP_QUERY_USER_AGENT 39 +#define HTTP_QUERY_WWW_AUTHENTICATE 40 +#define HTTP_QUERY_PROXY_AUTHENTICATE 41 +#define HTTP_QUERY_ACCEPT_RANGES 42 +#define HTTP_QUERY_SET_COOKIE 43 +#define HTTP_QUERY_COOKIE 44 +#define HTTP_QUERY_REQUEST_METHOD 45 +#define HTTP_QUERY_REFRESH 46 +#define HTTP_QUERY_CONTENT_DISPOSITION 47 +#define HTTP_QUERY_AGE 48 +#define HTTP_QUERY_CACHE_CONTROL 49 +#define HTTP_QUERY_CONTENT_BASE 50 +#define HTTP_QUERY_CONTENT_LOCATION 51 +#define HTTP_QUERY_CONTENT_MD5 52 +#define HTTP_QUERY_CONTENT_RANGE 53 +#define HTTP_QUERY_ETAG 54 +#define HTTP_QUERY_HOST 55 +#define HTTP_QUERY_IF_MATCH 56 +#define HTTP_QUERY_IF_NONE_MATCH 57 +#define HTTP_QUERY_IF_RANGE 58 +#define HTTP_QUERY_IF_UNMODIFIED_SINCE 59 +#define HTTP_QUERY_MAX_FORWARDS 60 +#define HTTP_QUERY_PROXY_AUTHORIZATION 61 +#define HTTP_QUERY_RANGE 62 +#define HTTP_QUERY_TRANSFER_ENCODING 63 +#define HTTP_QUERY_UPGRADE 64 +#define HTTP_QUERY_VARY 65 +#define HTTP_QUERY_VIA 66 +#define HTTP_QUERY_WARNING 67 +#define HTTP_QUERY_EXPECT 68 +#define HTTP_QUERY_PROXY_CONNECTION 69 +#define HTTP_QUERY_UNLESS_MODIFIED_SINCE 70 +#define HTTP_QUERY_ECHO_REQUEST 71 +#define HTTP_QUERY_ECHO_REPLY 72 +#define HTTP_QUERY_ECHO_HEADERS 73 +#define HTTP_QUERY_ECHO_HEADERS_CRLF 74 +#define HTTP_QUERY_PROXY_SUPPORT 75 +#define HTTP_QUERY_AUTHENTICATION_INFO 76 +#define HTTP_QUERY_PASSPORT_URLS 77 +#define HTTP_QUERY_PASSPORT_CONFIG 78 +#define HTTP_QUERY_MAX 78 +#define HTTP_QUERY_CUSTOM 65535 +#define HTTP_QUERY_FLAG_REQUEST_HEADERS 0x80000000 +#define HTTP_QUERY_FLAG_SYSTEMTIME 0x40000000 +#define HTTP_QUERY_FLAG_NUMBER 0x20000000 +#define HTTP_QUERY_FLAG_COALESCE 0x10000000 +#define HTTP_QUERY_MODIFIER_FLAGS_MASK (HTTP_QUERY_FLAG_REQUEST_HEADERS \ + | HTTP_QUERY_FLAG_SYSTEMTIME \ + | HTTP_QUERY_FLAG_NUMBER \ + | HTTP_QUERY_FLAG_COALESCE \ + ) +#define HTTP_QUERY_HEADER_MASK (~HTTP_QUERY_MODIFIER_FLAGS_MASK) + +#define HTTP_STATUS_CONTINUE 100 +#define HTTP_STATUS_SWITCH_PROTOCOLS 101 +#define HTTP_STATUS_OK 200 +#define HTTP_STATUS_CREATED 201 +#define HTTP_STATUS_ACCEPTED 202 +#define HTTP_STATUS_PARTIAL 203 +#define HTTP_STATUS_NO_CONTENT 204 +#define HTTP_STATUS_RESET_CONTENT 205 +#define HTTP_STATUS_PARTIAL_CONTENT 206 +#define HTTP_STATUS_AMBIGUOUS 300 +#define HTTP_STATUS_MOVED 301 +#define HTTP_STATUS_REDIRECT 302 +#define HTTP_STATUS_REDIRECT_METHOD 303 +#define HTTP_STATUS_NOT_MODIFIED 304 +#define HTTP_STATUS_USE_PROXY 305 +#define HTTP_STATUS_REDIRECT_KEEP_VERB 307 +#define HTTP_STATUS_BAD_REQUEST 400 +#define HTTP_STATUS_DENIED 401 +#define HTTP_STATUS_PAYMENT_REQ 402 +#define HTTP_STATUS_FORBIDDEN 403 +#define HTTP_STATUS_NOT_FOUND 404 +#define HTTP_STATUS_BAD_METHOD 405 +#define HTTP_STATUS_NONE_ACCEPTABLE 406 +#define HTTP_STATUS_PROXY_AUTH_REQ 407 +#define HTTP_STATUS_REQUEST_TIMEOUT 408 +#define HTTP_STATUS_CONFLICT 409 +#define HTTP_STATUS_GONE 410 +#define HTTP_STATUS_LENGTH_REQUIRED 411 +#define HTTP_STATUS_PRECOND_FAILED 412 +#define HTTP_STATUS_REQUEST_TOO_LARGE 413 +#define HTTP_STATUS_URI_TOO_LONG 414 +#define HTTP_STATUS_UNSUPPORTED_MEDIA 415 +#define HTTP_STATUS_SERVER_ERROR 500 +#define HTTP_STATUS_NOT_SUPPORTED 501 +#define HTTP_STATUS_BAD_GATEWAY 502 +#define HTTP_STATUS_SERVICE_UNAVAIL 503 +#define HTTP_STATUS_GATEWAY_TIMEOUT 504 +#define HTTP_STATUS_VERSION_NOT_SUP 505 +#define HTTP_STATUS_FIRST HTTP_STATUS_CONTINUE +#define HTTP_STATUS_LAST HTTP_STATUS_VERSION_NOT_SUP + + +INTERNETAPI HINTERNET WINAPI HttpOpenRequestA(HINTERNET ,LPCSTR ,LPCSTR ,LPCSTR , + LPCSTR lpszReferrer ,LPCSTR * ,DWORD ,DWORD); +INTERNETAPI HINTERNET WINAPI HttpOpenRequestW(HINTERNET ,LPCWSTR ,LPCWSTR ,LPCWSTR , + LPCWSTR lpszReferrer ,LPCWSTR * ,DWORD ,DWORD); +#define HttpOpenRequest WINELIB_NAME_AW(HttpOpenRequest) + +BOOLAPI HttpAddRequestHeadersA(HINTERNET ,LPCSTR ,DWORD ,DWORD); +BOOLAPI HttpAddRequestHeadersW(HINTERNET ,LPCWSTR ,DWORD ,DWORD); +#define HttpAddRequestHeaders WINELIB_NAME_AW(HttpAddRequestHeaders) + +#define HTTP_ADDREQ_INDEX_MASK 0x0000FFFF +#define HTTP_ADDREQ_FLAGS_MASK 0xFFFF0000 +#define HTTP_ADDREQ_FLAG_ADD_IF_NEW 0x10000000 +#define HTTP_ADDREQ_FLAG_ADD 0x20000000 +#define HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA 0x40000000 +#define HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON 0x01000000 +#define HTTP_ADDREQ_FLAG_COALESCE HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA +#define HTTP_ADDREQ_FLAG_REPLACE 0x80000000 + +BOOLAPI HttpSendRequestA(HINTERNET ,LPCSTR lpszHeaders ,DWORD ,LPVOID lpOptional ,DWORD); +BOOLAPI HttpSendRequestW(HINTERNET ,LPCWSTR lpszHeaders ,DWORD ,LPVOID lpOptional ,DWORD); +#define HttpSendRequest WINELIB_NAME_AW(HttpSendRequest) + +INTERNETAPI BOOL WINAPI HttpSendRequestExA(HINTERNET ,LPINTERNET_BUFFERSA lpBuffersIn , + LPINTERNET_BUFFERSA lpBuffersOut ,DWORD ,DWORD); +INTERNETAPI BOOL WINAPI HttpSendRequestExW(HINTERNET ,LPINTERNET_BUFFERSW lpBuffersIn , + LPINTERNET_BUFFERSW lpBuffersOut ,DWORD ,DWORD); +#define HttpSendRequestEx WINELIB_NAME_AW(HttpSendRequestEx) + +#define HSR_ASYNC WININET_API_FLAG_ASYNC +#define HSR_SYNC WININET_API_FLAG_SYNC +#define HSR_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT +#define HSR_INITIATE 0x00000008 +#define HSR_DOWNLOAD 0x00000010 +#define HSR_CHUNKED 0x00000020 + +INTERNETAPI BOOL WINAPI HttpEndRequestA(HINTERNET ,LPINTERNET_BUFFERSA lpBuffersOut ,DWORD ,DWORD); +INTERNETAPI BOOL WINAPI HttpEndRequestW(HINTERNET ,LPINTERNET_BUFFERSW lpBuffersOut ,DWORD ,DWORD); +#define HttpEndRequest WINELIB_NAME_AW(HttpEndRequest) + +BOOLAPI HttpQueryInfoA(HINTERNET ,DWORD ,LPVOID lpBuffer ,LPDWORD ,LPDWORD lpdwIndex); +BOOLAPI HttpQueryInfoW(HINTERNET ,DWORD ,LPVOID lpBuffer ,LPDWORD ,LPDWORD lpdwIndex); +#define HttpQueryInfo WINELIB_NAME_AW(HttpQueryInfo) + +BOOLAPI InternetClearAllPerSiteCookieDecisions(VOID); + +BOOLAPI InternetEnumPerSiteCookieDecisionA(LPSTR,unsigned long *,unsigned long *,unsigned long); +BOOLAPI InternetEnumPerSiteCookieDecisionW(LPWSTR,unsigned long *,unsigned long *,unsigned long); +#define InternetEnumPerSiteCookieDecision WINELIB_NAME_AW(InternetEnumPerSiteCookieDecision) + +BOOLAPI InternetGetCookieExA(LPCSTR,LPCSTR,LPSTR,LPDWORD,DWORD,LPVOID); +BOOLAPI InternetGetCookieExW(LPCWSTR,LPCWSTR,LPWSTR,LPDWORD,DWORD,LPVOID); +#define InternetGetCookieEx WINELIB_NAME_AW(InternetGetCookieEx) + +DWORD WINAPI InternetSetCookieExA(LPCSTR,LPCSTR,LPCSTR,DWORD,DWORD_PTR); +DWORD WINAPI InternetSetCookieExW(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,DWORD_PTR); +#define InternetSetCookieEx WINELIB_NAME_AW(InternetSetCookieEx) + +BOOLAPI InternetGetPerSiteCookieDecisionA(LPCSTR,unsigned long *); +BOOLAPI InternetGetPerSiteCookieDecisionW(LPCWSTR,unsigned long *); +#define InternetGetPerSiteCookieDecision WINELIB_NAME_AW(InternetGetPerSiteCookieDecision) + +BOOLAPI InternetSetPerSiteCookieDecisionA(LPCSTR,DWORD); +BOOLAPI InternetSetPerSiteCookieDecisionW(LPCWSTR,DWORD); +#define InternetSetPerSiteCookieDecision WINELIB_NAME_AW(InternetSetPerSiteCookieDecision) + +BOOLAPI InternetSetCookieA(LPCSTR ,LPCSTR ,LPCSTR); +BOOLAPI InternetSetCookieW(LPCWSTR ,LPCWSTR ,LPCWSTR); +#define InternetSetCookie WINELIB_NAME_AW(InternetSetCookie) + +BOOLAPI InternetGetCookieA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD); +BOOLAPI InternetGetCookieW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD); +#define InternetGetCookie WINELIB_NAME_AW(InternetGetCookie) + +INTERNETAPI DWORD WINAPI InternetAttemptConnect(DWORD); +BOOLAPI InternetCheckConnectionA(LPCSTR ,DWORD ,DWORD); +BOOLAPI InternetCheckConnectionW(LPCWSTR ,DWORD ,DWORD); +#define InternetCheckConnection WINELIB_NAME_AW(InternetCheckConnection) + +#define FLAG_ICC_FORCE_CONNECTION 0x00000001 + +#define FLAGS_ERROR_UI_FILTER_FOR_ERRORS 0x01 +#define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS 0x02 +#define FLAGS_ERROR_UI_FLAGS_GENERATE_DATA 0x04 +#define FLAGS_ERROR_UI_FLAGS_NO_UI 0x08 +#define FLAGS_ERROR_UI_SERIALIZE_DIALOGS 0x10 + +DWORD InternetAuthNotifyCallback ( DWORD ,DWORD ,LPVOID ); +typedef DWORD (CALLBACK *PFN_AUTH_NOTIFY) (DWORD,DWORD,LPVOID); + +typedef struct +{ + DWORD cbStruct; + DWORD dwOptions; + PFN_AUTH_NOTIFY pfnNotify; + DWORD dwContext; +} +INTERNET_AUTH_NOTIFY_DATA; + + +INTERNETAPI DWORD WINAPI InternetErrorDlg(HWND ,HINTERNET ,DWORD ,DWORD ,LPVOID *); +INTERNETAPI DWORD WINAPI InternetConfirmZoneCrossingA(HWND ,LPSTR ,LPSTR ,BOOL); +INTERNETAPI DWORD WINAPI InternetConfirmZoneCrossingW(HWND ,LPWSTR ,LPWSTR ,BOOL); +#define InternetConfirmZoneCrossing WINELIB_NAME_AW(InternetConfirmZoneCrossing) + +#define INTERNET_ERROR_BASE 12000 + +#define ERROR_INTERNET_OUT_OF_HANDLES (INTERNET_ERROR_BASE + 1) +#define ERROR_INTERNET_TIMEOUT (INTERNET_ERROR_BASE + 2) +#define ERROR_INTERNET_EXTENDED_ERROR (INTERNET_ERROR_BASE + 3) +#define ERROR_INTERNET_INTERNAL_ERROR (INTERNET_ERROR_BASE + 4) +#define ERROR_INTERNET_INVALID_URL (INTERNET_ERROR_BASE + 5) +#define ERROR_INTERNET_UNRECOGNIZED_SCHEME (INTERNET_ERROR_BASE + 6) +#define ERROR_INTERNET_NAME_NOT_RESOLVED (INTERNET_ERROR_BASE + 7) +#define ERROR_INTERNET_PROTOCOL_NOT_FOUND (INTERNET_ERROR_BASE + 8) +#define ERROR_INTERNET_INVALID_OPTION (INTERNET_ERROR_BASE + 9) +#define ERROR_INTERNET_BAD_OPTION_LENGTH (INTERNET_ERROR_BASE + 10) +#define ERROR_INTERNET_OPTION_NOT_SETTABLE (INTERNET_ERROR_BASE + 11) +#define ERROR_INTERNET_SHUTDOWN (INTERNET_ERROR_BASE + 12) +#define ERROR_INTERNET_INCORRECT_USER_NAME (INTERNET_ERROR_BASE + 13) +#define ERROR_INTERNET_INCORRECT_PASSWORD (INTERNET_ERROR_BASE + 14) +#define ERROR_INTERNET_LOGIN_FAILURE (INTERNET_ERROR_BASE + 15) +#define ERROR_INTERNET_INVALID_OPERATION (INTERNET_ERROR_BASE + 16) +#define ERROR_INTERNET_OPERATION_CANCELLED (INTERNET_ERROR_BASE + 17) +#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE (INTERNET_ERROR_BASE + 18) +#define ERROR_INTERNET_INCORRECT_HANDLE_STATE (INTERNET_ERROR_BASE + 19) +#define ERROR_INTERNET_NOT_PROXY_REQUEST (INTERNET_ERROR_BASE + 20) +#define ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND (INTERNET_ERROR_BASE + 21) +#define ERROR_INTERNET_BAD_REGISTRY_PARAMETER (INTERNET_ERROR_BASE + 22) +#define ERROR_INTERNET_NO_DIRECT_ACCESS (INTERNET_ERROR_BASE + 23) +#define ERROR_INTERNET_NO_CONTEXT (INTERNET_ERROR_BASE + 24) +#define ERROR_INTERNET_NO_CALLBACK (INTERNET_ERROR_BASE + 25) +#define ERROR_INTERNET_REQUEST_PENDING (INTERNET_ERROR_BASE + 26) +#define ERROR_INTERNET_INCORRECT_FORMAT (INTERNET_ERROR_BASE + 27) +#define ERROR_INTERNET_ITEM_NOT_FOUND (INTERNET_ERROR_BASE + 28) +#define ERROR_INTERNET_CANNOT_CONNECT (INTERNET_ERROR_BASE + 29) +#define ERROR_INTERNET_CONNECTION_ABORTED (INTERNET_ERROR_BASE + 30) +#define ERROR_INTERNET_CONNECTION_RESET (INTERNET_ERROR_BASE + 31) +#define ERROR_INTERNET_FORCE_RETRY (INTERNET_ERROR_BASE + 32) +#define ERROR_INTERNET_INVALID_PROXY_REQUEST (INTERNET_ERROR_BASE + 33) +#define ERROR_INTERNET_NEED_UI (INTERNET_ERROR_BASE + 34) +#define ERROR_INTERNET_HANDLE_EXISTS (INTERNET_ERROR_BASE + 36) +#define ERROR_INTERNET_SEC_CERT_DATE_INVALID (INTERNET_ERROR_BASE + 37) +#define ERROR_INTERNET_SEC_CERT_CN_INVALID (INTERNET_ERROR_BASE + 38) +#define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR (INTERNET_ERROR_BASE + 39) +#define ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR (INTERNET_ERROR_BASE + 40) +#define ERROR_INTERNET_MIXED_SECURITY (INTERNET_ERROR_BASE + 41) +#define ERROR_INTERNET_CHG_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 42) +#define ERROR_INTERNET_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 43) +#define ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED (INTERNET_ERROR_BASE + 44) +#define ERROR_INTERNET_INVALID_CA (INTERNET_ERROR_BASE + 45) +#define ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP (INTERNET_ERROR_BASE + 46) +#define ERROR_INTERNET_ASYNC_THREAD_FAILED (INTERNET_ERROR_BASE + 47) +#define ERROR_INTERNET_REDIRECT_SCHEME_CHANGE (INTERNET_ERROR_BASE + 48) +#define ERROR_INTERNET_DIALOG_PENDING (INTERNET_ERROR_BASE + 49) +#define ERROR_INTERNET_RETRY_DIALOG (INTERNET_ERROR_BASE + 50) +#define ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR (INTERNET_ERROR_BASE + 52) +#define ERROR_INTERNET_INSERT_CDROM (INTERNET_ERROR_BASE + 53) +#define ERROR_FTP_TRANSFER_IN_PROGRESS (INTERNET_ERROR_BASE + 110) +#define ERROR_FTP_DROPPED (INTERNET_ERROR_BASE + 111) +#define ERROR_FTP_NO_PASSIVE_MODE (INTERNET_ERROR_BASE + 112) +#define ERROR_GOPHER_PROTOCOL_ERROR (INTERNET_ERROR_BASE + 130) +#define ERROR_GOPHER_NOT_FILE (INTERNET_ERROR_BASE + 131) +#define ERROR_GOPHER_DATA_ERROR (INTERNET_ERROR_BASE + 132) +#define ERROR_GOPHER_END_OF_DATA (INTERNET_ERROR_BASE + 133) +#define ERROR_GOPHER_INVALID_LOCATOR (INTERNET_ERROR_BASE + 134) +#define ERROR_GOPHER_INCORRECT_LOCATOR_TYPE (INTERNET_ERROR_BASE + 135) +#define ERROR_GOPHER_NOT_GOPHER_PLUS (INTERNET_ERROR_BASE + 136) +#define ERROR_GOPHER_ATTRIBUTE_NOT_FOUND (INTERNET_ERROR_BASE + 137) +#define ERROR_GOPHER_UNKNOWN_LOCATOR (INTERNET_ERROR_BASE + 138) +#define ERROR_HTTP_HEADER_NOT_FOUND (INTERNET_ERROR_BASE + 150) +#define ERROR_HTTP_DOWNLEVEL_SERVER (INTERNET_ERROR_BASE + 151) +#define ERROR_HTTP_INVALID_SERVER_RESPONSE (INTERNET_ERROR_BASE + 152) +#define ERROR_HTTP_INVALID_HEADER (INTERNET_ERROR_BASE + 153) +#define ERROR_HTTP_INVALID_QUERY_REQUEST (INTERNET_ERROR_BASE + 154) +#define ERROR_HTTP_HEADER_ALREADY_EXISTS (INTERNET_ERROR_BASE + 155) +#define ERROR_HTTP_REDIRECT_FAILED (INTERNET_ERROR_BASE + 156) +#define ERROR_HTTP_NOT_REDIRECTED (INTERNET_ERROR_BASE + 160) +#define ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 161) +#define ERROR_HTTP_COOKIE_DECLINED (INTERNET_ERROR_BASE + 162) +#define ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 168) +#define ERROR_INTERNET_SECURITY_CHANNEL_ERROR (INTERNET_ERROR_BASE + 157) +#define ERROR_INTERNET_UNABLE_TO_CACHE_FILE (INTERNET_ERROR_BASE + 158) +#define ERROR_INTERNET_TCPIP_NOT_INSTALLED (INTERNET_ERROR_BASE + 159) +#define ERROR_INTERNET_DISCONNECTED (INTERNET_ERROR_BASE + 163) +#define ERROR_INTERNET_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 164) +#define ERROR_INTERNET_PROXY_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 165) +#define ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT (INTERNET_ERROR_BASE + 166) +#define ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT (INTERNET_ERROR_BASE + 167) +#define ERROR_INTERNET_SEC_INVALID_CERT (INTERNET_ERROR_BASE + 169) +#define ERROR_INTERNET_SEC_CERT_REVOKED (INTERNET_ERROR_BASE + 170) +#define ERROR_INTERNET_FAILED_DUETOSECURITYCHECK (INTERNET_ERROR_BASE + 171) +#define INTERNET_ERROR_LAST ERROR_INTERNET_FAILED_DUETOSECURITYCHECK + + +#define NORMAL_CACHE_ENTRY 0x00000001 +#define COOKIE_CACHE_ENTRY 0x00100000 +#define URLHISTORY_CACHE_ENTRY 0x00200000 +#define TRACK_OFFLINE_CACHE_ENTRY 0x00000010 +#define TRACK_ONLINE_CACHE_ENTRY 0x00000020 +#define STICKY_CACHE_ENTRY 0x00000004 +#define SPARSE_CACHE_ENTRY 0x00010000 + +#define URLCACHE_FIND_DEFAULT_FILTER NORMAL_CACHE_ENTRY \ + | COOKIE_CACHE_ENTRY \ + | URLHISTORY_CACHE_ENTRY \ + | TRACK_OFFLINE_CACHE_ENTRY \ + | TRACK_ONLINE_CACHE_ENTRY \ + | STICKY_CACHE_ENTRY + + +typedef struct _INTERNET_CACHE_ENTRY_INFOA { + DWORD dwStructSize; + LPSTR lpszSourceUrlName; + LPSTR lpszLocalFileName; + DWORD CacheEntryType; + DWORD dwUseCount; + DWORD dwHitRate; + DWORD dwSizeLow; + DWORD dwSizeHigh; + FILETIME LastModifiedTime; + FILETIME ExpireTime; + FILETIME LastAccessTime; + FILETIME LastSyncTime; + + LPBYTE lpHeaderInfo; + DWORD dwHeaderInfoSize; + LPSTR lpszFileExtension; + union { + DWORD dwReserved; + DWORD dwExemptDelta; + } DUMMYUNIONNAME; +} INTERNET_CACHE_ENTRY_INFOA,* LPINTERNET_CACHE_ENTRY_INFOA; + +typedef struct _INTERNET_CACHE_ENTRY_INFOW { + DWORD dwStructSize; + LPWSTR lpszSourceUrlName; + LPWSTR lpszLocalFileName; + DWORD CacheEntryType; + DWORD dwUseCount; + DWORD dwHitRate; + DWORD dwSizeLow; + DWORD dwSizeHigh; + FILETIME LastModifiedTime; + FILETIME ExpireTime; + FILETIME LastAccessTime; + FILETIME LastSyncTime; + + LPBYTE lpHeaderInfo; + DWORD dwHeaderInfoSize; + LPWSTR lpszFileExtension; + union { + DWORD dwReserved; + DWORD dwExemptDelta; + } DUMMYUNIONNAME; +} INTERNET_CACHE_ENTRY_INFOW,* LPINTERNET_CACHE_ENTRY_INFOW; + +DECL_WINELIB_TYPE_AW(INTERNET_CACHE_ENTRY_INFO) +DECL_WINELIB_TYPE_AW(LPINTERNET_CACHE_ENTRY_INFO) + +BOOLAPI CreateUrlCacheEntryA(LPCSTR ,DWORD ,LPCSTR ,LPSTR ,DWORD); +BOOLAPI CreateUrlCacheEntryW(LPCWSTR ,DWORD ,LPCWSTR ,LPWSTR ,DWORD); +#define CreateUrlCacheEntry WINELIB_NAME_AW(CreateUrlCacheEntry) + +BOOLAPI CommitUrlCacheEntryA(LPCSTR,LPCSTR,FILETIME,FILETIME,DWORD,LPBYTE,DWORD,LPCSTR,LPCSTR); +BOOLAPI CommitUrlCacheEntryW(LPCWSTR,LPCWSTR,FILETIME,FILETIME,DWORD,LPWSTR,DWORD,LPCWSTR,LPCWSTR); +#define CommitUrlCacheEntry WINELIB_NAME_AW(CommitUrlCacheEntry) + +BOOLAPI ResumeSuspendedDownload(HINTERNET, DWORD); + +BOOLAPI RetrieveUrlCacheEntryFileA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,DWORD); +BOOLAPI RetrieveUrlCacheEntryFileW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,DWORD); +#define RetrieveUrlCacheEntryFile WINELIB_NAME_AW(RetrieveUrlCacheEntryFile) + +BOOLAPI SetUrlCacheConfigInfoA(LPDWORD,DWORD); +BOOLAPI SetUrlCacheConfigInfoW(LPDWORD,DWORD); +#define SetUrlCacheConfigInfo WINELIB_NAME_AW(SetUrlCacheConfigInfo) + +BOOLAPI UnlockUrlCacheEntryFileA(LPCSTR ,DWORD); +BOOLAPI UnlockUrlCacheEntryFileW(LPCWSTR ,DWORD); +#define UnlockUrlCacheEntryFile WINELIB_NAME_AW(UnlockUrlCacheEntryFile) + +INTERNETAPI HANDLE WINAPI RetrieveUrlCacheEntryStreamA(LPCSTR , + LPINTERNET_CACHE_ENTRY_INFOA , LPDWORD ,BOOL ,DWORD); +INTERNETAPI HANDLE WINAPI RetrieveUrlCacheEntryStreamW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW , + LPDWORD ,BOOL ,DWORD); +#define RetrieveUrlCacheEntryStream WINELIB_NAME_AW(RetrieveUrlCacheEntryStream) + +BOOLAPI ReadUrlCacheEntryStream( HANDLE ,DWORD ,LPVOID ,LPDWORD ,DWORD ); +BOOLAPI UnlockUrlCacheEntryStream( HANDLE ,DWORD ); +BOOLAPI GetUrlCacheEntryInfoA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD); +BOOLAPI GetUrlCacheEntryInfoW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD); +#define GetUrlCacheEntryInfo WINELIB_NAME_AW(GetUrlCacheEntryInfo) + +BOOLAPI GetUrlCacheEntryInfoExA( + LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPSTR ,LPDWORD ,LPVOID ,DWORD); +BOOLAPI GetUrlCacheEntryInfoExW( + LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPWSTR ,LPDWORD ,LPVOID ,DWORD); +#define GetUrlCacheEntryInfoEx WINELIB_NAME_AW(GetUrlCacheEntryInfoEx) + +#define CACHE_ENTRY_ATTRIBUTE_FC 0x00000004 +#define CACHE_ENTRY_HITRATE_FC 0x00000010 +#define CACHE_ENTRY_MODTIME_FC 0x00000040 +#define CACHE_ENTRY_EXPTIME_FC 0x00000080 +#define CACHE_ENTRY_ACCTIME_FC 0x00000100 +#define CACHE_ENTRY_SYNCTIME_FC 0x00000200 +#define CACHE_ENTRY_HEADERINFO_FC 0x00000400 +#define CACHE_ENTRY_EXEMPT_DELTA_FC 0x00000800 + + +BOOLAPI SetUrlCacheEntryInfoA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,DWORD); +BOOLAPI SetUrlCacheEntryInfoW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,DWORD); +#define SetUrlCacheEntryInfo WINELIB_NAME_AW(SetUrlCacheEntryInfo) + +typedef LONGLONG GROUPID; + +INTERNETAPI GROUPID WINAPI CreateUrlCacheGroup(DWORD,LPVOID); +BOOLAPI DeleteUrlCacheGroup(GROUPID ,DWORD ,LPVOID); + +INTERNETAPI HANDLE WINAPI FindFirstUrlCacheGroup(DWORD,DWORD,LPVOID,DWORD,GROUPID*,LPVOID); +BOOLAPI FindNextUrlCacheGroup(HANDLE,GROUPID*,LPVOID); + +BOOLAPI GetUrlCacheGroupAttributeA(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOA,LPDWORD,LPVOID); +BOOLAPI GetUrlCacheGroupAttributeW(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOW,LPDWORD,LPVOID); +#define GetUrlCacheGroupAttribute WINELIB_NAME_AW(GetUrlCacheGroupAttribute) + +#define INTERNET_CACHE_GROUP_ADD 0 +#define INTERNET_CACHE_GROUP_REMOVE 1 + +BOOLAPI SetUrlCacheEntryGroupA(LPCSTR,DWORD,GROUPID,LPBYTE,DWORD,LPVOID); +BOOLAPI SetUrlCacheEntryGroupW(LPCWSTR,DWORD,GROUPID,LPBYTE,DWORD,LPVOID); +#define SetUrlCacheEntryGroup WINELIB_NAME_AW(SetUrlCacheEntryGroup) + +BOOLAPI SetUrlCacheGroupAttributeA(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOA,LPVOID); +BOOLAPI SetUrlCacheGroupAttributeW(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOW,LPVOID); +#define SetUrlCacheGroupAttribute WINELIB_NAME_AW(SetUrlCacheGroupAttribute) + +INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryExA( + LPCSTR ,DWORD ,DWORD ,GROUPID ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID ); +INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryExW( + LPCWSTR ,DWORD ,DWORD ,GROUPID ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID ); +#define FindFirstUrlCacheEntryEx WINELIB_NAME_AW(FindFirstUrlCacheEntryEx) + +BOOLAPI FindNextUrlCacheEntryExA(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID); +BOOLAPI FindNextUrlCacheEntryExW(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID); +#define FindNextUrlCacheEntryEx WINELIB_NAME_AW(FindNextUrlCacheEntryEx) + +INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD); +INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD); +#define FindFirstUrlCacheEntry WINELIB_NAME_AW(FindFirstUrlCacheEntry) + +BOOLAPI FindNextUrlCacheEntryA(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD); +BOOLAPI FindNextUrlCacheEntryW(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD); +#define FindNextUrlCacheEntry WINELIB_NAME_AW(FindNextUrlCacheEntry) + +BOOLAPI FindCloseUrlCache(HANDLE); + +BOOLAPI DeleteUrlCacheEntryA(LPCSTR); +BOOLAPI DeleteUrlCacheEntryW(LPCWSTR); +#define DeleteUrlCacheEntry WINELIB_NAME_AW(DeleteUrlCacheEntry) + +INTERNETAPI DWORD WINAPI InternetDialA(HWND ,LPSTR ,DWORD ,LPDWORD ,DWORD); +INTERNETAPI DWORD WINAPI InternetDialW(HWND ,LPWSTR ,DWORD ,LPDWORD ,DWORD); +#define InternetDial WINELIB_NAME_AW(InternetDial) + + +#define INTERNET_DIAL_UNATTENDED 0x8000 + +INTERNETAPI DWORD WINAPI InternetHangUp(DWORD ,DWORD); +BOOLAPI CreateMD5SSOHash(PWSTR,PWSTR,PWSTR,PBYTE); + +#define INTERENT_GOONLINE_REFRESH 0x00000001 +#define INTERENT_GOONLINE_MASK 0x00000001 +INTERNETAPI BOOL WINAPI InternetGoOnlineA(LPSTR ,HWND ,DWORD); +INTERNETAPI BOOL WINAPI InternetGoOnlineW(LPWSTR ,HWND ,DWORD); +#define InternetGoOnline WINELIB_NAME_AW(InternetGoOnline) +INTERNETAPI BOOL WINAPI InternetAutodial(DWORD,HWND); + +#define INTERNET_AUTODIAL_FORCE_ONLINE 1 +#define INTERNET_AUTODIAL_FORCE_UNATTENDED 2 +#define INTERNET_AUTODIAL_FAILIFSECURITYCHECK 4 + +#define INTERNET_AUTODIAL_FLAGS_MASK (INTERNET_AUTODIAL_FORCE_ONLINE | INTERNET_AUTODIAL_FORCE_UNATTENDED | INTERNET_AUTODIAL_FAILIFSECURITYCHECK) +INTERNETAPI BOOL WINAPI InternetAutodialHangup(DWORD); +INTERNETAPI BOOL WINAPI InternetGetConnectedState(LPDWORD ,DWORD); + +#define INTERNET_CONNECTION_MODEM 1 +#define INTERNET_CONNECTION_LAN 2 +#define INTERNET_CONNECTION_PROXY 4 +#define INTERNET_CONNECTION_MODEM_BUSY 8 + +typedef DWORD (CALLBACK *PFN_DIAL_HANDLER) (HWND,LPCSTR,DWORD,LPDWORD); + +#define INTERNET_CUSTOMDIAL_CONNECT 0 +#define INTERNET_CUSTOMDIAL_UNATTENDED 1 +#define INTERNET_CUSTOMDIAL_DISCONNECT 2 +#define INTERNET_CUSTOMDIAL_SHOWOFFLINE 4 +#define INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED 1 +#define INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE 2 +#define INTERNET_CUSTOMDIAL_CAN_HANGUP 4 + +INTERNETAPI BOOL WINAPI InternetSetDialStateA(LPCSTR ,DWORD ,DWORD); +INTERNETAPI BOOL WINAPI InternetSetDialStateW(LPCWSTR ,DWORD ,DWORD); +#define InternetSetDialState WINELIB_NAME_AW(InternetSetDialState) +#define INTERNET_DIALSTATE_DISCONNECTED 1 + +BOOLAPI InternetCheckConnectionA(LPCSTR lpszUrl,DWORD dwFlags,DWORD dwReserved); +BOOLAPI InternetCheckConnectionW(LPCWSTR lpszUrl,DWORD dwFlags,DWORD dwReserved); +#define InternetCheckConnection WINELIB_NAME_AW(InternetCheckConnection) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/lib/adns/src/event.c b/reactos/lib/adns/src/event.c index d07a201afca..4dd61f54d8f 100644 --- a/reactos/lib/adns/src/event.c +++ b/reactos/lib/adns/src/event.c @@ -394,7 +394,7 @@ int adns_processreadable(adns_state ads, ADNS_SOCKET fd, const struct timeval *n for (;;) { udpaddrlen= sizeof(udpaddr); ADNS_CLEAR_ERRNO; - r= recvfrom(ads->udpsocket,udpbuf,sizeof(udpbuf),0, + r= recvfrom(ads->udpsocket,(char*)udpbuf,sizeof(udpbuf),0, (struct sockaddr*)&udpaddr,&udpaddrlen); ADNS_CAPTURE_ERRNO; if (r<0) { diff --git a/reactos/lib/adns/src/general.c b/reactos/lib/adns/src/general.c index 832e69e3620..4d24fda8ba6 100644 --- a/reactos/lib/adns/src/general.c +++ b/reactos/lib/adns/src/general.c @@ -149,7 +149,7 @@ int adns__vbuf_append(vbuf *vb, const byte *data, int len) { int adns__vbuf_appendstr(vbuf *vb, const char *data) { int l; l= strlen(data); - return adns__vbuf_append(vb,data,l); + return adns__vbuf_append(vb,(byte*)data,l); } void adns__vbuf_free(vbuf *vb) { @@ -172,15 +172,15 @@ const char *adns__diag_domain(adns_state ads, int serv, adns_query qu, if (!(adns__vbuf_appendstr(vb,"") && - adns__vbuf_append(vb,"",1))) { + adns__vbuf_append(vb,(byte*)"",1))) { return ""; } } if (!vb->used) { adns__vbuf_appendstr(vb,""); - adns__vbuf_append(vb,"",1); + adns__vbuf_append(vb,(byte*)"",1); } - return vb->buf; + return (char*)vb->buf; } adns_status adns_rr_info(adns_rrtype type, @@ -203,10 +203,10 @@ adns_status adns_rr_info(adns_rrtype type, adns__vbuf_init(&vb); st= typei->convstring(&vb,datap); if (st) goto x_freevb; - if (!adns__vbuf_append(&vb,"",1)) { st= adns_s_nomemory; goto x_freevb; } - assert((int)strlen(vb.buf) == vb.used-1); + if (!adns__vbuf_append(&vb,(byte*)"",1)) { st= adns_s_nomemory; goto x_freevb; } + assert((int)strlen((char*)vb.buf) == vb.used-1); *data_r= realloc(vb.buf, (size_t) vb.used); - if (!*data_r) *data_r= vb.buf; + if (!*data_r) *data_r= (char*)vb.buf; return adns_s_ok; x_freevb: diff --git a/reactos/lib/adns/src/parse.c b/reactos/lib/adns/src/parse.c index 78154b68452..3d54638753b 100644 --- a/reactos/lib/adns/src/parse.c +++ b/reactos/lib/adns/src/parse.c @@ -47,7 +47,7 @@ int vbuf__append_quoted1035(vbuf *vb, const byte *buf, int len) { break; } } - if (!adns__vbuf_append(vb,buf,i) || !adns__vbuf_append(vb,qbuf,(int) strlen(qbuf))) + if (!adns__vbuf_append(vb,buf,i) || !adns__vbuf_append(vb,(byte*)qbuf,(int) strlen(qbuf))) return 0; if (idgram; + dgram= (char*)fls->dgram; for (;;) { if (fls->cbyte >= fls->dglen) goto x_truncated; if (fls->cbyte >= fls->max) goto x_badresponse; @@ -139,7 +139,7 @@ adns_status adns__parse_domain_more(findlabel_state *fls, adns_state ads, if (first) { first= 0; } else { - if (!adns__vbuf_append(vb,".",1)) return adns_s_nomemory; + if (!adns__vbuf_append(vb,(byte*)".",1)) return adns_s_nomemory; } if (flags & pdf_quoteok) { if (!vbuf__append_quoted1035(vb,dgram+labstart,lablen)) @@ -156,7 +156,7 @@ adns_status adns__parse_domain_more(findlabel_state *fls, adns_state ads, return adns_s_nomemory; } } - if (!adns__vbuf_append(vb,"",1)) return adns_s_nomemory; + if (!adns__vbuf_append(vb,(byte*)"",1)) return adns_s_nomemory; return adns_s_ok; } diff --git a/reactos/lib/adns/src/query.c b/reactos/lib/adns/src/query.c index ea73518b0f6..f8b8bf423cb 100644 --- a/reactos/lib/adns/src/query.c +++ b/reactos/lib/adns/src/query.c @@ -171,7 +171,7 @@ void adns__search_next(adns_state ads, adns_query qu, struct timeval now) { qu->search_vb.used= qu->search_origlen; if (nextentry) { - if (!adns__vbuf_append(&qu->search_vb,".",1) || + if (!adns__vbuf_append(&qu->search_vb,(byte*)".",1) || !adns__vbuf_appendstr(&qu->search_vb,nextentry)) { stat= adns_s_nomemory; goto x_fail; } @@ -180,7 +180,7 @@ void adns__search_next(adns_state ads, adns_query qu, struct timeval now) { free(qu->query_dgram); qu->query_dgram= 0; qu->query_dglen= 0; - query_simple(ads,qu, qu->search_vb.buf, qu->search_vb.used, qu->typei, qu->flags, now); + query_simple(ads,qu, (char*)qu->search_vb.buf, qu->search_vb.used, qu->typei, qu->flags, now); return; x_fail: @@ -239,7 +239,7 @@ int adns_submit(adns_state ads, } if (flags & adns_qf_search) { - r= adns__vbuf_append(&qu->search_vb,owner,ol); + r= adns__vbuf_append(&qu->search_vb,(byte*)owner,ol); if (!r) { stat= adns_s_nomemory; goto x_adnsfail; } for (ndots=0, p=owner; (p= strchr(p,'.')); p++, ndots++); @@ -511,7 +511,7 @@ void adns__query_done(adns_query qu) { if (qu->flags & adns_qf_owner && qu->flags & adns_qf_search && ans->status != adns_s_nomemory) { - if (!save_owner(qu, qu->search_vb.buf, qu->search_vb.used)) { + if (!save_owner(qu, (char*)qu->search_vb.buf, qu->search_vb.used)) { adns__query_fail(qu,adns_s_nomemory); return; } diff --git a/reactos/lib/adns/src/reply.c b/reactos/lib/adns/src/reply.c index d264e299ddd..9aae6fe0c5e 100644 --- a/reactos/lib/adns/src/reply.c +++ b/reactos/lib/adns/src/reply.c @@ -206,7 +206,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, dgram,dglen, &rdstart,rdstart+rdlength); if (!qu->vb.used) goto x_truncated; if (st) { adns__query_fail(qu,st); return; } - l= strlen(qu->vb.buf)+1; + l= strlen((char*)qu->vb.buf)+1; qu->answer->cname= adns__alloc_preserved(qu,(size_t) l); if (!qu->answer->cname) { adns__query_fail(qu,adns_s_nomemory); return; } diff --git a/reactos/lib/adns/src/transmit.c b/reactos/lib/adns/src/transmit.c index 62df41f0771..6b25adb054e 100644 --- a/reactos/lib/adns/src/transmit.c +++ b/reactos/lib/adns/src/transmit.c @@ -189,9 +189,9 @@ void adns__querysend_tcp(adns_query qu, struct timeval now) { if (ads->tcpsend.used) { wr= 0; } else { - iov[0].iov_base= length; + iov[0].iov_base= (char*)length; iov[0].iov_len= 2; - iov[1].iov_base= qu->query_dgram; + iov[1].iov_base= (char*)qu->query_dgram; iov[1].iov_len= qu->query_dglen; adns__sigpipe_protect(qu->ads); wr= writev(qu->ads->tcpsocket,iov,2); @@ -251,7 +251,7 @@ void adns__query_send(adns_query qu, struct timeval now) { servaddr.sin_port= htons(DNS_PORT); ADNS_CLEAR_ERRNO; - r= sendto(ads->udpsocket,qu->query_dgram,qu->query_dglen,0, + r= sendto(ads->udpsocket,(char*)qu->query_dgram,qu->query_dglen,0, (const struct sockaddr*)&servaddr,sizeof(servaddr)); ADNS_CAPTURE_ERRNO; if (r<0 && errno == EMSGSIZE) { qu->retries= 0; query_usetcp(qu,now); return; } diff --git a/reactos/lib/adns/src/types.c b/reactos/lib/adns/src/types.c index b0948a003a6..d200c225387 100644 --- a/reactos/lib/adns/src/types.c +++ b/reactos/lib/adns/src/types.c @@ -860,13 +860,13 @@ static adns_status pap_mailbox822(const parseinfo *pai, int *cbyte_io, int max, if (needquote || neednorm) { r= adns__vbuf_ensure(vb, lablen+needquote+4); if (!r) R_NOMEM; - adns__vbuf_appendq(vb,"\"",1); + adns__vbuf_appendq(vb,(byte*)"\"",1); for (i=0, needquote=0, p= pai->dgram+labstart; idgram+labstart, lablen); if (!r) R_NOMEM; } diff --git a/reactos/lib/advapi32/advapi32.def b/reactos/lib/advapi32/advapi32.def index 6f7059128b4..ea60f206513 100644 --- a/reactos/lib/advapi32/advapi32.def +++ b/reactos/lib/advapi32/advapi32.def @@ -414,7 +414,7 @@ MD5Update@12 MakeAbsoluteSD@44 ;MakeAbsoluteSD2 MakeSelfRelativeSD@12 -MapGenericMask@8 +MapGenericMask@8=NTDLL.RtlMapGenericMask ;NotifyBootConfigStatus@4 NotifyChangeEventLog@8 ObjectCloseAuditAlarmA@12 diff --git a/reactos/lib/advapi32/advapi32.xml b/reactos/lib/advapi32/advapi32.xml index b80dbfdd701..e7d5b0beaf6 100644 --- a/reactos/lib/advapi32/advapi32.xml +++ b/reactos/lib/advapi32/advapi32.xml @@ -1,12 +1,15 @@ . + include/idl 0x600 0x0500 0x0501 + scm_client ntdll kernel32 + rpcrt4 advapi32.h crypt.c diff --git a/reactos/lib/advapi32/makefile b/reactos/lib/advapi32/makefile index 9d35be29271..9e25e2750a9 100644 --- a/reactos/lib/advapi32/makefile +++ b/reactos/lib/advapi32/makefile @@ -16,7 +16,7 @@ TARGET_CFLAGS = -Wall -Werror -fno-builtin \ TARGET_LFLAGS = -nostartfiles -nostdlib -TARGET_SDKLIBS = ntdll.a kernel32.a +TARGET_SDKLIBS = ntdll.a kernel32.a rpcrt4.a TARGET_BASE = $(TARGET_BASE_LIB_ADVAPI32) @@ -48,6 +48,7 @@ SECURITY_OBJECTS = \ sec/trustee.o SERVICE_OBJECTS = \ + service/svcctl_c.o \ service/eventlog.o \ service/scm.o \ service/sctrl.o \ @@ -67,8 +68,17 @@ TARGET_OBJECTS = \ DEP_OBJECTS = $(TARGET_OBJECTS) +TARGET_CLEAN = service/svcctl_c.c service/svcctl_c.h + include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk include $(TOOLS_PATH)/depend.mk + +WIDL_FLAGS = -o \ + -D _X86_ -D MIDL_PASS \ + -I $(PATH_TO_TOP)/w32api/include + +service/svcctl_c.c service/svcctl.h: $(PATH_TO_TOP)/include/idl/svcctl.idl + $(WIDL) $(WIDL_FLAGS) -h -H service/svcctl_c.h -c -C service/svcctl_c.c $(PATH_TO_TOP)/include/idl/svcctl.idl diff --git a/reactos/lib/advapi32/reg/reg.c b/reactos/lib/advapi32/reg/reg.c index 8f22f56f9b9..71038c5e0d9 100644 --- a/reactos/lib/advapi32/reg/reg.c +++ b/reactos/lib/advapi32/reg/reg.c @@ -8,6 +8,7 @@ * UPDATE HISTORY: * Created 01/11/98 * 19990309 EA Stubs + * 20050502 Fireball imported some stuff from WINE */ /* INCLUDES *****************************************************************/ @@ -22,6 +23,9 @@ #define REG_MAX_NAME_SIZE 256 #define REG_MAX_DATA_SIZE 2048 +/* FIXME: should go into msvcrt.h header? */ +#define offsetof(s,m) (size_t)&(((s*)NULL)->m) + /* GLOBALS ******************************************************************/ static RTL_CRITICAL_SECTION HandleTableCS; @@ -40,6 +44,11 @@ static NTSTATUS OpenCurrentConfigKey(PHANDLE KeyHandle); /* FUNCTIONS ****************************************************************/ +/* check if value type needs string conversion (Ansi<->Unicode) */ +inline static int is_string( DWORD type ) +{ + return (type == REG_SZ) || (type == REG_EXPAND_SZ) || (type == REG_MULTI_SZ); +} /************************************************************************ * RegInitDefaultHandles @@ -850,166 +859,163 @@ RegEnumKeyExA (HKEY hKey, LPDWORD lpcbClass, PFILETIME lpftLastWriteTime) { - union - { - KEY_NODE_INFORMATION Node; - KEY_BASIC_INFORMATION Basic; - } *KeyInfo; - - UNICODE_STRING StringU; - ANSI_STRING StringA; - LONG ErrorCode = ERROR_SUCCESS; - DWORD NameLength; - DWORD ClassLength = 0; - DWORD BufferSize; - DWORD ResultSize; - HANDLE KeyHandle; - NTSTATUS Status; - - DPRINT("RegEnumKeyExA(hKey 0x%x, dwIndex %d, lpName 0x%x, *lpcbName %d, lpClass 0x%x, lpcbClass %d)\n", - hKey, dwIndex, lpName, *lpcbName, lpClass, lpcbClass ? *lpcbClass : 0); - - if ((lpClass) && (!lpcbClass)) - { - SetLastError (ERROR_INVALID_PARAMETER); - return ERROR_INVALID_PARAMETER; - } - - Status = MapDefaultKey(&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } - - if (*lpcbName > 0) - { - NameLength = min (*lpcbName - 1 , REG_MAX_NAME_SIZE) * sizeof (WCHAR); - } - else - { - NameLength = 0; - } - - if (lpClass) - { - if (*lpcbClass > 0) + union { - ClassLength = min (*lpcbClass -1, REG_MAX_NAME_SIZE) * sizeof(WCHAR); - } - else + KEY_NODE_INFORMATION Node; + KEY_BASIC_INFORMATION Basic; + } *KeyInfo; + + UNICODE_STRING StringU; + ANSI_STRING StringA; + LONG ErrorCode = ERROR_SUCCESS; + DWORD NameLength; + DWORD ClassLength = 0; + DWORD BufferSize; + DWORD ResultSize; + HANDLE KeyHandle; + NTSTATUS Status; + + DPRINT("RegEnumKeyExA(hKey 0x%x, dwIndex %d, lpName 0x%x, *lpcbName %d, lpClass 0x%x, lpcbClass %d)\n", + hKey, dwIndex, lpName, *lpcbName, lpClass, lpcbClass ? *lpcbClass : 0); + + if ((lpClass) && (!lpcbClass)) { - ClassLength = 0; + SetLastError (ERROR_INVALID_PARAMETER); + return ERROR_INVALID_PARAMETER; } - /* The class name should start at a dword boundary */ - BufferSize = ((sizeof(KEY_NODE_INFORMATION) + NameLength + 3) & ~3) + ClassLength; - } - else - { - BufferSize = sizeof(KEY_BASIC_INFORMATION) + NameLength; - } - - KeyInfo = RtlAllocateHeap (ProcessHeap, - 0, - BufferSize); - if (KeyInfo == NULL) - { - SetLastError (ERROR_OUTOFMEMORY); - return ERROR_OUTOFMEMORY; - } - - Status = NtEnumerateKey (KeyHandle, - (ULONG)dwIndex, - lpClass == NULL ? KeyBasicInformation : KeyNodeInformation, - KeyInfo, - BufferSize, - &ResultSize); - DPRINT("NtEnumerateKey() returned status 0x%X\n", Status); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - } - else - { - if (lpClass == NULL) + Status = MapDefaultKey(&KeyHandle, hKey); + if (!NT_SUCCESS(Status)) { - if (KeyInfo->Basic.NameLength > NameLength) - { - ErrorCode = ERROR_BUFFER_OVERFLOW; - } - else - { - StringU.Buffer = KeyInfo->Basic.Name; - StringU.Length = KeyInfo->Basic.NameLength; - StringU.MaximumLength = KeyInfo->Basic.NameLength; - } - } - else - { - if (KeyInfo->Node.NameLength > NameLength || - KeyInfo->Node.ClassLength > ClassLength) - { - ErrorCode = ERROR_BUFFER_OVERFLOW; - } - else - { - StringA.Buffer = lpClass; - StringA.Length = 0; - StringA.MaximumLength = *lpcbClass; - StringU.Buffer = (PWCHAR)((ULONG_PTR)KeyInfo->Node.Name + KeyInfo->Node.ClassOffset); - StringU.Length = KeyInfo->Node.ClassLength; - StringU.MaximumLength = KeyInfo->Node.ClassLength; - RtlUnicodeStringToAnsiString (&StringA, &StringU, FALSE); - lpClass[StringA.Length] = 0; - *lpcbClass = StringA.Length; - StringU.Buffer = KeyInfo->Node.Name; - StringU.Length = KeyInfo->Node.NameLength; - StringU.MaximumLength = KeyInfo->Node.NameLength; - } + ErrorCode = RtlNtStatusToDosError (Status); + SetLastError (ErrorCode); + return ErrorCode; } - if (ErrorCode == ERROR_SUCCESS) + if (*lpcbName > 0) { - StringA.Buffer = lpName; - StringA.Length = 0; - StringA.MaximumLength = *lpcbName; - RtlUnicodeStringToAnsiString (&StringA, &StringU, FALSE); - lpName[StringA.Length] = 0; - *lpcbName = StringA.Length; - if (lpftLastWriteTime != NULL) - { - if (lpClass == NULL) + NameLength = min (*lpcbName - 1 , REG_MAX_NAME_SIZE) * sizeof (WCHAR); + } + else + { + NameLength = 0; + } + + if (lpClass) + { + if (*lpcbClass > 0) { - lpftLastWriteTime->dwLowDateTime = KeyInfo->Basic.LastWriteTime.u.LowPart; - lpftLastWriteTime->dwHighDateTime = KeyInfo->Basic.LastWriteTime.u.HighPart; + ClassLength = min (*lpcbClass -1, REG_MAX_NAME_SIZE) * sizeof(WCHAR); } - else + else { - lpftLastWriteTime->dwLowDateTime = KeyInfo->Node.LastWriteTime.u.LowPart; - lpftLastWriteTime->dwHighDateTime = KeyInfo->Node.LastWriteTime.u.HighPart; + ClassLength = 0; } - } + + /* The class name should start at a dword boundary */ + BufferSize = ((sizeof(KEY_NODE_INFORMATION) + NameLength + 3) & ~3) + ClassLength; + } + else + { + BufferSize = sizeof(KEY_BASIC_INFORMATION) + NameLength; } - } - DPRINT("Key Namea0 Length %d\n", StringU.Length); - DPRINT("Key Namea1 Length %d\n", NameLength); - DPRINT("Key Namea Length %d\n", *lpcbName); - DPRINT("Key Namea %s\n", lpName); + KeyInfo = RtlAllocateHeap (ProcessHeap, 0, BufferSize); + if (KeyInfo == NULL) + { + SetLastError (ERROR_OUTOFMEMORY); + return ERROR_OUTOFMEMORY; + } - RtlFreeHeap (ProcessHeap, - 0, - KeyInfo); + Status = NtEnumerateKey (KeyHandle, + (ULONG)dwIndex, + lpClass == NULL ? KeyBasicInformation : KeyNodeInformation, + KeyInfo, + BufferSize, + &ResultSize); + DPRINT("NtEnumerateKey() returned status 0x%X\n", Status); + if (!NT_SUCCESS(Status)) + { + ErrorCode = RtlNtStatusToDosError (Status); + } + else + { + if (lpClass == NULL) + { + if (KeyInfo->Basic.NameLength > NameLength) + { + ErrorCode = ERROR_BUFFER_OVERFLOW; + } + else + { + StringU.Buffer = KeyInfo->Basic.Name; + StringU.Length = KeyInfo->Basic.NameLength; + StringU.MaximumLength = KeyInfo->Basic.NameLength; + } + } + else + { + if (KeyInfo->Node.NameLength > NameLength || + KeyInfo->Node.ClassLength > ClassLength) + { + ErrorCode = ERROR_BUFFER_OVERFLOW; + } + else + { + StringA.Buffer = lpClass; + StringA.Length = 0; + StringA.MaximumLength = *lpcbClass; + StringU.Buffer = (PWCHAR)((ULONG_PTR)KeyInfo->Node.Name + KeyInfo->Node.ClassOffset); + StringU.Length = KeyInfo->Node.ClassLength; + StringU.MaximumLength = KeyInfo->Node.ClassLength; + RtlUnicodeStringToAnsiString (&StringA, &StringU, FALSE); + lpClass[StringA.Length] = 0; + *lpcbClass = StringA.Length; + StringU.Buffer = KeyInfo->Node.Name; + StringU.Length = KeyInfo->Node.NameLength; + StringU.MaximumLength = KeyInfo->Node.NameLength; + } + } - if (ErrorCode != ERROR_SUCCESS) - { - SetLastError(ErrorCode); - } + if (ErrorCode == ERROR_SUCCESS) + { + StringA.Buffer = lpName; + StringA.Length = 0; + StringA.MaximumLength = *lpcbName; + RtlUnicodeStringToAnsiString (&StringA, &StringU, FALSE); + lpName[StringA.Length] = 0; + *lpcbName = StringA.Length; + if (lpftLastWriteTime != NULL) + { + if (lpClass == NULL) + { + lpftLastWriteTime->dwLowDateTime = KeyInfo->Basic.LastWriteTime.u.LowPart; + lpftLastWriteTime->dwHighDateTime = KeyInfo->Basic.LastWriteTime.u.HighPart; + } + else + { + lpftLastWriteTime->dwLowDateTime = KeyInfo->Node.LastWriteTime.u.LowPart; + lpftLastWriteTime->dwHighDateTime = KeyInfo->Node.LastWriteTime.u.HighPart; + } + } + } + } - return ErrorCode; + DPRINT("Key Namea0 Length %d\n", StringU.Length); + DPRINT("Key Namea1 Length %d\n", NameLength); + DPRINT("Key Namea Length %d\n", *lpcbName); + DPRINT("Key Namea %s\n", lpName); + + RtlFreeHeap (ProcessHeap, + 0, + KeyInfo); + + if (ErrorCode != ERROR_SUCCESS) + { + SetLastError(ErrorCode); + } + + return ErrorCode; } @@ -1164,313 +1170,226 @@ RegEnumKeyExW (HKEY hKey, return ErrorCode; } - /************************************************************************ * RegEnumValueA * * @implemented */ LONG STDCALL -RegEnumValueA (HKEY hKey, - DWORD dwIndex, - LPSTR lpValueName, - LPDWORD lpcbValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData) +RegEnumValueA( HKEY hKey, DWORD index, LPSTR value, LPDWORD val_count, + LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count ) { - union - { - KEY_VALUE_FULL_INFORMATION Full; - KEY_VALUE_BASIC_INFORMATION Basic; - } *ValueInfo; + HANDLE KeyHandle; + NTSTATUS status; + DWORD total_size; + char buffer[256], *buf_ptr = buffer; + KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer; + static const int info_size = offsetof( KEY_VALUE_FULL_INFORMATION, Name ); - ULONG NameLength; - ULONG BufferSize; - ULONG DataLength = 0; - ULONG ResultSize; - HANDLE KeyHandle; - LONG ErrorCode; - NTSTATUS Status; - UNICODE_STRING StringU; - ANSI_STRING StringA; - BOOL IsStringType; + //TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n", + // hkey, index, value, val_count, reserved, type, data, count ); - ErrorCode = ERROR_SUCCESS; - - Status = MapDefaultKey (&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } - - if (*lpcbValueName > 0) - { - NameLength = min (*lpcbValueName - 1, REG_MAX_NAME_SIZE) * sizeof(WCHAR); - } - else - { - NameLength = 0; - } - - if (lpData) - { - DataLength = min (*lpcbData * sizeof(WCHAR), REG_MAX_DATA_SIZE); - BufferSize = ((sizeof(KEY_VALUE_FULL_INFORMATION) + NameLength + 3) & ~3) + DataLength; - } - else - { - BufferSize = sizeof(KEY_VALUE_BASIC_INFORMATION) + NameLength; - } - - ValueInfo = RtlAllocateHeap (ProcessHeap, - 0, - BufferSize); - if (ValueInfo == NULL) - { - SetLastError(ERROR_OUTOFMEMORY); - return ERROR_OUTOFMEMORY; - } - - Status = NtEnumerateValueKey (KeyHandle, - (ULONG)dwIndex, - lpData ? KeyValueFullInformation : KeyValueBasicInformation, - ValueInfo, - BufferSize, - &ResultSize); - - DPRINT("NtEnumerateValueKey() returned status 0x%X\n", Status); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - } - else - { - if (lpData) - { - IsStringType = (ValueInfo->Full.Type == REG_SZ) || - (ValueInfo->Full.Type == REG_MULTI_SZ) || - (ValueInfo->Full.Type == REG_EXPAND_SZ); - if (ValueInfo->Full.NameLength > NameLength || - (!IsStringType && ValueInfo->Full.DataLength > *lpcbData) || - ValueInfo->Full.DataLength > DataLength) - { - ErrorCode = ERROR_BUFFER_OVERFLOW; - } - else - { - if (IsStringType) - { - StringU.Buffer = (PWCHAR)((ULONG_PTR)ValueInfo + ValueInfo->Full.DataOffset); - StringU.Length = ValueInfo->Full.DataLength; - StringU.MaximumLength = DataLength; - StringA.Buffer = (PCHAR)lpData; - StringA.Length = 0; - StringA.MaximumLength = *lpcbData; - RtlUnicodeStringToAnsiString (&StringA, - &StringU, - FALSE); - *lpcbData = StringA.Length; - } - else - { - RtlCopyMemory (lpData, - (PVOID)((ULONG_PTR)ValueInfo + ValueInfo->Full.DataOffset), - ValueInfo->Full.DataLength); - *lpcbData = ValueInfo->Full.DataLength; - } - - StringU.Buffer = ValueInfo->Full.Name; - StringU.Length = ValueInfo->Full.NameLength; - StringU.MaximumLength = NameLength; - } - } - else + /* NT only checks count, not val_count */ + if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER; + status = MapDefaultKey (&KeyHandle, hKey); + if (!NT_SUCCESS(status)) { - if (ValueInfo->Basic.NameLength > NameLength) - { - ErrorCode = ERROR_BUFFER_OVERFLOW; - } - else - { - StringU.Buffer = ValueInfo->Basic.Name; - StringU.Length = ValueInfo->Basic.NameLength; - StringU.MaximumLength = NameLength; - } + LONG ErrorCode; + ErrorCode = RtlNtStatusToDosError (status); + SetLastError (ErrorCode); + return ErrorCode; } - if (ErrorCode == ERROR_SUCCESS) - { - StringA.Buffer = (PCHAR)lpValueName; - StringA.Length = 0; - StringA.MaximumLength = *lpcbValueName; - RtlUnicodeStringToAnsiString (&StringA, - &StringU, - FALSE); - StringA.Buffer[StringA.Length] = 0; - *lpcbValueName = StringA.Length; - if (lpType) - { - *lpType = lpData ? ValueInfo->Full.Type : ValueInfo->Basic.Type; - } - } - } + total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR); + if (data) total_size += *count; + total_size = min( sizeof(buffer), total_size ); - RtlFreeHeap (ProcessHeap, - 0, - ValueInfo); - if (ErrorCode != ERROR_SUCCESS) + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buffer, total_size, &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done; + + /* we need to fetch the contents for a string type even if not requested, + * because we need to compute the length of the ASCII string. */ + if (value || data || is_string(info->Type)) { - SetLastError(ErrorCode); - } + /* retry with a dynamically allocated buffer */ + while (status == STATUS_BUFFER_OVERFLOW) + { + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size ))) + return ERROR_NOT_ENOUGH_MEMORY; + info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buf_ptr, total_size, &total_size ); + } - return ErrorCode; + if (status) goto done; + + if (is_string(info->Type)) + { + DWORD len; + RtlUnicodeToMultiByteSize( &len, (WCHAR *)(buf_ptr + info->DataOffset), + total_size - info->DataOffset ); + if (data && len) + { + if (len > *count) status = STATUS_BUFFER_OVERFLOW; + else + { + RtlUnicodeToMultiByteN( data, len, NULL, (WCHAR *)(buf_ptr + info->DataOffset), + total_size - info->DataOffset ); + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + if (len < *count && data[len-1]) data[len] = 0; + } + } + info->DataLength = len; + } + else if (data) + { + if (total_size - info->DataOffset > *count) status = STATUS_BUFFER_OVERFLOW; + else memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); + } + + if (value && !status) + { + DWORD len; + + RtlUnicodeToMultiByteSize( &len, info->Name, info->NameLength ); + if (len >= *val_count) + { + status = STATUS_BUFFER_OVERFLOW; + if (*val_count) + { + len = *val_count - 1; + RtlUnicodeToMultiByteN( value, len, NULL, info->Name, info->NameLength ); + value[len] = 0; + } + } + else + { + RtlUnicodeToMultiByteN( value, len, NULL, info->Name, info->NameLength ); + value[len] = 0; + *val_count = len; + } + } + } + else status = STATUS_SUCCESS; + + if (type) *type = info->Type; + if (count) *count = info->DataLength; + + done: + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + return RtlNtStatusToDosError(status); } - -/************************************************************************ - * RegEnumValueW - * +/****************************************************************************** + * RegEnumValueW [ADVAPI32.@] * @implemented + * + * PARAMS + * hkey [I] Handle to key to query + * index [I] Index of value to query + * value [O] Value string + * val_count [I/O] Size of value buffer (in wchars) + * reserved [I] Reserved + * type [O] Type code + * data [O] Value data + * count [I/O] Size of data buffer (in bytes) + * + * RETURNS + * Success: ERROR_SUCCESS + * Failure: nonzero error code from Winerror.h */ LONG STDCALL -RegEnumValueW (HKEY hKey, - DWORD dwIndex, - LPWSTR lpValueName, - LPDWORD lpcbValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData) +RegEnumValueW( HKEY hKey, DWORD index, LPWSTR value, PDWORD val_count, + PDWORD reserved, PDWORD type, LPBYTE data, PDWORD count ) { - union - { - KEY_VALUE_FULL_INFORMATION Full; - KEY_VALUE_BASIC_INFORMATION Basic; - } *ValueInfo; + HANDLE KeyHandle; + NTSTATUS status; + DWORD total_size; + char buffer[256], *buf_ptr = buffer; + KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer; + static const int info_size = offsetof( KEY_VALUE_FULL_INFORMATION, Name ); - ULONG NameLength; - ULONG BufferSize; - ULONG DataLength = 0; - ULONG ResultSize; - HANDLE KeyHandle; - LONG ErrorCode; - NTSTATUS Status; + //TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n", + // hkey, index, value, val_count, reserved, type, data, count ); - ErrorCode = ERROR_SUCCESS; - - Status = MapDefaultKey (&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } - - if (*lpcbValueName > 0) - { - NameLength = min (*lpcbValueName - 1, REG_MAX_NAME_SIZE) * sizeof(WCHAR); - } - else - { - NameLength = 0; - } - - if (lpData) - { - DataLength = min(*lpcbData, REG_MAX_DATA_SIZE); - BufferSize = ((sizeof(KEY_VALUE_FULL_INFORMATION) + NameLength + 3) & ~3) + DataLength; - } - else - { - BufferSize = sizeof(KEY_VALUE_BASIC_INFORMATION) + NameLength; - } - ValueInfo = RtlAllocateHeap (ProcessHeap, - 0, - BufferSize); - if (ValueInfo == NULL) - { - SetLastError (ERROR_OUTOFMEMORY); - return ERROR_OUTOFMEMORY; - } - Status = NtEnumerateValueKey (KeyHandle, - (ULONG)dwIndex, - lpData ? KeyValueFullInformation : KeyValueBasicInformation, - ValueInfo, - BufferSize, - &ResultSize); - - DPRINT("NtEnumerateValueKey() returned status 0x%X\n", Status); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - } - else - { - if (lpData) + /* NT only checks count, not val_count */ + if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER; + + status = MapDefaultKey (&KeyHandle, hKey); + if (!NT_SUCCESS(status)) { - if (ValueInfo->Full.DataLength > DataLength || - ValueInfo->Full.NameLength > NameLength) - { - ErrorCode = ERROR_BUFFER_OVERFLOW; - } - else - { - RtlCopyMemory (lpValueName, - ValueInfo->Full.Name, - ValueInfo->Full.NameLength); - *lpcbValueName = (DWORD)(ValueInfo->Full.NameLength / sizeof(WCHAR)); - lpValueName[*lpcbValueName] = 0; - RtlCopyMemory (lpData, - (PVOID)((ULONG_PTR)ValueInfo + ValueInfo->Full.DataOffset), - ValueInfo->Full.DataLength); - *lpcbData = (DWORD)ValueInfo->Full.DataLength; - } - } - else - { - if (ValueInfo->Basic.NameLength > NameLength) - { - ErrorCode = ERROR_BUFFER_OVERFLOW; - } - else - { - RtlCopyMemory (lpValueName, - ValueInfo->Basic.Name, - ValueInfo->Basic.NameLength); - *lpcbValueName = (DWORD)(ValueInfo->Basic.NameLength / sizeof(WCHAR)); - lpValueName[*lpcbValueName] = 0; - } - if (NULL != lpcbData) - { - *lpcbData = (DWORD)ValueInfo->Full.DataLength; - } + LONG ErrorCode; + ErrorCode = RtlNtStatusToDosError (status); + SetLastError (ErrorCode); + return ErrorCode; } - if (ErrorCode == ERROR_SUCCESS && lpType != NULL) - { - *lpType = lpData ? ValueInfo->Full.Type : ValueInfo->Basic.Type; - } - } + total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR); + if (data) total_size += *count; + total_size = min( sizeof(buffer), total_size ); - RtlFreeHeap (ProcessHeap, - 0, - ValueInfo); + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buffer, total_size, &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done; - if (ErrorCode != ERROR_SUCCESS) + if (value || data) { - SetLastError (ErrorCode); - } + /* retry with a dynamically allocated buffer */ + while (status == STATUS_BUFFER_OVERFLOW) + { + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size ))) + return ERROR_NOT_ENOUGH_MEMORY; + info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buf_ptr, total_size, &total_size ); + } - return ErrorCode; + if (status) goto done; + + if (value) + { + if (info->NameLength/sizeof(WCHAR) >= *val_count) + { + status = STATUS_BUFFER_OVERFLOW; + goto overflow; + } + memcpy( value, info->Name, info->NameLength ); + *val_count = info->NameLength / sizeof(WCHAR); + value[*val_count] = 0; + } + + if (data) + { + if (total_size - info->DataOffset > *count) + { + status = STATUS_BUFFER_OVERFLOW; + goto overflow; + } + memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); + if (total_size - info->DataOffset <= *count-sizeof(WCHAR) && is_string(info->Type)) + { + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + WCHAR *ptr = (WCHAR *)(data + total_size - info->DataOffset); + if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0; + } + } + } + else status = STATUS_SUCCESS; + + overflow: + if (type) *type = info->Type; + if (count) *count = info->DataLength; + + done: + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + return RtlNtStatusToDosError(status); } - /************************************************************************ * RegFlushKey * @@ -1717,6 +1636,8 @@ RegNotifyChangeKeyValue (HKEY hKey, /************************************************************************ * RegOpenKeyA * + * 20050503 Fireball - imported from WINE + * * @implemented */ LONG STDCALL @@ -1724,41 +1645,15 @@ RegOpenKeyA (HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult) { - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING SubKeyString; - HANDLE KeyHandle; - LONG ErrorCode; - NTSTATUS Status; + DPRINT("RegOpenKeyA hKey 0x%x lpSubKey %s phkResult %p\n", hKey, lpSubKey, phkResult); - DPRINT("RegOpenKeyA hKey 0x%x lpSubKey %s phkResult %p\n", hKey, lpSubKey, phkResult); - Status = MapDefaultKey (&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } + if (!lpSubKey || !*lpSubKey) + { + *phkResult = hKey; + return ERROR_SUCCESS; + } - RtlCreateUnicodeStringFromAsciiz (&SubKeyString, - (LPSTR)lpSubKey); - InitializeObjectAttributes (&ObjectAttributes, - &SubKeyString, - OBJ_CASE_INSENSITIVE, - KeyHandle, - NULL); - Status = NtOpenKey ((PHANDLE)phkResult, - MAXIMUM_ALLOWED, - &ObjectAttributes); - RtlFreeUnicodeString (&SubKeyString); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } - - return ERROR_SUCCESS; + return RegOpenKeyExA( hKey, lpSubKey, 0, KEY_ALL_ACCESS, phkResult); } @@ -1767,6 +1662,7 @@ RegOpenKeyA (HKEY hKey, * * 19981101 Ariadne * 19990525 EA + * 20050503 Fireball - imported from WINE * * @implemented */ @@ -1775,40 +1671,14 @@ RegOpenKeyW (HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult) { - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING SubKeyString; - HANDLE KeyHandle; - LONG ErrorCode; - NTSTATUS Status; + DPRINT("RegOpenKeyW hKey 0x%x lpSubKey %S phkResult %p\n", hKey, lpSubKey, phkResult); - DPRINT("RegOpenKeyW hKey 0x%x lpSubKey %S phkResult %p\n", hKey, lpSubKey, phkResult); - Status = MapDefaultKey (&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } - - RtlInitUnicodeString (&SubKeyString, - (LPWSTR)lpSubKey); - InitializeObjectAttributes (&ObjectAttributes, - &SubKeyString, - OBJ_CASE_INSENSITIVE, - KeyHandle, - NULL); - Status = NtOpenKey ((PHANDLE)phkResult, - MAXIMUM_ALLOWED, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError(ErrorCode); - return ErrorCode; - } - - return ERROR_SUCCESS; + if (!lpSubKey || !*lpSubKey) + { + *phkResult = hKey; + return ERROR_SUCCESS; + } + return RegOpenKeyExW(hKey, lpSubKey, 0, KEY_ALL_ACCESS, phkResult); } @@ -1824,42 +1694,40 @@ RegOpenKeyExA (HKEY hKey, REGSAM samDesired, PHKEY phkResult) { - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING SubKeyString; - HANDLE KeyHandle; - LONG ErrorCode; - NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING SubKeyString; + HANDLE KeyHandle; + LONG ErrorCode; + NTSTATUS Status; - DPRINT("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", - hKey, lpSubKey, ulOptions, samDesired, phkResult); - Status = MapDefaultKey (&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } + DPRINT("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", + hKey, lpSubKey, ulOptions, samDesired, phkResult); - RtlCreateUnicodeStringFromAsciiz (&SubKeyString, - (LPSTR)lpSubKey); - InitializeObjectAttributes (&ObjectAttributes, - &SubKeyString, - OBJ_CASE_INSENSITIVE, - KeyHandle, - NULL); - Status = NtOpenKey ((PHANDLE)phkResult, - samDesired, - &ObjectAttributes); - RtlFreeUnicodeString (&SubKeyString); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } + Status = MapDefaultKey (&KeyHandle, hKey); + if (!NT_SUCCESS(Status)) + { + ErrorCode = RtlNtStatusToDosError (Status); + SetLastError (ErrorCode); + return ErrorCode; + } - return ERROR_SUCCESS; + RtlCreateUnicodeStringFromAsciiz (&SubKeyString, (LPSTR)lpSubKey); + InitializeObjectAttributes (&ObjectAttributes, + &SubKeyString, + OBJ_CASE_INSENSITIVE, + KeyHandle, + NULL); + + Status = NtOpenKey ((PHANDLE)phkResult, samDesired, &ObjectAttributes); + RtlFreeUnicodeString (&SubKeyString); + if (!NT_SUCCESS(Status)) + { + ErrorCode = RtlNtStatusToDosError (Status); + SetLastError (ErrorCode); + return ErrorCode; + } + + return ERROR_SUCCESS; } @@ -1875,49 +1743,44 @@ RegOpenKeyExW (HKEY hKey, REGSAM samDesired, PHKEY phkResult) { - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING SubKeyString; - HANDLE KeyHandle; - LONG ErrorCode; - NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING SubKeyString; + HANDLE KeyHandle; + LONG ErrorCode; + NTSTATUS Status; - DPRINT("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n", - hKey, lpSubKey, ulOptions, samDesired, phkResult); - Status = MapDefaultKey (&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } + DPRINT("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n", + hKey, lpSubKey, ulOptions, samDesired, phkResult); + + Status = MapDefaultKey (&KeyHandle, hKey); + if (!NT_SUCCESS(Status)) + { + ErrorCode = RtlNtStatusToDosError (Status); + SetLastError (ErrorCode); + return ErrorCode; + } - if (lpSubKey != NULL) - { - RtlInitUnicodeString (&SubKeyString, - (LPWSTR)lpSubKey); - } - else - { - RtlInitUnicodeString (&SubKeyString, - (LPWSTR)L""); - } - InitializeObjectAttributes (&ObjectAttributes, - &SubKeyString, - OBJ_CASE_INSENSITIVE, - KeyHandle, - NULL); - Status = NtOpenKey ((PHANDLE)phkResult, - samDesired, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; - } + if (lpSubKey != NULL) + RtlInitUnicodeString (&SubKeyString, (LPWSTR)lpSubKey); + else + RtlInitUnicodeString (&SubKeyString, (LPWSTR)L""); - return ERROR_SUCCESS; + InitializeObjectAttributes (&ObjectAttributes, + &SubKeyString, + OBJ_CASE_INSENSITIVE, + KeyHandle, + NULL); + + Status = NtOpenKey ((PHANDLE)phkResult, samDesired, &ObjectAttributes); + + if (!NT_SUCCESS(Status)) + { + ErrorCode = RtlNtStatusToDosError (Status); + SetLastError (ErrorCode); + return ErrorCode; + } + + return ERROR_SUCCESS; } diff --git a/reactos/lib/advapi32/sec/misc.c b/reactos/lib/advapi32/sec/misc.c index a3501bc8927..0b8a8198f71 100644 --- a/reactos/lib/advapi32/sec/misc.c +++ b/reactos/lib/advapi32/sec/misc.c @@ -335,18 +335,6 @@ SetKernelObjectSecurity(HANDLE Handle, } -/* - * @implemented - */ -VOID STDCALL -MapGenericMask(PDWORD AccessMask, - PGENERIC_MAPPING GenericMapping) -{ - RtlMapGenericMask(AccessMask, - GenericMapping); -} - - /* * @implemented */ diff --git a/reactos/lib/advapi32/service/scm.c b/reactos/lib/advapi32/service/scm.c index 20faa01407a..9d1e6ef9501 100644 --- a/reactos/lib/advapi32/service/scm.c +++ b/reactos/lib/advapi32/service/scm.c @@ -1,10 +1,10 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/advapi32/service/scm.c * PURPOSE: Service control manager functions * PROGRAMMER: Emanuele Aliberti + * Eric Kohl * UPDATE HISTORY: * 19990413 EA created * 19990515 EA @@ -13,11 +13,70 @@ /* INCLUDES ******************************************************************/ #include "advapi32.h" +#include "svcctl_c.h" + #define NDEBUG #include /* FUNCTIONS *****************************************************************/ +handle_t BindingHandle = NULL; + +static VOID +HandleBind(VOID) +{ + LPWSTR pszStringBinding; + RPC_STATUS status; + + if (BindingHandle != NULL) + return; + + status = RpcStringBindingComposeW(NULL, + L"ncacn_np", + NULL, + L"\\pipe\\ntsvcs", + NULL, + &pszStringBinding); + if (status) + { + DPRINT1("RpcStringBindingCompose returned 0x%x\n", status); + return; + } + + /* Set the binding handle that will be used to bind to the server. */ + status = RpcBindingFromStringBindingW(pszStringBinding, + &BindingHandle); + if (status) + { + DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", status); + } + + status = RpcStringFreeW(&pszStringBinding); + if (status) + { + DPRINT1("RpcStringFree returned 0x%x\n", status); + } +} + + +#if 0 +static VOID +HandleUnbind(VOID) +{ + RPC_STATUS status; + + if (BindingHandle == NULL) + return; + + status = RpcBindingFree(&BindingHandle); + if (status) + { + DPRINT1("RpcBindingFree returned 0x%x\n", status); + } +} +#endif + + /********************************************************************** * ChangeServiceConfigA * @@ -75,17 +134,28 @@ ChangeServiceConfigW( * * @implemented */ -BOOL -STDCALL +BOOL STDCALL CloseServiceHandle(SC_HANDLE hSCObject) { - DPRINT("CloseServiceHandle() - called.\n"); + DWORD dwError; - if (!CloseHandle(hSCObject)) { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - return TRUE; + DPRINT("CloseServiceHandle() called\n"); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrCloseServiceHandle(BindingHandle, + (unsigned int)hSCObject); + if (dwError) + { + DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError); + SetLastError(dwError); + return FALSE; + } + + DPRINT("CloseServiceHandle() done\n"); + + return TRUE; } @@ -94,15 +164,33 @@ CloseServiceHandle(SC_HANDLE hSCObject) * * @unimplemented */ -BOOL -STDCALL +BOOL STDCALL ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus) { - DPRINT1("ControlService is unimplemented\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + DWORD dwError; + + DPRINT("ControlService(%x, %x, %p)\n", + hService, dwControl, lpServiceStatus); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrControlService(BindingHandle, + (unsigned int)hService, + dwControl, + lpServiceStatus); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError); + SetLastError(dwError); return FALSE; + } + + DPRINT("ControlService() done\n"); + + return TRUE; } @@ -163,15 +251,28 @@ CreateServiceW( /********************************************************************** * DeleteService * - * @unimplemented + * @implemented */ -BOOL -STDCALL +BOOL STDCALL DeleteService(SC_HANDLE hService) { - DPRINT1("DeleteService is unimplemented\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + DWORD dwError; + + DPRINT("DeleteService(%x)\n", hService); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrDeleteService(BindingHandle, + (unsigned int)hService); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError); + SetLastError(dwError); return FALSE; + } + + return TRUE; } @@ -410,268 +511,228 @@ GetServiceKeyNameW( return FALSE; } + /********************************************************************** * LockServiceDatabase * - * @unimplemented + * @implemented */ -SC_LOCK -STDCALL -LockServiceDatabase(SC_HANDLE hSCManager) +SC_LOCK STDCALL +LockServiceDatabase(SC_HANDLE hSCManager) { - DPRINT1("LockServiceDatabase is unimplemented\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + SC_LOCK hLock; + DWORD dwError; + + DPRINT("LockServiceDatabase(%x)\n", hSCManager); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrLockServiceDatabase(BindingHandle, + (unsigned int)hSCManager, + (unsigned int *)&hLock); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError); + SetLastError(dwError); return NULL; + } + + DPRINT("hLock = %p\n", hLock); + + return hLock; +} + + +static VOID +WaitForSCManager(VOID) +{ + HANDLE hEvent; + + DPRINT("WaitForSCManager() called\n"); + + /* Try to open the existing event */ + hEvent = OpenEventW(SYNCHRONIZE, + FALSE, + L"SvcctrlStartEvent_A3725DX"); + if (hEvent == NULL) + { + if (GetLastError() != ERROR_FILE_NOT_FOUND) + return; + + /* Try to create a new event */ + hEvent = CreateEventW(NULL, + TRUE, + FALSE, + L"SvcctrlStartEvent_A3725DX"); + if (hEvent == NULL) + { + /* Try to open the existing event again */ + hEvent = OpenEventW(SYNCHRONIZE, + FALSE, + L"SvcctrlStartEvent_A3725DX"); + if (hEvent == NULL) + return; + } + } + + /* Wait for 3 minutes */ + WaitForSingleObject(hEvent, 180000); + CloseHandle(hEvent); + + DPRINT("ScmWaitForSCManager() done\n"); } /********************************************************************** * OpenSCManagerA * - * @unplemented + * @implemented */ SC_HANDLE STDCALL OpenSCManagerA(LPCSTR lpMachineName, - LPCSTR lpDatabaseName, - DWORD dwDesiredAccess) + LPCSTR lpDatabaseName, + DWORD dwDesiredAccess) { - SC_HANDLE Handle; - UNICODE_STRING MachineNameW; - UNICODE_STRING DatabaseNameW; - ANSI_STRING MachineNameA; - ANSI_STRING DatabaseNameA; + SC_HANDLE hScm = NULL; + DWORD dwError; - DPRINT("OpenSCManagerA(%x, %x, %d)\n", lpMachineName, lpDatabaseName, dwDesiredAccess); + DPRINT("OpenSCManagerA(%s, %s, %lx)\n", + lpMachineName, lpDatabaseName, dwDesiredAccess); - RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName); - RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE); - RtlInitAnsiString(&DatabaseNameA, (LPSTR)lpDatabaseName); - RtlAnsiStringToUnicodeString(&DatabaseNameW, &DatabaseNameA, TRUE); + WaitForSCManager(); - Handle = OpenSCManagerW(lpMachineName ? MachineNameW.Buffer : NULL, - lpDatabaseName ? DatabaseNameW.Buffer : NULL, - dwDesiredAccess); + HandleBind(); - RtlFreeHeap(GetProcessHeap(), 0, MachineNameW.Buffer); - RtlFreeHeap(GetProcessHeap(), 0, DatabaseNameW.Buffer); - return Handle; + /* Call to services.exe using RPC */ + dwError = ScmrOpenSCManagerA(BindingHandle, + (LPSTR)lpMachineName, + (LPSTR)lpDatabaseName, + dwDesiredAccess, + (unsigned int*)&hScm); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError); + SetLastError(dwError); + return NULL; + } + + DPRINT("hScm = %p\n", hScm); + + return hScm; } /********************************************************************** * OpenSCManagerW * - * @unimplemented + * @implemented */ -SC_HANDLE STDCALL OpenSCManagerW(LPCWSTR lpMachineName, - LPCWSTR lpDatabaseName, - DWORD dwDesiredAccess) +SC_HANDLE STDCALL +OpenSCManagerW(LPCWSTR lpMachineName, + LPCWSTR lpDatabaseName, + DWORD dwDesiredAccess) { - HANDLE hPipe; - DWORD dwMode; - DWORD dwWait; - BOOL fSuccess; - HANDLE hStartEvent; - LPWSTR lpszPipeName = L"\\\\.\\pipe\\Ntsvcs"; + SC_HANDLE hScm = NULL; + DWORD dwError; - DPRINT("OpenSCManagerW(%x, %x, %d)\n", lpMachineName, lpDatabaseName, dwDesiredAccess); + DPRINT("OpenSCManagerW(%S, %S, %lx)\n", + lpMachineName, lpDatabaseName, dwDesiredAccess); - if (lpMachineName == NULL || wcslen(lpMachineName) == 0) - { - if (lpDatabaseName != NULL && wcscmp(lpDatabaseName, SERVICES_ACTIVE_DATABASEW) != 0) - { - DPRINT("OpenSCManagerW() - Invalid parameters.\n"); - return NULL; - } + WaitForSCManager(); - DPRINT("OpenSCManagerW() - OpenEvent(\"SvcctrlStartEvent_A3725DX\")\n"); + HandleBind(); - // Only connect to scm when event "SvcctrlStartEvent_A3725DX" is signaled - hStartEvent = OpenEventW(SYNCHRONIZE, FALSE, L"SvcctrlStartEvent_A3725DX"); - if (hStartEvent == NULL) - { - SetLastError(ERROR_DATABASE_DOES_NOT_EXIST); - DPRINT("OpenSCManagerW() - Failed to Open Event \"SvcctrlStartEvent_A3725DX\".\n"); - return NULL; - } + /* Call to services.exe using RPC */ + dwError = ScmrOpenSCManagerW(BindingHandle, + (LPWSTR)lpMachineName, + (LPWSTR)lpDatabaseName, + dwDesiredAccess, + (unsigned int*)&hScm); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrOpenSCManagerW() failed (Error %lu)\n", dwError); + SetLastError(dwError); + return NULL; + } - DPRINT("OpenSCManagerW() - Waiting forever on event handle: %x\n", hStartEvent); + DPRINT("hScm = %p\n", hScm); -#if 1 - dwWait = WaitForSingleObject(hStartEvent, INFINITE); - if (dwWait == WAIT_FAILED) - { - DPRINT("OpenSCManagerW() - Wait For Start Event failed.\n"); - SetLastError(ERROR_ACCESS_DENIED); - return NULL; - } -#else - { - DWORD Count; - - /* wait for event creation (by SCM) for max. 20 seconds */ - for (Count = 0; Count < 20; Count++) - { - dwWait = WaitForSingleObject(hStartEvent, 1000); - if (dwWait == WAIT_FAILED) - { - DPRINT("OpenSCManagerW() - Wait For Start Event failed.\n"); - Sleep(1000); - } - else - { - break; - } - } - - if (dwWait == WAIT_FAILED) - { - DbgPrint("WL: Failed to wait on event \"SvcctrlStartEvent_A3725DX\"\n"); - } - - } -#endif - - DPRINT("OpenSCManagerW() - Closing handle to event...\n"); - - CloseHandle(hStartEvent); - - // Try to open a named pipe; wait for it, if necessary - while (1) - { - DWORD dwLastError; - DPRINT("OpenSCManagerW() - attempting to open named pipe to SCM.\n"); - hPipe = CreateFileW(lpszPipeName, // pipe name - dwDesiredAccess, - 0, // no sharing - NULL, // no security attributes - OPEN_EXISTING, // opens existing pipe - 0, // default attributes - NULL); // no template file - - DPRINT("OpenSCManagerW() - handle to named pipe: %x\n", hPipe); - // Break if the pipe handle is valid - if (hPipe != INVALID_HANDLE_VALUE) - { - break; - } - - // Exit if an error other than ERROR_PIPE_BUSY occurs - dwLastError = GetLastError(); - if (dwLastError != ERROR_PIPE_BUSY) - { - DPRINT("OpenSCManagerW() - returning at 4, dwLastError %d\n", dwLastError); - return NULL; - } - - // All pipe instances are busy, so wait for 20 seconds - if (!WaitNamedPipeW(lpszPipeName, 20000)) - { - DPRINT("OpenSCManagerW() - Failed on WaitNamedPipeW(...).\n"); - return NULL; - } - } - - // The pipe connected; change to message-read mode - dwMode = PIPE_READMODE_MESSAGE; - fSuccess = SetNamedPipeHandleState( - hPipe, // pipe handle - &dwMode, // new pipe mode - NULL, // don't set maximum bytes - NULL); // don't set maximum time - if (!fSuccess) - { - CloseHandle(hPipe); - DPRINT("OpenSCManagerW() - Failed on SetNamedPipeHandleState(...).\n"); - return NULL; - } -#if 0 - // Send a message to the pipe server - lpvMessage = (argc > 1) ? argv[1] : "default message"; - - fSuccess = WriteFile( - hPipe, // pipe handle - lpvMessage, // message - strlen(lpvMessage) + 1, // message length - &cbWritten, // bytes written - NULL); // not overlapped - if (!fSuccess) - { - CloseHandle(hPipe); - DPRINT("OpenSCManagerW() - Failed to write to pipe.\n"); - return NULL; - } - - do - { - DPRINT("OpenSCManagerW() - in I/O loop to SCM...\n"); - // Read from the pipe - fSuccess = ReadFile( - hPipe, // pipe handle - chBuf, // buffer to receive reply - 512, // size of buffer - &cbRead, // number of bytes read - NULL); // not overlapped - - if (!fSuccess && GetLastError() != ERROR_MORE_DATA) - { - break; - } - - // Reply from the pipe is written to STDOUT. - if (!WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), chBuf, cbRead, &cbWritten, NULL)) - { - break; - } - } while(!fSuccess); // repeat loop if ERROR_MORE_DATA - - DPRINT("OpenSCManagerW() - I/O loop completed.\n"); - //CloseHandle(hPipe); -#endif - DPRINT("OpenSCManagerW() - success, returning handle to pipe %x\n", hPipe); - return hPipe; - } - else - { - /* FIXME: Connect to remote SCM */ - DPRINT("OpenSCManagerW() - FIXME: Connect to remote SCM is unimplemented.\n"); - return NULL; - } + return hScm; } /********************************************************************** * OpenServiceA * - * @unimplemented + * @implemented */ SC_HANDLE STDCALL OpenServiceA(SC_HANDLE hSCManager, - LPCSTR lpServiceName, - DWORD dwDesiredAccess) + LPCSTR lpServiceName, + DWORD dwDesiredAccess) { - DPRINT1("OpenServiceA is unimplemented, returning ERROR_SERVICE_DOES_NOT_EXIST for %s\n", lpServiceName); - SetLastError(ERROR_SERVICE_DOES_NOT_EXIST); - return NULL; + SC_HANDLE hService = NULL; + DWORD dwError; + + DPRINT("OpenServiceA(%p, %s, %lx)\n", + hSCManager, lpServiceName, dwDesiredAccess); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrOpenServiceA(BindingHandle, + (unsigned int)hSCManager, + (LPSTR)lpServiceName, + dwDesiredAccess, + (unsigned int*)&hService); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError); + SetLastError(dwError); + return NULL; + } + + DPRINT("hService = %p\n", hService); + + return hService; } /********************************************************************** * OpenServiceW * - * @unimplemented + * @implemented */ -SC_HANDLE -STDCALL -OpenServiceW( - SC_HANDLE hSCManager, - LPCWSTR lpServiceName, - DWORD dwDesiredAccess - ) +SC_HANDLE STDCALL +OpenServiceW(SC_HANDLE hSCManager, + LPCWSTR lpServiceName, + DWORD dwDesiredAccess) { - DPRINT1("OpenServiceW is unimplemented, returning ERROR_SERVICE_DOES_NOT_EXIST for %S\n", lpServiceName); - SetLastError(ERROR_SERVICE_DOES_NOT_EXIST); - return NULL; + SC_HANDLE hService = NULL; + DWORD dwError; + + DPRINT("OpenServiceW(%p, %S, %lx)\n", + hSCManager, lpServiceName, dwDesiredAccess); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrOpenServiceW(BindingHandle, + (unsigned int)hSCManager, + (LPWSTR)lpServiceName, + dwDesiredAccess, + (unsigned int*)&hService); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError); + SetLastError(dwError); + return NULL; + } + + DPRINT("hService = %p\n", hService); + + return hService; } @@ -774,17 +835,31 @@ QueryServiceObjectSecurity( /********************************************************************** * QueryServiceStatus * - * @unimplemented + * @implemented */ -BOOL -STDCALL -QueryServiceStatus( - SC_HANDLE hService, - LPSERVICE_STATUS lpServiceStatus) +BOOL STDCALL +QueryServiceStatus(SC_HANDLE hService, + LPSERVICE_STATUS lpServiceStatus) { - DPRINT1("QueryServiceStatus is unimplemented\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + DWORD dwError; + + DPRINT("QueryServiceStatus(%p, %p)\n", + hService, lpServiceStatus); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrQueryServiceStatus(BindingHandle, + (unsigned int)hService, + lpServiceStatus); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError); + SetLastError(dwError); return FALSE; + } + + return TRUE; } @@ -825,8 +900,6 @@ StartServiceA( } - - /********************************************************************** * StartServiceW * @@ -848,16 +921,39 @@ StartServiceW( /********************************************************************** * UnlockServiceDatabase * - * @unimplemented + * @implemented */ -BOOL -STDCALL -UnlockServiceDatabase(SC_LOCK ScLock) +BOOL STDCALL +UnlockServiceDatabase(SC_LOCK ScLock) { - DPRINT1("UnlockServiceDatabase is unimplemented\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + DWORD dwError; + + DPRINT("UnlockServiceDatabase(%x)\n", hSCManager); + + HandleBind(); + + /* Call to services.exe using RPC */ + dwError = ScmrUnlockServiceDatabase(BindingHandle, + (unsigned int)ScLock); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError); + SetLastError(dwError); return FALSE; + } + + return TRUE; } +void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +{ + return GlobalAlloc(GPTR,len); +} + +void __RPC_USER midl_user_free(void __RPC_FAR * ptr) +{ + GlobalFree(ptr); +} + /* EOF */ diff --git a/reactos/lib/advapi32/winetests/crypt.c b/reactos/lib/advapi32/winetests/crypt.c index 3e0f4a7d48a..ed68658c259 100644 --- a/reactos/lib/advapi32/winetests/crypt.c +++ b/reactos/lib/advapi32/winetests/crypt.c @@ -1,575 +1,764 @@ -/* - * Unit tests for crypt functions - * - * Copyright (c) 2004 Michael Jung - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "windef.h" -#include "winbase.h" -#include "wincrypt.h" -#include "winerror.h" -#include "winreg.h" - -#include "wine/test.h" - -static const char szRsaBaseProv[] = MS_DEF_PROV_A; -static const char szNonExistentProv[] = "Wine Nonexistent Cryptographic Provider v11.2"; -static const char szKeySet[] = "wine_test_keyset"; -static const char szBadKeySet[] = "wine_test_bad_keyset"; -#define NON_DEF_PROV_TYPE 999 - -static HMODULE hadvapi32; -static BOOL (WINAPI *pCryptAcquireContextA)(HCRYPTPROV*,LPCSTR,LPCSTR,DWORD,DWORD); -static BOOL (WINAPI *pCryptEnumProviderTypesA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*); -static BOOL (WINAPI *pCryptEnumProvidersA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*); -static BOOL (WINAPI *pCryptGetDefaultProviderA)(DWORD, DWORD*, DWORD, LPSTR, DWORD*); -static BOOL (WINAPI *pCryptReleaseContext)(HCRYPTPROV, DWORD); -static BOOL (WINAPI *pCryptSetProviderExA)(LPCSTR, DWORD, DWORD*, DWORD); - -static void init_function_pointers(void) -{ - hadvapi32 = GetModuleHandleA("advapi32.dll"); - - if(hadvapi32) - { - pCryptAcquireContextA = (void*)GetProcAddress(hadvapi32, "CryptAcquireContextA"); - pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA"); - pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA"); - pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA"); - pCryptReleaseContext = (void*)GetProcAddress(hadvapi32, "CryptReleaseContext"); - pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA"); - } -} - - -static void init_environment(void) -{ - HCRYPTPROV hProv; - - /* Ensure that container "wine_test_keyset" does exist */ - if (!pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) - { - pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_NEWKEYSET); - } - pCryptReleaseContext(hProv, 0); - - /* Ensure that container "wine_test_keyset" does exist in default PROV_RSA_FULL type provider */ - if (!pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0)) - { - pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); - } - pCryptReleaseContext(hProv, 0); - - /* Ensure that container "wine_test_bad_keyset" does not exist. */ - if (pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) - { - pCryptReleaseContext(hProv, 0); - pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET); - } -} - -static void clean_up_environment(void) -{ - HCRYPTPROV hProv; - - /* Remove container "wine_test_keyset" */ - if (pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) - { - pCryptReleaseContext(hProv, 0); - pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET); - } - - /* Remove container "wine_test_keyset" from default PROV_RSA_FULL type provider */ - if (pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0)) - { - pCryptReleaseContext(hProv, 0); - pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); - } -} - -static void test_acquire_context(void) -{ - BOOL result; - HCRYPTPROV hProv; - - /* Provoke all kinds of error conditions (which are easy to provoke). - * The order of the error tests seems to match Windows XP's rsaenh.dll CSP, - * but since this is likely to change between CSP versions, we don't check - * this. Please don't change the order of tests. */ - result = pCryptAcquireContextA(&hProv, NULL, NULL, 0, 0); - ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError()); - - result = pCryptAcquireContextA(&hProv, NULL, NULL, 1000, 0); - ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError()); - - result = pCryptAcquireContextA(&hProv, NULL, NULL, NON_DEF_PROV_TYPE, 0); - ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%ld\n", GetLastError()); - - result = pCryptAcquireContextA(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0); - ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%ld\n", GetLastError()); - - result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0); - ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%ld\n", GetLastError()); - - /* This test fails under Win2k SP4: - result = TRUE, GetLastError() == ERROR_INVALID_PARAMETER - SetLastError(0xdeadbeef); - result = pCryptAcquireContextA(NULL, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); - ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%d/%ld\n", result, GetLastError()); - */ - - /* Last not least, try to really acquire a context. */ - hProv = 0; - SetLastError(0xdeadbeef); - result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); - ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError()); - - if (hProv) - pCryptReleaseContext(hProv, 0); - - /* Try again, witch an empty ("\0") szProvider parameter */ - hProv = 0; - SetLastError(0xdeadbeef); - result = pCryptAcquireContextA(&hProv, szKeySet, "", PROV_RSA_FULL, 0); - ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError()); - - if (hProv) - pCryptReleaseContext(hProv, 0); -} - -static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvName, - DWORD *pcbProvName, DWORD *pdwProvCount) -{ - HKEY hKey; - HKEY subkey; - DWORD size = sizeof(DWORD); - - if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider", &hKey)) - return FALSE; - - RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwProvCount, pcbProvName, - NULL, NULL, NULL, NULL, NULL, NULL); - (*pcbProvName)++; - - if (!(*pszProvName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbProvName)))) - return FALSE; - - RegEnumKeyEx(hKey, dwIndex, *pszProvName, pcbProvName, NULL, NULL, NULL, NULL); - (*pcbProvName)++; - - RegOpenKey(hKey, *pszProvName, &subkey); - RegQueryValueEx(subkey, "Type", NULL, NULL, (BYTE*)pdwProvType, &size); - - RegCloseKey(subkey); - RegCloseKey(hKey); - - return TRUE; -} - -static void test_enum_providers(void) -{ - /* expected results */ - CHAR *pszProvName = NULL; - DWORD cbName; - DWORD dwType; - DWORD provCount; - DWORD dwIndex = 0; - - /* actual results */ - CHAR *provider = NULL; - DWORD providerLen; - DWORD type; - DWORD count; - BOOL result; - DWORD notNull = 5; - DWORD notZeroFlags = 5; - - if(!pCryptEnumProvidersA) - { - trace("skipping CryptEnumProviders tests\n"); - return; - } - - if (!FindProvRegVals(dwIndex, &dwType, &pszProvName, &cbName, &provCount)) - return; - - /* check pdwReserved flag for NULL */ - result = pCryptEnumProvidersA(dwIndex, ¬Null, 0, &type, NULL, &providerLen); - ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); - - /* check dwFlags == 0 */ - result = pCryptEnumProvidersA(dwIndex, NULL, notZeroFlags, &type, NULL, &providerLen); - ok(!result && GetLastError()==NTE_BAD_FLAGS, "%ld\n", GetLastError()); - - /* alloc provider to half the size required - * cbName holds the size required */ - providerLen = cbName / 2; - if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen)))) - return; - - result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen); - ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n", - ERROR_MORE_DATA, GetLastError()); - - LocalFree(provider); - - /* loop through the providers to get the number of providers - * after loop ends, count should be provCount + 1 so subtract 1 - * to get actual number of providers */ - count = 0; - while(pCryptEnumProvidersA(count++, NULL, 0, &type, NULL, &providerLen)) - ; - count--; - ok(count==provCount, "expected %i, got %i\n", (int)provCount, (int)count); - - /* loop past the actual number of providers to get the error - * ERROR_NO_MORE_ITEMS */ - for (count = 0; count < provCount + 1; count++) - result = pCryptEnumProvidersA(count, NULL, 0, &type, NULL, &providerLen); - ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n", - ERROR_NO_MORE_ITEMS, GetLastError()); - - /* check expected versus actual values returned */ - result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, NULL, &providerLen); - ok(result && providerLen==cbName, "expected %i, got %i\n", (int)cbName, (int)providerLen); - if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen)))) - return; - - result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen); - ok(result && type==dwType, "expected %ld, got %ld\n", - dwType, type); - ok(result && !strcmp(pszProvName, provider), "expected %s, got %s\n", pszProvName, provider); - ok(result && cbName==providerLen, "expected %ld, got %ld\n", - cbName, providerLen); - - LocalFree(provider); -} - -static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTypeName, - DWORD *pcbTypeName, DWORD *pdwTypeCount) -{ - HKEY hKey; - HKEY hSubKey; - PSTR ch; - - if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types", &hKey)) - return FALSE; - - if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, pcbTypeName, NULL, - NULL, NULL, NULL, NULL, NULL)) - return FALSE; - (*pcbTypeName)++; - - if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName)))) - return FALSE; - - if (RegEnumKeyEx(hKey, dwIndex, *pszTypeName, pcbTypeName, NULL, NULL, NULL, NULL)) - return FALSE; - (*pcbTypeName)++; - ch = *pszTypeName + strlen(*pszTypeName); - /* Convert "Type 000" to 0, etc/ */ - *pdwProvType = *(--ch) - '0'; - *pdwProvType += (*(--ch) - '0') * 10; - *pdwProvType += (*(--ch) - '0') * 100; - - if (RegOpenKey(hKey, *pszTypeName, &hSubKey)) - return FALSE; - - if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName)) - return FALSE; - - if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName)))) - return FALSE; - - if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, *pszTypeName, pcbTypeName)) - return FALSE; - - RegCloseKey(hSubKey); - RegCloseKey(hKey); - - return TRUE; -} - -static void test_enum_provider_types() -{ - /* expected values */ - DWORD dwProvType; - LPSTR pszTypeName = NULL; - DWORD cbTypeName; - DWORD dwTypeCount; - - /* actual values */ - DWORD index = 0; - DWORD provType; - LPSTR typeName = NULL; - DWORD typeNameSize; - DWORD typeCount; - DWORD result; - DWORD notNull = 5; - DWORD notZeroFlags = 5; - - if(!pCryptEnumProviderTypesA) - { - trace("skipping CryptEnumProviderTypes tests\n"); - return; - } - - if (!FindProvTypesRegVals(index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount)) - { - trace("could not find provider types in registry, skipping the test\n"); - return; - } - - /* check pdwReserved for NULL */ - result = pCryptEnumProviderTypesA(index, ¬Null, 0, &provType, typeName, &typeNameSize); - ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - /* check dwFlags == zero */ - result = pCryptEnumProviderTypesA(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize); - ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %ld\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - /* alloc provider type to half the size required - * cbTypeName holds the size required */ - typeNameSize = cbTypeName / 2; - if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) - return; - - /* This test fails under Win2k SP4: - result = TRUE, GetLastError() == 0xdeadbeef - SetLastError(0xdeadbeef); - result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); - ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx\n", - result, GetLastError()); - */ - - LocalFree(typeName); - - /* loop through the provider types to get the number of provider types - * after loop ends, count should be dwTypeCount + 1 so subtract 1 - * to get actual number of provider types */ - typeCount = 0; - while(pCryptEnumProviderTypesA(typeCount++, NULL, 0, &provType, NULL, &typeNameSize)) - ; - typeCount--; - ok(typeCount==dwTypeCount, "expected %ld, got %ld\n", dwTypeCount, typeCount); - - /* loop past the actual number of provider types to get the error - * ERROR_NO_MORE_ITEMS */ - for (typeCount = 0; typeCount < dwTypeCount + 1; typeCount++) - result = pCryptEnumProviderTypesA(typeCount, NULL, 0, &provType, NULL, &typeNameSize); - ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n", - ERROR_NO_MORE_ITEMS, GetLastError()); - - - /* check expected versus actual values returned */ - result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, NULL, &typeNameSize); - ok(result && typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize); - if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) - return; - - typeNameSize = 0xdeadbeef; - result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); - ok(result, "expected TRUE, got %ld\n", result); - ok(provType==dwProvType, "expected %ld, got %ld\n", dwProvType, provType); - if (pszTypeName) - ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName); - ok(typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize); - - LocalFree(typeName); -} - -static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvName, DWORD *pcbProvName) -{ - HKEY hKey; - PSTR keyname; - PSTR ptr; - DWORD user = dwFlags & CRYPT_USER_DEFAULT; - - LPSTR MACHINESTR = "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types\\Type XXX"; - LPSTR USERSTR = "Software\\Microsoft\\Cryptography\\Provider Type XXX"; - - keyname = LocalAlloc(LMEM_ZEROINIT, (user ? strlen(USERSTR) : strlen(MACHINESTR)) + 1); - if (keyname) - { - user ? strcpy(keyname, USERSTR) : strcpy(keyname, MACHINESTR); - ptr = keyname + strlen(keyname); - *(--ptr) = (dwProvType % 10) + '0'; - *(--ptr) = ((dwProvType / 10) % 10) + '0'; - *(--ptr) = (dwProvType / 100) + '0'; - } else - return FALSE; - - if (RegOpenKey((dwFlags & CRYPT_USER_DEFAULT) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE ,keyname, &hKey)) - { - LocalFree(keyname); - return FALSE; - } - LocalFree(keyname); - - if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName)) - { - if (GetLastError() != ERROR_MORE_DATA) - SetLastError(NTE_PROV_TYPE_ENTRY_BAD); - return FALSE; - } - - if (!(*pszProvName = LocalAlloc(LMEM_ZEROINIT, *pcbProvName))) - return FALSE; - - if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName)) - { - if (GetLastError() != ERROR_MORE_DATA) - SetLastError(NTE_PROV_TYPE_ENTRY_BAD); - return FALSE; - } - - RegCloseKey(hKey); - - return TRUE; -} - -static void test_get_default_provider() -{ - /* expected results */ - DWORD dwProvType = PROV_RSA_FULL; - DWORD dwFlags = CRYPT_MACHINE_DEFAULT; - LPSTR pszProvName = NULL; - DWORD cbProvName; - - /* actual results */ - DWORD provType = PROV_RSA_FULL; - DWORD flags = CRYPT_MACHINE_DEFAULT; - LPSTR provName = NULL; - DWORD provNameSize; - DWORD result; - DWORD notNull = 5; - - if(!pCryptGetDefaultProviderA) - { - trace("skipping CryptGetDefaultProvider tests\n"); - return; - } - - FindDfltProvRegVals(dwProvType, dwFlags, &pszProvName, &cbProvName); - - /* check pdwReserved for NULL */ - result = pCryptGetDefaultProviderA(provType, ¬Null, flags, provName, &provNameSize); - ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - /* check for invalid flag */ - flags = 0xdeadbeef; - result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); - ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %ld, got %ld\n", - NTE_BAD_FLAGS, GetLastError()); - flags = CRYPT_MACHINE_DEFAULT; - - /* check for invalid prov type */ - provType = 0xdeadbeef; - result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); - ok(!result && (GetLastError() == NTE_BAD_PROV_TYPE || - GetLastError() == ERROR_INVALID_PARAMETER), - "expected NTE_BAD_PROV_TYPE or ERROR_INVALID_PARAMETER, got %ld/%ld\n", - result, GetLastError()); - provType = PROV_RSA_FULL; - - SetLastError(0); - - /* alloc provName to half the size required - * cbProvName holds the size required */ - provNameSize = cbProvName / 2; - if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize))) - return; - - result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); - ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n", - ERROR_MORE_DATA, GetLastError()); - - LocalFree(provName); - - /* check expected versus actual values returned */ - result = pCryptGetDefaultProviderA(provType, NULL, flags, NULL, &provNameSize); - ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize); - provNameSize = cbProvName; - - if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize))) - return; - - result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); - ok(result && !strcmp(pszProvName, provName), "expected %s, got %s\n", pszProvName, provName); - ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize); - - LocalFree(provName); -} - -static void test_set_provider_ex() -{ - DWORD result; - DWORD notNull = 5; - - /* results */ - LPSTR pszProvName = NULL; - DWORD cbProvName; - - if(!pCryptGetDefaultProviderA || !pCryptSetProviderExA) - { - trace("skipping CryptSetProviderEx tests\n"); - return; - } - - /* check pdwReserved for NULL */ - result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, ¬Null, CRYPT_MACHINE_DEFAULT); - ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - /* remove the default provider and then set it to MS_DEF_PROV/PROV_RSA_FULL */ - result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT | CRYPT_DELETE_DEFAULT); - ok(result, "%ld\n", GetLastError()); - - result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT); - ok(result, "%ld\n", GetLastError()); - - /* call CryptGetDefaultProvider to see if they match */ - result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName); - if (!(pszProvName = LocalAlloc(LMEM_ZEROINIT, cbProvName))) - return; - - result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, pszProvName, &cbProvName); - ok(result && !strcmp(MS_DEF_PROV, pszProvName), "expected %s, got %s\n", MS_DEF_PROV, pszProvName); - ok(result && cbProvName==(strlen(MS_DEF_PROV) + 1), "expected %i, got %ld\n", (strlen(MS_DEF_PROV) + 1), cbProvName); - - LocalFree(pszProvName); -} - -START_TEST(crypt) -{ - init_function_pointers(); - if(pCryptAcquireContextA && pCryptReleaseContext) { - init_environment(); - test_acquire_context(); - clean_up_environment(); - } - - test_enum_providers(); - test_enum_provider_types(); - test_get_default_provider(); - test_set_provider_ex(); -} +/* + * Unit tests for crypt functions + * + * Copyright (c) 2004 Michael Jung + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "wincrypt.h" +#include "winerror.h" +#include "winreg.h" + +#include "wine/test.h" + +static const char szRsaBaseProv[] = MS_DEF_PROV_A; +static const char szNonExistentProv[] = "Wine Nonexistent Cryptographic Provider v11.2"; +static const char szKeySet[] = "wine_test_keyset"; +static const char szBadKeySet[] = "wine_test_bad_keyset"; +#define NON_DEF_PROV_TYPE 999 + +static HMODULE hadvapi32; +static BOOL (WINAPI *pCryptAcquireContextA)(HCRYPTPROV*,LPCSTR,LPCSTR,DWORD,DWORD); +static BOOL (WINAPI *pCryptEnumProviderTypesA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*); +static BOOL (WINAPI *pCryptEnumProvidersA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*); +static BOOL (WINAPI *pCryptGetDefaultProviderA)(DWORD, DWORD*, DWORD, LPSTR, DWORD*); +static BOOL (WINAPI *pCryptReleaseContext)(HCRYPTPROV, DWORD); +static BOOL (WINAPI *pCryptSetProviderExA)(LPCSTR, DWORD, DWORD*, DWORD); +static BOOL (WINAPI *pCryptCreateHash)(HCRYPTPROV, ALG_ID, HCRYPTKEY, DWORD, HCRYPTHASH*); +static BOOL (WINAPI *pCryptDestroyHash)(HCRYPTHASH); +static BOOL (WINAPI *pCryptGenRandom)(HCRYPTPROV, DWORD, BYTE*); +static BOOL (WINAPI *pCryptContextAddRef)(HCRYPTPROV, DWORD*, DWORD dwFlags); +static BOOL (WINAPI *pCryptGenKey)(HCRYPTPROV, ALG_ID, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptDestroyKey)(HCRYPTKEY); +static BOOL (WINAPI *pCryptDecrypt)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE*, DWORD*); +static BOOL (WINAPI *pCryptDeriveKey)(HCRYPTPROV, ALG_ID, HCRYPTHASH, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptDuplicateHash)(HCRYPTHASH, DWORD*, DWORD, HCRYPTHASH*); +static BOOL (WINAPI *pCryptDuplicateKey)(HCRYPTKEY, DWORD*, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptEncrypt)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptExportKey)(HCRYPTKEY, HCRYPTKEY, DWORD, DWORD, BYTE*, DWORD*); +static BOOL (WINAPI *pCryptGetHashParam)(HCRYPTHASH, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptGetKeyParam)(HCRYPTKEY, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptGetProvParam)(HCRYPTPROV, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptGetUserKey)(HCRYPTPROV, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptHashData)(HCRYPTHASH, BYTE*, DWORD, DWORD); +static BOOL (WINAPI *pCryptHashSessionKey)(HCRYPTHASH, HCRYPTKEY, DWORD); +static BOOL (WINAPI *pCryptImportKey)(HCRYPTPROV, BYTE*, DWORD, HCRYPTKEY, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptSignHashW)(HCRYPTHASH, DWORD, LPCWSTR, DWORD, BYTE*, DWORD*); +static BOOL (WINAPI *pCryptSetHashParam)(HCRYPTKEY, DWORD, BYTE*, DWORD); +static BOOL (WINAPI *pCryptSetKeyParam)(HCRYPTKEY, DWORD, BYTE*, DWORD); +static BOOL (WINAPI *pCryptSetProvParam)(HCRYPTPROV, DWORD, BYTE*, DWORD); +static BOOL (WINAPI *pCryptVerifySignatureW)(HCRYPTHASH, BYTE*, DWORD, HCRYPTKEY, LPCWSTR, DWORD); + +static void init_function_pointers(void) +{ + hadvapi32 = GetModuleHandleA("advapi32.dll"); + + if(hadvapi32) + { + pCryptAcquireContextA = (void*)GetProcAddress(hadvapi32, "CryptAcquireContextA"); + pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA"); + pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA"); + pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA"); + pCryptReleaseContext = (void*)GetProcAddress(hadvapi32, "CryptReleaseContext"); + pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA"); + pCryptCreateHash = (void*)GetProcAddress(hadvapi32, "CryptCreateHash"); + pCryptDestroyHash = (void*)GetProcAddress(hadvapi32, "CryptDestroyHash"); + pCryptGenRandom = (void*)GetProcAddress(hadvapi32, "CryptGenRandom"); + pCryptContextAddRef = (void*)GetProcAddress(hadvapi32, "CryptContextAddRef"); + pCryptGenKey = (void*)GetProcAddress(hadvapi32, "CryptGenKey"); + pCryptDestroyKey = (void*)GetProcAddress(hadvapi32, "CryptDestroyKey"); + pCryptDecrypt = (void*)GetProcAddress(hadvapi32, "CryptDecrypt"); + pCryptDeriveKey = (void*)GetProcAddress(hadvapi32, "CryptDeriveKey"); + pCryptDuplicateHash = (void*)GetProcAddress(hadvapi32, "CryptDuplicateHash"); + pCryptDuplicateKey = (void*)GetProcAddress(hadvapi32, "CryptDuplicateKey"); + pCryptEncrypt = (void*)GetProcAddress(hadvapi32, "CryptEncrypt"); + pCryptExportKey = (void*)GetProcAddress(hadvapi32, "CryptExportKey"); + pCryptGetHashParam = (void*)GetProcAddress(hadvapi32, "CryptGetHashParam"); + pCryptGetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptGetKeyParam"); + pCryptGetProvParam = (void*)GetProcAddress(hadvapi32, "CryptGetProvParam"); + pCryptGetUserKey = (void*)GetProcAddress(hadvapi32, "CryptGetUserKey"); + pCryptHashData = (void*)GetProcAddress(hadvapi32, "CryptHashData"); + pCryptHashSessionKey = (void*)GetProcAddress(hadvapi32, "CryptHashSessionKey"); + pCryptImportKey = (void*)GetProcAddress(hadvapi32, "CryptImportKey"); + pCryptSignHashW = (void*)GetProcAddress(hadvapi32, "CryptSignHashW"); + pCryptSetHashParam = (void*)GetProcAddress(hadvapi32, "CryptSetHashParam"); + pCryptSetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptSetKeyParam"); + pCryptSetProvParam = (void*)GetProcAddress(hadvapi32, "CryptSetProvParam"); + pCryptVerifySignatureW = (void*)GetProcAddress(hadvapi32, "CryptVerifySignatureW"); + } +} + +static void init_environment(void) +{ + HCRYPTPROV hProv; + + /* Ensure that container "wine_test_keyset" does exist */ + if (!pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) + { + pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_NEWKEYSET); + } + pCryptReleaseContext(hProv, 0); + + /* Ensure that container "wine_test_keyset" does exist in default PROV_RSA_FULL type provider */ + if (!pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0)) + { + pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); + } + pCryptReleaseContext(hProv, 0); + + /* Ensure that container "wine_test_bad_keyset" does not exist. */ + if (pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) + { + pCryptReleaseContext(hProv, 0); + pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + } +} + +static void clean_up_environment(void) +{ + HCRYPTPROV hProv; + + /* Remove container "wine_test_keyset" */ + if (pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) + { + pCryptReleaseContext(hProv, 0); + pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + } + + /* Remove container "wine_test_keyset" from default PROV_RSA_FULL type provider */ + if (pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0)) + { + pCryptReleaseContext(hProv, 0); + pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + } +} + +static void test_acquire_context(void) +{ + BOOL result; + HCRYPTPROV hProv; + + /* Provoke all kinds of error conditions (which are easy to provoke). + * The order of the error tests seems to match Windows XP's rsaenh.dll CSP, + * but since this is likely to change between CSP versions, we don't check + * this. Please don't change the order of tests. */ + result = pCryptAcquireContextA(&hProv, NULL, NULL, 0, 0); + ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError()); + + result = pCryptAcquireContextA(&hProv, NULL, NULL, 1000, 0); + ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError()); + + result = pCryptAcquireContextA(&hProv, NULL, NULL, NON_DEF_PROV_TYPE, 0); + ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%ld\n", GetLastError()); + + result = pCryptAcquireContextA(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0); + ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%ld\n", GetLastError()); + + result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0); + ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%ld\n", GetLastError()); + + /* This test fails under Win2k SP4: + result = TRUE, GetLastError() == ERROR_INVALID_PARAMETER + SetLastError(0xdeadbeef); + result = pCryptAcquireContextA(NULL, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); + ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%d/%ld\n", result, GetLastError()); + */ + + /* Last not least, try to really acquire a context. */ + hProv = 0; + SetLastError(0xdeadbeef); + result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); + ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE || GetLastError() == NTE_FAIL), "%d/%ld\n", result, GetLastError()); + + if (hProv) + pCryptReleaseContext(hProv, 0); + + /* Try again, witch an empty ("\0") szProvider parameter */ + hProv = 0; + SetLastError(0xdeadbeef); + result = pCryptAcquireContextA(&hProv, szKeySet, "", PROV_RSA_FULL, 0); + ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE || GetLastError() == NTE_FAIL), "%d/%ld\n", result, GetLastError()); + + if (hProv) + pCryptReleaseContext(hProv, 0); +} + +static void test_incorrect_api_usage(void) +{ + BOOL result; + HCRYPTPROV hProv, hProv2; + HCRYPTHASH hHash, hHash2; + HCRYPTKEY hKey, hKey2; + BYTE temp; + DWORD dwLen, dwTemp; + + /* This is to document incorrect api usage in the + * "Uru - Ages beyond Myst Demo" installer as reported by Paul Vriens. + * + * The installer destroys a hash object after having released the context + * with which the hash was created. This is not allowed according to MSDN, + * since CryptReleaseContext destroys all hash and key objects belonging to + * the respective context. However, while wine used to crash, Windows is more + * robust here and returns an ERROR_INVALID_PARAMETER code. + */ + + result = pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, + PROV_RSA_FULL, CRYPT_NEWKEYSET); + ok (result, "%08lx\n", GetLastError()); + if (!result) return; + + result = pCryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptDestroyKey(hKey2); + ok (result, "%ld\n", GetLastError()); + + dwTemp = CRYPT_MODE_ECB; + result = pCryptSetKeyParam(hKey2, KP_MODE, (BYTE*)&dwTemp, sizeof(DWORD)); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptAcquireContextA(&hProv2, szBadKeySet, NULL, PROV_RSA_FULL, + CRYPT_DELETEKEYSET); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptReleaseContext(hProv, 0); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptReleaseContext(hProv, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptGenRandom(hProv, 1, &temp); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + +#ifdef CRASHES_ON_NT40 + result = pCryptContextAddRef(hProv, NULL, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); +#endif + + result = pCryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptDeriveKey(hProv, CALG_RC4, hHash, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + +#ifdef CRASHES_ON_NT40 + result = pCryptDuplicateHash(hHash, NULL, 0, &hHash2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptDuplicateKey(hKey, NULL, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); +#endif + + dwLen = 1; + result = pCryptExportKey(hKey, (HCRYPTPROV)NULL, 0, 0, &temp, &dwLen); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptGetHashParam(hHash, 0, &temp, &dwLen, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptGetKeyParam(hKey, 0, &temp, &dwLen, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptGetProvParam(hProv, 0, &temp, &dwLen, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptGetUserKey(hProv, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptHashData(hHash, &temp, 1, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptHashSessionKey(hHash, hKey, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptImportKey(hProv, &temp, 1, (HCRYPTKEY)NULL, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptSignHashW(hHash, 0, NULL, 0, &temp, &dwLen); + ok (!result && (GetLastError() == ERROR_INVALID_PARAMETER || + GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%ld\n", GetLastError()); + + result = pCryptSetKeyParam(hKey, 0, &temp, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptSetHashParam(hHash, 0, &temp, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptSetProvParam(hProv, 0, &temp, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptVerifySignatureW(hHash, &temp, 1, hKey, NULL, 0); + ok (!result && (GetLastError() == ERROR_INVALID_PARAMETER || + GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%ld\n", GetLastError()); + + result = pCryptDestroyHash(hHash); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptDestroyKey(hKey); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); +} + +static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvName, + DWORD *pcbProvName, DWORD *pdwProvCount) +{ + HKEY hKey; + HKEY subkey; + DWORD size = sizeof(DWORD); + + if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider", &hKey)) + return FALSE; + + RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwProvCount, pcbProvName, + NULL, NULL, NULL, NULL, NULL, NULL); + (*pcbProvName)++; + + if (!(*pszProvName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbProvName)))) + return FALSE; + + RegEnumKeyEx(hKey, dwIndex, *pszProvName, pcbProvName, NULL, NULL, NULL, NULL); + (*pcbProvName)++; + + RegOpenKey(hKey, *pszProvName, &subkey); + RegQueryValueEx(subkey, "Type", NULL, NULL, (BYTE*)pdwProvType, &size); + + RegCloseKey(subkey); + RegCloseKey(hKey); + + return TRUE; +} + +static void test_enum_providers(void) +{ + /* expected results */ + CHAR *pszProvName = NULL; + DWORD cbName; + DWORD dwType; + DWORD provCount; + DWORD dwIndex = 0; + + /* actual results */ + CHAR *provider = NULL; + DWORD providerLen; + DWORD type; + DWORD count; + BOOL result; + DWORD notNull = 5; + DWORD notZeroFlags = 5; + + if(!pCryptEnumProvidersA) + { + trace("skipping CryptEnumProviders tests\n"); + return; + } + + if (!FindProvRegVals(dwIndex, &dwType, &pszProvName, &cbName, &provCount)) + return; + + /* check pdwReserved flag for NULL */ + result = pCryptEnumProvidersA(dwIndex, ¬Null, 0, &type, NULL, &providerLen); + ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + /* check dwFlags == 0 */ + result = pCryptEnumProvidersA(dwIndex, NULL, notZeroFlags, &type, NULL, &providerLen); + ok(!result && GetLastError()==NTE_BAD_FLAGS, "%ld\n", GetLastError()); + + /* alloc provider to half the size required + * cbName holds the size required */ + providerLen = cbName / 2; + if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen)))) + return; + + result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen); + ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n", + ERROR_MORE_DATA, GetLastError()); + + LocalFree(provider); + + /* loop through the providers to get the number of providers + * after loop ends, count should be provCount + 1 so subtract 1 + * to get actual number of providers */ + count = 0; + while(pCryptEnumProvidersA(count++, NULL, 0, &type, NULL, &providerLen)) + ; + count--; + ok(count==provCount, "expected %i, got %i\n", (int)provCount, (int)count); + + /* loop past the actual number of providers to get the error + * ERROR_NO_MORE_ITEMS */ + for (count = 0; count < provCount + 1; count++) + result = pCryptEnumProvidersA(count, NULL, 0, &type, NULL, &providerLen); + ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n", + ERROR_NO_MORE_ITEMS, GetLastError()); + + /* check expected versus actual values returned */ + result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, NULL, &providerLen); + ok(result && providerLen==cbName, "expected %i, got %i\n", (int)cbName, (int)providerLen); + if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen)))) + return; + + result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen); + ok(result && type==dwType, "expected %ld, got %ld\n", + dwType, type); + ok(result && !strcmp(pszProvName, provider), "expected %s, got %s\n", pszProvName, provider); + ok(result && cbName==providerLen, "expected %ld, got %ld\n", + cbName, providerLen); + + LocalFree(provider); +} + +static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTypeName, + DWORD *pcbTypeName, DWORD *pdwTypeCount) +{ + HKEY hKey; + HKEY hSubKey; + PSTR ch; + + if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types", &hKey)) + return FALSE; + + if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, pcbTypeName, NULL, + NULL, NULL, NULL, NULL, NULL)) + return FALSE; + (*pcbTypeName)++; + + if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName)))) + return FALSE; + + if (RegEnumKeyEx(hKey, dwIndex, *pszTypeName, pcbTypeName, NULL, NULL, NULL, NULL)) + return FALSE; + (*pcbTypeName)++; + ch = *pszTypeName + strlen(*pszTypeName); + /* Convert "Type 000" to 0, etc/ */ + *pdwProvType = *(--ch) - '0'; + *pdwProvType += (*(--ch) - '0') * 10; + *pdwProvType += (*(--ch) - '0') * 100; + + if (RegOpenKey(hKey, *pszTypeName, &hSubKey)) + return FALSE; + + if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName)) + return FALSE; + + if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName)))) + return FALSE; + + if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, *pszTypeName, pcbTypeName)) + return FALSE; + + RegCloseKey(hSubKey); + RegCloseKey(hKey); + + return TRUE; +} + +static void test_enum_provider_types() +{ + /* expected values */ + DWORD dwProvType; + LPSTR pszTypeName = NULL; + DWORD cbTypeName; + DWORD dwTypeCount; + + /* actual values */ + DWORD index = 0; + DWORD provType; + LPSTR typeName = NULL; + DWORD typeNameSize; + DWORD typeCount; + DWORD result; + DWORD notNull = 5; + DWORD notZeroFlags = 5; + + if(!pCryptEnumProviderTypesA) + { + trace("skipping CryptEnumProviderTypes tests\n"); + return; + } + + if (!FindProvTypesRegVals(index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount)) + { + trace("could not find provider types in registry, skipping the test\n"); + return; + } + + /* check pdwReserved for NULL */ + result = pCryptEnumProviderTypesA(index, ¬Null, 0, &provType, typeName, &typeNameSize); + ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", + ERROR_INVALID_PARAMETER, GetLastError()); + + /* check dwFlags == zero */ + result = pCryptEnumProviderTypesA(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize); + ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %ld\n", + ERROR_INVALID_PARAMETER, GetLastError()); + + /* alloc provider type to half the size required + * cbTypeName holds the size required */ + typeNameSize = cbTypeName / 2; + if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) + return; + + /* This test fails under Win2k SP4: + result = TRUE, GetLastError() == 0xdeadbeef + SetLastError(0xdeadbeef); + result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); + ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx\n", + result, GetLastError()); + */ + + LocalFree(typeName); + + /* loop through the provider types to get the number of provider types + * after loop ends, count should be dwTypeCount + 1 so subtract 1 + * to get actual number of provider types */ + typeCount = 0; + while(pCryptEnumProviderTypesA(typeCount++, NULL, 0, &provType, NULL, &typeNameSize)) + ; + typeCount--; + ok(typeCount==dwTypeCount, "expected %ld, got %ld\n", dwTypeCount, typeCount); + + /* loop past the actual number of provider types to get the error + * ERROR_NO_MORE_ITEMS */ + for (typeCount = 0; typeCount < dwTypeCount + 1; typeCount++) + result = pCryptEnumProviderTypesA(typeCount, NULL, 0, &provType, NULL, &typeNameSize); + ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n", + ERROR_NO_MORE_ITEMS, GetLastError()); + + + /* check expected versus actual values returned */ + result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, NULL, &typeNameSize); + ok(result && typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize); + if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) + return; + + typeNameSize = 0xdeadbeef; + result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); + ok(result, "expected TRUE, got %ld\n", result); + ok(provType==dwProvType, "expected %ld, got %ld\n", dwProvType, provType); + if (pszTypeName) + ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName); + ok(typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize); + + LocalFree(typeName); +} + +static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvName, DWORD *pcbProvName) +{ + HKEY hKey; + PSTR keyname; + PSTR ptr; + DWORD user = dwFlags & CRYPT_USER_DEFAULT; + + LPSTR MACHINESTR = "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types\\Type XXX"; + LPSTR USERSTR = "Software\\Microsoft\\Cryptography\\Provider Type XXX"; + + keyname = LocalAlloc(LMEM_ZEROINIT, (user ? strlen(USERSTR) : strlen(MACHINESTR)) + 1); + if (keyname) + { + user ? strcpy(keyname, USERSTR) : strcpy(keyname, MACHINESTR); + ptr = keyname + strlen(keyname); + *(--ptr) = (dwProvType % 10) + '0'; + *(--ptr) = ((dwProvType / 10) % 10) + '0'; + *(--ptr) = (dwProvType / 100) + '0'; + } else + return FALSE; + + if (RegOpenKey((dwFlags & CRYPT_USER_DEFAULT) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE ,keyname, &hKey)) + { + LocalFree(keyname); + return FALSE; + } + LocalFree(keyname); + + if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName)) + { + if (GetLastError() != ERROR_MORE_DATA) + SetLastError(NTE_PROV_TYPE_ENTRY_BAD); + return FALSE; + } + + if (!(*pszProvName = LocalAlloc(LMEM_ZEROINIT, *pcbProvName))) + return FALSE; + + if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName)) + { + if (GetLastError() != ERROR_MORE_DATA) + SetLastError(NTE_PROV_TYPE_ENTRY_BAD); + return FALSE; + } + + RegCloseKey(hKey); + + return TRUE; +} + +static void test_get_default_provider() +{ + /* expected results */ + DWORD dwProvType = PROV_RSA_FULL; + DWORD dwFlags = CRYPT_MACHINE_DEFAULT; + LPSTR pszProvName = NULL; + DWORD cbProvName; + + /* actual results */ + DWORD provType = PROV_RSA_FULL; + DWORD flags = CRYPT_MACHINE_DEFAULT; + LPSTR provName = NULL; + DWORD provNameSize; + DWORD result; + DWORD notNull = 5; + + if(!pCryptGetDefaultProviderA) + { + trace("skipping CryptGetDefaultProvider tests\n"); + return; + } + + FindDfltProvRegVals(dwProvType, dwFlags, &pszProvName, &cbProvName); + + /* check pdwReserved for NULL */ + result = pCryptGetDefaultProviderA(provType, ¬Null, flags, provName, &provNameSize); + ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", + ERROR_INVALID_PARAMETER, GetLastError()); + + /* check for invalid flag */ + flags = 0xdeadbeef; + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); + ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %ld, got %ld\n", + NTE_BAD_FLAGS, GetLastError()); + flags = CRYPT_MACHINE_DEFAULT; + + /* check for invalid prov type */ + provType = 0xdeadbeef; + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); + ok(!result && (GetLastError() == NTE_BAD_PROV_TYPE || + GetLastError() == ERROR_INVALID_PARAMETER), + "expected NTE_BAD_PROV_TYPE or ERROR_INVALID_PARAMETER, got %ld/%ld\n", + result, GetLastError()); + provType = PROV_RSA_FULL; + + SetLastError(0); + + /* alloc provName to half the size required + * cbProvName holds the size required */ + provNameSize = cbProvName / 2; + if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize))) + return; + + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); + ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n", + ERROR_MORE_DATA, GetLastError()); + + LocalFree(provName); + + /* check expected versus actual values returned */ + result = pCryptGetDefaultProviderA(provType, NULL, flags, NULL, &provNameSize); + ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize); + provNameSize = cbProvName; + + if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize))) + return; + + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); + ok(result && !strcmp(pszProvName, provName), "expected %s, got %s\n", pszProvName, provName); + ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize); + + LocalFree(provName); +} + +static void test_set_provider_ex() +{ + DWORD result; + DWORD notNull = 5; + + /* results */ + LPSTR pszProvName = NULL; + DWORD cbProvName; + + if(!pCryptGetDefaultProviderA || !pCryptSetProviderExA) + { + trace("skipping CryptSetProviderEx tests\n"); + return; + } + + /* check pdwReserved for NULL */ + result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, ¬Null, CRYPT_MACHINE_DEFAULT); + ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", + ERROR_INVALID_PARAMETER, GetLastError()); + + /* remove the default provider and then set it to MS_DEF_PROV/PROV_RSA_FULL */ + result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT | CRYPT_DELETE_DEFAULT); + ok(result, "%ld\n", GetLastError()); + + result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT); + ok(result, "%ld\n", GetLastError()); + + /* call CryptGetDefaultProvider to see if they match */ + result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName); + if (!(pszProvName = LocalAlloc(LMEM_ZEROINIT, cbProvName))) + return; + + result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, pszProvName, &cbProvName); + ok(result && !strcmp(MS_DEF_PROV, pszProvName), "expected %s, got %s\n", MS_DEF_PROV, pszProvName); + ok(result && cbProvName==(strlen(MS_DEF_PROV) + 1), "expected %i, got %ld\n", (strlen(MS_DEF_PROV) + 1), cbProvName); + + LocalFree(pszProvName); +} + +START_TEST(crypt) +{ + init_function_pointers(); + if(pCryptAcquireContextA && pCryptReleaseContext) { + init_environment(); + test_acquire_context(); + test_incorrect_api_usage(); + clean_up_environment(); + } + + test_enum_providers(); + test_enum_provider_types(); + test_get_default_provider(); + test_set_provider_ex(); +} diff --git a/reactos/lib/advapi32/winetests/crypt_lmhash.c b/reactos/lib/advapi32/winetests/crypt_lmhash.c index d8879539de4..ff352c454de 100644 --- a/reactos/lib/advapi32/winetests/crypt_lmhash.c +++ b/reactos/lib/advapi32/winetests/crypt_lmhash.c @@ -1,63 +1,63 @@ -/* - * Unit tests for SystemFunction006 (LMHash?) - * - * Copyright 2004 Hans Leidekker - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" - -typedef VOID (WINAPI *fnSystemFunction006)( PCSTR passwd, PSTR lmhash ); -fnSystemFunction006 pSystemFunction006; - -static void test_SystemFunction006() -{ - static unsigned char lmhash[16 + 1]; - - unsigned char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 }; - unsigned char expect[] = - { 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb, - 0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee }; - - pSystemFunction006( passwd, lmhash ); - - ok( !memcmp( lmhash, expect, sizeof(expect) ), - "lmhash: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", - lmhash[0], lmhash[1], lmhash[2], lmhash[3], lmhash[4], lmhash[5], - lmhash[6], lmhash[7], lmhash[8], lmhash[9], lmhash[10], lmhash[11], - lmhash[12], lmhash[13], lmhash[14], lmhash[15] ); -} - -START_TEST(crypt_lmhash) -{ - HMODULE module; - - if (!(module = LoadLibrary("advapi32.dll"))) return; - - pSystemFunction006 = (fnSystemFunction006)GetProcAddress( module, "SystemFunction006" ); - - if (!pSystemFunction006) goto out; - - if (pSystemFunction006) - test_SystemFunction006(); - -out: - FreeLibrary( module ); -} +/* + * Unit tests for SystemFunction006 (LMHash?) + * + * Copyright 2004 Hans Leidekker + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wine/test.h" +#include "windef.h" +#include "winbase.h" + +typedef VOID (WINAPI *fnSystemFunction006)( PCSTR passwd, PSTR lmhash ); +fnSystemFunction006 pSystemFunction006; + +static void test_SystemFunction006() +{ + static unsigned char lmhash[16 + 1]; + + unsigned char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 }; + unsigned char expect[] = + { 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb, + 0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee }; + + pSystemFunction006( passwd, lmhash ); + + ok( !memcmp( lmhash, expect, sizeof(expect) ), + "lmhash: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", + lmhash[0], lmhash[1], lmhash[2], lmhash[3], lmhash[4], lmhash[5], + lmhash[6], lmhash[7], lmhash[8], lmhash[9], lmhash[10], lmhash[11], + lmhash[12], lmhash[13], lmhash[14], lmhash[15] ); +} + +START_TEST(crypt_lmhash) +{ + HMODULE module; + + if (!(module = LoadLibrary("advapi32.dll"))) return; + + pSystemFunction006 = (fnSystemFunction006)GetProcAddress( module, "SystemFunction006" ); + + if (!pSystemFunction006) goto out; + + if (pSystemFunction006) + test_SystemFunction006(); + +out: + FreeLibrary( module ); +} diff --git a/reactos/lib/advapi32/winetests/crypt_md4.c b/reactos/lib/advapi32/winetests/crypt_md4.c index 391a2b74302..c18f958b11c 100644 --- a/reactos/lib/advapi32/winetests/crypt_md4.c +++ b/reactos/lib/advapi32/winetests/crypt_md4.c @@ -1,109 +1,109 @@ -/* - * Unit tests for MD4 functions - * - * Copyright 2004 Hans Leidekker - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -typedef struct -{ - unsigned int buf[4]; - unsigned int i[2]; - unsigned char in[64]; - unsigned char digest[16]; -} MD4_CTX; - -typedef VOID (WINAPI *fnMD4Init)( MD4_CTX *ctx ); -typedef VOID (WINAPI *fnMD4Update)( MD4_CTX *ctx, const unsigned char *src, const int len ); -typedef VOID (WINAPI *fnMD4Final)( MD4_CTX *ctx ); - -fnMD4Init pMD4Init; -fnMD4Update pMD4Update; -fnMD4Final pMD4Final; - -#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD4_CTX, in ) ) - -void test_md4_ctx() -{ - static unsigned char message[] = - "In our Life there's If" - "In our beliefs there's Lie" - "In our business there is Sin" - "In our bodies, there is Die"; - - int size = strlen( message ); - HMODULE module; - - MD4_CTX ctx; - MD4_CTX ctx_initialized = - { - { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }, - { 0, 0 } - }; - - MD4_CTX ctx_update1 = - { - { 0x5e592ef7, 0xbdcb1567, 0x2b626d17, 0x7d1198bd }, - { 0x00000338, 0 } - }; - - MD4_CTX ctx_update2 = - { - { 0x05dcfd65, 0xb3711c0d, 0x9e3369c2, 0x903ead11 }, - { 0x00000670, 0 } - }; - - unsigned char expect[16] = - { 0x5f, 0xd3, 0x9b, 0x29, 0x47, 0x53, 0x47, 0xaf, - 0xa5, 0xba, 0x0c, 0x05, 0xff, 0xc0, 0xc7, 0xda }; - - if (!(module = LoadLibrary( "advapi32.dll" ))) return; - - pMD4Init = (fnMD4Init)GetProcAddress( module, "MD4Init" ); - pMD4Update = (fnMD4Update)GetProcAddress( module, "MD4Update" ); - pMD4Final = (fnMD4Final)GetProcAddress( module, "MD4Final" ); - - if (!pMD4Init || !pMD4Update || !pMD4Final) goto out; - - memset( &ctx, 0, sizeof(ctx) ); - pMD4Init( &ctx ); - ok( !ctxcmp( &ctx, &ctx_initialized ), "invalid initialization\n" ); - - pMD4Update( &ctx, message, size ); - ok( !ctxcmp( &ctx, &ctx_update1 ), "update doesn't work correctly\n" ); - - pMD4Update( &ctx, message, size ); - ok( !ctxcmp( &ctx, &ctx_update2 ), "update doesn't work correctly\n" ); - - pMD4Final( &ctx ); - ok( ctxcmp( &ctx, &ctx_initialized ), "context has changed\n" ); - ok( !memcmp( ctx.digest, expect, sizeof(expect) ), "incorrect result\n" ); - -out: - FreeLibrary( module ); -} - -START_TEST(crypt_md4) -{ - test_md4_ctx(); -} +/* + * Unit tests for MD4 functions + * + * Copyright 2004 Hans Leidekker + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wine/test.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" + +typedef struct +{ + unsigned int buf[4]; + unsigned int i[2]; + unsigned char in[64]; + unsigned char digest[16]; +} MD4_CTX; + +typedef VOID (WINAPI *fnMD4Init)( MD4_CTX *ctx ); +typedef VOID (WINAPI *fnMD4Update)( MD4_CTX *ctx, const unsigned char *src, const int len ); +typedef VOID (WINAPI *fnMD4Final)( MD4_CTX *ctx ); + +fnMD4Init pMD4Init; +fnMD4Update pMD4Update; +fnMD4Final pMD4Final; + +#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD4_CTX, in ) ) + +void test_md4_ctx() +{ + static unsigned char message[] = + "In our Life there's If" + "In our beliefs there's Lie" + "In our business there is Sin" + "In our bodies, there is Die"; + + int size = strlen( message ); + HMODULE module; + + MD4_CTX ctx; + MD4_CTX ctx_initialized = + { + { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }, + { 0, 0 } + }; + + MD4_CTX ctx_update1 = + { + { 0x5e592ef7, 0xbdcb1567, 0x2b626d17, 0x7d1198bd }, + { 0x00000338, 0 } + }; + + MD4_CTX ctx_update2 = + { + { 0x05dcfd65, 0xb3711c0d, 0x9e3369c2, 0x903ead11 }, + { 0x00000670, 0 } + }; + + unsigned char expect[16] = + { 0x5f, 0xd3, 0x9b, 0x29, 0x47, 0x53, 0x47, 0xaf, + 0xa5, 0xba, 0x0c, 0x05, 0xff, 0xc0, 0xc7, 0xda }; + + if (!(module = LoadLibrary( "advapi32.dll" ))) return; + + pMD4Init = (fnMD4Init)GetProcAddress( module, "MD4Init" ); + pMD4Update = (fnMD4Update)GetProcAddress( module, "MD4Update" ); + pMD4Final = (fnMD4Final)GetProcAddress( module, "MD4Final" ); + + if (!pMD4Init || !pMD4Update || !pMD4Final) goto out; + + memset( &ctx, 0, sizeof(ctx) ); + pMD4Init( &ctx ); + ok( !ctxcmp( &ctx, &ctx_initialized ), "invalid initialization\n" ); + + pMD4Update( &ctx, message, size ); + ok( !ctxcmp( &ctx, &ctx_update1 ), "update doesn't work correctly\n" ); + + pMD4Update( &ctx, message, size ); + ok( !ctxcmp( &ctx, &ctx_update2 ), "update doesn't work correctly\n" ); + + pMD4Final( &ctx ); + ok( ctxcmp( &ctx, &ctx_initialized ), "context has changed\n" ); + ok( !memcmp( ctx.digest, expect, sizeof(expect) ), "incorrect result\n" ); + +out: + FreeLibrary( module ); +} + +START_TEST(crypt_md4) +{ + test_md4_ctx(); +} diff --git a/reactos/lib/advapi32/winetests/crypt_md5.c b/reactos/lib/advapi32/winetests/crypt_md5.c index 68afd60c5c6..106ccdf2895 100644 --- a/reactos/lib/advapi32/winetests/crypt_md5.c +++ b/reactos/lib/advapi32/winetests/crypt_md5.c @@ -1,109 +1,109 @@ -/* - * Unit tests for MD5 functions - * - * Copyright 2004 Hans Leidekker - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -typedef struct -{ - unsigned int i[2]; - unsigned int buf[4]; - unsigned char in[64]; - unsigned char digest[16]; -} MD5_CTX; - -typedef VOID (WINAPI *fnMD5Init)( MD5_CTX *ctx ); -typedef VOID (WINAPI *fnMD5Update)( MD5_CTX *ctx, const unsigned char *src, const int len ); -typedef VOID (WINAPI *fnMD5Final)( MD5_CTX *ctx ); - -fnMD5Init pMD5Init; -fnMD5Update pMD5Update; -fnMD5Final pMD5Final; - -#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD5_CTX, in ) ) - -void test_md5_ctx() -{ - static unsigned char message[] = - "In our Life there's If" - "In our beliefs there's Lie" - "In our business there is Sin" - "In our bodies, there is Die"; - - int size = strlen( message ); - HMODULE module; - - MD5_CTX ctx; - MD5_CTX ctx_initialized = - { - { 0, 0 }, - { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 } - }; - - MD5_CTX ctx_update1 = - { - { 0x00000338, 0 }, - { 0x068cb64d, 0xb7a05790, 0x426979ee, 0xed67e221 } - }; - - MD5_CTX ctx_update2 = - { - { 0x00000670, 0 }, - { 0x2f7afe58, 0xcc3e9315, 0x709c465c, 0xbf6414c8 } - }; - - unsigned char expect[16] = - { 0x43, 0x03, 0xdd, 0x8c, 0x60, 0xd9, 0x3a, 0x22, - 0x0b, 0x28, 0xd0, 0xb2, 0x65, 0x93, 0xd0, 0x36 }; - - if (!(module = LoadLibrary( "advapi32.dll" ))) return; - - pMD5Init = (fnMD5Init)GetProcAddress( module, "MD5Init" ); - pMD5Update = (fnMD5Update)GetProcAddress( module, "MD5Update" ); - pMD5Final = (fnMD5Final)GetProcAddress( module, "MD5Final" ); - - if (!pMD5Init || !pMD5Update || !pMD5Final) goto out; - - memset( &ctx, 0, sizeof(ctx) ); - pMD5Init( &ctx ); - ok( !ctxcmp( &ctx, &ctx_initialized ), "invalid initialization\n" ); - - pMD5Update( &ctx, message, size ); - ok( !ctxcmp( &ctx, &ctx_update1 ), "update doesn't work correctly\n" ); - - pMD5Update( &ctx, message, size ); - ok( !ctxcmp( &ctx, &ctx_update2 ), "update doesn't work correctly\n" ); - - pMD5Final( &ctx ); - ok( ctxcmp( &ctx, &ctx_initialized ), "context has changed\n" ); - ok( !memcmp( ctx.digest, expect, sizeof(expect) ), "incorrect result\n" ); - -out: - FreeLibrary( module ); -} - -START_TEST(crypt_md5) -{ - test_md5_ctx(); -} +/* + * Unit tests for MD5 functions + * + * Copyright 2004 Hans Leidekker + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wine/test.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" + +typedef struct +{ + unsigned int i[2]; + unsigned int buf[4]; + unsigned char in[64]; + unsigned char digest[16]; +} MD5_CTX; + +typedef VOID (WINAPI *fnMD5Init)( MD5_CTX *ctx ); +typedef VOID (WINAPI *fnMD5Update)( MD5_CTX *ctx, const unsigned char *src, const int len ); +typedef VOID (WINAPI *fnMD5Final)( MD5_CTX *ctx ); + +fnMD5Init pMD5Init; +fnMD5Update pMD5Update; +fnMD5Final pMD5Final; + +#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD5_CTX, in ) ) + +void test_md5_ctx() +{ + static unsigned char message[] = + "In our Life there's If" + "In our beliefs there's Lie" + "In our business there is Sin" + "In our bodies, there is Die"; + + int size = strlen( message ); + HMODULE module; + + MD5_CTX ctx; + MD5_CTX ctx_initialized = + { + { 0, 0 }, + { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 } + }; + + MD5_CTX ctx_update1 = + { + { 0x00000338, 0 }, + { 0x068cb64d, 0xb7a05790, 0x426979ee, 0xed67e221 } + }; + + MD5_CTX ctx_update2 = + { + { 0x00000670, 0 }, + { 0x2f7afe58, 0xcc3e9315, 0x709c465c, 0xbf6414c8 } + }; + + unsigned char expect[16] = + { 0x43, 0x03, 0xdd, 0x8c, 0x60, 0xd9, 0x3a, 0x22, + 0x0b, 0x28, 0xd0, 0xb2, 0x65, 0x93, 0xd0, 0x36 }; + + if (!(module = LoadLibrary( "advapi32.dll" ))) return; + + pMD5Init = (fnMD5Init)GetProcAddress( module, "MD5Init" ); + pMD5Update = (fnMD5Update)GetProcAddress( module, "MD5Update" ); + pMD5Final = (fnMD5Final)GetProcAddress( module, "MD5Final" ); + + if (!pMD5Init || !pMD5Update || !pMD5Final) goto out; + + memset( &ctx, 0, sizeof(ctx) ); + pMD5Init( &ctx ); + ok( !ctxcmp( &ctx, &ctx_initialized ), "invalid initialization\n" ); + + pMD5Update( &ctx, message, size ); + ok( !ctxcmp( &ctx, &ctx_update1 ), "update doesn't work correctly\n" ); + + pMD5Update( &ctx, message, size ); + ok( !ctxcmp( &ctx, &ctx_update2 ), "update doesn't work correctly\n" ); + + pMD5Final( &ctx ); + ok( ctxcmp( &ctx, &ctx_initialized ), "context has changed\n" ); + ok( !memcmp( ctx.digest, expect, sizeof(expect) ), "incorrect result\n" ); + +out: + FreeLibrary( module ); +} + +START_TEST(crypt_md5) +{ + test_md5_ctx(); +} diff --git a/reactos/lib/advapi32/winetests/crypt_sha.c b/reactos/lib/advapi32/winetests/crypt_sha.c index a3642356a89..5cf6fdb64c9 100644 --- a/reactos/lib/advapi32/winetests/crypt_sha.c +++ b/reactos/lib/advapi32/winetests/crypt_sha.c @@ -1,81 +1,81 @@ -/* - * Unit tests for SHA functions - * - * Copyright (c) 2004 Filip Navara - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -#include "wine/test.h" - -typedef struct { - ULONG Unknown[6]; - ULONG State[5]; - ULONG Count[2]; - UCHAR Buffer[64]; -} SHA_CTX, *PSHA_CTX; - -#define ctxcmp(a,b) memcmp((char*)a, (char*)b, FIELD_OFFSET(SHA_CTX, Buffer)) - -static void test_sha_ctx(void) -{ - FARPROC pA_SHAInit, pA_SHAUpdate, pA_SHAFinal; - static const char test_buffer[] = "In our Life there's If" - "In our beliefs there's Lie" - "In our business there is Sin" - "In our bodies, there is Die"; - ULONG test_buffer_size = strlen(test_buffer); - HMODULE hmod; - SHA_CTX ctx; - SHA_CTX ctx_initialized = {{0, 0, 0, 0, 0}, {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0}, {0, 0}}; - SHA_CTX ctx_update1 = {{0, 0, 0, 0, 0}, {0xdbe5eba8, 0x6b4335ca, 0xf7c94abe, 0xc9f34e31, 0x311023f0}, {0, 0x67}}; - SHA_CTX ctx_update2 = {{0, 0, 0, 0, 0}, {0x5ecc818d, 0x52498169, 0xf6758559, 0xd035a164, 0x871dd125}, {0, 0xce}}; - ULONG result[5]; - ULONG result_correct[5] = {0xe014f93, 0xe09791ec, 0x6dcf96c8, 0x8e9385fc, 0x1611c1bb}; - - hmod = LoadLibrary("advapi32.dll"); - pA_SHAInit = GetProcAddress(hmod, "A_SHAInit"); - pA_SHAUpdate = GetProcAddress(hmod, "A_SHAUpdate"); - pA_SHAFinal = GetProcAddress(hmod, "A_SHAFinal"); - - if (!pA_SHAInit || !pA_SHAUpdate || !pA_SHAFinal) return; - - RtlZeroMemory(&ctx, sizeof(ctx)); - pA_SHAInit(&ctx); - ok(!ctxcmp(&ctx, &ctx_initialized), "invalid initialization\n"); - - pA_SHAUpdate(&ctx, test_buffer, test_buffer_size); - ok(!ctxcmp(&ctx, &ctx_update1), "update doesn't work correctly\n"); - - pA_SHAUpdate(&ctx, test_buffer, test_buffer_size); - ok(!ctxcmp(&ctx, &ctx_update2), "update doesn't work correctly\n"); - - pA_SHAFinal(&ctx, result); - ok(!ctxcmp(&ctx, &ctx_initialized), "context hasn't been reinitialized\n"); - ok(!memcmp(result, result_correct, sizeof(result)), "incorrect result\n"); - - FreeLibrary(hmod); -} - -START_TEST(crypt_sha) -{ - test_sha_ctx(); -} +/* + * Unit tests for SHA functions + * + * Copyright (c) 2004 Filip Navara + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" + +#include "wine/test.h" + +typedef struct { + ULONG Unknown[6]; + ULONG State[5]; + ULONG Count[2]; + UCHAR Buffer[64]; +} SHA_CTX, *PSHA_CTX; + +#define ctxcmp(a,b) memcmp((char*)a, (char*)b, FIELD_OFFSET(SHA_CTX, Buffer)) + +static void test_sha_ctx(void) +{ + FARPROC pA_SHAInit, pA_SHAUpdate, pA_SHAFinal; + static const char test_buffer[] = "In our Life there's If" + "In our beliefs there's Lie" + "In our business there is Sin" + "In our bodies, there is Die"; + ULONG test_buffer_size = strlen(test_buffer); + HMODULE hmod; + SHA_CTX ctx; + SHA_CTX ctx_initialized = {{0, 0, 0, 0, 0}, {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0}, {0, 0}}; + SHA_CTX ctx_update1 = {{0, 0, 0, 0, 0}, {0xdbe5eba8, 0x6b4335ca, 0xf7c94abe, 0xc9f34e31, 0x311023f0}, {0, 0x67}}; + SHA_CTX ctx_update2 = {{0, 0, 0, 0, 0}, {0x5ecc818d, 0x52498169, 0xf6758559, 0xd035a164, 0x871dd125}, {0, 0xce}}; + ULONG result[5]; + ULONG result_correct[5] = {0xe014f93, 0xe09791ec, 0x6dcf96c8, 0x8e9385fc, 0x1611c1bb}; + + hmod = LoadLibrary("advapi32.dll"); + pA_SHAInit = GetProcAddress(hmod, "A_SHAInit"); + pA_SHAUpdate = GetProcAddress(hmod, "A_SHAUpdate"); + pA_SHAFinal = GetProcAddress(hmod, "A_SHAFinal"); + + if (!pA_SHAInit || !pA_SHAUpdate || !pA_SHAFinal) return; + + RtlZeroMemory(&ctx, sizeof(ctx)); + pA_SHAInit(&ctx); + ok(!ctxcmp(&ctx, &ctx_initialized), "invalid initialization\n"); + + pA_SHAUpdate(&ctx, test_buffer, test_buffer_size); + ok(!ctxcmp(&ctx, &ctx_update1), "update doesn't work correctly\n"); + + pA_SHAUpdate(&ctx, test_buffer, test_buffer_size); + ok(!ctxcmp(&ctx, &ctx_update2), "update doesn't work correctly\n"); + + pA_SHAFinal(&ctx, result); + ok(!ctxcmp(&ctx, &ctx_initialized), "context hasn't been reinitialized\n"); + ok(!memcmp(result, result_correct, sizeof(result)), "incorrect result\n"); + + FreeLibrary(hmod); +} + +START_TEST(crypt_sha) +{ + test_sha_ctx(); +} diff --git a/reactos/lib/advapi32/winetests/registry.c b/reactos/lib/advapi32/winetests/registry.c index 0416a3ee742..bd26bb6b25a 100644 --- a/reactos/lib/advapi32/winetests/registry.c +++ b/reactos/lib/advapi32/winetests/registry.c @@ -1,358 +1,451 @@ -/* - * Unit tests for registry functions - * - * Copyright (c) 2002 Alexandre Julliard - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winerror.h" - -static HKEY hkey_main; - -static const char * sTestpath1 = "%LONGSYSTEMVAR%\\subdir1"; -static const char * sTestpath2 = "%FOO%\\subdir1"; - -/* delete key and all its subkeys */ -static DWORD delete_key( HKEY hkey ) -{ - char name[MAX_PATH]; - DWORD ret; - - while (!(ret = RegEnumKeyA(hkey, 0, name, sizeof(name)))) - { - HKEY tmp; - if (!(ret = RegOpenKeyExA( hkey, name, 0, KEY_ENUMERATE_SUB_KEYS, &tmp ))) - { - ret = delete_key( tmp ); - RegCloseKey( tmp ); - } - if (ret) break; - } - if (ret != ERROR_NO_MORE_ITEMS) return ret; - RegDeleteKeyA( hkey, NULL ); - return 0; -} - -static void setup_main_key(void) -{ - if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main )) delete_key( hkey_main ); - - assert (!RegCreateKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main )); -} - -static void create_test_entries(void) -{ - SetEnvironmentVariableA("LONGSYSTEMVAR", "bar"); - SetEnvironmentVariableA("FOO", "ImARatherLongButIndeedNeededString"); - - ok(!RegSetValueExA(hkey_main,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1), - "RegSetValueExA failed\n"); - ok(!RegSetValueExA(hkey_main,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1), - "RegSetValueExA failed\n"); - ok(!RegSetValueExA(hkey_main,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1), - "RegSetValueExA failed\n"); -} - -static void test_enum_value(void) -{ - DWORD res; - char value[20], data[20]; - WCHAR valueW[20], dataW[20]; - DWORD val_count, data_count, type; - static const WCHAR foobarW[] = {'f','o','o','b','a','r',0}; - static const WCHAR testW[] = {'T','e','s','t',0}; - static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0}; - - /* check NULL data with zero length */ - res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, NULL, 0 ); - if (GetVersion() & 0x80000000) - ok( res == ERROR_INVALID_PARAMETER, "RegSetValueExA returned %ld\n", res ); - else - ok( !res, "RegSetValueExA returned %ld\n", res ); - res = RegSetValueExA( hkey_main, "Test", 0, REG_EXPAND_SZ, NULL, 0 ); - ok( !res, "RegSetValueExA returned %ld\n", res ); - res = RegSetValueExA( hkey_main, "Test", 0, REG_BINARY, NULL, 0 ); - ok( !res, "RegSetValueExA returned %ld\n", res ); - - res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 ); - ok( res == 0, "RegSetValueExA failed error %ld\n", res ); - - /* overflow both name and data */ - val_count = 2; - data_count = 2; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 2, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); - ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data ); - - /* overflow name */ - val_count = 3; - data_count = 20; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - /* Win9x returns 2 as specified by MSDN but NT returns 3... */ - ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); -#if 0 - /* v5.1.2600.0 (XP Home) does not touch value or data in this case */ - ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'\n", value ); - ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data ); -#endif - - /* overflow empty name */ - val_count = 0; - data_count = 20; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 0, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); -#if 0 - /* v5.1.2600.0 (XP Home) does not touch data in this case */ - ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data ); -#endif - - /* overflow data */ - val_count = 20; - data_count = 2; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 20, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); - ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data ); - - /* no overflow */ - val_count = 20; - data_count = 20; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); - ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "Test" ), "value is '%s' instead of Test\n", value ); - ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar\n", data ); - - /* Unicode tests */ - - SetLastError(0); - res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (const BYTE *)foobarW, 7*sizeof(WCHAR) ); - if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - goto CLEANUP; - ok( res == 0, "RegSetValueExW failed error %ld\n", res ); - - /* overflow both name and data */ - val_count = 2; - data_count = 2; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 2, "val_count set to %ld\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" ); - ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); - - /* overflow name */ - val_count = 3; - data_count = 20; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 3, "val_count set to %ld\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" ); - ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); - - /* overflow data */ - val_count = 20; - data_count = 2; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); - ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); - - /* no overflow */ - val_count = 20; - data_count = 20; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); - ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); - ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" ); - -CLEANUP: - /* cleanup */ - RegDeleteValueA( hkey_main, "Test" ); -} - -static void test_query_value_ex() -{ - DWORD ret; - DWORD size; - DWORD type; - - ret = RegQueryValueExA(hkey_main, "Test2", NULL, &type, NULL, &size); - ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - ok(size == strlen(sTestpath1) + 1, "(%ld,%ld)\n", (DWORD)strlen(sTestpath1) + 1, size); - ok(type == REG_SZ, "type %ld is not REG_SZ\n", type); -} - -static void test_reg_open_key() -{ - DWORD ret = 0; - HKEY hkResult = NULL; - HKEY hkPreserve = NULL; - - /* successful open */ - ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult); - ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - ok(hkResult != NULL, "expected hkResult != NULL\n"); - hkPreserve = hkResult; - - /* open same key twice */ - ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult); - ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - ok(hkResult != hkPreserve && hkResult != NULL, - "expected hkResult != hkPreserve and hkResult != NULL\n"); - RegCloseKey(hkResult); - - /* open nonexistent key - * check that hkResult is set to NULL - */ - hkResult = hkPreserve; - ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult); - ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret); - ok(hkResult == NULL, "expected hkResult == NULL\n"); - - /* open the same nonexistent key again to make sure the key wasn't created */ - hkResult = hkPreserve; - ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult); - ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret); - ok(hkResult == NULL, "expected hkResult == NULL\n"); - - /* send in NULL lpSubKey - * check that hkResult receives the value of hKey - */ - hkResult = hkPreserve; - ret = RegOpenKeyA(HKEY_CURRENT_USER, NULL, &hkResult); - ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n"); - - /* send empty-string in lpSubKey */ - hkResult = hkPreserve; - ret = RegOpenKeyA(HKEY_CURRENT_USER, "", &hkResult); - ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n"); - - /* send in NULL lpSubKey and NULL hKey - * hkResult is set to NULL - */ - hkResult = hkPreserve; - ret = RegOpenKeyA(NULL, NULL, &hkResult); - ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - ok(hkResult == NULL, "expected hkResult == NULL\n"); - - /* only send NULL hKey - * the value of hkResult remains unchanged - */ - hkResult = hkPreserve; - ret = RegOpenKeyA(NULL, "Software\\Wine\\Test", &hkResult); - ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret); - ok(hkResult == hkPreserve, "expected hkResult == hkPreserve\n"); - RegCloseKey(hkResult); - - /* send in NULL hkResult */ - ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", NULL); - ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret); -} - -static void test_reg_close_key() -{ - DWORD ret = 0; - HKEY hkHandle; - - /* successfully close key - * hkHandle remains changed after call to RegCloseKey - */ - ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkHandle); - ret = RegCloseKey(hkHandle); - ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - - /* try to close the key twice */ - ret = RegCloseKey(hkHandle); - ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret); - - /* try to close a NULL handle */ - ret = RegCloseKey(NULL); - ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret); -} - -START_TEST(registry) -{ - setup_main_key(); - create_test_entries(); - test_enum_value(); - test_query_value_ex(); - test_reg_open_key(); - test_reg_close_key(); - - /* cleanup */ - delete_key( hkey_main ); -} +/* + * Unit tests for registry functions + * + * Copyright (c) 2002 Alexandre Julliard + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include "wine/test.h" +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winerror.h" + +static HKEY hkey_main; + +static const char * sTestpath1 = "%LONGSYSTEMVAR%\\subdir1"; +static const char * sTestpath2 = "%FOO%\\subdir1"; + +/* delete key and all its subkeys */ +static DWORD delete_key( HKEY hkey ) +{ + char name[MAX_PATH]; + DWORD ret; + + while (!(ret = RegEnumKeyA(hkey, 0, name, sizeof(name)))) + { + HKEY tmp; + if (!(ret = RegOpenKeyExA( hkey, name, 0, KEY_ENUMERATE_SUB_KEYS, &tmp ))) + { + ret = delete_key( tmp ); + RegCloseKey( tmp ); + } + if (ret) break; + } + if (ret != ERROR_NO_MORE_ITEMS) return ret; + RegDeleteKeyA( hkey, "" ); + return 0; +} + +static void setup_main_key(void) +{ + if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main )) delete_key( hkey_main ); + + assert (!RegCreateKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main )); +} + +static void create_test_entries(void) +{ + SetEnvironmentVariableA("LONGSYSTEMVAR", "bar"); + SetEnvironmentVariableA("FOO", "ImARatherLongButIndeedNeededString"); + + ok(!RegSetValueExA(hkey_main,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1), + "RegSetValueExA failed\n"); + ok(!RegSetValueExA(hkey_main,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1), + "RegSetValueExA failed\n"); + ok(!RegSetValueExA(hkey_main,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1), + "RegSetValueExA failed\n"); +} + +static void test_enum_value(void) +{ + DWORD res; + HKEY test_key; + char value[20], data[20]; + WCHAR valueW[20], dataW[20]; + DWORD val_count, data_count, type; + static const WCHAR foobarW[] = {'f','o','o','b','a','r',0}; + static const WCHAR testW[] = {'T','e','s','t',0}; + static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0}; + + /* create the working key for new 'Test' value */ + res = RegCreateKeyA( hkey_main, "TestKey", &test_key ); + ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res); + + /* check NULL data with zero length */ + res = RegSetValueExA( test_key, "Test", 0, REG_SZ, NULL, 0 ); + if (GetVersion() & 0x80000000) + ok( res == ERROR_INVALID_PARAMETER, "RegSetValueExA returned %ld\n", res ); + else + ok( !res, "RegSetValueExA returned %ld\n", res ); + res = RegSetValueExA( test_key, "Test", 0, REG_EXPAND_SZ, NULL, 0 ); + ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %ld\n", res ); + res = RegSetValueExA( test_key, "Test", 0, REG_BINARY, NULL, 0 ); + ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %ld\n", res ); + + res = RegSetValueExA( test_key, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 ); + ok( res == 0, "RegSetValueExA failed error %ld\n", res ); + + /* overflow both name and data */ + val_count = 2; + data_count = 2; + type = 1234; + strcpy( value, "xxxxxxxxxx" ); + strcpy( data, "xxxxxxxxxx" ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); + ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); + ok( val_count == 2, "val_count set to %ld\n", val_count ); + ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); + ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data ); + + /* overflow name */ + val_count = 3; + data_count = 20; + type = 1234; + strcpy( value, "xxxxxxxxxx" ); + strcpy( data, "xxxxxxxxxx" ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); + ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); + /* Win9x returns 2 as specified by MSDN but NT returns 3... */ + ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count ); + ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); +#if 0 + /* v5.1.2600.0 (XP Home) does not touch value or data in this case */ + ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'\n", value ); + ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data ); +#endif + + /* overflow empty name */ + val_count = 0; + data_count = 20; + type = 1234; + strcpy( value, "xxxxxxxxxx" ); + strcpy( data, "xxxxxxxxxx" ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); + ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); + ok( val_count == 0, "val_count set to %ld\n", val_count ); + ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); +#if 0 + /* v5.1.2600.0 (XP Home) does not touch data in this case */ + ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data ); +#endif + + /* overflow data */ + val_count = 20; + data_count = 2; + type = 1234; + strcpy( value, "xxxxxxxxxx" ); + strcpy( data, "xxxxxxxxxx" ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); + ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); + ok( val_count == 20, "val_count set to %ld\n", val_count ); + ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); + ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data ); + + /* no overflow */ + val_count = 20; + data_count = 20; + type = 1234; + strcpy( value, "xxxxxxxxxx" ); + strcpy( data, "xxxxxxxxxx" ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); + ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); + ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); + ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !strcmp( value, "Test" ), "value is '%s' instead of Test\n", value ); + ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar\n", data ); + + /* Unicode tests */ + + SetLastError(0); + res = RegSetValueExW( test_key, testW, 0, REG_SZ, (const BYTE *)foobarW, 7*sizeof(WCHAR) ); + if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) + return; + ok( res == 0, "RegSetValueExW failed error %ld\n", res ); + + /* overflow both name and data */ + val_count = 2; + data_count = 2; + type = 1234; + memcpy( valueW, xxxW, sizeof(xxxW) ); + memcpy( dataW, xxxW, sizeof(xxxW) ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); + ok( val_count == 2, "val_count set to %ld\n", val_count ); + ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" ); + ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); + + /* overflow name */ + val_count = 3; + data_count = 20; + type = 1234; + memcpy( valueW, xxxW, sizeof(xxxW) ); + memcpy( dataW, xxxW, sizeof(xxxW) ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); + ok( val_count == 3, "val_count set to %ld\n", val_count ); + ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" ); + ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); + + /* overflow data */ + val_count = 20; + data_count = 2; + type = 1234; + memcpy( valueW, xxxW, sizeof(xxxW) ); + memcpy( dataW, xxxW, sizeof(xxxW) ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); + ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); + ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); + ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); + + /* no overflow */ + val_count = 20; + data_count = 20; + type = 1234; + memcpy( valueW, xxxW, sizeof(xxxW) ); + memcpy( dataW, xxxW, sizeof(xxxW) ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); + ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); + ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); + ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); + ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); + ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" ); +} + +static void test_query_value_ex() +{ + DWORD ret; + DWORD size; + DWORD type; + + ret = RegQueryValueExA(hkey_main, "Test2", NULL, &type, NULL, &size); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + ok(size == strlen(sTestpath1) + 1, "(%ld,%ld)\n", (DWORD)strlen(sTestpath1) + 1, size); + ok(type == REG_SZ, "type %ld is not REG_SZ\n", type); +} + +static void test_reg_open_key() +{ + DWORD ret = 0; + HKEY hkResult = NULL; + HKEY hkPreserve = NULL; + + /* successful open */ + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + ok(hkResult != NULL, "expected hkResult != NULL\n"); + hkPreserve = hkResult; + + /* open same key twice */ + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + ok(hkResult != hkPreserve, "epxected hkResult != hkPreserve\n"); + ok(hkResult != NULL, "hkResult != NULL\n"); + RegCloseKey(hkResult); + + /* open nonexistent key + * check that hkResult is set to NULL + */ + hkResult = hkPreserve; + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult); + ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret); + ok(hkResult == NULL, "expected hkResult == NULL\n"); + + /* open the same nonexistent key again to make sure the key wasn't created */ + hkResult = hkPreserve; + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult); + ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret); + ok(hkResult == NULL, "expected hkResult == NULL\n"); + + /* send in NULL lpSubKey + * check that hkResult receives the value of hKey + */ + hkResult = hkPreserve; + ret = RegOpenKeyA(HKEY_CURRENT_USER, NULL, &hkResult); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n"); + + /* send empty-string in lpSubKey */ + hkResult = hkPreserve; + ret = RegOpenKeyA(HKEY_CURRENT_USER, "", &hkResult); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n"); + + /* send in NULL lpSubKey and NULL hKey + * hkResult is set to NULL + */ + hkResult = hkPreserve; + ret = RegOpenKeyA(NULL, NULL, &hkResult); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + ok(hkResult == NULL, "expected hkResult == NULL\n"); + + /* only send NULL hKey + * the value of hkResult remains unchanged + */ + hkResult = hkPreserve; + ret = RegOpenKeyA(NULL, "Software\\Wine\\Test", &hkResult); + ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_BADKEY, /* Windows 95 returns BADKEY */ + "expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", ret); + ok(hkResult == hkPreserve, "expected hkResult == hkPreserve\n"); + RegCloseKey(hkResult); + + /* send in NULL hkResult */ + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", NULL); + ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret); +} + +static void test_reg_close_key() +{ + DWORD ret = 0; + HKEY hkHandle; + + /* successfully close key + * hkHandle remains changed after call to RegCloseKey + */ + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkHandle); + ret = RegCloseKey(hkHandle); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + + /* try to close the key twice */ + ret = RegCloseKey(hkHandle); /* Windows 95 doesn't mind. */ + ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_SUCCESS, + "expected ERROR_INVALID_HANDLE or ERROR_SUCCESS, got %ld\n", ret); + + /* try to close a NULL handle */ + ret = RegCloseKey(NULL); + ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_BADKEY, /* Windows 95 returns BADKEY */ + "expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", ret); +} + +static void test_reg_delete_key() +{ + DWORD ret; + + ret = RegDeleteKey(hkey_main, NULL); + ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_ACCESS_DENIED, + "expected ERROR_INVALID_PARAMETER or ERROR_ACCESS_DENIED, got %ld\n", ret); +} + +static void test_reg_save_key() +{ + DWORD ret; + + ret = RegSaveKey(hkey_main, "saved_key", NULL); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); +} + +static void test_reg_load_key() +{ + DWORD ret; + HKEY hkHandle; + + ret = RegLoadKey(HKEY_LOCAL_MACHINE, "Test", "saved_key"); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + + ret = RegOpenKey(HKEY_LOCAL_MACHINE, "Test", &hkHandle); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + + RegCloseKey(hkHandle); +} + +static void test_reg_unload_key() +{ + DWORD ret; + + ret = RegUnLoadKey(HKEY_LOCAL_MACHINE, "Test"); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + + DeleteFile("saved_key"); +} + +static BOOL set_privileges(LPCSTR privilege, BOOL set) +{ + TOKEN_PRIVILEGES tp; + HANDLE hToken; + LUID luid; + + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) + return FALSE; + + if(!LookupPrivilegeValue(NULL, privilege, &luid)) + { + CloseHandle(hToken); + return FALSE; + } + + tp.PrivilegeCount = 1; + tp.Privileges[0].Luid = luid; + + if (set) + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + else + tp.Privileges[0].Attributes = 0; + + AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL); + if (GetLastError() != ERROR_SUCCESS) + { + CloseHandle(hToken); + return FALSE; + } + + CloseHandle(hToken); + return TRUE; +} + +START_TEST(registry) +{ + setup_main_key(); + create_test_entries(); + test_enum_value(); +#if 0 + test_query_value_ex(); + test_reg_open_key(); + test_reg_close_key(); + test_reg_delete_key(); + + /* SaveKey/LoadKey require the SE_BACKUP_NAME privilege to be set */ + if (set_privileges(SE_BACKUP_NAME, TRUE) && + set_privileges(SE_RESTORE_NAME, TRUE)) + { + test_reg_save_key(); + test_reg_load_key(); + test_reg_unload_key(); + + set_privileges(SE_BACKUP_NAME, FALSE); + set_privileges(SE_RESTORE_NAME, FALSE); + } +#endif + /* cleanup */ + delete_key( hkey_main ); +} diff --git a/reactos/lib/advapi32/winetests/security.c b/reactos/lib/advapi32/winetests/security.c index ad8a4e16777..cc7f5379e15 100644 --- a/reactos/lib/advapi32/winetests/security.c +++ b/reactos/lib/advapi32/winetests/security.c @@ -1,408 +1,443 @@ -/* - * Unit tests for security functions - * - * Copyright (c) 2004 Mike McCormack - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "aclapi.h" -#include "winnt.h" - -typedef BOOL (WINAPI *fnBuildTrusteeWithSidA)( TRUSTEE *trustee, PSID psid ); -typedef BOOL (WINAPI *fnBuildTrusteeWithNameA)( TRUSTEE *trustee, LPSTR str ); -typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str ); -typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid ); - -static HMODULE hmod; - -fnBuildTrusteeWithSidA pBuildTrusteeWithSidA; -fnBuildTrusteeWithNameA pBuildTrusteeWithNameA; -fnConvertSidToStringSidA pConvertSidToStringSidA; -fnConvertStringSidToSidA pConvertStringSidToSidA; - -struct sidRef -{ - SID_IDENTIFIER_AUTHORITY auth; - const char *refStr; -}; - -static void init(void) -{ - hmod = GetModuleHandle("advapi32.dll"); -} - -void test_sid() -{ - struct sidRef refs[] = { - { { {0x00,0x00,0x33,0x44,0x55,0x66} }, "S-1-860116326-1" }, - { { {0x00,0x00,0x01,0x02,0x03,0x04} }, "S-1-16909060-1" }, - { { {0x00,0x00,0x00,0x01,0x02,0x03} }, "S-1-66051-1" }, - { { {0x00,0x00,0x00,0x00,0x01,0x02} }, "S-1-258-1" }, - { { {0x00,0x00,0x00,0x00,0x00,0x02} }, "S-1-2-1" }, - { { {0x00,0x00,0x00,0x00,0x00,0x0c} }, "S-1-12-1" }, - }; - const char noSubAuthStr[] = "S-1-5"; - unsigned int i; - PSID psid = NULL; - BOOL r; - LPSTR str = NULL; - - pConvertSidToStringSidA = (fnConvertSidToStringSidA) - GetProcAddress( hmod, "ConvertSidToStringSidA" ); - if( !pConvertSidToStringSidA ) - return; - pConvertStringSidToSidA = (fnConvertStringSidToSidA) - GetProcAddress( hmod, "ConvertStringSidToSidA" ); - if( !pConvertStringSidToSidA ) - return; - - r = pConvertStringSidToSidA( NULL, NULL ); - ok( !r, "expected failure with NULL parameters\n" ); - if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) - return; - ok( GetLastError() == ERROR_INVALID_PARAMETER, - "expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n", - GetLastError() ); - - r = pConvertStringSidToSidA( refs[0].refStr, NULL ); - ok( !r && GetLastError() == ERROR_INVALID_PARAMETER, - "expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n", - GetLastError() ); - - r = pConvertStringSidToSidA( NULL, &str ); - ok( !r && GetLastError() == ERROR_INVALID_PARAMETER, - "expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n", - GetLastError() ); - - r = pConvertStringSidToSidA( noSubAuthStr, &psid ); - ok( !r, - "expected failure with no sub authorities\n" ); - ok( GetLastError() == ERROR_INVALID_SID, - "expected GetLastError() is ERROR_INVALID_SID, got %ld\n", - GetLastError() ); - - for( i = 0; i < sizeof(refs) / sizeof(refs[0]); i++ ) - { - PISID pisid; - - r = AllocateAndInitializeSid( &refs[i].auth, 1,1,0,0,0,0,0,0,0, - &psid ); - ok( r, "failed to allocate sid\n" ); - r = pConvertSidToStringSidA( psid, &str ); - ok( r, "failed to convert sid\n" ); - ok( !strcmp( str, refs[i].refStr ), - "incorrect sid, expected %s, got %s\n", refs[i].refStr, str ); - if( str ) - LocalFree( str ); - if( psid ) - FreeSid( psid ); - - r = pConvertStringSidToSidA( refs[i].refStr, &psid ); - ok( r, "failed to parse sid string\n" ); - pisid = (PISID)psid; - ok( pisid && - !memcmp( pisid->IdentifierAuthority.Value, refs[i].auth.Value, - sizeof(refs[i].auth) ), - "string sid %s didn't parse to expected value\n" - "(got 0x%04x%08lx, expected 0x%04x%08lx)\n", - refs[i].refStr, - MAKEWORD( pisid->IdentifierAuthority.Value[1], - pisid->IdentifierAuthority.Value[0] ), - MAKELONG( MAKEWORD( pisid->IdentifierAuthority.Value[5], - pisid->IdentifierAuthority.Value[4] ), - MAKEWORD( pisid->IdentifierAuthority.Value[3], - pisid->IdentifierAuthority.Value[2] ) ), - MAKEWORD( refs[i].auth.Value[1], refs[i].auth.Value[0] ), - MAKELONG( MAKEWORD( refs[i].auth.Value[5], refs[i].auth.Value[4] ), - MAKEWORD( refs[i].auth.Value[3], refs[i].auth.Value[2] ) ) ); - if( psid ) - LocalFree( psid ); - } -} - -void test_trustee() -{ - TRUSTEE trustee; - PSID psid; - LPSTR str = "2jjj"; - - SID_IDENTIFIER_AUTHORITY auth = { {0x11,0x22,0,0,0, 0} }; - - pBuildTrusteeWithSidA = (fnBuildTrusteeWithSidA) - GetProcAddress( hmod, "BuildTrusteeWithSidA" ); - pBuildTrusteeWithNameA = (fnBuildTrusteeWithNameA) - GetProcAddress( hmod, "BuildTrusteeWithNameA" ); - if( !pBuildTrusteeWithSidA || !pBuildTrusteeWithNameA) - return; - - if ( ! AllocateAndInitializeSid( &auth, 1, 42, 0,0,0,0,0,0,0,&psid ) ) - { - trace( "failed to init SID\n" ); - return; - } - - memset( &trustee, 0xff, sizeof trustee ); - pBuildTrusteeWithSidA( &trustee, psid ); - - ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n"); - ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE, - "MultipleTrusteeOperation wrong\n"); - ok( trustee.TrusteeForm == TRUSTEE_IS_SID, "TrusteeForm wrong\n"); - ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); - ok( trustee.ptstrName == (LPSTR) psid, "ptstrName wrong\n" ); - FreeSid( psid ); - - /* test BuildTrusteeWithNameA */ - memset( &trustee, 0xff, sizeof trustee ); - pBuildTrusteeWithNameA( &trustee, str ); - - ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n"); - ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE, - "MultipleTrusteeOperation wrong\n"); - ok( trustee.TrusteeForm == TRUSTEE_IS_NAME, "TrusteeForm wrong\n"); - ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); - ok( trustee.ptstrName == str, "ptstrName wrong\n" ); -} - -/* If the first isn't defined, assume none is */ -#ifndef SE_MIN_WELL_KNOWN_PRIVILEGE -#define SE_MIN_WELL_KNOWN_PRIVILEGE 2L -#define SE_CREATE_TOKEN_PRIVILEGE 2L -#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE 3L -#define SE_LOCK_MEMORY_PRIVILEGE 4L -#define SE_INCREASE_QUOTA_PRIVILEGE 5L -#define SE_MACHINE_ACCOUNT_PRIVILEGE 6L -#define SE_TCB_PRIVILEGE 7L -#define SE_SECURITY_PRIVILEGE 8L -#define SE_TAKE_OWNERSHIP_PRIVILEGE 9L -#define SE_LOAD_DRIVER_PRIVILEGE 10L -#define SE_SYSTEM_PROFILE_PRIVILEGE 11L -#define SE_SYSTEMTIME_PRIVILEGE 12L -#define SE_PROF_SINGLE_PROCESS_PRIVILEGE 13L -#define SE_INC_BASE_PRIORITY_PRIVILEGE 14L -#define SE_CREATE_PAGEFILE_PRIVILEGE 15L -#define SE_CREATE_PERMANENT_PRIVILEGE 16L -#define SE_BACKUP_PRIVILEGE 17L -#define SE_RESTORE_PRIVILEGE 18L -#define SE_SHUTDOWN_PRIVILEGE 19L -#define SE_DEBUG_PRIVILEGE 20L -#define SE_AUDIT_PRIVILEGE 21L -#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE 22L -#define SE_CHANGE_NOTIFY_PRIVILLEGE 23L -#define SE_REMOTE_SHUTDOWN_PRIVILEGE 24L -#define SE_UNDOCK_PRIVILEGE 25L -#define SE_SYNC_AGENT_PRIVILEGE 26L -#define SE_ENABLE_DELEGATION_PRIVILEGE 27L -#define SE_MANAGE_VOLUME_PRIVILEGE 28L -#define SE_IMPERSONATE_PRIVILEGE 29L -#define SE_CREATE_GLOBAL_PRIVILEGE 30L -#define SE_MAX_WELL_KNOWN_PRIVILEGE SE_CREATE_GLOBAL_PRIVILEGE -#endif /* ndef SE_MIN_WELL_KNOWN_PRIVILEGE */ - -static void test_allocateLuid(void) -{ - BOOL (WINAPI *pAllocateLocallyUniqueId)(PLUID); - LUID luid1, luid2; - BOOL ret; - - pAllocateLocallyUniqueId = (void*)GetProcAddress(hmod, "AllocateLocallyUniqueId"); - if (!pAllocateLocallyUniqueId) return; - - ret = pAllocateLocallyUniqueId(&luid1); - if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - return; - - ok(ret, - "AllocateLocallyUniqueId failed: %ld\n", GetLastError()); - ret = pAllocateLocallyUniqueId(&luid2); - ok( ret, - "AllocateLocallyUniqueId failed: %ld\n", GetLastError()); - ok(luid1.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE || luid1.HighPart != 0, - "AllocateLocallyUniqueId returned a well-known LUID\n"); - ok(luid1.LowPart != luid2.LowPart || luid1.HighPart != luid2.HighPart, - "AllocateLocallyUniqueId returned non-unique LUIDs\n"); - ret = pAllocateLocallyUniqueId(NULL); - ok( !ret && GetLastError() == ERROR_NOACCESS, - "AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %ld\n", - GetLastError()); -} - -static void test_lookupPrivilegeName(void) -{ - BOOL (WINAPI *pLookupPrivilegeNameA)(LPSTR, PLUID, LPSTR, LPDWORD); - char buf[MAX_PATH]; /* arbitrary, seems long enough */ - DWORD cchName = sizeof(buf); - LUID luid = { 0, 0 }; - LONG i; - BOOL ret; - - /* check whether it's available first */ - pLookupPrivilegeNameA = (void*)GetProcAddress(hmod, "LookupPrivilegeNameA"); - if (!pLookupPrivilegeNameA) return; - luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; - ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); - if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - return; - - /* check with a short buffer */ - cchName = 0; - luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; - ret = pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName); - ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n", - GetLastError()); - ok(cchName == strlen("SeCreateTokenPrivilege") + 1, - "LookupPrivilegeNameA returned an incorrect required length for\n" - "SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName, - strlen("SeCreateTokenPrivilege") + 1); - /* check a known value and its returned length on success */ - cchName = sizeof(buf); - ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) && - cchName == strlen("SeCreateTokenPrivilege"), - "LookupPrivilegeNameA returned an incorrect output length for\n" - "SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName, - (int)strlen("SeCreateTokenPrivilege")); - /* check known values */ - for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i < SE_MAX_WELL_KNOWN_PRIVILEGE; i++) - { - luid.LowPart = i; - cchName = sizeof(buf); - ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); - ok( ret && GetLastError() != ERROR_NO_SUCH_PRIVILEGE, - "LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError()); - } - /* check a bogus LUID */ - luid.LowPart = 0xdeadbeef; - cchName = sizeof(buf); - ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); - ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, - "LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", - GetLastError()); - /* check on a bogus system */ - luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; - cchName = sizeof(buf); - ret = pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName); - ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE, - "LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n", - GetLastError()); -} - -struct NameToLUID -{ - const char *name; - DWORD lowPart; -}; - -static void test_lookupPrivilegeValue(void) -{ - static const struct NameToLUID privs[] = { - { "SeCreateTokenPrivilege", SE_CREATE_TOKEN_PRIVILEGE }, - { "SeAssignPrimaryTokenPrivilege", SE_ASSIGNPRIMARYTOKEN_PRIVILEGE }, - { "SeLockMemoryPrivilege", SE_LOCK_MEMORY_PRIVILEGE }, - { "SeIncreaseQuotaPrivilege", SE_INCREASE_QUOTA_PRIVILEGE }, - { "SeMachineAccountPrivilege", SE_MACHINE_ACCOUNT_PRIVILEGE }, - { "SeTcbPrivilege", SE_TCB_PRIVILEGE }, - { "SeSecurityPrivilege", SE_SECURITY_PRIVILEGE }, - { "SeTakeOwnershipPrivilege", SE_TAKE_OWNERSHIP_PRIVILEGE }, - { "SeLoadDriverPrivilege", SE_LOAD_DRIVER_PRIVILEGE }, - { "SeSystemProfilePrivilege", SE_SYSTEM_PROFILE_PRIVILEGE }, - { "SeSystemtimePrivilege", SE_SYSTEMTIME_PRIVILEGE }, - { "SeProfileSingleProcessPrivilege", SE_PROF_SINGLE_PROCESS_PRIVILEGE }, - { "SeIncreaseBasePriorityPrivilege", SE_INC_BASE_PRIORITY_PRIVILEGE }, - { "SeCreatePagefilePrivilege", SE_CREATE_PAGEFILE_PRIVILEGE }, - { "SeCreatePermanentPrivilege", SE_CREATE_PERMANENT_PRIVILEGE }, - { "SeBackupPrivilege", SE_BACKUP_PRIVILEGE }, - { "SeRestorePrivilege", SE_RESTORE_PRIVILEGE }, - { "SeShutdownPrivilege", SE_SHUTDOWN_PRIVILEGE }, - { "SeDebugPrivilege", SE_DEBUG_PRIVILEGE }, - { "SeAuditPrivilege", SE_AUDIT_PRIVILEGE }, - { "SeSystemEnvironmentPrivilege", SE_SYSTEM_ENVIRONMENT_PRIVILEGE }, - { "SeChangeNotifyPrivilege", SE_CHANGE_NOTIFY_PRIVILLEGE }, - { "SeRemoteShutdownPrivilege", SE_REMOTE_SHUTDOWN_PRIVILEGE }, - { "SeUndockPrivilege", SE_UNDOCK_PRIVILEGE }, - { "SeSyncAgentPrivilege", SE_SYNC_AGENT_PRIVILEGE }, - { "SeEnableDelegationPrivilege", SE_ENABLE_DELEGATION_PRIVILEGE }, - { "SeManageVolumePrivilege", SE_MANAGE_VOLUME_PRIVILEGE }, - { "SeImpersonatePrivilege", SE_IMPERSONATE_PRIVILEGE }, - { "SeCreateGlobalPrivilege", SE_CREATE_GLOBAL_PRIVILEGE }, - }; - BOOL (WINAPI *pLookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID); - int i; - LUID luid; - BOOL ret; - - /* check whether it's available first */ - pLookupPrivilegeValueA = (void*)GetProcAddress(hmod, "LookupPrivilegeValueA"); - if (!pLookupPrivilegeValueA) return; - ret = pLookupPrivilegeValueA(NULL, "SeCreateTokenPrivilege", &luid); - if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - return; - - /* check a bogus system name */ - ret = pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid); - ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE, - "LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n", - GetLastError()); - /* check a NULL string */ - ret = pLookupPrivilegeValueA(NULL, 0, &luid); - ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, - "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", - GetLastError()); - /* check a bogus privilege name */ - ret = pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid); - ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, - "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", - GetLastError()); - /* check case insensitive */ - ret = pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid); - ok( ret, - "LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %ld\n", - GetLastError()); - for (i = 0; i < sizeof(privs) / sizeof(privs[0]); i++) - { - /* Not all privileges are implemented on all Windows versions, so - * don't worry if the call fails - */ - if (pLookupPrivilegeValueA(NULL, privs[i].name, &luid)) - { - ok(luid.LowPart == privs[i].lowPart, - "LookupPrivilegeValueA returned an invalid LUID for %s\n", - privs[i].name); - } - } -} - -static void test_luid(void) -{ - test_allocateLuid(); - test_lookupPrivilegeName(); - test_lookupPrivilegeValue(); -} - -START_TEST(security) -{ - init(); - if (!hmod) return; - test_sid(); - test_trustee(); - test_luid(); -} +/* + * Unit tests for security functions + * + * Copyright (c) 2004 Mike McCormack + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wine/test.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "aclapi.h" +#include "winnt.h" + +typedef BOOL (WINAPI *fnBuildTrusteeWithSidA)( TRUSTEE *trustee, PSID psid ); +typedef BOOL (WINAPI *fnBuildTrusteeWithNameA)( TRUSTEE *trustee, LPSTR str ); +typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str ); +typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid ); +typedef BOOL (WINAPI *fnGetFileSecurityA)(LPCSTR, SECURITY_INFORMATION, + PSECURITY_DESCRIPTOR, DWORD, LPDWORD); + +static HMODULE hmod; + +fnBuildTrusteeWithSidA pBuildTrusteeWithSidA; +fnBuildTrusteeWithNameA pBuildTrusteeWithNameA; +fnConvertSidToStringSidA pConvertSidToStringSidA; +fnConvertStringSidToSidA pConvertStringSidToSidA; +fnGetFileSecurityA pGetFileSecurityA; + +struct sidRef +{ + SID_IDENTIFIER_AUTHORITY auth; + const char *refStr; +}; + +static void init(void) +{ + hmod = GetModuleHandle("advapi32.dll"); +} + +void test_sid() +{ + struct sidRef refs[] = { + { { {0x00,0x00,0x33,0x44,0x55,0x66} }, "S-1-860116326-1" }, + { { {0x00,0x00,0x01,0x02,0x03,0x04} }, "S-1-16909060-1" }, + { { {0x00,0x00,0x00,0x01,0x02,0x03} }, "S-1-66051-1" }, + { { {0x00,0x00,0x00,0x00,0x01,0x02} }, "S-1-258-1" }, + { { {0x00,0x00,0x00,0x00,0x00,0x02} }, "S-1-2-1" }, + { { {0x00,0x00,0x00,0x00,0x00,0x0c} }, "S-1-12-1" }, + }; + const char noSubAuthStr[] = "S-1-5"; + unsigned int i; + PSID psid = NULL; + BOOL r; + LPSTR str = NULL; + + pConvertSidToStringSidA = (fnConvertSidToStringSidA) + GetProcAddress( hmod, "ConvertSidToStringSidA" ); + if( !pConvertSidToStringSidA ) + return; + pConvertStringSidToSidA = (fnConvertStringSidToSidA) + GetProcAddress( hmod, "ConvertStringSidToSidA" ); + if( !pConvertStringSidToSidA ) + return; + + r = pConvertStringSidToSidA( NULL, NULL ); + ok( !r, "expected failure with NULL parameters\n" ); + if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) + return; + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n", + GetLastError() ); + + r = pConvertStringSidToSidA( refs[0].refStr, NULL ); + ok( !r && GetLastError() == ERROR_INVALID_PARAMETER, + "expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n", + GetLastError() ); + + r = pConvertStringSidToSidA( NULL, &str ); + ok( !r && GetLastError() == ERROR_INVALID_PARAMETER, + "expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n", + GetLastError() ); + + r = pConvertStringSidToSidA( noSubAuthStr, &psid ); + ok( !r, + "expected failure with no sub authorities\n" ); + ok( GetLastError() == ERROR_INVALID_SID, + "expected GetLastError() is ERROR_INVALID_SID, got %ld\n", + GetLastError() ); + + for( i = 0; i < sizeof(refs) / sizeof(refs[0]); i++ ) + { + PISID pisid; + + r = AllocateAndInitializeSid( &refs[i].auth, 1,1,0,0,0,0,0,0,0, + &psid ); + ok( r, "failed to allocate sid\n" ); + r = pConvertSidToStringSidA( psid, &str ); + ok( r, "failed to convert sid\n" ); + if (r) + { + ok( !strcmp( str, refs[i].refStr ), + "incorrect sid, expected %s, got %s\n", refs[i].refStr, str ); + LocalFree( str ); + } + if( psid ) + FreeSid( psid ); + + r = pConvertStringSidToSidA( refs[i].refStr, &psid ); + ok( r, "failed to parse sid string\n" ); + pisid = (PISID)psid; + ok( pisid && + !memcmp( pisid->IdentifierAuthority.Value, refs[i].auth.Value, + sizeof(refs[i].auth) ), + "string sid %s didn't parse to expected value\n" + "(got 0x%04x%08lx, expected 0x%04x%08lx)\n", + refs[i].refStr, + MAKEWORD( pisid->IdentifierAuthority.Value[1], + pisid->IdentifierAuthority.Value[0] ), + MAKELONG( MAKEWORD( pisid->IdentifierAuthority.Value[5], + pisid->IdentifierAuthority.Value[4] ), + MAKEWORD( pisid->IdentifierAuthority.Value[3], + pisid->IdentifierAuthority.Value[2] ) ), + MAKEWORD( refs[i].auth.Value[1], refs[i].auth.Value[0] ), + MAKELONG( MAKEWORD( refs[i].auth.Value[5], refs[i].auth.Value[4] ), + MAKEWORD( refs[i].auth.Value[3], refs[i].auth.Value[2] ) ) ); + if( psid ) + LocalFree( psid ); + } +} + +void test_trustee() +{ + TRUSTEE trustee; + PSID psid; + LPSTR str = "2jjj"; + + SID_IDENTIFIER_AUTHORITY auth = { {0x11,0x22,0,0,0, 0} }; + + pBuildTrusteeWithSidA = (fnBuildTrusteeWithSidA) + GetProcAddress( hmod, "BuildTrusteeWithSidA" ); + pBuildTrusteeWithNameA = (fnBuildTrusteeWithNameA) + GetProcAddress( hmod, "BuildTrusteeWithNameA" ); + if( !pBuildTrusteeWithSidA || !pBuildTrusteeWithNameA) + return; + + if ( ! AllocateAndInitializeSid( &auth, 1, 42, 0,0,0,0,0,0,0,&psid ) ) + { + trace( "failed to init SID\n" ); + return; + } + + memset( &trustee, 0xff, sizeof trustee ); + pBuildTrusteeWithSidA( &trustee, psid ); + + ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n"); + ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE, + "MultipleTrusteeOperation wrong\n"); + ok( trustee.TrusteeForm == TRUSTEE_IS_SID, "TrusteeForm wrong\n"); + ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); + ok( trustee.ptstrName == (LPSTR) psid, "ptstrName wrong\n" ); + FreeSid( psid ); + + /* test BuildTrusteeWithNameA */ + memset( &trustee, 0xff, sizeof trustee ); + pBuildTrusteeWithNameA( &trustee, str ); + + ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n"); + ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE, + "MultipleTrusteeOperation wrong\n"); + ok( trustee.TrusteeForm == TRUSTEE_IS_NAME, "TrusteeForm wrong\n"); + ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); + ok( trustee.ptstrName == str, "ptstrName wrong\n" ); +} + +/* If the first isn't defined, assume none is */ +#ifndef SE_MIN_WELL_KNOWN_PRIVILEGE +#define SE_MIN_WELL_KNOWN_PRIVILEGE 2L +#define SE_CREATE_TOKEN_PRIVILEGE 2L +#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE 3L +#define SE_LOCK_MEMORY_PRIVILEGE 4L +#define SE_INCREASE_QUOTA_PRIVILEGE 5L +#define SE_MACHINE_ACCOUNT_PRIVILEGE 6L +#define SE_TCB_PRIVILEGE 7L +#define SE_SECURITY_PRIVILEGE 8L +#define SE_TAKE_OWNERSHIP_PRIVILEGE 9L +#define SE_LOAD_DRIVER_PRIVILEGE 10L +#define SE_SYSTEM_PROFILE_PRIVILEGE 11L +#define SE_SYSTEMTIME_PRIVILEGE 12L +#define SE_PROF_SINGLE_PROCESS_PRIVILEGE 13L +#define SE_INC_BASE_PRIORITY_PRIVILEGE 14L +#define SE_CREATE_PAGEFILE_PRIVILEGE 15L +#define SE_CREATE_PERMANENT_PRIVILEGE 16L +#define SE_BACKUP_PRIVILEGE 17L +#define SE_RESTORE_PRIVILEGE 18L +#define SE_SHUTDOWN_PRIVILEGE 19L +#define SE_DEBUG_PRIVILEGE 20L +#define SE_AUDIT_PRIVILEGE 21L +#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE 22L +#define SE_CHANGE_NOTIFY_PRIVILLEGE 23L +#define SE_REMOTE_SHUTDOWN_PRIVILEGE 24L +#define SE_UNDOCK_PRIVILEGE 25L +#define SE_SYNC_AGENT_PRIVILEGE 26L +#define SE_ENABLE_DELEGATION_PRIVILEGE 27L +#define SE_MANAGE_VOLUME_PRIVILEGE 28L +#define SE_IMPERSONATE_PRIVILEGE 29L +#define SE_CREATE_GLOBAL_PRIVILEGE 30L +#define SE_MAX_WELL_KNOWN_PRIVILEGE SE_CREATE_GLOBAL_PRIVILEGE +#endif /* ndef SE_MIN_WELL_KNOWN_PRIVILEGE */ + +static void test_allocateLuid(void) +{ + BOOL (WINAPI *pAllocateLocallyUniqueId)(PLUID); + LUID luid1, luid2; + BOOL ret; + + pAllocateLocallyUniqueId = (void*)GetProcAddress(hmod, "AllocateLocallyUniqueId"); + if (!pAllocateLocallyUniqueId) return; + + ret = pAllocateLocallyUniqueId(&luid1); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + return; + + ok(ret, + "AllocateLocallyUniqueId failed: %ld\n", GetLastError()); + ret = pAllocateLocallyUniqueId(&luid2); + ok( ret, + "AllocateLocallyUniqueId failed: %ld\n", GetLastError()); + ok(luid1.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE || luid1.HighPart != 0, + "AllocateLocallyUniqueId returned a well-known LUID\n"); + ok(luid1.LowPart != luid2.LowPart || luid1.HighPart != luid2.HighPart, + "AllocateLocallyUniqueId returned non-unique LUIDs\n"); + ret = pAllocateLocallyUniqueId(NULL); + ok( !ret && GetLastError() == ERROR_NOACCESS, + "AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %ld\n", + GetLastError()); +} + +static void test_lookupPrivilegeName(void) +{ + BOOL (WINAPI *pLookupPrivilegeNameA)(LPSTR, PLUID, LPSTR, LPDWORD); + char buf[MAX_PATH]; /* arbitrary, seems long enough */ + DWORD cchName = sizeof(buf); + LUID luid = { 0, 0 }; + LONG i; + BOOL ret; + + /* check whether it's available first */ + pLookupPrivilegeNameA = (void*)GetProcAddress(hmod, "LookupPrivilegeNameA"); + if (!pLookupPrivilegeNameA) return; + luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; + ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + return; + + /* check with a short buffer */ + cchName = 0; + luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; + ret = pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName); + ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n", + GetLastError()); + ok(cchName == strlen("SeCreateTokenPrivilege") + 1, + "LookupPrivilegeNameA returned an incorrect required length for\n" + "SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName, + strlen("SeCreateTokenPrivilege") + 1); + /* check a known value and its returned length on success */ + cchName = sizeof(buf); + ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) && + cchName == strlen("SeCreateTokenPrivilege"), + "LookupPrivilegeNameA returned an incorrect output length for\n" + "SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName, + (int)strlen("SeCreateTokenPrivilege")); + /* check known values */ + for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i < SE_MAX_WELL_KNOWN_PRIVILEGE; i++) + { + luid.LowPart = i; + cchName = sizeof(buf); + ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); + ok( ret || GetLastError() == ERROR_NO_SUCH_PRIVILEGE, + "LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError()); + } + /* check a bogus LUID */ + luid.LowPart = 0xdeadbeef; + cchName = sizeof(buf); + ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); + ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, + "LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", + GetLastError()); + /* check on a bogus system */ + luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; + cchName = sizeof(buf); + ret = pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName); + ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE, + "LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n", + GetLastError()); +} + +struct NameToLUID +{ + const char *name; + DWORD lowPart; +}; + +static void test_lookupPrivilegeValue(void) +{ + static const struct NameToLUID privs[] = { + { "SeCreateTokenPrivilege", SE_CREATE_TOKEN_PRIVILEGE }, + { "SeAssignPrimaryTokenPrivilege", SE_ASSIGNPRIMARYTOKEN_PRIVILEGE }, + { "SeLockMemoryPrivilege", SE_LOCK_MEMORY_PRIVILEGE }, + { "SeIncreaseQuotaPrivilege", SE_INCREASE_QUOTA_PRIVILEGE }, + { "SeMachineAccountPrivilege", SE_MACHINE_ACCOUNT_PRIVILEGE }, + { "SeTcbPrivilege", SE_TCB_PRIVILEGE }, + { "SeSecurityPrivilege", SE_SECURITY_PRIVILEGE }, + { "SeTakeOwnershipPrivilege", SE_TAKE_OWNERSHIP_PRIVILEGE }, + { "SeLoadDriverPrivilege", SE_LOAD_DRIVER_PRIVILEGE }, + { "SeSystemProfilePrivilege", SE_SYSTEM_PROFILE_PRIVILEGE }, + { "SeSystemtimePrivilege", SE_SYSTEMTIME_PRIVILEGE }, + { "SeProfileSingleProcessPrivilege", SE_PROF_SINGLE_PROCESS_PRIVILEGE }, + { "SeIncreaseBasePriorityPrivilege", SE_INC_BASE_PRIORITY_PRIVILEGE }, + { "SeCreatePagefilePrivilege", SE_CREATE_PAGEFILE_PRIVILEGE }, + { "SeCreatePermanentPrivilege", SE_CREATE_PERMANENT_PRIVILEGE }, + { "SeBackupPrivilege", SE_BACKUP_PRIVILEGE }, + { "SeRestorePrivilege", SE_RESTORE_PRIVILEGE }, + { "SeShutdownPrivilege", SE_SHUTDOWN_PRIVILEGE }, + { "SeDebugPrivilege", SE_DEBUG_PRIVILEGE }, + { "SeAuditPrivilege", SE_AUDIT_PRIVILEGE }, + { "SeSystemEnvironmentPrivilege", SE_SYSTEM_ENVIRONMENT_PRIVILEGE }, + { "SeChangeNotifyPrivilege", SE_CHANGE_NOTIFY_PRIVILLEGE }, + { "SeRemoteShutdownPrivilege", SE_REMOTE_SHUTDOWN_PRIVILEGE }, + { "SeUndockPrivilege", SE_UNDOCK_PRIVILEGE }, + { "SeSyncAgentPrivilege", SE_SYNC_AGENT_PRIVILEGE }, + { "SeEnableDelegationPrivilege", SE_ENABLE_DELEGATION_PRIVILEGE }, + { "SeManageVolumePrivilege", SE_MANAGE_VOLUME_PRIVILEGE }, + { "SeImpersonatePrivilege", SE_IMPERSONATE_PRIVILEGE }, + { "SeCreateGlobalPrivilege", SE_CREATE_GLOBAL_PRIVILEGE }, + }; + BOOL (WINAPI *pLookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID); + int i; + LUID luid; + BOOL ret; + + /* check whether it's available first */ + pLookupPrivilegeValueA = (void*)GetProcAddress(hmod, "LookupPrivilegeValueA"); + if (!pLookupPrivilegeValueA) return; + ret = pLookupPrivilegeValueA(NULL, "SeCreateTokenPrivilege", &luid); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + return; + + /* check a bogus system name */ + ret = pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid); + ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE, + "LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n", + GetLastError()); + /* check a NULL string */ + ret = pLookupPrivilegeValueA(NULL, 0, &luid); + ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, + "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", + GetLastError()); + /* check a bogus privilege name */ + ret = pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid); + ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, + "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", + GetLastError()); + /* check case insensitive */ + ret = pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid); + ok( ret, + "LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %ld\n", + GetLastError()); + for (i = 0; i < sizeof(privs) / sizeof(privs[0]); i++) + { + /* Not all privileges are implemented on all Windows versions, so + * don't worry if the call fails + */ + if (pLookupPrivilegeValueA(NULL, privs[i].name, &luid)) + { + ok(luid.LowPart == privs[i].lowPart, + "LookupPrivilegeValueA returned an invalid LUID for %s\n", + privs[i].name); + } + } +} + +static void test_luid(void) +{ + test_allocateLuid(); + test_lookupPrivilegeName(); + test_lookupPrivilegeValue(); +} + +static void test_FileSecurity(void) +{ + char directory[MAX_PATH]; + DWORD retval, outSize; + BOOL result; + BYTE buffer[0x40]; + + pGetFileSecurityA = (fnGetFileSecurityA) + GetProcAddress( hmod, "GetFileSecurityA" ); + if( !pGetFileSecurityA ) + return; + + retval = GetTempPathA(sizeof(directory), directory); + if (!retval) { + trace("GetTempPathA failed\n"); + return; + } + + strcpy(directory, "\\Should not exist"); + + SetLastError(NO_ERROR); + result = pGetFileSecurityA( directory,OWNER_SECURITY_INFORMATION,buffer,0x40,&outSize); + ok(!result, "GetFileSecurityA should fail for not existing directories/files\n"); + ok( (GetLastError() == ERROR_FILE_NOT_FOUND ) || + (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) , + "last error ERROR_FILE_NOT_FOUND / ERROR_CALL_NOT_IMPLEMENTED (98) " + "expected, got %ld\n", GetLastError()); +} + +START_TEST(security) +{ + init(); + if (!hmod) return; + test_sid(); + test_trustee(); + test_luid(); + test_FileSecurity(); +} diff --git a/reactos/lib/cabinet/cabextract.c b/reactos/lib/cabinet/cabextract.c index f20eb10454e..4845c40bb65 100644 --- a/reactos/lib/cabinet/cabextract.c +++ b/reactos/lib/cabinet/cabextract.c @@ -2068,7 +2068,7 @@ struct cabinet *find_cabs_in_file(LPCSTR name, cab_UBYTE search_buf[]) */ void find_cabinet_file(char **cabname, LPCSTR origcab) { - char *tail, *cab, *name, *nextpart, nametmp[MAX_PATH], *filepart; + char *tail, *cab, *name, *nextpart, nametmp[MAX_PATH]; int found = 0; TRACE("(*cabname == ^%p, origcab == %s)\n", cabname ? *cabname : NULL, debugstr_a(origcab)); @@ -2107,11 +2107,11 @@ void find_cabinet_file(char **cabname, LPCSTR origcab) { nextpart = strchr(name, '\\'); if (nextpart) *nextpart = '\0'; - found = SearchPathA(cab, name, NULL, MAX_PATH, nametmp, &filepart); + found = SearchPathA(cab, name, NULL, MAX_PATH, nametmp, NULL); /* if the component was not found, look for it in the current dir */ if (!found) { - found = SearchPathA(".", name, NULL, MAX_PATH, nametmp, &filepart); + found = SearchPathA(".", name, NULL, MAX_PATH, nametmp, NULL); } if (found) @@ -2135,7 +2135,7 @@ void find_cabinet_file(char **cabname, LPCSTR origcab) { if (found) { free((void *) *cabname); *cabname = cab; - strncpy(cab, nametmp, found+1); + memcpy(cab, nametmp, found+1); TRACE("result: %s\n", debugstr_a(cab)); } else { free((void *) cab); diff --git a/reactos/lib/cards/cards.c b/reactos/lib/cards/cards.c index 9c78febde1e..f8b1d42736e 100644 --- a/reactos/lib/cards/cards.c +++ b/reactos/lib/cards/cards.c @@ -76,6 +76,37 @@ BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color) return cdtDrawExt(hdc, x, y, CARD_WIDTH, CARD_HEIGHT, card, type, color); } +/* + * internal + */ +inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, DWORD dwRasterOp, BOOL bStretch) +{ + if (bStretch) + { + StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp); + } else + { + BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp); +/* + * This is need when using Microsoft images, because they use two-color red/white images for + * red cards and thus needs fix-up of the edge to black color. + */ +#if 0 + if (ISREDCARD(card)) + { + PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS); + PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS); + PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS); + PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS); + SetPixel(hdc, x + 1, y + 1, 0); + SetPixel(hdc, x + dx - 2, y + 1, 0); + SetPixel(hdc, x + 1, y + dy - 2, 0); + SetPixel(hdc, x + dx - 2, y + dy - 2, 0); + } +#endif + } +} + /* * Render card * @@ -92,7 +123,6 @@ BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color) BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type, COLORREF color) { HDC hdcCard; - COLORREF SavedPixels[12]; DWORD dwRasterOp = SRCCOPY, OldBkColor; BOOL bSaveEdges = TRUE; BOOL bStretch = FALSE; @@ -154,6 +184,7 @@ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color); if (bSaveEdges) { + COLORREF SavedPixels[12]; SavedPixels[0] = GetPixel(hdc, x, y); SavedPixels[1] = GetPixel(hdc, x + 1, y); SavedPixels[2] = GetPixel(hdc, x, y + 1); @@ -165,35 +196,11 @@ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type SavedPixels[8] = GetPixel(hdc, x, y + dy - 2); SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1); SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1); - SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2); - } - if (bStretch) - { - StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp); - } else - { - BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp); -/* - * This is need when using Microsoft images, because they use two-color red/white images for - * red cards and thus needs fix-up of the edge to black color. - */ -#if 0 - if (ISREDCARD(card)) - { - PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS); - PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS); - PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS); - PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS); - SetPixel(hdc, x + 1, y + 1, 0); - SetPixel(hdc, x + dx - 2, y + 1, 0); - SetPixel(hdc, x + 1, y + dy - 2, 0); - SetPixel(hdc, x + dx - 2, y + dy - 2, 0); - } -#endif - } - if (bSaveEdges) - { - SetPixel(hdc, x, y, SavedPixels[0]); + SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2); + + BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); + + SetPixel(hdc, x, y, SavedPixels[0]); SetPixel(hdc, x + 1, y, SavedPixels[1]); SetPixel(hdc, x, y + 1, SavedPixels[2]); SetPixel(hdc, x + dx - 1, y, SavedPixels[3]); @@ -205,7 +212,11 @@ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type SetPixel(hdc, x + dx - 1, y + dy - 1, SavedPixels[9]); SetPixel(hdc, x + dx - 2, y + dy - 1, SavedPixels[10]); SetPixel(hdc, x + dx - 1, y + dy - 2, SavedPixels[11]); - } + } + else + { + BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); + } SetBkColor(hdc, OldBkColor); DeleteDC(hdcCard); } diff --git a/reactos/lib/comctl32/animate.c b/reactos/lib/comctl32/animate.c index ce9b3f3f41a..b1fe5cad053 100644 --- a/reactos/lib/comctl32/animate.c +++ b/reactos/lib/comctl32/animate.c @@ -3,7 +3,8 @@ * Animation control * * Copyright 1998, 1999 Eric Kohl - * 1999 Eric Pouech + * Copyright 1999 Eric Pouech + * Copyright 2005 Dimitrie O. Paun * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +21,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * NOTES - * I will only improve this control once in a while. - * Eric * + * This code was audited for completeness against the documented features + * of Comctl32.dll version 6.0 on Mar. 15, 2005, by Dimitrie O. Paun. + * + * Unless otherwise noted, we believe this code to be complete, as per + * the specification mentioned above. + * If you discover missing features, or bugs, please note them below. + * * TODO: * - check for the 'rec ' list in some AVI files - * - concurrent access to infoPtr */ #define COM_NO_WINDOWS_H @@ -59,6 +64,7 @@ typedef struct HMMIO hMMio; /* handle to mmio stream */ HWND hwndSelf; HWND hwndNotify; + DWORD dwStyle; /* information on the loaded AVI file */ MainAVIHeader mah; AVIStreamHeader ash; @@ -86,23 +92,23 @@ typedef struct HBITMAP hbmPrevFrame; } ANIMATE_INFO; -#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0)) #define ANIMATE_COLOR_NONE 0xffffffff -static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) +static void ANIMATE_Notify(ANIMATE_INFO *infoPtr, UINT notif) { - SendMessageA(infoPtr->hwndNotify, WM_COMMAND, + SendMessageW(infoPtr->hwndNotify, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif), (LPARAM)infoPtr->hwndSelf); } -static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName) +static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPWSTR lpName) { + static const WCHAR aviW[] = { 'A', 'V', 'I', 0 }; HRSRC hrsrc; MMIOINFO mminfo; LPVOID lpAvi; - hrsrc = FindResourceA(hInst, lpName, "AVI"); + hrsrc = FindResourceW(hInst, lpName, aviW); if (!hrsrc) return FALSE; @@ -118,8 +124,9 @@ static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpNam mminfo.fccIOProc = FOURCC_MEM; mminfo.pchBuffer = (LPSTR)lpAvi; mminfo.cchBuffer = SizeofResource(hInst, hrsrc); - infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ); - if (!infoPtr->hMMio) { + infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ); + if (!infoPtr->hMMio) + { FreeResource(infoPtr->hRes); return FALSE; } @@ -128,19 +135,15 @@ static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpNam } -static BOOL ANIMATE_LoadFileA(ANIMATE_INFO *infoPtr, LPSTR lpName) +static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName) { - infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL, - MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); + infoPtr->hMMio = mmioOpenW(lpName, 0, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); - if (!infoPtr->hMMio) - return FALSE; - - return TRUE; + return (BOOL)infoPtr->hMMio; } -static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr) +static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr) { EnterCriticalSection(&infoPtr->cs); @@ -187,28 +190,25 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr) FreeResource(infoPtr->hRes); infoPtr->hRes = 0; } - HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex); + Free (infoPtr->lpIndex); infoPtr->lpIndex = NULL; if (infoPtr->hic) { fnIC.fnICClose(infoPtr->hic); infoPtr->hic = 0; } - HeapFree(GetProcessHeap(), 0, infoPtr->inbih); + Free (infoPtr->inbih); infoPtr->inbih = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->outbih); + Free (infoPtr->outbih); infoPtr->outbih = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->indata); + Free (infoPtr->indata); infoPtr->indata = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->outdata); + Free (infoPtr->outdata); infoPtr->outdata = NULL; if( infoPtr->hbmPrevFrame ) { DeleteObject(infoPtr->hbmPrevFrame); infoPtr->hbmPrevFrame = 0; } - infoPtr->indata = infoPtr->outdata = NULL; - infoPtr->hwndSelf = 0; - infoPtr->hMMio = 0; memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); @@ -217,7 +217,7 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr) infoPtr->transparentColor = ANIMATE_COLOR_NONE; } -static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource) +static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSource) { HDC hdcMask; HBITMAP hbmMask; @@ -249,7 +249,7 @@ static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSo DeleteDC(hdcMask); } -static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) +static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) { void* pBitmapData = NULL; LPBITMAPINFO pBitmapInfo = NULL; @@ -273,7 +273,8 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) nWidth = infoPtr->outbih->biWidth; nHeight = infoPtr->outbih->biHeight; - } else + } + else { pBitmapData = infoPtr->indata; pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih; @@ -302,7 +303,7 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) infoPtr->transparentColor = GetPixel(hdcMem,0,0); } - if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT) + if(infoPtr->dwStyle & ACS_TRANSPARENT) { HDC hdcFinal = CreateCompatibleDC(hDC); HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight); @@ -325,15 +326,15 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) DeleteDC(hdcFinal); DeleteObject(infoPtr->hbmPrevFrame); infoPtr->hbmPrevFrame = hbmFinal; - } + } - if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER) + if (infoPtr->dwStyle & ACS_CENTER) { - RECT rect; + RECT rect; - GetWindowRect(infoPtr->hwndSelf, &rect); - nOffsetX = ((rect.right - rect.left) - nWidth)/2; - nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; + GetWindowRect(infoPtr->hwndSelf, &rect); + nOffsetX = ((rect.right - rect.left) - nWidth)/2; + nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; } BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); @@ -342,21 +343,18 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) return TRUE; } -static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr) +static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr) { HDC hDC; TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop); - EnterCriticalSection(&infoPtr->cs); - mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET); mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize); if (infoPtr->hic && fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { - LeaveCriticalSection(&infoPtr->cs); WARN("Decompression error\n"); return FALSE; } @@ -374,14 +372,27 @@ static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr) } } } - LeaveCriticalSection(&infoPtr->cs); return TRUE; } +static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr) +{ + /* FIXME: we should pass the hDC instead of 0 to WM_CTLCOLORSTATIC */ + if (infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, + 0, (LPARAM)infoPtr->hwndSelf); + EnterCriticalSection(&infoPtr->cs); + ANIMATE_DrawFrame(infoPtr); + LeaveCriticalSection(&infoPtr->cs); + + return 0; +} + static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_) { - ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_; + ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)ptr_; HANDLE event; DWORD timeout; @@ -400,10 +411,8 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_) return TRUE; } -static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam) +static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - /* nothing opened */ if (!infoPtr->hMMio) return FALSE; @@ -413,9 +422,9 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam) return TRUE; } - infoPtr->nFromFrame = (INT)LOWORD(lParam); - infoPtr->nToFrame = (INT)HIWORD(lParam); - infoPtr->nLoop = (INT)wParam; + infoPtr->nFromFrame = wFrom; + infoPtr->nToFrame = wTo; + infoPtr->nLoop = cRepeat; if (infoPtr->nToFrame == 0xFFFF) infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1; @@ -429,25 +438,25 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam) infoPtr->currFrame = infoPtr->nFromFrame; - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) { + if (infoPtr->dwStyle & ACS_TIMER) + { TRACE("Using a timer\n"); /* create a timer to display AVI */ - infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); - } else { - if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - { - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, 0, (LPARAM)hWnd); - } + infoPtr->uTimer = SetTimer(infoPtr->hwndSelf, 1, + infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); + } + else + { + if(infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, 0, + (LPARAM)infoPtr->hwndSelf); TRACE("Using an animation thread\n"); infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL ); - infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &infoPtr->threadId); - if(!infoPtr->hThread) - { - ERR("Could not create animation thread!\n"); - return FALSE; - } + infoPtr->hThread = CreateThread(0, 0, ANIMATE_AnimationThread, + (LPVOID)infoPtr, 0, &infoPtr->threadId); + if(!infoPtr->hThread) return FALSE; } @@ -548,7 +557,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) return FALSE; } - infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); + infoPtr->inbih = Alloc(mmckInfo.cksize); if (!infoPtr->inbih) { WARN("Can't alloc input BIH\n"); return FALSE; @@ -595,12 +604,9 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) /* FIXME: should handle the 'rec ' LIST when present */ - infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - infoPtr->mah.dwTotalFrames * sizeof(DWORD)); - if (!infoPtr->lpIndex) { - WARN("Can't alloc index array\n"); + infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD)); + if (!infoPtr->lpIndex) return FALSE; - } numFrame = insize = 0; while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && @@ -620,17 +626,15 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) infoPtr->ash.dwSuggestedBufferSize = insize; } - infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize); - if (!infoPtr->indata) { - WARN("Can't alloc input buffer\n"); + infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize); + if (!infoPtr->indata) return FALSE; - } return TRUE; } -static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) +static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) { DWORD outSize; @@ -653,23 +657,20 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD)infoPtr->inbih, 0L); - infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize); - if (!infoPtr->outbih) { - WARN("Can't alloc output BIH\n"); + infoPtr->outbih = Alloc(outSize); + if (!infoPtr->outbih) return FALSE; - } if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, - (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) { + (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) + { WARN("Can't get output BIH\n"); return FALSE; } - infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage); - if (!infoPtr->outdata) { - WARN("Can't alloc output buffer\n"); + infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage); + if (!infoPtr->outdata) return FALSE; - } if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { @@ -680,74 +681,93 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) return TRUE; } -static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam) + +static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - HINSTANCE hInstance = (HINSTANCE)wParam; - ANIMATE_Free(infoPtr); - infoPtr->hwndSelf = hWnd; - if (!lParam) { + if (!lpszName) + { TRACE("Closing avi!\n"); /* installer of thebat! v1.62 requires FALSE here */ return (infoPtr->hMMio != 0); } if (!hInstance) - hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE); + hInstance = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE); - if (HIWORD(lParam)) { - TRACE("(\"%s\");\n", (LPSTR)lParam); + if (HIWORD(lpszName)) + { + TRACE("(\"%s\");\n", debugstr_w(lpszName)); - if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) { + if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName)) + { TRACE("No AVI resource found!\n"); - if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) { + if (!ANIMATE_LoadFileW(infoPtr, lpszName)) + { WARN("No AVI file found!\n"); return FALSE; } } - } else { - TRACE("(%u);\n", (WORD)LOWORD(lParam)); + } + else + { + TRACE("(%u);\n", (WORD)(DWORD)lpszName); - if (!ANIMATE_LoadResA(infoPtr, hInstance, - MAKEINTRESOURCEA((INT)lParam))) { + if (!ANIMATE_LoadResW(infoPtr, hInstance, MAKEINTRESOURCEW((INT)lpszName))) + { WARN("No AVI resource found!\n"); return FALSE; } } - if (!ANIMATE_GetAviInfo(infoPtr)) { + if (!ANIMATE_GetAviInfo(infoPtr)) + { WARN("Can't get AVI information\n"); ANIMATE_Free(infoPtr); return FALSE; } - if (!ANIMATE_GetAviCodec(infoPtr)) { + if (!ANIMATE_GetAviCodec(infoPtr)) + { WARN("Can't get AVI Codec\n"); ANIMATE_Free(infoPtr); return FALSE; } - if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { - SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, + if (!(infoPtr->dwStyle & ACS_CENTER)) + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); - } - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) { - return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1)); - } + if (infoPtr->dwStyle & ACS_AUTOPLAY) + return ANIMATE_Play(infoPtr, -1, 0, infoPtr->mah.dwTotalFrames - 1); return TRUE; } -/* << ANIMATE_Open32W >> */ - -static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); + LPWSTR lpwszName; + LRESULT result; + INT len; + if (!HIWORD(lpszName)) + return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName); + + len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0); + lpwszName = Alloc(len * sizeof(WCHAR)); + if (!lpwszName) return FALSE; + MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len); + + result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName); + Free (lpwszName); + return result; +} + + +static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr) +{ /* nothing opened */ if (!infoPtr->hMMio) return FALSE; @@ -757,18 +777,14 @@ static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam) } -static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_Create(HWND hWnd, LPCREATESTRUCTW lpcs) { - ANIMATE_INFO* infoPtr; + static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 }; + ANIMATE_INFO *infoPtr; - if (!fnIC.hModule) /* FIXME: not thread safe */ + if (!fnIC.hModule) { - /* since there's a circular dep between msvfw32 and comctl32, we could either: - * - fix the build chain to allow this circular dep - * - handle it by hand - * AJ wants the latter :-( - */ - fnIC.hModule = LoadLibraryA("msvfw32.dll"); + fnIC.hModule = LoadLibraryW(msvfw32W); if (!fnIC.hModule) return FALSE; fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen"); @@ -779,19 +795,17 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) /* allocate memory for info structure */ infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO)); - if (!infoPtr) { - ERR("could not allocate info memory!\n"); - return 0; - } + if (!infoPtr) return FALSE; /* store crossref hWnd <-> info structure */ SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndSelf = hWnd; - infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; + infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->transparentColor = ANIMATE_COLOR_NONE; infoPtr->hbmPrevFrame = 0; + infoPtr->dwStyle = lpcs->style; - TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongA(hWnd, GWL_STYLE), infoPtr->hwndNotify); + TRACE("Animate style=0x%08lx, parent=%p\n", infoPtr->dwStyle, infoPtr->hwndNotify); InitializeCriticalSection(&infoPtr->cs); @@ -799,97 +813,98 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) } -static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam) +static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - - /* free avi data */ ANIMATE_Free(infoPtr); /* free animate info data */ + SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0); + + DeleteCriticalSection(&infoPtr->cs); Free(infoPtr); - SetWindowLongPtrW(hWnd, 0, 0); return 0; } -static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_EraseBackground(ANIMATE_INFO *infoPtr, HDC hdc) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); RECT rect; HBRUSH hBrush = 0; - if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) + if(infoPtr->dwStyle & ACS_TRANSPARENT) { - hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); + hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, + (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf); } - GetClientRect(hWnd, &rect); - FillRect((HDC)wParam, &rect, hBrush ? hBrush : GetCurrentObject((HDC)wParam, OBJ_BRUSH)); + GetClientRect(infoPtr->hwndSelf, &rect); + FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH)); return TRUE; } -static LRESULT WINAPI ANIMATE_Size(HWND hWnd, WPARAM wParam, LPARAM lParam) + +static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss) { - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { - InvalidateRect(hWnd, NULL, TRUE); - } - return TRUE; + TRACE("(styletype=%x, styleOld=0x%08lx, styleNew=0x%08lx)\n", + wStyleType, lpss->styleOld, lpss->styleNew); + + if (wStyleType != GWL_STYLE) return 0; + + infoPtr->dwStyle = lpss->styleNew; + + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + return 0; } + static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0); + TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam); - if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE)) - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + if (!infoPtr && (uMsg != WM_NCCREATE)) + return DefWindowProcW(hWnd, uMsg, wParam, lParam); switch (uMsg) { case ACM_OPENA: - return ANIMATE_OpenA(hWnd, wParam, lParam); + return ANIMATE_OpenA(infoPtr, (HINSTANCE)wParam, (LPSTR)lParam); case ACM_OPENW: - FIXME("ACM_OPENW: stub!\n"); - /* return ANIMATE_Open32W(hWnd, wParam, lParam); */ - return 0; + return ANIMATE_OpenW(infoPtr, (HINSTANCE)wParam, (LPWSTR)lParam); case ACM_PLAY: - return ANIMATE_Play(hWnd, wParam, lParam); + return ANIMATE_Play(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam)); case ACM_STOP: - return ANIMATE_Stop(hWnd, wParam, lParam); + return ANIMATE_Stop(infoPtr); + + case WM_CLOSE: + ANIMATE_Free(infoPtr); + return 0; case WM_NCCREATE: - return ANIMATE_Create(hWnd, wParam, lParam); + return ANIMATE_Create(hWnd, (LPCREATESTRUCTW)lParam); case WM_NCHITTEST: return HTTRANSPARENT; case WM_DESTROY: - return ANIMATE_Destroy(hWnd, wParam, lParam); + return ANIMATE_Destroy(infoPtr); case WM_ERASEBKGND: - return ANIMATE_EraseBackground(hWnd, wParam, lParam); + return ANIMATE_EraseBackground(infoPtr, (HDC)wParam); - /* case WM_STYLECHANGED: FIXME shall we do something ?? */ + case WM_STYLECHANGED: + return ANIMATE_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam); case WM_TIMER: - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - { - ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); - } - return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd)); + return ANIMATE_Timer(infoPtr); case WM_PAINT: { - ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); - /* the animation isn't playing, or has not decompressed * (and displayed) the first frame yet, don't paint */ @@ -897,13 +912,13 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP !infoPtr->hbmPrevFrame) { /* default paint handling */ - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); } - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); + if (infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, + wParam, (LPARAM)infoPtr->hwndSelf); if (wParam) { @@ -913,48 +928,50 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP } else { - PAINTSTRUCT ps; - HDC hDC = BeginPaint(hWnd, &ps); + PAINTSTRUCT ps; + HDC hDC = BeginPaint(infoPtr->hwndSelf, &ps); EnterCriticalSection(&infoPtr->cs); ANIMATE_PaintFrame(infoPtr, hDC); LeaveCriticalSection(&infoPtr->cs); - EndPaint(hWnd, &ps); - } + EndPaint(infoPtr->hwndSelf, &ps); + } } - break; + break; case WM_SIZE: - return ANIMATE_Size(hWnd, wParam, lParam); + if (infoPtr->dwStyle & ACS_CENTER) + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); default: if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); } return 0; } void ANIMATE_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = ANIMATE_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(ANIMATE_INFO *); - wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wndClass.lpszClassName = ANIMATE_CLASSA; + wndClass.lpszClassName = ANIMATE_CLASSW; - RegisterClassA(&wndClass); + RegisterClassW(&wndClass); } void ANIMATE_Unregister(void) { - UnregisterClassA(ANIMATE_CLASSA, NULL); + UnregisterClassW(ANIMATE_CLASSW, NULL); } diff --git a/reactos/lib/comctl32/comboex.c b/reactos/lib/comctl32/comboex.c index 8cff35a286a..5037365db13 100644 --- a/reactos/lib/comctl32/comboex.c +++ b/reactos/lib/comctl32/comboex.c @@ -121,7 +121,11 @@ typedef struct /* Offset between image and text */ #define CBE_SEP 4 -#define COMBOEX_SUBCLASS_PROP "CCComboEx32SubclassInfo" +static const WCHAR COMBOEX_SUBCLASS_PROP[] = { + 'C','C','C','o','m','b','o','E','x','3','2', + 'S','u','b','c','l','a','s','s','I','n','f','o',0 +}; + #define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0)) @@ -317,13 +321,14 @@ static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item) static void COMBOEX_GetComboFontSize (COMBOEX_INFO *infoPtr, SIZE *size) { + static const WCHAR strA[] = { 'A', 0 }; HFONT nfont, ofont; HDC mydc; mydc = GetDC (0); /* why the entire screen???? */ nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); ofont = (HFONT) SelectObject (mydc, nfont); - GetTextExtentPointA (mydc, "A", 1, size); + GetTextExtentPointW (mydc, strA, 1, size); SelectObject (mydc, ofont); ReleaseDC (0, mydc); TRACE("selected font hwnd=%p, height=%ld\n", nfont, size->cy); @@ -949,7 +954,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ /* specified. It then creates it's own version of the EDIT control */ /* and makes the ComboBox the parent. This is because a normal */ - /* DROPDOWNLIST does not have a EDIT control, but we need one. */ + /* DROPDOWNLIST does not have an EDIT control, but we need one. */ /* We also need to place the edit control at the proper location */ /* (allow space for the icons). */ @@ -976,7 +981,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) * Setup a property to hold the pointer to the COMBOBOXEX * data structure. */ - SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); + SetPropW(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndCombo, GWLP_WNDPROC, (DWORD_PTR)COMBOEX_ComboWndProc); infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); @@ -1005,7 +1010,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) * Setup a property to hold the pointer to the COMBOBOXEX * data structure. */ - SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); + SetPropW(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndEdit, GWLP_WNDPROC, (DWORD_PTR)COMBOEX_EditWndProc); infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0); @@ -1547,11 +1552,12 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr) static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO *infoPtr, MEASUREITEMSTRUCT *mis) { + static const WCHAR strW[] = { 'W', 0 }; SIZE mysize; HDC hdc; hdc = GetDC (0); - GetTextExtentPointA (hdc, "W", 1, &mysize); + GetTextExtentPointW (hdc, strW, 1, &mysize); ReleaseDC (0, hdc); mis->itemHeight = mysize.cy + CBE_EXTRA; @@ -1647,7 +1653,7 @@ static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp) static LRESULT WINAPI COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; WCHAR edit_text[260]; @@ -1694,7 +1700,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case VK_ESCAPE: /* native version seems to do following for COMBOEX */ /* - * GetWindowTextA(Edit,&?, 0x104) x + * GetWindowTextW(Edit,&?, 0x104) x * CB_GETCURSEL to Combo rets -1 x * WM_NOTIFY to COMBOEX parent (rebar) x * (CBEN_ENDEDIT{A|W} @@ -1735,7 +1741,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case VK_RETURN: /* native version seems to do following for COMBOEX */ /* - * GetWindowTextA(Edit,&?, 0x104) x + * GetWindowTextW(Edit,&?, 0x104) x * CB_GETCURSEL to Combo rets -1 x * CB_GETCOUNT to Combo rets 0 * if >0 loop @@ -1846,7 +1852,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; NMMOUSE nmmse; @@ -1955,7 +1961,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) * Native does: * * GetFocus() retns AA - * GetWindowTextA(Edit) + * GetWindowTextW(Edit) * CB_GETCURSEL(Combo) (got -1) * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS * CB_GETCURSEL(Combo) (got -1) @@ -2019,7 +2025,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) INT selected = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); - /* lstrlenA( lastworkingURL ) */ + /* lstrlenW( lastworkingURL ) */ GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); if (selected == -1) { diff --git a/reactos/lib/comctl32/comctl32undoc.c b/reactos/lib/comctl32/comctl32undoc.c index 3eae1aebf57..e86c0a4885c 100644 --- a/reactos/lib/comctl32/comctl32undoc.c +++ b/reactos/lib/comctl32/comctl32undoc.c @@ -88,6 +88,8 @@ typedef struct _LOADDATA typedef HRESULT (CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM); +static const WCHAR strMRUList[] = { 'M','R','U','L','i','s','t',0 }; + /************************************************************************** * DPA_LoadStream [COMCTL32.9] * @@ -558,7 +560,7 @@ typedef struct tagWINEMRULIST BOOL isUnicode; /* is compare fn Unicode */ DWORD wineFlags; /* internal flags */ DWORD cursize; /* current size of realMRU */ - LPSTR realMRU; /* pointer to string of index names */ + LPWSTR realMRU; /* pointer to string of index names */ LPWINEMRUITEM *array; /* array of pointers to data */ /* in 'a' to 'z' order */ } WINEMRULIST, *LPWINEMRULIST; @@ -603,12 +605,12 @@ static void MRU_SaveChanged ( LPWINEMRULIST mp ) } if (mp->wineFlags & WMRUF_CHANGED) { mp->wineFlags &= ~WMRUF_CHANGED; - err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, - mp->realMRU, strlen(mp->realMRU) + 1); + err = RegSetValueExW(newkey, strMRUList, 0, REG_SZ, (LPBYTE)mp->realMRU, + (strlenW(mp->realMRU) + 1)*sizeof(WCHAR)); if (err) { ERR("error saving MRUList, err=%d\n", err); } - TRACE("saving MRUList=/%s/\n", mp->realMRU); + TRACE("saving MRUList=/%s/\n", debugstr_w(mp->realMRU)); } realname[1] = 0; for(i=0; icursize; i++) { @@ -768,7 +770,7 @@ INT WINAPI AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData) if ((replace = FindMRUData (hList, lpData, cbData, NULL)) >= 0) { /* Item exists, just move it to the front */ - LPSTR pos = strchr(mp->realMRU, replace + 'a'); + LPWSTR pos = strchrW(mp->realMRU, replace + 'a'); while (pos > mp->realMRU) { pos[0] = pos[-1]; @@ -961,7 +963,7 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp) /* get space to save indices that will turn into names * but in order of most to least recently used */ - mp->realMRU = Alloc(mp->extview.nMaxItems + 2); + mp->realMRU = Alloc((mp->extview.nMaxItems + 2) * sizeof(WCHAR)); /* get space to save pointers to actual data in order of * 'a' to 'z' (0 to n). @@ -988,14 +990,14 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp) /* get values from key 'MRUList' */ if (newkey) { datasize = mp->extview.nMaxItems + 1; - if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU, - &datasize))) { + if((err=RegQueryValueExW( newkey, strMRUList, 0, &type, + (LPBYTE)mp->realMRU, &datasize))) { /* not present - set size to 1 (will become 0 later) */ datasize = 1; *mp->realMRU = 0; } - TRACE("MRU list = %s, datasize = %ld\n", mp->realMRU, datasize); + TRACE("MRU list = %s, datasize = %ld\n", debugstr_w(mp->realMRU), datasize); mp->cursize = datasize - 1; /* datasize now has number of items in the MRUList */ @@ -1824,7 +1826,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) if (!hdpaNew) { /* create a new DPA */ - hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpaTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpaTemp)); hdpaTemp->hHeap = hdpa->hHeap; hdpaTemp->nGrow = hdpa->nGrow; @@ -1844,8 +1846,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) nNewItems = hdpaTemp->nGrow * ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1); nSize = nNewItems * sizeof(LPVOID); - hdpaTemp->ptrs = - (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); + hdpaTemp->ptrs = HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); hdpaTemp->nMaxCount = nNewItems; /* clone the pointer array */ @@ -1985,9 +1986,9 @@ BOOL WINAPI DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) INT nSize = nNewItems * sizeof(LPVOID); if (hdpa->ptrs) - lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize); + lpTemp = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize); else - lpTemp = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize); + lpTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize); if (!lpTemp) return FALSE; @@ -2046,7 +2047,7 @@ LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT i) if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount); nSize = nNewItems * sizeof(LPVOID); - lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + lpDest = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize); if (!lpDest) return NULL; @@ -2083,7 +2084,7 @@ BOOL WINAPI DPA_DeleteAllPtrs (const HDPA hdpa) hdpa->nItemCount = 0; hdpa->nMaxCount = hdpa->nGrow * 2; - hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpa->ptrs = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->nMaxCount * sizeof(LPVOID)); return TRUE; @@ -2280,7 +2281,7 @@ HDPA WINAPI DPA_CreateEx (INT nGrow, HANDLE hHeap) TRACE("(%d %p)\n", nGrow, hHeap); if (hHeap) - hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa)); + hdpa = HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa)); else hdpa = Alloc (sizeof(*hdpa)); @@ -2367,7 +2368,7 @@ static LRESULT DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr) lpNmh->code = uCode; } - return SendMessageA (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh); + return SendMessageW (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh); } diff --git a/reactos/lib/comctl32/comctl_Sv.rc b/reactos/lib/comctl32/comctl_Sv.rc index cea2d6b12d3..273ee861da0 100644 --- a/reactos/lib/comctl32/comctl_Sv.rc +++ b/reactos/lib/comctl32/comctl_Sv.rc @@ -1,87 +1,87 @@ -/* - * Copyright 2005 Andreas Bjerkeholt - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH - -IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 -STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE -CAPTION "Egenskaper för " -FONT 8, "MS Shell Dlg" -BEGIN - DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP - PUSHBUTTON "Avbryt", IDCANCEL,58,122,50,14 - PUSHBUTTON "&Verkställ", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED - PUSHBUTTON "Hjälp", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP - CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 -END - - -IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE -CAPTION "Guide" -FONT 8, "MS Shell Dlg" -BEGIN - DEFPUSHBUTTON "Slutför", IDC_FINISH_BUTTON,121,138,50,14 - DEFPUSHBUTTON "&Nästa >", IDC_NEXT_BUTTON,121,138,50,14 - PUSHBUTTON "< &Föregående", IDC_BACK_BUTTON,71,138,50,14 - PUSHBUTTON "Avbryt", IDCANCEL,178,138,50,14 - PUSHBUTTON "Hjälp", IDHELP,235,138,50,14,WS_GROUP - LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN - CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 - LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE -END - - -IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Anpassa verktygsfältet" -FONT 8, "MS Shell Dlg" -BEGIN - DEFPUSHBUTTON "&Stäng", IDCANCEL,308,6,44,14 - PUSHBUTTON "&Återställ", IDC_RESET_BTN,308,23,44,14 - PUSHBUTTON "&Hjälp", IDC_HELP_BTN,308,40,44,14 - PUSHBUTTON "Flytta &upp", IDC_MOVEUP_BTN,308,74,44,14 - PUSHBUTTON "Flytta &ned", IDC_MOVEDN_BTN,308,91,44,14 - LTEXT "T&illgängliga knappar:", -1,4,5,84,10 - LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - PUSHBUTTON "&Lägg till ->", IDOK, 131, 42, 44, 14 - PUSHBUTTON "<- &Ta bort", IDC_REMOVE_BTN,131,62,44,14 - LTEXT "Knappar i v&erktygsfältet:", -1,182,5,85,10 - LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP -END - -STRINGTABLE DISCARDABLE -{ - IDS_CLOSE "Stäng" -} - -STRINGTABLE DISCARDABLE -{ - IDM_TODAY "Idag:" - IDM_GOTODAY "Gå till idag" -} - -STRINGTABLE DISCARDABLE -{ - IDS_SEPARATOR "Separator" -} - -STRINGTABLE DISCARDABLE -{ - HKY_NONE "Ingen" -} +/* + * Copyright 2005 Andreas Bjerkeholt + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 +STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Egenskaper för " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP + PUSHBUTTON "Avbryt", IDCANCEL,58,122,50,14 + PUSHBUTTON "&Verkställ", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED + PUSHBUTTON "Hjälp", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 +END + + +IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Guide" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Slutför", IDC_FINISH_BUTTON,121,138,50,14 + DEFPUSHBUTTON "&Nästa >", IDC_NEXT_BUTTON,121,138,50,14 + PUSHBUTTON "< &Föregående", IDC_BACK_BUTTON,71,138,50,14 + PUSHBUTTON "Avbryt", IDCANCEL,178,138,50,14 + PUSHBUTTON "Hjälp", IDHELP,235,138,50,14,WS_GROUP + LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 + LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE +END + + +IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Anpassa verktygsfältet" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "&Stäng", IDCANCEL,308,6,44,14 + PUSHBUTTON "&Återställ", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "&Hjälp", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "Flytta &upp", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "Flytta &ned", IDC_MOVEDN_BTN,308,91,44,14 + LTEXT "T&illgängliga knappar:", -1,4,5,84,10 + LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + PUSHBUTTON "&Lägg till ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- &Ta bort", IDC_REMOVE_BTN,131,62,44,14 + LTEXT "Knappar i v&erktygsfältet:", -1,182,5,85,10 + LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP +END + +STRINGTABLE DISCARDABLE +{ + IDS_CLOSE "Stäng" +} + +STRINGTABLE DISCARDABLE +{ + IDM_TODAY "Idag:" + IDM_GOTODAY "Gå till idag" +} + +STRINGTABLE DISCARDABLE +{ + IDS_SEPARATOR "Separator" +} + +STRINGTABLE DISCARDABLE +{ + HKY_NONE "Ingen" +} diff --git a/reactos/lib/comctl32/commctrl.c b/reactos/lib/comctl32/commctrl.c index 0fbbc940710..c10adeddd3c 100644 --- a/reactos/lib/comctl32/commctrl.c +++ b/reactos/lib/comctl32/commctrl.c @@ -118,7 +118,7 @@ extern void UPDOWN_Unregister(void); LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -LPSTR COMCTL32_aSubclass = NULL; +LPWSTR COMCTL32_wSubclass = NULL; HMODULE COMCTL32_hModule = 0; LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); HBRUSH COMCTL32_hPattern55AABrush = NULL; @@ -132,6 +132,9 @@ static const WORD wPattern55AA[] = 0x5555, 0xaaaa, 0x5555, 0xaaaa }; +static const WCHAR strCC32SubclassInfo[] = { + 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0 +}; /*********************************************************************** * DllMain [Internal] @@ -159,8 +162,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) COMCTL32_hModule = (HMODULE)hinstDLL; /* add global subclassing atom (used by 'tooltip' and 'updown') */ - COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo"); - TRACE("Subclassing atom added: %p\n", COMCTL32_aSubclass); + COMCTL32_wSubclass = (LPWSTR)(DWORD)GlobalAddAtomW (strCC32SubclassInfo); + TRACE("Subclassing atom added: %p\n", COMCTL32_wSubclass); /* create local pattern brush */ COMCTL32_hPattern55AABitmap = CreateBitmap (8, 8, 1, 1, wPattern55AA); @@ -217,9 +220,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) COMCTL32_hPattern55AABitmap = NULL; /* delete global subclassing atom */ - GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass)); - TRACE("Subclassing atom deleted: %p\n", COMCTL32_aSubclass); - COMCTL32_aSubclass = NULL; + GlobalDeleteAtom (LOWORD(COMCTL32_wSubclass)); + TRACE("Subclassing atom deleted: %p\n", COMCTL32_wSubclass); + COMCTL32_wSubclass = NULL; break; } @@ -274,7 +277,7 @@ MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) { /* menu was closed */ TRACE("menu was closed!\n"); - SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0); + SendMessageW (hwndStatus, SB_SIMPLE, FALSE, 0); } else { /* menu item was selected */ @@ -285,14 +288,14 @@ MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, TRACE("uMenuID = %u\n", uMenuID); if (uMenuID) { - CHAR szText[256]; + WCHAR szText[256]; - if (!LoadStringA (hInst, uMenuID, szText, 256)) + if (!LoadStringW (hInst, uMenuID, szText, sizeof(szText)/sizeof(szText[0]))) szText[0] = '\0'; - SendMessageA (hwndStatus, SB_SETTEXTA, + SendMessageW (hwndStatus, SB_SETTEXTW, 255 | SBT_NOBORDERS, (LPARAM)szText); - SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0); + SendMessageW (hwndStatus, SB_SIMPLE, TRUE, 0); } } break; @@ -425,7 +428,7 @@ GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo) return; lpRun++; hwndCtrl = GetDlgItem (hwnd, *lpRun); - if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) { + if (GetWindowLongW (hwndCtrl, GWL_STYLE) & WS_VISIBLE) { TRACE("control id 0x%x\n", *lpRun); GetWindowRect (hwndCtrl, &rcCtrl); MapWindowPoints (NULL, hwnd, (LPPOINT)&rcCtrl, 2); @@ -511,12 +514,12 @@ void WINAPI DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style) if ( text ) { if ( (len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 )) ) { - if ( (textW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )) ) + if ( (textW = Alloc( len * sizeof(WCHAR) )) ) MultiByteToWideChar( CP_ACP, 0, text, -1, textW, len ); } } DrawStatusTextW( hdc, lprc, textW, style ); - HeapFree( GetProcessHeap(), 0, textW ); + Free( textW ); } @@ -603,12 +606,12 @@ CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy, HWND buddy, INT maxVal, INT minVal, INT curVal) { HWND hUD = - CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy, + CreateWindowW (UPDOWN_CLASSW, 0, style, x, y, cx, cy, parent, (HMENU)id, inst, 0); if (hUD) { - SendMessageA (hUD, UDM_SETBUDDY, (WPARAM)buddy, 0); - SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); - SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); + SendMessageW (hUD, UDM_SETBUDDY, (WPARAM)buddy, 0); + SendMessageW (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); + SendMessageW (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); } return hUD; @@ -764,13 +767,12 @@ CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps, HWND hwndTB; hwndTB = - CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL, style|WS_CHILD, 0,0,100,30, + CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL, style|WS_CHILD, 0,0,100,30, hwnd, (HMENU)wID, COMCTL32_hModule, NULL); if(hwndTB) { TBADDBITMAP tbab; - SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE, - (WPARAM)uStructSize, 0); + SendMessageW (hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM)uStructSize, 0); /* set bitmap and button size */ /*If CreateToolbarEx receives 0, windows sets default values*/ @@ -778,29 +780,28 @@ CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps, dxBitmap = 16; if (dyBitmap <= 0) dyBitmap = 15; - SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0, - MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap)); + SendMessageW (hwndTB, TB_SETBITMAPSIZE, 0, + MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap)); if (dxButton <= 0) dxButton = 24; if (dyButton <= 0) dyButton = 22; - SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0, - MAKELPARAM((WORD)dxButton, (WORD)dyButton)); + SendMessageW (hwndTB, TB_SETBUTTONSIZE, 0, + MAKELPARAM((WORD)dxButton, (WORD)dyButton)); /* add bitmaps */ if (nBitmaps > 0) { - tbab.hInst = hBMInst; - tbab.nID = wBMID; + tbab.hInst = hBMInst; + tbab.nID = wBMID; - SendMessageA (hwndTB, TB_ADDBITMAP, - (WPARAM)nBitmaps, (LPARAM)&tbab); + SendMessageW (hwndTB, TB_ADDBITMAP, (WPARAM)nBitmaps, (LPARAM)&tbab); } /* add buttons */ if(iNumButtons > 0) - SendMessageA (hwndTB, TB_ADDBUTTONSA, + SendMessageW (hwndTB, TB_ADDBUTTONSW, (WPARAM)iNumButtons, (LPARAM)lpButtons); } @@ -856,7 +857,7 @@ CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags, sysColorMap = (LPCOLORMAP)internalColorMap; } - hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, (LPSTR)RT_BITMAP); + hRsrc = FindResourceW (hInstance, (LPWSTR)idBitmap, (LPWSTR)RT_BITMAP); if (hRsrc == 0) return 0; hglb = LoadResource (hInstance, hRsrc); @@ -1103,16 +1104,15 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, * from there. */ /* See if we have been called for this window */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { /* allocate stack */ - stack = (LPSUBCLASS_INFO)HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(SUBCLASS_INFO)); + stack = Alloc (sizeof(SUBCLASS_INFO)); if (!stack) { ERR ("Failed to allocate our Subclassing stack\n"); return FALSE; } - SetPropA (hWnd, COMCTL32_aSubclass, (HANDLE)stack); + SetPropW (hWnd, COMCTL32_wSubclass, (HANDLE)stack); /* set window procedure to our own and save the current one */ if (IsWindowUnicode (hWnd)) @@ -1136,15 +1136,15 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, } } - proc = HeapAlloc(GetProcessHeap(), 0, sizeof(SUBCLASSPROCS)); + proc = Alloc(sizeof(SUBCLASSPROCS)); if (!proc) { ERR ("Failed to allocate subclass entry in stack\n"); if (IsWindowUnicode (hWnd)) SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); - HeapFree (GetProcessHeap (), 0, stack); - RemovePropA( hWnd, COMCTL32_aSubclass ); + Free (stack); + RemovePropW( hWnd, COMCTL32_wSubclass ); return FALSE; } @@ -1183,7 +1183,7 @@ BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, TRACE ("(%p, %p, %x, %p)\n", hWnd, pfnSubclass, uID, pdwRef); /* See if we have been called for this window */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; @@ -1226,7 +1226,7 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u TRACE ("(%p, %p, %x)\n", hWnd, pfnSubclass, uID); /* Find the Subclass to remove */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; @@ -1243,7 +1243,7 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u if (stack->stackpos == proc) stack->stackpos = stack->stackpos->next; - HeapFree (GetProcessHeap (), 0, proc); + Free (proc); ret = TRUE; break; } @@ -1258,8 +1258,8 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); - HeapFree (GetProcessHeap (), 0, stack); - RemovePropA( hWnd, COMCTL32_aSubclass ); + Free (stack); + RemovePropW( hWnd, COMCTL32_wSubclass ); } return ret; @@ -1279,7 +1279,7 @@ LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARA TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; @@ -1300,8 +1300,8 @@ LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARA SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); - HeapFree (GetProcessHeap (), 0, stack); - RemovePropA( hWnd, COMCTL32_aSubclass ); + Free (stack); + RemovePropW( hWnd, COMCTL32_wSubclass ); } return ret; } @@ -1330,7 +1330,7 @@ LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); /* retrieve our little stack from the Properties */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; @@ -1374,7 +1374,7 @@ COMCTL32_CreateToolTip(HWND hwndOwner) { HWND hwndToolTip; - hwndToolTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0, + hwndToolTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, 0, 0, 0); @@ -1390,9 +1390,9 @@ COMCTL32_CreateToolTip(HWND hwndOwner) nmttc.hdr.code = NM_TOOLTIPSCREATED; nmttc.hwndToolTips = hwndToolTip; - SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY, + SendMessageW(GetParent(hwndTrueOwner), WM_NOTIFY, (WPARAM)GetWindowLongPtrW(hwndTrueOwner, GWLP_ID), - (LPARAM)&nmttc); + (LPARAM)&nmttc); } return hwndToolTip; diff --git a/reactos/lib/comctl32/datetime.c b/reactos/lib/comctl32/datetime.c index 8b8af308a8d..5fed3f7bda1 100644 --- a/reactos/lib/comctl32/datetime.c +++ b/reactos/lib/comctl32/datetime.c @@ -82,6 +82,7 @@ typedef struct int *buflen; WCHAR textbuf[256]; POINT monthcal_pos; + int pendingUpdown; } DATETIME_INFO, *LPDATETIME_INFO; /* in monthcal.c */ @@ -256,7 +257,7 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat) if (infoPtr->dwStyle & DTS_LONGDATEFORMAT) format_item = LOCALE_SLONGDATE; - else if (infoPtr->dwStyle & DTS_TIMEFORMAT) + else if ((infoPtr->dwStyle & DTS_TIMEFORMAT) == DTS_TIMEFORMAT) format_item = LOCALE_STIMEFORMAT; else /* DTS_SHORTDATEFORMAT */ format_item = LOCALE_SSHORTDATE; @@ -265,6 +266,7 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat) } DATETIME_UseFormat (infoPtr, lpszFormat); + InvalidateRect (infoPtr->hwndSelf, NULL, TRUE); return infoPtr->nrFields; } @@ -338,10 +340,22 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, LPWSTR result, int result GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDAYNAME1+(date.wDayOfWeek+6)%7, result, resultSize); break; case ONEDIGIT12HOUR: - wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0)); + if (date.wHour == 0) { + result[0] = '1'; + result[1] = '2'; + result[2] = 0; + } + else + wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0)); break; case TWODIGIT12HOUR: - wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0)); + if (date.wHour == 0) { + result[0] = '1'; + result[1] = '2'; + result[2] = 0; + } + else + wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0)); break; case ONEDIGIT24HOUR: wsprintfW (result, fmt_dW, date.wHour); @@ -405,6 +419,19 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, LPWSTR result, int result TRACE ("arg%d=%x->[%s]\n", count, infoPtr->fieldspec[count], debugstr_w(result)); } +/* Offsets of days in the week to the weekday of january 1 in a leap year. */ +static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; + +/* returns the day in the week(0 == sunday, 6 == saturday) */ +/* day(1 == 1st, 2 == 2nd... etc), year is the year value */ +static int DATETIME_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year) +{ + year-=(month < 3); + + return((year + year/4 - year/100 + year/400 + + DayOfWeekTable[month-1] + day ) % 7); +} + static int wrap(int val, int delta, int minVal, int maxVal) { val += delta; @@ -428,12 +455,14 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta) case TWODIGITYEAR: case FULLYEAR: date->wYear = wrap(date->wYear, delta, 1752, 9999); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear); break; case ONEDIGITMONTH: case TWODIGITMONTH: case THREECHARMONTH: case FULLMONTH: date->wMonth = wrap(date->wMonth, delta, 1, 12); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear); delta = 0; /* fall through */ case ONEDIGITDAY: @@ -441,6 +470,7 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta) case THREECHARDAY: case FULLDAY: date->wDay = wrap(date->wDay, delta, 1, MONTHCAL_MonthLength(date->wMonth, date->wYear)); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear); break; case ONELETTERAMPM: case TWOLETTERAMPM: @@ -481,6 +511,92 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta) } +static void +DATETIME_ReturnFieldWidth (DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *fieldWidthPtr) +{ + /* fields are a fixed width, determined by the largest possible string */ + /* presumably, these widths should be language dependent */ + static const WCHAR fld_d1W[] = { '2', 0 }; + static const WCHAR fld_d2W[] = { '2', '2', 0 }; + static const WCHAR fld_d4W[] = { '2', '2', '2', '2', 0 }; + static const WCHAR fld_am1[] = { 'A', 0 }; + static const WCHAR fld_am2[] = { 'A', 'M', 0 }; + static const WCHAR fld_day[] = { 'W', 'e', 'd', 'n', 'e', 's', 'd', 'a', 'y', 0 }; + static const WCHAR fld_day3[] = { 'W', 'e', 'd', 0 }; + static const WCHAR fld_mon[] = { 'S', 'e', 'p', 't', 'e', 'm', 'b', 'e', 'r', 0 }; + static const WCHAR fld_mon3[] = { 'D', 'e', 'c', 0 }; + int spec; + WCHAR buffer[80], *bufptr; + SIZE size; + + TRACE ("%d,%d\n", infoPtr->nrFields, count); + if (count>infoPtr->nrFields || count < 0) { + WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count); + return; + } + + if (!infoPtr->fieldspec) return; + + spec = infoPtr->fieldspec[count]; + if (spec & DT_STRING) { + int txtlen = infoPtr->buflen[count]; + + if (txtlen > 79) + txtlen = 79; + memcpy (buffer, infoPtr->textbuf + (spec &~ DT_STRING), txtlen * sizeof(WCHAR)); + buffer[txtlen] = 0; + bufptr = buffer; + } + else { + switch (spec) { + case ONEDIGITDAY: + case ONEDIGIT12HOUR: + case ONEDIGIT24HOUR: + case ONEDIGITSECOND: + case ONEDIGITMINUTE: + case ONEDIGITMONTH: + case ONEDIGITYEAR: + /* these seem to use a two byte field */ + case TWODIGITDAY: + case TWODIGIT12HOUR: + case TWODIGIT24HOUR: + case TWODIGITSECOND: + case TWODIGITMINUTE: + case TWODIGITMONTH: + case TWODIGITYEAR: + bufptr = (WCHAR *)fld_d2W; + break; + case INVALIDFULLYEAR: + case FULLYEAR: + bufptr = (WCHAR *)fld_d4W; + break; + case THREECHARDAY: + bufptr = (WCHAR *)fld_day3; + break; + case FULLDAY: + bufptr = (WCHAR *)fld_day; + break; + case THREECHARMONTH: + bufptr = (WCHAR *)fld_mon3; + break; + case FULLMONTH: + bufptr = (WCHAR *)fld_mon; + break; + case ONELETTERAMPM: + bufptr = (WCHAR *)fld_am1; + break; + case TWOLETTERAMPM: + bufptr = (WCHAR *)fld_am2; + break; + default: + bufptr = (WCHAR *)fld_d1W; + break; + } + } + GetTextExtentPoint32W (hdc, bufptr, strlenW(bufptr), &size); + *fieldWidthPtr = size.cx; +} + static void DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) { @@ -491,6 +607,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) RECT *checkbox = &infoPtr->checkbox; SIZE size; COLORREF oldTextColor; + SHORT fieldWidth; /* draw control edge */ TRACE("\n"); @@ -509,9 +626,10 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) for (i = 0; i < infoPtr->nrFields; i++) { DATETIME_ReturnTxt (infoPtr, i, txt, sizeof(txt)/sizeof(txt[0])); GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size); + DATETIME_ReturnFieldWidth (infoPtr, hdc, i, &fieldWidth); field = &infoPtr->fieldRect[i]; field->left = prevright; - field->right = prevright+size.cx; + field->right = prevright + fieldWidth; field->top = rcDraw->top; field->bottom = rcDraw->bottom; prevright = field->right; @@ -720,12 +838,17 @@ DATETIME_Notify (DATETIME_INFO *infoPtr, int idCtrl, LPNMHDR lpnmh) ShowWindow(infoPtr->hMonthCal, SW_HIDE); infoPtr->dateValid = TRUE; SendMessageW (infoPtr->hMonthCal, MCM_GETCURSEL, 0, (LPARAM)&infoPtr->date); - TRACE("got from calendar %04d/%02d/%02d\n", - infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay); + TRACE("got from calendar %04d/%02d/%02d day of week %d\n", + infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay, infoPtr->date.wDayOfWeek); SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); DATETIME_SendDateTimeChangeNotify (infoPtr); } + if ((lpnmh->hwndFrom == infoPtr->hUpdown) && (lpnmh->code == UDN_DELTAPOS)) { + LPNMUPDOWN lpnmud = (LPNMUPDOWN)lpnmh; + TRACE("Delta pos %d\n", lpnmud->iDelta); + infoPtr->pendingUpdown = lpnmud->iDelta; + } return 0; } @@ -743,6 +866,83 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode, LPARAM flags) FIXME ("Callbacks not implemented yet\n"); } + if (vkCode >= '0' && vkCode <= '9') { + /* this is a somewhat simplified version of what Windows does */ + SYSTEMTIME *date = &infoPtr->date; + switch (infoPtr->fieldspec[fieldNum]) { + case ONEDIGITYEAR: + case TWODIGITYEAR: + date->wYear = date->wYear - (date->wYear%100) + + (date->wYear%10)*10 + (vkCode-'0'); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case INVALIDFULLYEAR: + case FULLYEAR: + date->wYear = (date->wYear%1000)*10 + (vkCode-'0'); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITMONTH: + case TWODIGITMONTH: + if ((date->wMonth%10) > 1 || (vkCode-'0') > 2) + date->wMonth = vkCode-'0'; + else + date->wMonth = (date->wMonth%10)*10+vkCode-'0'; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITDAY: + case TWODIGITDAY: + /* probably better checking here would help */ + if ((date->wDay%10) >= 3 && (vkCode-'0') > 1) + date->wDay = vkCode-'0'; + else + date->wDay = (date->wDay%10)*10+vkCode-'0'; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGIT12HOUR: + case TWODIGIT12HOUR: + if ((date->wHour%10) > 1 || (vkCode-'0') > 2) + date->wHour = vkCode-'0'; + else + date->wHour = (date->wHour%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGIT24HOUR: + case TWODIGIT24HOUR: + if ((date->wHour%10) > 2) + date->wHour = vkCode-'0'; + else if ((date->wHour%10) == 2 && (vkCode-'0') > 3) + date->wHour = vkCode-'0'; + else + date->wHour = (date->wHour%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITMINUTE: + case TWODIGITMINUTE: + if ((date->wMinute%10) > 5) + date->wMinute = vkCode-'0'; + else + date->wMinute = (date->wMinute%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITSECOND: + case TWODIGITSECOND: + if ((date->wSecond%10) > 5) + date->wSecond = vkCode-'0'; + else + date->wSecond = (date->wSecond%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + } + } + switch (vkCode) { case VK_ADD: case VK_UP: @@ -783,7 +983,31 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode, LPARAM flags) break; } - InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + + return 0; +} + + +static LRESULT +DATETIME_VScroll (DATETIME_INFO *infoPtr, WORD wScroll) +{ + int fieldNum = infoPtr->select & DTHT_DATEFIELD; + + if ((SHORT)LOWORD(wScroll) != SB_THUMBPOSITION) return 0; + if (!(infoPtr->haveFocus)) return 0; + if ((fieldNum==0) && (infoPtr->select)) return 0; + + if (infoPtr->pendingUpdown >= 0) { + DATETIME_IncreaseField (infoPtr, fieldNum, 1); + DATETIME_SendDateTimeChangeNotify (infoPtr); + } + else { + DATETIME_IncreaseField (infoPtr, fieldNum, -1); + DATETIME_SendDateTimeChangeNotify (infoPtr); + } + + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return 0; } @@ -874,13 +1098,21 @@ DATETIME_Size (DATETIME_INFO *infoPtr, WORD flags, INT width, INT height) TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right); infoPtr->rcDraw = infoPtr->rcClient; - - /* set the size of the button that drops the calendar down */ - /* FIXME: account for style that allows button on left side */ - infoPtr->calbutton.top = infoPtr->rcDraw.top; - infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom; - infoPtr->calbutton.left = infoPtr->rcDraw.right-15; - infoPtr->calbutton.right = infoPtr->rcDraw.right; + + if (infoPtr->dwStyle & DTS_UPDOWN) { + SetWindowPos(infoPtr->hUpdown, NULL, + infoPtr->rcClient.right-14, 0, + 15, infoPtr->rcClient.bottom - infoPtr->rcClient.top, + SWP_NOACTIVATE | SWP_NOZORDER); + } + else { + /* set the size of the button that drops the calendar down */ + /* FIXME: account for style that allows button on left side */ + infoPtr->calbutton.top = infoPtr->rcDraw.top; + infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom; + infoPtr->calbutton.left = infoPtr->rcDraw.right-15; + infoPtr->calbutton.right = infoPtr->rcDraw.right; + } /* set enable/disable button size for show none style being enabled */ /* FIXME: these dimensions are completely incorrect */ @@ -958,7 +1190,7 @@ DATETIME_Create (HWND hwnd, LPCREATESTRUCTW lpcs) 0, 0, 0, 0, infoPtr->hwndSelf, 0, 0, 0); /* initialize info structure */ - GetSystemTime (&infoPtr->date); + GetLocalTime (&infoPtr->date); infoPtr->dateValid = TRUE; infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT); @@ -1067,6 +1299,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_LBUTTONUP: return DATETIME_LButtonUp (infoPtr, (WORD)wParam); + case WM_VSCROLL: + return DATETIME_VScroll (infoPtr, (WORD)wParam); + case WM_CREATE: return DATETIME_Create (hwnd, (LPCREATESTRUCTW)lParam); diff --git a/reactos/lib/comctl32/flatsb.c b/reactos/lib/comctl32/flatsb.c index 1c5fa66236a..baebbe68244 100644 --- a/reactos/lib/comctl32/flatsb.c +++ b/reactos/lib/comctl32/flatsb.c @@ -245,7 +245,7 @@ static LRESULT WINAPI FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) - return DefWindowProcA( hwnd, uMsg, wParam, lParam ); + return DefWindowProcW( hwnd, uMsg, wParam, lParam ); switch (uMsg) { @@ -259,7 +259,7 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); } } @@ -267,23 +267,23 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) VOID FLATSB_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS; wndClass.lpfnWndProc = FlatSB_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(FLATSB_INFO *); - wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wndClass.lpszClassName = FLATSB_CLASSA; + wndClass.lpszClassName = FLATSB_CLASSW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); } VOID FLATSB_Unregister (void) { - UnregisterClassA (FLATSB_CLASSA, NULL); + UnregisterClassW (FLATSB_CLASSW, NULL); } diff --git a/reactos/lib/comctl32/header.c b/reactos/lib/comctl32/header.c index 601a0c886fe..56d0b747ff8 100644 --- a/reactos/lib/comctl32/header.c +++ b/reactos/lib/comctl32/header.c @@ -83,7 +83,7 @@ typedef struct INT iHotItem; /* index of hot item (cursor is over this item) */ INT iMargin; /* width of the margin that surrounds a bitmap */ - HIMAGELIST himl; /* handle to a image list (may be 0) */ + HIMAGELIST himl; /* handle to an image list (may be 0) */ HEADER_ITEM *items; /* pointer to array of HEADER_ITEM's */ BOOL bRectsValid; /* validity flag for bounding rectangles */ } HEADER_INFO; @@ -174,7 +174,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack) if (r.right - r.left == 0) return phdi->rect.right; - if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) { + if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) { if (phdi->bDown) { DrawEdge (hdc, &r, BDR_RAISEDOUTER, BF_RECT | BF_FLAT | BF_MIDDLE | BF_ADJUST); @@ -200,7 +200,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack) dis.rcItem = r; dis.itemData = phdi->lParam; oldBkMode = SetBkMode(hdc, TRANSPARENT); - SendMessageA (infoPtr->hwndNotify, WM_DRAWITEM, + SendMessageW (infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis); if (oldBkMode != TRANSPARENT) SetBkMode(hdc, oldBkMode); @@ -218,7 +218,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack) HDC hdcBitmap; INT yD, yS, cx, cy, rx, ry; - GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); ry = r.bottom - r.top; rx = r.right - r.left; @@ -257,7 +257,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack) INT xD, yD, yS, cx, cy, rx, ry, tx; RECT textRect; - GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); textRect = r; if (phdi->fmt & HDF_STRING) { @@ -385,7 +385,7 @@ HEADER_Refresh (HWND hwnd, HDC hdc) if ((x <= rect.right) && (infoPtr->uNumItem > 0)) { rect.left = x; - if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) + if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) DrawEdge (hdc, &rect, EDGE_RAISED, BF_TOP|BF_LEFT|BF_BOTTOM|BF_SOFT); else DrawEdge (hdc, &rect, EDGE_ETCHED, BF_BOTTOM); @@ -558,7 +558,7 @@ HEADER_SendSimpleNotify (HWND hwnd, UINT code) nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.code = code; - return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + return (BOOL)SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } @@ -587,7 +587,7 @@ HEADER_SendHeaderNotify (HWND hwnd, UINT code, INT iItem, INT mask) nmitem.iOrder = infoPtr->items[iItem].iOrder; nmitem.iImage = infoPtr->items[iItem].iImage; - return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + return (BOOL)SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr); } @@ -1106,7 +1106,7 @@ HEADER_Layout (HWND hwnd, WPARAM wParam, LPARAM lParam) lpLayout->pwpos->x = lpLayout->prc->left; lpLayout->pwpos->y = lpLayout->prc->top; lpLayout->pwpos->cx = lpLayout->prc->right - lpLayout->prc->left; - if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_HIDDEN) + if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_HIDDEN) lpLayout->pwpos->cy = 0; else { lpLayout->pwpos->cy = infoPtr->nHeight; @@ -1304,21 +1304,21 @@ static LRESULT HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr; - TEXTMETRICA tm; + TEXTMETRICW tm; HFONT hOldFont; HDC hdc; infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO)); - SetWindowLongPtrA (hwnd, 0, (DWORD_PTR)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->uNumItem = 0; infoPtr->hFont = 0; infoPtr->items = 0; infoPtr->bRectsValid = FALSE; - infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW); - infoPtr->hcurDivider = LoadCursorA (COMCTL32_hModule, MAKEINTRESOURCEA(IDC_DIVIDER)); - infoPtr->hcurDivopen = LoadCursorA (COMCTL32_hModule, MAKEINTRESOURCEA(IDC_DIVIDEROPEN)); + infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW); + infoPtr->hcurDivider = LoadCursorW (COMCTL32_hModule, MAKEINTRESOURCEW(IDC_DIVIDER)); + infoPtr->hcurDivopen = LoadCursorW (COMCTL32_hModule, MAKEINTRESOURCEW(IDC_DIVIDEROPEN)); infoPtr->bPressed = FALSE; infoPtr->bTracking = FALSE; infoPtr->iMoveItem = 0; @@ -1327,11 +1327,11 @@ HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->bUnicode = IsWindowUnicode (hwnd); infoPtr->iMargin = 3*GetSystemMetrics(SM_CXEDGE); infoPtr->nNotifyFormat = - SendMessageA (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); + SendMessageW (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); hdc = GetDC (0); hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); - GetTextMetricsA (hdc, &tm); + GetTextMetricsW (hdc, &tm); infoPtr->nHeight = tm.tmHeight + VERT_BORDER; SelectObject (hdc, hOldFont); ReleaseDC (0, hdc); @@ -1359,8 +1359,8 @@ HEADER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) if (infoPtr->himl) ImageList_Destroy (infoPtr->himl); + SetWindowLongPtrW (hwnd, 0, 0); Free (infoPtr); - SetWindowLongPtrA (hwnd, 0, 0); return 0; } @@ -1385,7 +1385,7 @@ HEADER_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam) pt.y = (INT)HIWORD(lParam); HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); - if ((GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER)) + if ((GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER)) HEADER_SendHeaderNotify (hwnd, HDN_ITEMDBLCLICKA, nItem,0); else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) HEADER_SendHeaderNotify (hwnd, HDN_DIVIDERDBLCLICKA, nItem,0); @@ -1398,7 +1398,7 @@ static LRESULT HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); POINT pt; UINT flags; INT nItem; @@ -1452,7 +1452,7 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); /* - *DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + *DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); */ POINT pt; UINT flags; @@ -1551,7 +1551,7 @@ HEADER_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) case NF_REQUERY: infoPtr->nNotifyFormat = - SendMessageA ((HWND)wParam, WM_NOTIFYFORMAT, + SendMessageW ((HWND)wParam, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_QUERY); return infoPtr->nNotifyFormat; } @@ -1564,7 +1564,7 @@ static LRESULT HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); POINT pt; UINT flags; INT nItem, nWidth; @@ -1661,7 +1661,7 @@ HEADER_RButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) ClientToScreen(hwnd, &pt); /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */ - SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y)); + SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y)); return bRet; } @@ -1697,7 +1697,7 @@ static LRESULT HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - TEXTMETRICA tm; + TEXTMETRICW tm; HFONT hFont, hOldFont; HDC hdc; @@ -1707,7 +1707,7 @@ HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) hdc = GetDC (0); hOldFont = SelectObject (hdc, hFont); - GetTextMetricsA (hdc, &tm); + GetTextMetricsW (hdc, &tm); infoPtr->nHeight = tm.tmHeight + VERT_BORDER; SelectObject (hdc, hOldFont); ReleaseDC (0, hdc); @@ -1727,7 +1727,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { TRACE("hwnd=%p msg=%x wparam=%x lParam=%lx\n", hwnd, msg, wParam, lParam); if (!HEADER_GetInfoPtr (hwnd) && (msg != WM_CREATE)) - return DefWindowProcA (hwnd, msg, wParam, lParam); + return DefWindowProcW (hwnd, msg, wParam, lParam); switch (msg) { /* case HDM_CLEARFILTER: */ @@ -1857,22 +1857,22 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) VOID HEADER_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = HEADER_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(HEADER_INFO *); - wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); - wndClass.lpszClassName = WC_HEADERA; + wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); + wndClass.lpszClassName = WC_HEADERW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); } VOID HEADER_Unregister (void) { - UnregisterClassA (WC_HEADERA, NULL); + UnregisterClassW (WC_HEADERW, NULL); } diff --git a/reactos/lib/comctl32/imagelist.c b/reactos/lib/comctl32/imagelist.c index db098b2cc11..f392f131ba2 100644 --- a/reactos/lib/comctl32/imagelist.c +++ b/reactos/lib/comctl32/imagelist.c @@ -1405,14 +1405,19 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle) TRACE("%p %d %d\n", himl, i, fStyle); if (!is_valid(himl) || (i < 0) || (i >= himl->cCurImage)) return NULL; - hdcDst = CreateCompatibleDC(0); - ii.fIcon = TRUE; ii.xHotspot = 0; ii.yHotspot = 0; + /* create colour bitmap */ + hdcDst = GetDC(0); + ii.hbmColor = CreateCompatibleBitmap(hdcDst, himl->cx, himl->cy); + ReleaseDC(0, hdcDst); + + hdcDst = CreateCompatibleDC(0); + /* draw mask*/ - ii.hbmMask = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy); + ii.hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL); hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask); if (himl->hbmMask) { BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, @@ -1422,7 +1427,6 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle) PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); /* draw image*/ - ii.hbmColor = CreateCompatibleBitmap (himl->hdcImage, himl->cx, himl->cy); SelectObject (hdcDst, ii.hbmColor); BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, himl->hdcImage, i * himl->cx, 0, SRCCOPY); @@ -1594,11 +1598,11 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow, uType, uFlags); len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0); - lpbmpW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + lpbmpW = Alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len); himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags); - HeapFree(GetProcessHeap(), 0, lpbmpW); + Free (lpbmpW); return himl; } @@ -2786,7 +2790,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT BYTE temp; colors = 1 << himl->uBitsPixel; - bmi = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) + + bmi = Alloc(sizeof(BITMAPINFOHEADER) + sizeof(PALETTEENTRY) * colors); pal = (LPPALETTEENTRY)bmi->bmiColors; @@ -2803,7 +2807,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT } else { - bmi = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER)); + bmi = Alloc(sizeof(BITMAPINFOHEADER)); } bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -2820,7 +2824,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, &bits, 0, 0); - HeapFree(GetProcessHeap(), 0, bmi); + Free (bmi); } else /*if (ilc == ILC_COLORDDB)*/ { diff --git a/reactos/lib/comctl32/listview.c b/reactos/lib/comctl32/listview.c index e35c4f57582..df00d220e50 100644 --- a/reactos/lib/comctl32/listview.c +++ b/reactos/lib/comctl32/listview.c @@ -40,8 +40,7 @@ * * Bugs * -- Expand large item in ICON mode when the cursor is flying over the icon or text. - * -- Support CustonDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs. - * -- in LISTVIEW_AddGroupSelection, we would send LVN_ODSTATECHANGED + * -- Support CustomDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs). * -- LVA_SNAPTOGRID not implemented * -- LISTVIEW_ApproximateViewRect partially implemented * -- LISTVIEW_[GS]etColumnOrderArray stubs @@ -98,7 +97,6 @@ * -- LVN_HOTTRACK * -- LVN_MARQUEEBEGIN * -- LVN_ODFINDITEM - * -- LVN_ODSTATECHANGED * -- LVN_SETDISPINFO * -- NM_HOVER * @@ -441,7 +439,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW) if (!isW && is_textT(text, isW)) { INT len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, NULL, 0); - wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + wstr = Alloc(len * sizeof(WCHAR)); if (wstr) MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, wstr, len); } TRACE(" wstr=%s\n", text == LPSTR_TEXTCALLBACKW ? "(callback)" : debugstr_w(wstr)); @@ -450,7 +448,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW) static inline void textfreeT(LPWSTR wstr, BOOL isW) { - if (!isW && is_textT(wstr, isW)) HeapFree(GetProcessHeap(), 0, wstr); + if (!isW && is_textT(wstr, isW)) Free (wstr); } /* @@ -558,7 +556,7 @@ static inline const char* debugrect(const RECT *rect) } else return "(null)"; } -static const char * debugscrollinfo(const SCROLLINFO *pScrollInfo) +static const char* debugscrollinfo(const SCROLLINFO *pScrollInfo) { char* buf = debug_getbuf(), *text = buf; int len, size = DEBUG_BUFFER_SIZE; @@ -853,8 +851,7 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML *pdi->item.pszText = 0; /* make sure we don't process garbage */ } - pszTempBuf = HeapAlloc(GetProcessHeap(), 0, - (convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax); + pszTempBuf = Alloc( (convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax); if (!pszTempBuf) return FALSE; if (convertToUnicode) @@ -887,7 +884,7 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML savPszText, savCchTextMax); pdi->item.pszText = savPszText; /* restores our buffer */ pdi->item.cchTextMax = savCchTextMax; - HeapFree(GetProcessHeap(), 0, pszTempBuf); + Free (pszTempBuf); } return bResult; } @@ -1023,7 +1020,7 @@ static inline BOOL ranges_delitem(RANGES ranges, INT nItem) * five versa, should leave the iterator at the same item: * prev * n, next * n = next * n, prev * n * - * The iterator has a notion of a out-of-order, special item, + * The iterator has a notion of an out-of-order, special item, * which sits at the start of the list. This is used in * LVS_ICON, and LVS_SMALLICON mode to handle the focused item, * which needs to be first, as it may overlap other items. @@ -2970,22 +2967,35 @@ static void LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) { INT nFirst = min(infoPtr->nSelectionMark, nItem); INT nLast = max(infoPtr->nSelectionMark, nItem); - INT i; + NMLVODSTATECHANGE nmlv; LVITEMW item; + BOOL bOldChange; + INT i; + + /* Temporarily disable change notification + * If the control is LVS_OWNERDATA, we need to send + * only one LVN_ODSTATECHANGED notification. + * See MSDN documentation for LVN_ITEMCHANGED. + */ + bOldChange = infoPtr->bDoChangeNotify; + if (infoPtr->dwStyle & LVS_OWNERDATA) infoPtr->bDoChangeNotify = FALSE; if (nFirst == -1) nFirst = nItem; item.state = LVIS_SELECTED; item.stateMask = LVIS_SELECTED; - /* FIXME: this is not correct LVS_OWNERDATA - * setting the item states individually will generate - * a LVN_ITEMCHANGED notification for each one. Instead, - * we have to send a LVN_ODSTATECHANGED notification. - * See MSDN documentation for LVN_ITEMCHANGED. - */ for (i = nFirst; i <= nLast; i++) LISTVIEW_SetItemState(infoPtr,i,&item); + + ZeroMemory(&nmlv, sizeof(nmlv)); + nmlv.iFrom = nFirst; + nmlv.iTo = nLast; + nmlv.uNewState = 0; + nmlv.uOldState = item.state; + + notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv); + infoPtr->bDoChangeNotify = bOldChange; } @@ -7075,7 +7085,7 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE bResult = LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE); /* - *update selection mark + * Update selection mark * * Investigation on windows 2k showed that selection mark was updated * whenever a new selection was made, but if the selected item was @@ -9551,7 +9561,7 @@ static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, DWORD style, TRACE("(text=%s, ..., isW=%d)\n", debugtext_t(text, isW), isW); - style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|WS_BORDER; + style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|ES_AUTOHSCROLL|WS_BORDER; hdc = GetDC(infoPtr->hwndSelf); /* Select the font to get appropriate metric dimensions */ diff --git a/reactos/lib/comctl32/monthcal.c b/reactos/lib/comctl32/monthcal.c index 961fcae6e69..84aa1dbca6e 100644 --- a/reactos/lib/comctl32/monthcal.c +++ b/reactos/lib/comctl32/monthcal.c @@ -33,12 +33,11 @@ * TODO: * -- MCM_[GS]ETUNICODEFORMAT * -- MONTHCAL_GetMonthRange - * -- Unicodification * -- handle resources better (doesn't work now); * -- take care of internationalization. * -- keyboard handling. * -- GetRange: At the moment, we copy ranges anyway, regardless of - * infoPtr->rangeValid; a invalid range is simply filled + * infoPtr->rangeValid; an invalid range is simply filled * with zeros in SetRange. Is this the right behavior? * -- search for FIXME */ @@ -56,6 +55,7 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(monthcal); @@ -70,6 +70,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(monthcal); #define MC_NEXTMONTHTIMER 1 /* Timer ID's */ #define MC_PREVMONTHTIMER 2 +#define countof(arr) (sizeof(arr)/sizeof(arr[0])) + typedef struct { HWND hwndSelf; @@ -120,7 +122,7 @@ typedef struct } MONTHCAL_INFO, *LPMONTHCAL_INFO; -/* Offsets of days in the week to the weekday of january 1. */ +/* Offsets of days in the week to the weekday of january 1 in a leap year */ static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; @@ -185,17 +187,17 @@ void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) Need to find out if we're on a DST place & adjust the clock accordingly. Above function assumes we have a valid data. Valid for year>1752; 1 <= d <= 31, 1 <= m <= 12. - 0 = Monday. + 0 = Sunday. */ -/* returns the day in the week(0 == monday, 6 == sunday) */ +/* returns the day in the week(0 == sunday, 6 == saturday) */ /* day(1 == 1st, 2 == 2nd... etc), year is the year value */ static int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year) { year-=(month < 3); return((year + year/4 - year/100 + year/400 + - DayOfWeekTable[month-1] + day - 1 ) % 7); + DayOfWeekTable[month-1] + day ) % 7); } /* From a given point, calculate the row (weekpos), column(daypos) @@ -333,14 +335,15 @@ static void MONTHCAL_CircleDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int mon static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month, int x, int y, int bold) { - char buf[10]; + static const WCHAR fmtW[] = { '%','d',0 }; + WCHAR buf[10]; RECT r; static int haveBoldFont, haveSelectedDay = FALSE; HBRUSH hbr; COLORREF oldCol = 0; COLORREF oldBk = 0; - sprintf(buf, "%d", day); + wsprintfW(buf, fmtW, day); /* No need to check styles: when selection is not valid, it is set to zero. * 1curSelDay) && (month==infoPtr->currentMonth)) @@ -400,6 +403,10 @@ static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) { + static const WCHAR todayW[] = { 'T','o','d','a','y',':',0 }; + static const WCHAR fmt1W[] = { '%','s',' ','%','l','d',0 }; + static const WCHAR fmt2W[] = { '%','s',' ','%','s',0 }; + static const WCHAR fmt3W[] = { '%','d',0 }; RECT *title=&infoPtr->title; RECT *prev=&infoPtr->titlebtnprev; RECT *next=&infoPtr->titlebtnnext; @@ -413,9 +420,9 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) SIZE size; HBRUSH hbr; HFONT currentFont; - char buf[20]; - char buf1[20]; - char buf2[32]; + WCHAR buf[20]; + WCHAR buf1[20]; + WCHAR buf2[32]; COLORREF oldTextColor, oldBkColor; DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE); RECT rcTemp; @@ -470,13 +477,13 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) titlemonth->left = title->left; titlemonth->right = title->right; - GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, - buf1,sizeof(buf1)); - sprintf(buf, "%s %ld", buf1, infoPtr->currentYear); + GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, + buf1,countof(buf1)); + wsprintfW(buf, fmt1W, buf1, infoPtr->currentYear); if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth)) { - DrawTextA(hdc, buf, strlen(buf), titlemonth, + DrawTextW(hdc, buf, strlenW(buf), titlemonth, DT_CENTER | DT_VCENTER | DT_SINGLELINE); } @@ -486,10 +493,10 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) * MCM_HitTestInfo wants month & year rects, so prepare these now. *(no, we can't draw them separately; the whole text is centered) */ - GetTextExtentPoint32A(hdc, buf, strlen(buf), &size); + GetTextExtentPoint32W(hdc, buf, strlenW(buf), &size); titlemonth->left = title->right / 2 - size.cx / 2; titleyear->right = title->right / 2 + size.cx / 2; - GetTextExtentPoint32A(hdc, buf1, strlen(buf1), &size); + GetTextExtentPoint32W(hdc, buf1, strlenW(buf1), &size); titlemonth->right = titlemonth->left + size.cx; titleyear->left = titlemonth->right; @@ -530,10 +537,8 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) i = infoPtr->firstDay; for(j=0; j<7; j++) { - GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i +j)%7, - buf,sizeof(buf)); - DrawTextA(hdc, buf, strlen(buf), days, - DT_CENTER | DT_VCENTER | DT_SINGLELINE ); + GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i+j+6)%7, buf, countof(buf)); + DrawTextW(hdc, buf, strlenW(buf), days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); days->left+=infoPtr->width_increment; days->right+=infoPtr->width_increment; } @@ -657,21 +662,21 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) infoPtr->currentMonth); offset+=textWidth; } - if (!LoadStringA(COMCTL32_hModule,IDM_TODAY,buf1,sizeof(buf1))) + if (!LoadStringW(COMCTL32_hModule,IDM_TODAY,buf1,countof(buf1))) { WARN("Can't load resource\n"); - strcpy(buf1,"Today:"); + strcpyW(buf1, todayW); } MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6); MONTHCAL_CopyTime(&infoPtr->todaysDate,&localtime); - GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,sizeof(buf2)); - sprintf(buf, "%s %s", buf1,buf2); + GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,countof(buf2)); + wsprintfW(buf, fmt2W, buf1, buf2); SelectObject(hdc, infoPtr->hBoldFont); if(IntersectRect(&rcTemp, &(ps->rcPaint), &rtoday)) { - DrawTextA(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE); - DrawTextA(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE); + DrawTextW(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE); + DrawTextW(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE); } SelectObject(hdc, infoPtr->hFont); } @@ -689,9 +694,8 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?) The first week of the year must contain only days of the new year */ - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, - buf, sizeof(buf)); - sscanf(buf, "%d", &weeknum); + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, buf, countof(buf)); + weeknum = atoiW(buf); switch (weeknum) { case 1: mindays = 6; @@ -738,16 +742,16 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) for(i=0; i<6; i++) { if((i==0)&&(weeknum>50)) { - sprintf(buf, "%d", weeknum); + wsprintfW(buf, fmt3W, weeknum); weeknum=0; } else if((i==5)&&(weeknum>47)) { - sprintf(buf, "%d", 1); + wsprintfW(buf, fmt3W, 1); } else - sprintf(buf, "%d", weeknum + i); - DrawTextA(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); + wsprintfW(buf, fmt3W, weeknum + i); + DrawTextW(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); days->top+=infoPtr->height_increment; days->bottom+=infoPtr->height_increment; } @@ -882,15 +886,14 @@ MONTHCAL_GetFirstDayOfWeek(MONTHCAL_INFO *infoPtr) /* sets the first day of the week that will appear in the control */ -/* 0 == Monday, 6 == Sunday */ +/* 0 == Sunday, 6 == Saturday */ /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */ /* FIXME: we need more error checking here */ static LRESULT MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam) { int prev = infoPtr->firstDay; - char buf[40]; - int day; + WCHAR buf[40]; TRACE("day %ld\n", lParam); @@ -899,13 +902,9 @@ MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam) } else { - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, - buf, sizeof(buf)); - TRACE("%s %d\n", buf, strlen(buf)); - if(sscanf(buf, "%d", &day) == 1) - infoPtr->firstDay = day; - else - infoPtr->firstDay = 0; + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf)); + TRACE("%s %d\n", debugstr_w(buf), strlenW(buf)); + infoPtr->firstDay = (atoiW(buf)+1)%7; } return prev; } @@ -1151,6 +1150,7 @@ MONTHCAL_HitTest(MONTHCAL_INFO *infoPtr, LPARAM lParam) y = lpht->pt.y; retval = MCHT_NOWHERE; + ZeroMemory(&lpht->st, sizeof(lpht->st)); /* Comment in for debugging... TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, @@ -1238,6 +1238,7 @@ MONTHCAL_HitTest(MONTHCAL_INFO *infoPtr, LPARAM lParam) retval = MCHT_CALENDARDATE; lpht->st.wMonth = infoPtr->currentMonth; lpht->st.wDay = day; + lpht->st.wDayOfWeek = MONTHCAL_CalculateDayOfWeek(day,lpht->st.wMonth,lpht->st.wYear); } goto done; } @@ -1278,7 +1279,7 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) nmds.cDayState = infoPtr->monthRange; nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds); for(i=0; imonthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; @@ -1309,7 +1310,7 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) nmds.prgDayState = Alloc (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds); for(i=0; imonthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; @@ -1319,17 +1320,18 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) static LRESULT MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) { + static const WCHAR todayW[] = { 'G','o',' ','t','o',' ','T','o','d','a','y',':',0 }; HMENU hMenu; POINT menupoint; - char buf[32]; + WCHAR buf[32]; hMenu = CreatePopupMenu(); - if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf))) + if (!LoadStringW(COMCTL32_hModule,IDM_GOTODAY,buf,countof(buf))) { WARN("Can't load resource\n"); - strcpy(buf,"Go to Today:"); + strcpyW(buf, todayW); } - AppendMenuA(hMenu, MF_STRING|MF_ENABLED,1, buf); + AppendMenuW(hMenu, MF_STRING|MF_ENABLED,1, buf); menupoint.x=(INT)LOWORD(lParam); menupoint.y=(INT)HIWORD(lParam); ClientToScreen(infoPtr->hwndSelf, &menupoint); @@ -1346,11 +1348,12 @@ MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) static LRESULT MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) { + static const WCHAR EditW[] = { 'E','D','I','T',0 }; MCHITTESTINFO ht; DWORD hit; HMENU hMenu; RECT rcDay; /* used in determining area to invalidate */ - char buf[32]; + WCHAR buf[32]; int i; POINT menupoint; @@ -1358,7 +1361,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) if (infoPtr->hWndYearUpDown) { - infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); + infoPtr->currentYear=SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); if(!DestroyWindow(infoPtr->hWndYearUpDown)) { FIXME("Can't destroy Updown Control\n"); @@ -1401,9 +1404,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) for (i=0; i<12;i++) { - GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, - buf,sizeof(buf)); - AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf); + GetLocaleInfoW(LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, buf,countof(buf)); + AppendMenuW(hMenu, MF_STRING|MF_ENABLED,i+1, buf); } menupoint.x=infoPtr->titlemonth.right; menupoint.y=infoPtr->titlemonth.bottom; @@ -1417,8 +1419,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) } } if(hit == MCHT_TITLEYEAR) { - infoPtr->hWndYearEdit=CreateWindowExA(0, - "EDIT", + infoPtr->hWndYearEdit=CreateWindowExW(0, + EditW, 0, WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT, infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top, @@ -1428,8 +1430,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) NULL, NULL, NULL); - infoPtr->hWndYearUpDown=CreateWindowExA(0, - UPDOWN_CLASSA, + infoPtr->hWndYearUpDown=CreateWindowExW(0, + UPDOWN_CLASSW, 0, WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS, infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top, @@ -1439,9 +1441,9 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) NULL, NULL, NULL); - SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); - SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); - SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); + SendMessageW( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); + SendMessageW( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); + SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); return TRUE; } @@ -1466,7 +1468,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart); MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); @@ -1532,8 +1534,7 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) nmhdr.code = NM_RELEASEDCAPTURE; TRACE("Sent notification from %p to %p\n", infoPtr->hwndSelf, infoPtr->hwndNotify); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); /* redraw if necessary */ if(redraw) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); @@ -1545,8 +1546,7 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart); MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); } return 0; @@ -1699,6 +1699,8 @@ MONTHCAL_SetFocus(MONTHCAL_INFO *infoPtr) /* sets the size information */ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) { + static const WCHAR SunW[] = { 'S','u','n',0 }; + static const WCHAR O0W[] = { '0','0',0 }; HDC hdc = GetDC(infoPtr->hwndSelf); RECT *title=&infoPtr->title; RECT *prev=&infoPtr->titlebtnprev; @@ -1710,7 +1712,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) RECT *days=&infoPtr->days; RECT *todayrect=&infoPtr->todayrect; SIZE size; - TEXTMETRICA tm; + TEXTMETRICW tm; DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE); HFONT currentFont; int xdiv, left_offset; @@ -1721,13 +1723,13 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) currentFont = SelectObject(hdc, infoPtr->hFont); /* get the height and width of each day's text */ - GetTextMetricsA(hdc, &tm); + GetTextMetricsW(hdc, &tm); infoPtr->textHeight = tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading; - GetTextExtentPoint32A(hdc, "Sun", 3, &size); + GetTextExtentPoint32W(hdc, SunW, 3, &size); infoPtr->textWidth = size.cx + 2; /* recalculate the height and width increments and offsets */ - GetTextExtentPoint32A(hdc, "00", 2, &size); + GetTextExtentPoint32W(hdc, O0W, 2, &size); xdiv = (dwStyle & MCS_WEEKNUMBERS) ? 8 : 7; @@ -1898,7 +1900,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) infoPtr = MONTHCAL_GetInfoPtr(hwnd); if (!infoPtr && (uMsg != WM_CREATE)) - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); switch(uMsg) { case MCM_GETCURSEL: @@ -2009,7 +2011,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) default: if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR( "unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } } @@ -2017,23 +2019,23 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) void MONTHCAL_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS; wndClass.lpfnWndProc = MONTHCAL_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(MONTHCAL_INFO *); - wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wndClass.lpszClassName = MONTHCAL_CLASSA; + wndClass.lpszClassName = MONTHCAL_CLASSW; - RegisterClassA(&wndClass); + RegisterClassW(&wndClass); } void MONTHCAL_Unregister(void) { - UnregisterClassA(MONTHCAL_CLASSA, NULL); + UnregisterClassW(MONTHCAL_CLASSW, NULL); } diff --git a/reactos/lib/comctl32/pager.c b/reactos/lib/comctl32/pager.c index bde664dd3bd..021489ef04d 100644 --- a/reactos/lib/comctl32/pager.c +++ b/reactos/lib/comctl32/pager.c @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * NOTES - * Tested primarily with the controlspy Pager application. - * Susan Farley (susan@codeweavers.com) * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Sep. 18, 2004, by Robert Shearman. @@ -36,6 +34,20 @@ * PGS_DRAGNDROP * Notifications: * PGN_HOTITEMCHANGE + * + * TESTING: + * Tested primarily with the controlspy Pager application. + * Susan Farley (susan@codeweavers.com) + * + * IMPLEMENTATION NOTES: + * This control uses WM_NCPAINT instead of WM_PAINT to paint itself + * as we need to scroll a child window. In order to do this we move + * the child window in the control's client area, using the clipping + * region that is automatically set around the client area. As the + * entire client area now consists of the child window, we must + * allocate space (WM_NCCALCSIZE) for the buttons and draw them as + * a non-client area (WM_NCPAINT). + * Robert Shearman */ #include @@ -45,6 +57,7 @@ #include "wingdi.h" #include "winuser.h" #include "winnls.h" +#include "windowsx.h" #include "commctrl.h" #include "comctl32.h" #include "wine/debug.h" @@ -53,9 +66,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(pager); typedef struct { + HWND hwndSelf; /* handle of the control wnd */ HWND hwndChild; /* handle of the contained wnd */ HWND hwndNotify; /* handle of the parent wnd */ - BOOL bNoResize; /* set when created with CCS_NORESIZE */ + DWORD dwStyle; /* styles for this control */ COLORREF clrBk; /* background color */ INT nBorder; /* border size for the control */ INT nButtonSize;/* size of the pager btns */ @@ -69,9 +83,6 @@ typedef struct INT direction; /* direction of the scroll, (e.g. PGF_SCROLLUP) */ } PAGER_INFO; -#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongPtrW(hwnd, 0)) -#define PAGER_IsHorizontal(hwnd) ((GetWindowLongA (hwnd, GWL_STYLE) & PGS_HORZ)) - #define MIN_ARROW_WIDTH 8 #define MIN_ARROW_HEIGHT 5 @@ -81,22 +92,22 @@ typedef struct #define REPEAT_DELAY 50 static void -PAGER_GetButtonRects(HWND hwnd, PAGER_INFO* infoPtr, RECT* prcTopLeft, RECT* prcBottomRight, BOOL bClientCoords) +PAGER_GetButtonRects(PAGER_INFO* infoPtr, RECT* prcTopLeft, RECT* prcBottomRight, BOOL bClientCoords) { RECT rcWindow; - GetWindowRect (hwnd, &rcWindow); + GetWindowRect (infoPtr->hwndSelf, &rcWindow); if (bClientCoords) { POINT pt = {rcWindow.left, rcWindow.top}; - ScreenToClient(hwnd, &pt); + ScreenToClient(infoPtr->hwndSelf, &pt); OffsetRect(&rcWindow, -(rcWindow.left-pt.x), -(rcWindow.top-pt.y)); } else OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top); *prcTopLeft = *prcBottomRight = rcWindow; - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { prcTopLeft->right = prcTopLeft->left + infoPtr->nButtonSize; prcBottomRight->left = prcBottomRight->right - infoPtr->nButtonSize; @@ -277,23 +288,20 @@ PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect, /* << PAGER_GetDropTarget >> */ static inline LRESULT -PAGER_ForwardMouse (HWND hwnd, WPARAM wParam) +PAGER_ForwardMouse (PAGER_INFO* infoPtr, BOOL bFwd) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); - infoPtr->bForward = (BOOL)wParam; + infoPtr->bForward = bFwd; return 0; } static inline LRESULT -PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_GetButtonState (PAGER_INFO* infoPtr, INT btn) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); LRESULT btnState = PGF_INVISIBLE; - INT btn = (INT)lParam; - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); if (btn == PGB_TOPORLEFT) btnState = infoPtr->TLbtnState; @@ -304,46 +312,41 @@ PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam) } -static inline LRESULT -PAGER_GetPos(HWND hwnd) +static inline INT +PAGER_GetPos(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %d\n", hwnd, infoPtr->nPos); - return (LRESULT)infoPtr->nPos; + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nPos); + return infoPtr->nPos; } -static inline LRESULT -PAGER_GetButtonSize(HWND hwnd) +static inline INT +PAGER_GetButtonSize(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %d\n", hwnd, infoPtr->nButtonSize); - return (LRESULT)infoPtr->nButtonSize; + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nButtonSize); + return infoPtr->nButtonSize; } -static inline LRESULT -PAGER_GetBorder(HWND hwnd) +static inline INT +PAGER_GetBorder(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %d\n", hwnd, infoPtr->nBorder); - return (LRESULT)infoPtr->nBorder; + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nBorder); + return infoPtr->nBorder; } -static inline LRESULT -PAGER_GetBkColor(HWND hwnd) +static inline COLORREF +PAGER_GetBkColor(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %06lx\n", hwnd, infoPtr->clrBk); - return (LRESULT)infoPtr->clrBk; + TRACE("[%p] returns %06lx\n", infoPtr->hwndSelf, infoPtr->clrBk); + return infoPtr->clrBk; } static void -PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) +PAGER_CalcSize (PAGER_INFO *infoPtr, INT* size, BOOL getWidth) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); NMPGCALCSIZE nmpgcs; ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE)); - nmpgcs.hdr.hwndFrom = hwnd; - nmpgcs.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); + nmpgcs.hdr.hwndFrom = infoPtr->hwndSelf; + nmpgcs.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID); nmpgcs.hdr.code = PGN_CALCSIZE; nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT; nmpgcs.iWidth = getWidth ? *size : 0; @@ -353,12 +356,12 @@ PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight; - TRACE("[%p] PGN_CALCSIZE returns %s=%d\n", hwnd, + TRACE("[%p] PGN_CALCSIZE returns %s=%d\n", infoPtr->hwndSelf, getWidth ? "width" : "height", *size); } static void -PAGER_PositionChildWnd(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_PositionChildWnd(PAGER_INFO* infoPtr) { if (infoPtr->hwndChild) { @@ -369,15 +372,15 @@ PAGER_PositionChildWnd(HWND hwnd, PAGER_INFO* infoPtr) if (infoPtr->TLbtnState == PGF_GRAYED) nPos += infoPtr->nButtonSize; - GetClientRect(hwnd, &rcClient); + GetClientRect(infoPtr->hwndSelf, &rcClient); - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { int wndSize = max(0, rcClient.right - rcClient.left); if (infoPtr->nWidth < wndSize) infoPtr->nWidth = wndSize; - TRACE("[%p] SWP %dx%d at (%d,%d)\n", hwnd, + TRACE("[%p] SWP %dx%d at (%d,%d)\n", infoPtr->hwndSelf, infoPtr->nWidth, infoPtr->nHeight, -nPos, 0); SetWindowPos(infoPtr->hwndChild, 0, @@ -391,7 +394,7 @@ PAGER_PositionChildWnd(HWND hwnd, PAGER_INFO* infoPtr) if (infoPtr->nHeight < wndSize) infoPtr->nHeight = wndSize; - TRACE("[%p] SWP %dx%d at (%d,%d)\n", hwnd, + TRACE("[%p] SWP %dx%d at (%d,%d)\n", infoPtr->hwndSelf, infoPtr->nWidth, infoPtr->nHeight, 0, -nPos); SetWindowPos(infoPtr->hwndChild, 0, @@ -405,7 +408,7 @@ PAGER_PositionChildWnd(HWND hwnd, PAGER_INFO* infoPtr) } static INT -PAGER_GetScrollRange(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_GetScrollRange(PAGER_INFO* infoPtr) { INT scrollRange = 0; @@ -413,18 +416,18 @@ PAGER_GetScrollRange(HWND hwnd, PAGER_INFO* infoPtr) { INT wndSize, childSize; RECT wndRect; - GetWindowRect(hwnd, &wndRect); + GetWindowRect(infoPtr->hwndSelf, &wndRect); - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { wndSize = wndRect.right - wndRect.left; - PAGER_CalcSize(hwnd, &infoPtr->nWidth, TRUE); + PAGER_CalcSize(infoPtr, &infoPtr->nWidth, TRUE); childSize = infoPtr->nWidth; } else { wndSize = wndRect.bottom - wndRect.top; - PAGER_CalcSize(hwnd, &infoPtr->nHeight, FALSE); + PAGER_CalcSize(infoPtr, &infoPtr->nHeight, FALSE); childSize = infoPtr->nHeight; } @@ -433,13 +436,12 @@ PAGER_GetScrollRange(HWND hwnd, PAGER_INFO* infoPtr) scrollRange = childSize - wndSize + infoPtr->nButtonSize; } - TRACE("[%p] returns %d\n", hwnd, scrollRange); + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, scrollRange); return scrollRange; } static void -PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr, - INT scrollRange, BOOL hideGrayBtns) +PAGER_UpdateBtns(PAGER_INFO *infoPtr, INT scrollRange, BOOL hideGrayBtns) { BOOL resizeClient; BOOL repaintBtns; @@ -449,7 +451,7 @@ PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr, RECT rcTopLeft, rcBottomRight; /* get button rects */ - PAGER_GetButtonRects(hwnd, infoPtr, &rcTopLeft, &rcBottomRight, FALSE); + PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, FALSE); GetCursorPos(&pt); @@ -485,7 +487,7 @@ PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr, ((oldBRbtnState == PGF_INVISIBLE) != (infoPtr->BRbtnState == PGF_INVISIBLE)); /* initiate NCCalcSize to resize client wnd if necessary */ if (resizeClient) - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); @@ -493,14 +495,13 @@ PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr, repaintBtns = (oldTLbtnState != infoPtr->TLbtnState) || (oldBRbtnState != infoPtr->BRbtnState); if (repaintBtns) - SendMessageW(hwnd, WM_NCPAINT, 0, 0); + SendMessageW(infoPtr->hwndSelf, WM_NCPAINT, 0, 0); } static LRESULT -PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress) +PAGER_SetPos(PAGER_INFO* infoPtr, INT newPos, BOOL fromBtnPress) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - INT scrollRange = PAGER_GetScrollRange(hwnd, infoPtr); + INT scrollRange = PAGER_GetScrollRange(infoPtr); INT oldPos = infoPtr->nPos; if ((scrollRange <= 0) || (newPos < 0)) @@ -510,24 +511,22 @@ PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress) else infoPtr->nPos = newPos; - TRACE("[%p] pos=%d, oldpos=%d\n", hwnd, infoPtr->nPos, oldPos); + TRACE("[%p] pos=%d, oldpos=%d\n", infoPtr->hwndSelf, infoPtr->nPos, oldPos); if (infoPtr->nPos != oldPos) { /* gray and restore btns, and if from WM_SETPOS, hide the gray btns */ - PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, !fromBtnPress); - PAGER_PositionChildWnd(hwnd, infoPtr); + PAGER_UpdateBtns(infoPtr, scrollRange, !fromBtnPress); + PAGER_PositionChildWnd(infoPtr); } return 0; } static LRESULT -PAGER_HandleWindowPosChanging(HWND hwnd, WPARAM wParam, WINDOWPOS *winpos) +PAGER_WindowPosChanging(PAGER_INFO* infoPtr, WINDOWPOS *winpos) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - - if (infoPtr->bNoResize && !(winpos->flags & SWP_NOSIZE)) + if ((infoPtr->dwStyle & CCS_NORESIZE) && !(winpos->flags & SWP_NOSIZE)) { /* don't let the app resize the nonscrollable dimension of a control * that was created with CCS_NORESIZE style @@ -536,7 +535,7 @@ PAGER_HandleWindowPosChanging(HWND hwnd, WPARAM wParam, WINDOWPOS *winpos) /* except if the current dimension is 0 and app is setting for * first time, then save amount as dimension. - GA 8/01 */ - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) if (!infoPtr->nHeight && winpos->cy) infoPtr->nHeight = winpos->cy; else @@ -549,13 +548,11 @@ PAGER_HandleWindowPosChanging(HWND hwnd, WPARAM wParam, WINDOWPOS *winpos) return 0; } - DefWindowProcW (hwnd, WM_WINDOWPOSCHANGING, wParam, (LPARAM)winpos); - - return 1; + return DefWindowProcW (infoPtr->hwndSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM)winpos); } static INT -PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_SetFixedWidth(PAGER_INFO* infoPtr) { /* Must set the non-scrollable dimension to be less than the full height/width * so that NCCalcSize is called. The Msoft docs mention 3/4 factor for button @@ -563,12 +560,12 @@ PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr) RECT wndRect; INT delta, h; - GetWindowRect(hwnd, &wndRect); + GetWindowRect(infoPtr->hwndSelf, &wndRect); /* see what the app says for btn width */ - PAGER_CalcSize(hwnd, &infoPtr->nWidth, TRUE); + PAGER_CalcSize(infoPtr, &infoPtr->nWidth, TRUE); - if (infoPtr->bNoResize) + if (infoPtr->dwStyle & CCS_NORESIZE) { delta = wndRect.right - wndRect.left - infoPtr->nWidth; if (delta > infoPtr->nButtonSize) @@ -580,13 +577,13 @@ PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr) h = wndRect.bottom - wndRect.top + infoPtr->nButtonSize; TRACE("[%p] infoPtr->nWidth set to %d\n", - hwnd, infoPtr->nWidth); + infoPtr->hwndSelf, infoPtr->nWidth); return h; } static INT -PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_SetFixedHeight(PAGER_INFO* infoPtr) { /* Must set the non-scrollable dimension to be less than the full height/width * so that NCCalcSize is called. The Msoft docs mention 3/4 factor for button @@ -594,12 +591,12 @@ PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) RECT wndRect; INT delta, w; - GetWindowRect(hwnd, &wndRect); + GetWindowRect(infoPtr->hwndSelf, &wndRect); /* see what the app says for btn height */ - PAGER_CalcSize(hwnd, &infoPtr->nHeight, FALSE); + PAGER_CalcSize(infoPtr, &infoPtr->nHeight, FALSE); - if (infoPtr->bNoResize) + if (infoPtr->dwStyle & CCS_NORESIZE) { delta = wndRect.bottom - wndRect.top - infoPtr->nHeight; if (delta > infoPtr->nButtonSize) @@ -611,7 +608,7 @@ PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) w = wndRect.right - wndRect.left + infoPtr->nButtonSize; TRACE("[%p] infoPtr->nHeight set to %d\n", - hwnd, infoPtr->nHeight); + infoPtr->hwndSelf, infoPtr->nHeight); return w; } @@ -629,102 +626,96 @@ PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) ******************************************************************/ static LRESULT -PAGER_RecalcSize(HWND hwnd) +PAGER_RecalcSize(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); if (infoPtr->hwndChild) { - INT scrollRange = PAGER_GetScrollRange(hwnd, infoPtr); + INT scrollRange = PAGER_GetScrollRange(infoPtr); if (scrollRange <= 0) { infoPtr->nPos = -1; - PAGER_SetPos(hwnd, 0, FALSE); + PAGER_SetPos(infoPtr, 0, FALSE); } else - PAGER_PositionChildWnd(hwnd, infoPtr); + PAGER_PositionChildWnd(infoPtr); } return 1; } -static LRESULT -PAGER_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) +static COLORREF +PAGER_SetBkColor (PAGER_INFO* infoPtr, COLORREF clrBk) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); COLORREF clrTemp = infoPtr->clrBk; - infoPtr->clrBk = (COLORREF)lParam; - TRACE("[%p] %06lx\n", hwnd, infoPtr->clrBk); + infoPtr->clrBk = clrBk; + TRACE("[%p] %06lx\n", infoPtr->hwndSelf, infoPtr->clrBk); /* the native control seems to do things this way */ - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); - RedrawWindow(hwnd, 0, 0, RDW_ERASE | RDW_INVALIDATE); + RedrawWindow(infoPtr->hwndSelf, 0, 0, RDW_ERASE | RDW_INVALIDATE); - return (LRESULT)clrTemp; + return clrTemp; } -static LRESULT -PAGER_SetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam) +static INT +PAGER_SetBorder (PAGER_INFO* infoPtr, INT iBorder) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); INT nTemp = infoPtr->nBorder; - infoPtr->nBorder = (INT)lParam; - TRACE("[%p] %d\n", hwnd, infoPtr->nBorder); + infoPtr->nBorder = iBorder; + TRACE("[%p] %d\n", infoPtr->hwndSelf, infoPtr->nBorder); - PAGER_RecalcSize(hwnd); + PAGER_RecalcSize(infoPtr); - return (LRESULT)nTemp; + return nTemp; } -static LRESULT -PAGER_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam) +static INT +PAGER_SetButtonSize (PAGER_INFO* infoPtr, INT iButtonSize) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); INT nTemp = infoPtr->nButtonSize; - infoPtr->nButtonSize = (INT)lParam; - TRACE("[%p] %d\n", hwnd, infoPtr->nButtonSize); + infoPtr->nButtonSize = iButtonSize; + TRACE("[%p] %d\n", infoPtr->hwndSelf, infoPtr->nButtonSize); - PAGER_RecalcSize(hwnd); + PAGER_RecalcSize(infoPtr); - return (LRESULT)nTemp; + return nTemp; } static LRESULT -PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_SetChild (PAGER_INFO* infoPtr, HWND hwndChild) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); INT hw; - infoPtr->hwndChild = IsWindow ((HWND)lParam) ? (HWND)lParam : 0; + infoPtr->hwndChild = IsWindow (hwndChild) ? hwndChild : 0; if (infoPtr->hwndChild) { - TRACE("[%p] hwndChild=%p\n", hwnd, infoPtr->hwndChild); + TRACE("[%p] hwndChild=%p\n", infoPtr->hwndSelf, infoPtr->hwndChild); - if (PAGER_IsHorizontal(hwnd)) { - hw = PAGER_SetFixedHeight(hwnd, infoPtr); + if (infoPtr->dwStyle & PGS_HORZ) { + hw = PAGER_SetFixedHeight(infoPtr); /* adjust non-scrollable dimension to fit the child */ - SetWindowPos(hwnd, 0, 0,0, hw, infoPtr->nHeight, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, hw, infoPtr->nHeight, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); } else { - hw = PAGER_SetFixedWidth(hwnd, infoPtr); + hw = PAGER_SetFixedWidth(infoPtr); /* adjust non-scrollable dimension to fit the child */ - SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, hw, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->nWidth, hw, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); } @@ -735,32 +726,31 @@ PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam) SWP_SHOWWINDOW | SWP_NOSIZE); /* native is 0 */ infoPtr->nPos = -1; - PAGER_SetPos(hwnd, 0, FALSE); + PAGER_SetPos(infoPtr, 0, FALSE); } return 0; } static void -PAGER_Scroll(HWND hwnd, INT dir) +PAGER_Scroll(PAGER_INFO* infoPtr, INT dir) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); NMPGSCROLL nmpgScroll; RECT rcWnd; if (infoPtr->hwndChild) { ZeroMemory (&nmpgScroll, sizeof (NMPGSCROLL)); - nmpgScroll.hdr.hwndFrom = hwnd; - nmpgScroll.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); + nmpgScroll.hdr.hwndFrom = infoPtr->hwndSelf; + nmpgScroll.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID); nmpgScroll.hdr.code = PGN_SCROLL; - GetWindowRect(hwnd, &rcWnd); - GetClientRect(hwnd, &nmpgScroll.rcParent); + GetWindowRect(infoPtr->hwndSelf, &rcWnd); + GetClientRect(infoPtr->hwndSelf, &nmpgScroll.rcParent); nmpgScroll.iXpos = nmpgScroll.iYpos = 0; nmpgScroll.iDir = dir; - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { nmpgScroll.iScroll = rcWnd.right - rcWnd.left; nmpgScroll.iXpos = infoPtr->nPos; @@ -775,16 +765,16 @@ PAGER_Scroll(HWND hwnd, INT dir) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll); - TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll); + TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", infoPtr->hwndSelf, nmpgScroll.iScroll); if (nmpgScroll.iScroll > 0) { infoPtr->direction = dir; if (dir == PGF_SCROLLLEFT || dir == PGF_SCROLLUP) - PAGER_SetPos(hwnd, infoPtr->nPos - nmpgScroll.iScroll, TRUE); + PAGER_SetPos(infoPtr, infoPtr->nPos - nmpgScroll.iScroll, TRUE); else - PAGER_SetPos(hwnd, infoPtr->nPos + nmpgScroll.iScroll, TRUE); + PAGER_SetPos(infoPtr, infoPtr->nPos + nmpgScroll.iScroll, TRUE); } else infoPtr->direction = -1; @@ -792,12 +782,10 @@ PAGER_Scroll(HWND hwnd, INT dir) } static LRESULT -PAGER_FmtLines(HWND hwnd) +PAGER_FmtLines(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - /* initiate NCCalcSize to resize client wnd and get size */ - SetWindowPos(hwnd, 0, 0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); @@ -805,23 +793,24 @@ PAGER_FmtLines(HWND hwnd) 0,0,infoPtr->nWidth,infoPtr->nHeight, 0); - return DefWindowProcW (hwnd, EM_FMTLINES, 0, 0); + return DefWindowProcW (infoPtr->hwndSelf, EM_FMTLINES, 0, 0); } static LRESULT -PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_Create (HWND hwnd, LPCREATESTRUCTW lpcs) { PAGER_INFO *infoPtr; - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); /* allocate memory for info structure */ infoPtr = (PAGER_INFO *)Alloc (sizeof(PAGER_INFO)); + if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* set default settings */ + infoPtr->hwndSelf = hwnd; infoPtr->hwndChild = NULL; - infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; - infoPtr->bNoResize = dwStyle & CCS_NORESIZE; + infoPtr->hwndNotify = lpcs->hwndParent; + infoPtr->dwStyle = lpcs->style; infoPtr->clrBk = GetSysColor(COLOR_BTNFACE); infoPtr->nBorder = 0; infoPtr->nButtonSize = 12; @@ -834,50 +823,46 @@ PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->BRbtnState = PGF_INVISIBLE; infoPtr->direction = -1; - if (dwStyle & PGS_DRAGNDROP) - FIXME("[%p] Drag and Drop style is not implemented yet.\n", hwnd); + if (infoPtr->dwStyle & PGS_DRAGNDROP) + FIXME("[%p] Drag and Drop style is not implemented yet.\n", infoPtr->hwndSelf); return 0; } static LRESULT -PAGER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_Destroy (PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - /* free pager info data */ - Free (infoPtr); - SetWindowLongPtrW (hwnd, 0, 0); + SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); + Free (infoPtr); /* free pager info data */ return 0; } static LRESULT -PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_NCCalcSize(PAGER_INFO* infoPtr, WPARAM wParam, LPRECT lpRect) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - LPRECT lpRect = (LPRECT)lParam; RECT rcChild, rcWindow; INT scrollRange; /* - * lParam points to a RECT struct. On entry, the struct + * lpRect points to a RECT struct. On entry, the struct * contains the proposed wnd rectangle for the window. * On exit, the struct should contain the screen * coordinates of the corresponding window's client area. */ - DefWindowProcW (hwnd, WM_NCCALCSIZE, wParam, lParam); + DefWindowProcW (infoPtr->hwndSelf, WM_NCCALCSIZE, wParam, (LPARAM)lpRect); TRACE("orig rect=%s\n", wine_dbgstr_rect(lpRect)); GetWindowRect (infoPtr->hwndChild, &rcChild); - MapWindowPoints (0, hwnd, (LPPOINT)&rcChild, 2); /* FIXME: RECT != 2 POINTS */ - GetWindowRect (hwnd, &rcWindow); + MapWindowPoints (0, infoPtr->hwndSelf, (LPPOINT)&rcChild, 2); /* FIXME: RECT != 2 POINTS */ + GetWindowRect (infoPtr->hwndSelf, &rcWindow); - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { infoPtr->nWidth = lpRect->right - lpRect->left; - PAGER_CalcSize (hwnd, &infoPtr->nWidth, TRUE); + PAGER_CalcSize (infoPtr, &infoPtr->nWidth, TRUE); scrollRange = infoPtr->nWidth - (rcWindow.right - rcWindow.left); @@ -889,7 +874,7 @@ PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam) else { infoPtr->nHeight = lpRect->bottom - lpRect->top; - PAGER_CalcSize (hwnd, &infoPtr->nHeight, FALSE); + PAGER_CalcSize (infoPtr, &infoPtr->nHeight, FALSE); scrollRange = infoPtr->nHeight - (rcWindow.bottom - rcWindow.top); @@ -904,7 +889,7 @@ PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam) wine_dbgstr_rect(&rcWindow)); TRACE("[%p] client rect set to %ldx%ld at (%ld,%ld) BtnState[%d,%d]\n", - hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top, + infoPtr->hwndSelf, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top, lpRect->left, lpRect->top, infoPtr->TLbtnState, infoPtr->BRbtnState); @@ -912,41 +897,37 @@ PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam) } static LRESULT -PAGER_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_NCPaint (PAGER_INFO* infoPtr, HRGN hRgn) { - PAGER_INFO* infoPtr = PAGER_GetInfoPtr(hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); RECT rcBottomRight, rcTopLeft; HDC hdc; - BOOL bHorizontal = PAGER_IsHorizontal(hwnd); - if (dwStyle & WS_MINIMIZE) + if (infoPtr->dwStyle & WS_MINIMIZE) return 0; - DefWindowProcW (hwnd, WM_NCPAINT, wParam, lParam); + DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)hRgn, 0); - if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW))) + if (!(hdc = GetDCEx (infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW))) return 0; - PAGER_GetButtonRects(hwnd, infoPtr, &rcTopLeft, &rcBottomRight, FALSE); + PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, FALSE); PAGER_DrawButton(hdc, infoPtr->clrBk, rcTopLeft, - bHorizontal, TRUE, infoPtr->TLbtnState); + infoPtr->dwStyle & PGS_HORZ, TRUE, infoPtr->TLbtnState); PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight, - bHorizontal, FALSE, infoPtr->BRbtnState); + infoPtr->dwStyle & PGS_HORZ, FALSE, infoPtr->BRbtnState); - ReleaseDC( hwnd, hdc ); + ReleaseDC( infoPtr->hwndSelf, hdc ); return 0; } static INT -PAGER_HitTest (HWND hwnd, const POINT * pt) +PAGER_HitTest (PAGER_INFO* infoPtr, const POINT * pt) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); RECT clientRect, rcTopLeft, rcBottomRight; POINT ptWindow; - GetClientRect (hwnd, &clientRect); + GetClientRect (infoPtr->hwndSelf, &clientRect); if (PtInRect(&clientRect, *pt)) { @@ -955,7 +936,7 @@ PAGER_HitTest (HWND hwnd, const POINT * pt) } ptWindow = *pt; - PAGER_GetButtonRects(hwnd, infoPtr, &rcTopLeft, &rcBottomRight, TRUE); + PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, TRUE); if ((infoPtr->TLbtnState != PGF_INVISIBLE) && PtInRect(&rcTopLeft, ptWindow)) { @@ -973,46 +954,43 @@ PAGER_HitTest (HWND hwnd, const POINT * pt) } static LRESULT -PAGER_NCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_NCHitTest (PAGER_INFO* infoPtr, INT x, INT y) { POINT pt; INT nHit; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + pt.x = x; + pt.y = y; - ScreenToClient (hwnd, &pt); - nHit = PAGER_HitTest(hwnd, &pt); - if (nHit < 0) - return HTTRANSPARENT; - return HTCLIENT; + ScreenToClient (infoPtr->hwndSelf, &pt); + nHit = PAGER_HitTest(infoPtr, &pt); + + return (nHit < 0) ? HTTRANSPARENT : HTCLIENT; } static LRESULT -PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_MouseMove (PAGER_INFO* infoPtr, INT keys, INT x, INT y) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); POINT clpt, pt; RECT wnrect, *btnrect = NULL; - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); BOOL topLeft = FALSE; INT btnstate = 0; INT hit; HDC hdc; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + pt.x = x; + pt.y = y; - TRACE("[%p] to (%ld,%ld)\n", hwnd, pt.x, pt.y); - ClientToScreen(hwnd, &pt); - GetWindowRect(hwnd, &wnrect); + TRACE("[%p] to (%d,%d)\n", infoPtr->hwndSelf, x, y); + ClientToScreen(infoPtr->hwndSelf, &pt); + GetWindowRect(infoPtr->hwndSelf, &wnrect); if (PtInRect(&wnrect, pt)) { RECT TLbtnrect, BRbtnrect; - PAGER_GetButtonRects(hwnd, infoPtr, &TLbtnrect, &BRbtnrect, FALSE); + PAGER_GetButtonRects(infoPtr, &TLbtnrect, &BRbtnrect, FALSE); clpt = pt; - MapWindowPoints(0, hwnd, &clpt, 1); - hit = PAGER_HitTest(hwnd, &clpt); + MapWindowPoints(0, infoPtr->hwndSelf, &clpt, 1); + hit = PAGER_HitTest(infoPtr, &clpt); if ((hit == PGB_TOPORLEFT) && (infoPtr->TLbtnState == PGF_NORMAL)) { topLeft = TRUE; @@ -1032,42 +1010,42 @@ PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) if (btnrect) { TRACE("[%p] draw btn (%ld,%ld)-(%ld,%ld), Capture %s, style %08lx\n", - hwnd, btnrect->left, btnrect->top, + infoPtr->hwndSelf, btnrect->left, btnrect->top, btnrect->right, btnrect->bottom, (infoPtr->bCapture) ? "TRUE" : "FALSE", - dwStyle); + infoPtr->dwStyle); if (!infoPtr->bCapture) { - TRACE("[%p] SetCapture\n", hwnd); - SetCapture(hwnd); + TRACE("[%p] SetCapture\n", infoPtr->hwndSelf); + SetCapture(infoPtr->hwndSelf); infoPtr->bCapture = TRUE; } - if (dwStyle & PGS_AUTOSCROLL) - SetTimer(hwnd, TIMERID1, 0x3e, 0); - hdc = GetWindowDC(hwnd); + if (infoPtr->dwStyle & PGS_AUTOSCROLL) + SetTimer(infoPtr->hwndSelf, TIMERID1, 0x3e, 0); + hdc = GetWindowDC(infoPtr->hwndSelf); /* OffsetRect(wnrect, 0 | 1, 0 | 1) */ PAGER_DrawButton(hdc, infoPtr->clrBk, *btnrect, - PAGER_IsHorizontal(hwnd), topLeft, btnstate); - ReleaseDC(hwnd, hdc); + infoPtr->dwStyle & PGS_HORZ, topLeft, btnstate); + ReleaseDC(infoPtr->hwndSelf, hdc); return 0; } } /* If we think we are captured, then do release */ - if (infoPtr->bCapture && (WindowFromPoint(pt) != hwnd)) + if (infoPtr->bCapture && (WindowFromPoint(pt) != infoPtr->hwndSelf)) { NMHDR nmhdr; infoPtr->bCapture = FALSE; - if (GetCapture() == hwnd) + if (GetCapture() == infoPtr->hwndSelf) { ReleaseCapture(); if (infoPtr->TLbtnState == PGF_GRAYED) { infoPtr->TLbtnState = PGF_INVISIBLE; - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1075,13 +1053,13 @@ PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) { infoPtr->TLbtnState = PGF_NORMAL; /* FIXME: just invalidate button rect */ - RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + RedrawWindow(infoPtr->hwndSelf, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); } if (infoPtr->BRbtnState == PGF_GRAYED) { infoPtr->BRbtnState = PGF_INVISIBLE; - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1089,96 +1067,94 @@ PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) { infoPtr->BRbtnState = PGF_NORMAL; /* FIXME: just invalidate button rect */ - RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + RedrawWindow(infoPtr->hwndSelf, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); } /* Notify parent of released mouse capture */ memset(&nmhdr, 0, sizeof(NMHDR)); - nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); + nmhdr.hwndFrom = infoPtr->hwndSelf; + nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); nmhdr.code = NM_RELEASEDCAPTURE; SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } - if (IsWindow(hwnd)) - KillTimer(hwnd, TIMERID1); + if (IsWindow(infoPtr->hwndSelf)) + KillTimer(infoPtr->hwndSelf, TIMERID1); } return 0; } static LRESULT -PAGER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_LButtonDown (PAGER_INFO* infoPtr, INT keys, INT x, INT y) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); BOOL repaintBtns = FALSE; POINT pt; INT hit; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + pt.x = x; + pt.y = y; - TRACE("[%p] at (%d,%d)\n", hwnd, (short)LOWORD(lParam), (short)HIWORD(lParam)); + TRACE("[%p] at (%d,%d)\n", infoPtr->hwndSelf, x, y); - hit = PAGER_HitTest(hwnd, &pt); + hit = PAGER_HitTest(infoPtr, &pt); /* put btn in DEPRESSED state */ if (hit == PGB_TOPORLEFT) { repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED; infoPtr->TLbtnState = PGF_DEPRESSED; - SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); + SetTimer(infoPtr->hwndSelf, TIMERID1, INITIAL_DELAY, 0); } else if (hit == PGB_BOTTOMORRIGHT) { repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED; infoPtr->BRbtnState = PGF_DEPRESSED; - SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); + SetTimer(infoPtr->hwndSelf, TIMERID1, INITIAL_DELAY, 0); } if (repaintBtns) - SendMessageW(hwnd, WM_NCPAINT, 0, 0); + SendMessageW(infoPtr->hwndSelf, WM_NCPAINT, 0, 0); switch(hit) { case PGB_TOPORLEFT: - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { - TRACE("[%p] PGF_SCROLLLEFT\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLLEFT); + TRACE("[%p] PGF_SCROLLLEFT\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLLEFT); } else { - TRACE("[%p] PGF_SCROLLUP\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLUP); + TRACE("[%p] PGF_SCROLLUP\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLUP); } break; case PGB_BOTTOMORRIGHT: - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { - TRACE("[%p] PGF_SCROLLRIGHT\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLRIGHT); + TRACE("[%p] PGF_SCROLLRIGHT\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLRIGHT); } else { - TRACE("[%p] PGF_SCROLLDOWN\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLDOWN); + TRACE("[%p] PGF_SCROLLDOWN\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLDOWN); } break; default: break; } - return TRUE; + return 0; } static LRESULT -PAGER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_LButtonUp (PAGER_INFO* infoPtr, INT keys, INT x, INT y) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); - KillTimer (hwnd, TIMERID1); - KillTimer (hwnd, TIMERID2); + KillTimer (infoPtr->hwndSelf, TIMERID1); + KillTimer (infoPtr->hwndSelf, TIMERID2); /* make PRESSED btns NORMAL but don't hide gray btns */ if (infoPtr->TLbtnState & (PGF_HOT | PGF_DEPRESSED)) @@ -1190,26 +1166,25 @@ PAGER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) } static LRESULT -PAGER_Timer (HWND hwnd, WPARAM wParam) +PAGER_Timer (PAGER_INFO* infoPtr, INT nTimerId) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); INT dir; /* if initial timer, kill it and start the repeat timer */ - if (wParam == TIMERID1) { + if (nTimerId == TIMERID1) { if (infoPtr->TLbtnState == PGF_HOT) - dir = PAGER_IsHorizontal(hwnd) ? + dir = (infoPtr->dwStyle & PGS_HORZ) ? PGF_SCROLLLEFT : PGF_SCROLLUP; else - dir = PAGER_IsHorizontal(hwnd) ? + dir = (infoPtr->dwStyle & PGS_HORZ) ? PGF_SCROLLRIGHT : PGF_SCROLLDOWN; - TRACE("[%p] TIMERID1: style=%08lx, dir=%d\n", hwnd, dwStyle, dir); - KillTimer(hwnd, TIMERID1); - SetTimer(hwnd, TIMERID1, REPEAT_DELAY, 0); - if (dwStyle & PGS_AUTOSCROLL) { - PAGER_Scroll(hwnd, dir); - SetWindowPos(hwnd, 0,0,0,0,0, + TRACE("[%p] TIMERID1: style=%08lx, dir=%d\n", + infoPtr->hwndSelf, infoPtr->dwStyle, dir); + KillTimer(infoPtr->hwndSelf, TIMERID1); + SetTimer(infoPtr->hwndSelf, TIMERID1, REPEAT_DELAY, 0); + if (infoPtr->dwStyle & PGS_AUTOSCROLL) { + PAGER_Scroll(infoPtr, dir); + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1217,55 +1192,73 @@ PAGER_Timer (HWND hwnd, WPARAM wParam) } - TRACE("[%p] TIMERID2: dir=%d\n", hwnd, infoPtr->direction); - KillTimer(hwnd, TIMERID2); + TRACE("[%p] TIMERID2: dir=%d\n", infoPtr->hwndSelf, infoPtr->direction); + KillTimer(infoPtr->hwndSelf, TIMERID2); if (infoPtr->direction > 0) { - PAGER_Scroll(hwnd, infoPtr->direction); - SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); + PAGER_Scroll(infoPtr, infoPtr->direction); + SetTimer(infoPtr->hwndSelf, TIMERID2, REPEAT_DELAY, 0); } return 0; } static LRESULT -PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_EraseBackground (PAGER_INFO* infoPtr, HDC hdc) { POINT pt, ptorig; - HDC hdc = (HDC)wParam; HWND parent; pt.x = 0; pt.y = 0; - parent = GetParent(hwnd); - MapWindowPoints(hwnd, parent, &pt, 1); + parent = GetParent(infoPtr->hwndSelf); + MapWindowPoints(infoPtr->hwndSelf, parent, &pt, 1); OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig); - SendMessageW (parent, WM_ERASEBKGND, wParam, lParam); + SendMessageW (parent, WM_ERASEBKGND, (WPARAM)hdc, 0); SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0); - return TRUE; + return 0; } static LRESULT -PAGER_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_Size (PAGER_INFO* infoPtr, INT type, INT x, INT y) { /* note that WM_SIZE is sent whenever NCCalcSize resizes the client wnd */ - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] %dx%d\n", hwnd, (short)LOWORD(lParam), (short)HIWORD(lParam)); + TRACE("[%p] %d,%d\n", infoPtr->hwndSelf, x, y); - if (PAGER_IsHorizontal(hwnd)) - infoPtr->nHeight = (short)HIWORD(lParam); + if (infoPtr->dwStyle & PGS_HORZ) + infoPtr->nHeight = x; else - infoPtr->nWidth = (short)LOWORD(lParam); + infoPtr->nWidth = y; - return PAGER_RecalcSize(hwnd); + return PAGER_RecalcSize(infoPtr); } +static LRESULT +PAGER_StyleChanged(PAGER_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss) +{ + DWORD oldStyle = infoPtr->dwStyle; + + TRACE("(styletype=%x, styleOld=0x%08lx, styleNew=0x%08lx)\n", + wStyleType, lpss->styleOld, lpss->styleNew); + + if (wStyleType != GWL_STYLE) return 0; + + infoPtr->dwStyle = lpss->styleNew; + + if ((oldStyle ^ lpss->styleNew) & (PGS_HORZ | PGS_VERT)) + { + PAGER_RecalcSize(infoPtr); + } + + return 0; +} + static LRESULT WINAPI PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); + PAGER_INFO *infoPtr = (PAGER_INFO *)GetWindowLongPtrW(hwnd, 0); if (!infoPtr && (uMsg != WM_CREATE)) return DefWindowProcW (hwnd, uMsg, wParam, lParam); @@ -1273,83 +1266,86 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) switch (uMsg) { case EM_FMTLINES: - return PAGER_FmtLines(hwnd); + return PAGER_FmtLines(infoPtr); case PGM_FORWARDMOUSE: - return PAGER_ForwardMouse (hwnd, wParam); + return PAGER_ForwardMouse (infoPtr, (BOOL)wParam); case PGM_GETBKCOLOR: - return PAGER_GetBkColor(hwnd); + return PAGER_GetBkColor(infoPtr); case PGM_GETBORDER: - return PAGER_GetBorder(hwnd); + return PAGER_GetBorder(infoPtr); case PGM_GETBUTTONSIZE: - return PAGER_GetButtonSize(hwnd); + return PAGER_GetButtonSize(infoPtr); case PGM_GETPOS: - return PAGER_GetPos(hwnd); + return PAGER_GetPos(infoPtr); case PGM_GETBUTTONSTATE: - return PAGER_GetButtonState (hwnd, wParam, lParam); + return PAGER_GetButtonState (infoPtr, (INT)lParam); /* case PGM_GETDROPTARGET: */ case PGM_RECALCSIZE: - return PAGER_RecalcSize(hwnd); + return PAGER_RecalcSize(infoPtr); case PGM_SETBKCOLOR: - return PAGER_SetBkColor (hwnd, wParam, lParam); + return PAGER_SetBkColor (infoPtr, (COLORREF)lParam); case PGM_SETBORDER: - return PAGER_SetBorder (hwnd, wParam, lParam); + return PAGER_SetBorder (infoPtr, (INT)lParam); case PGM_SETBUTTONSIZE: - return PAGER_SetButtonSize (hwnd, wParam, lParam); + return PAGER_SetButtonSize (infoPtr, (INT)lParam); case PGM_SETCHILD: - return PAGER_SetChild (hwnd, wParam, lParam); + return PAGER_SetChild (infoPtr, (HWND)lParam); case PGM_SETPOS: - return PAGER_SetPos(hwnd, (INT)lParam, FALSE); + return PAGER_SetPos(infoPtr, (INT)lParam, FALSE); case WM_CREATE: - return PAGER_Create (hwnd, wParam, lParam); + return PAGER_Create (hwnd, (LPCREATESTRUCTW)lParam); case WM_DESTROY: - return PAGER_Destroy (hwnd, wParam, lParam); + return PAGER_Destroy (infoPtr); case WM_SIZE: - return PAGER_Size (hwnd, wParam, lParam); + return PAGER_Size (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_NCPAINT: - return PAGER_NCPaint (hwnd, wParam, lParam); + return PAGER_NCPaint (infoPtr, (HRGN)wParam); case WM_WINDOWPOSCHANGING: - return PAGER_HandleWindowPosChanging (hwnd, wParam, (WINDOWPOS*)lParam); + return PAGER_WindowPosChanging (infoPtr, (WINDOWPOS*)lParam); + + case WM_STYLECHANGED: + return PAGER_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam); case WM_NCCALCSIZE: - return PAGER_NCCalcSize (hwnd, wParam, lParam); + return PAGER_NCCalcSize (infoPtr, wParam, (LPRECT)lParam); case WM_NCHITTEST: - return PAGER_NCHitTest (hwnd, wParam, lParam); + return PAGER_NCHitTest (infoPtr, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_MOUSEMOVE: if (infoPtr->bForward && infoPtr->hwndChild) PostMessageW(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam); - return PAGER_MouseMove (hwnd, wParam, lParam); + return PAGER_MouseMove (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_LBUTTONDOWN: - return PAGER_LButtonDown (hwnd, wParam, lParam); + return PAGER_LButtonDown (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_LBUTTONUP: - return PAGER_LButtonUp (hwnd, wParam, lParam); + return PAGER_LButtonUp (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_ERASEBKGND: - return PAGER_EraseBackground (hwnd, wParam, lParam); + return PAGER_EraseBackground (infoPtr, (HDC)wParam); case WM_TIMER: - return PAGER_Timer (hwnd, wParam); + return PAGER_Timer (infoPtr, (INT)wParam); case WM_NOTIFY: case WM_COMMAND: diff --git a/reactos/lib/comctl32/propsheet.c b/reactos/lib/comctl32/propsheet.c index 2ad24f2a151..f61463aa741 100644 --- a/reactos/lib/comctl32/propsheet.c +++ b/reactos/lib/comctl32/propsheet.c @@ -323,7 +323,7 @@ static void PROPSHEET_AtoW(LPCWSTR *tostr, LPCSTR frstr) TRACE("<%s>\n", frstr); len = MultiByteToWideChar(CP_ACP, 0, frstr, -1, 0, 0); - *tostr = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + *tostr = Alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, frstr, -1, (LPWSTR)*tostr, len); } @@ -357,7 +357,7 @@ static BOOL PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh, if (HIWORD(lppsh->pszCaption)) { int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0); - psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); + psInfo->ppshheader.pszCaption = Alloc( len*sizeof (WCHAR) ); MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len); } } @@ -411,7 +411,7 @@ static BOOL PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh, if (HIWORD(lppsh->pszCaption)) { int len = strlenW(lppsh->pszCaption); - psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) ); + psInfo->ppshheader.pszCaption = Alloc( (len+1)*sizeof(WCHAR) ); strcpyW( (WCHAR *)psInfo->ppshheader.pszCaption, lppsh->pszCaption ); } } @@ -951,7 +951,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo) SetWindowPos(hwndButton, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); - SendMessageA(hwndParent, DM_SETDEFID, IDOK, 0); + SendMessageW(hwndParent, DM_SETDEFID, IDOK, 0); /* @@ -1708,7 +1708,7 @@ static BOOL PROPSHEET_Next(HWND hwndDlg) hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; - msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); if (msgResult == -1) return FALSE; else if (msgResult == 0) @@ -1789,7 +1789,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam) hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; - if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE) + if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE) return FALSE; /* @@ -1803,7 +1803,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam) hwndPage = psInfo->proppage[i].hwndPage; if (hwndPage) { - switch (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) + switch (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) { case PSNRET_INVALID: PROPSHEET_ShowPage(hwndDlg, i, psInfo); @@ -1823,7 +1823,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam) psn.hdr.code = PSN_SETACTIVE; psn.lParam = 0; hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; - SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); } return TRUE; @@ -1850,7 +1850,7 @@ static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam) psn.hdr.idFrom = 0; psn.lParam = 0; - if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) + if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) return; psn.hdr.code = PSN_RESET; @@ -1861,7 +1861,7 @@ static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam) hwndPage = psInfo->proppage[i].hwndPage; if (hwndPage) - SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); } if (psInfo->isModeless) @@ -1893,7 +1893,7 @@ static void PROPSHEET_Help(HWND hwndDlg) psn.hdr.idFrom = 0; psn.lParam = 0; - SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); } /****************************************************************************** @@ -2036,7 +2036,7 @@ static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg) psn.hdr.idFrom = 0; psn.lParam = 0; - res = !SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + res = !SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); end: TRACE("<-- %d\n", res); @@ -2222,7 +2222,7 @@ static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText) EnableWindow(hwndButton, TRUE); /* Make it default pushbutton */ - SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); /* Hide Back button */ hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); @@ -2267,13 +2267,12 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg, int i = 0; HWND hwndPage; LRESULT msgResult = 0; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); while ((i < psInfo->nPages) && (msgResult == 0)) { hwndPage = psInfo->proppage[i].hwndPage; - msgResult = SendMessageA(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam); + msgResult = SendMessageW(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam); i++; } @@ -2423,7 +2422,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)psInfo->proppage[index].hpage; if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[index].pszText) - HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->proppage[index].pszText); + Free ((LPVOID)psInfo->proppage[index].pszText); DestroyPropertySheetPage(psInfo->proppage[index].hpage); } @@ -2480,7 +2479,7 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) EnableWindow(hwndNext, TRUE); /* Set the Next button as the default pushbutton */ - SendMessageA(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); + SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); } if ((dwFlags & PSWIZB_FINISH) || (dwFlags & PSWIZB_DISABLEDFINISH)) @@ -2495,7 +2494,7 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) EnableWindow(hwndFinish, TRUE); /* Set the Finish button as the default pushbutton */ - SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); } } @@ -2694,7 +2693,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) TRACE("\n"); if (!psInfo) return; if (HIWORD(psInfo->ppshheader.pszCaption)) - HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->ppshheader.pszCaption); + Free ((LPVOID)psInfo->ppshheader.pszCaption); for (i = 0; i < psInfo->nPages; i++) { @@ -2715,7 +2714,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) if(psp) { if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[i].pszText) - HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->proppage[i].pszText); + Free ((LPVOID)psInfo->proppage[i].pszText); DestroyPropertySheetPage(psInfo->proppage[i].hpage); } @@ -2866,7 +2865,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( { int len = strlen(lpPropSheetPage->u.pszTemplate); - ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,len+1 ); + ppsp->u.pszTemplate = Alloc( len+1 ); strcpy( (LPSTR)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate ); } if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) ) @@ -2901,20 +2900,20 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage { int len = strlenW(lpPropSheetPage->u.pszTemplate); - ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,(len+1)*sizeof (WCHAR) ); + ppsp->u.pszTemplate = Alloc( (len+1)*sizeof (WCHAR) ); strcpyW( (WCHAR *)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate ); } if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) ) { int len = strlenW(lpPropSheetPage->u2.pszIcon); - ppsp->u2.pszIcon = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) ); + ppsp->u2.pszIcon = Alloc( (len+1)*sizeof (WCHAR) ); strcpyW( (WCHAR *)ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon ); } if ((ppsp->dwFlags & PSP_USETITLE) && HIWORD( ppsp->pszTitle )) { int len = strlenW(lpPropSheetPage->pszTitle); - ppsp->pszTitle = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) ); + ppsp->pszTitle = Alloc( (len+1)*sizeof (WCHAR) ); strcpyW( (WCHAR *)ppsp->pszTitle, lpPropSheetPage->pszTitle ); } else if ( !(ppsp->dwFlags & PSP_USETITLE) ) @@ -2942,13 +2941,13 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage) return FALSE; if ( !(psp->dwFlags & PSP_DLGINDIRECT) && HIWORD( psp->u.pszTemplate ) ) - HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u.pszTemplate); + Free ((LPVOID)psp->u.pszTemplate); if ( (psp->dwFlags & PSP_USEICONID) && HIWORD( psp->u2.pszIcon ) ) - HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u2.pszIcon); + Free ((LPVOID)psp->u2.pszIcon); if ((psp->dwFlags & PSP_USETITLE) && HIWORD( psp->pszTitle )) - HeapFree(GetProcessHeap(), 0, (LPVOID)psp->pszTitle); + Free ((LPVOID)psp->pszTitle); Free(hPropPage); @@ -2969,7 +2968,7 @@ static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg) if (lpMsg->message == WM_KEYDOWN && (GetKeyState(VK_CONTROL) & 0x8000)) { int new_page = 0; - INT dlgCode = SendMessageA(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg); + INT dlgCode = SendMessageW(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg); if (!(dlgCode & DLGC_WANTMESSAGE)) { @@ -3005,7 +3004,7 @@ static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg) } } - return IsDialogMessageA(hwnd, lpMsg); + return IsDialogMessageW(hwnd, lpMsg); } /****************************************************************************** @@ -3078,7 +3077,7 @@ static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID) /****************************************************************************** * PROPSHEET_Paint */ -static LRESULT PROPSHEET_Paint(HWND hwnd) +static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) { PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr); PAINTSTRUCT ps; @@ -3093,7 +3092,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) WCHAR szBuffer[256]; int nLength; - hdc = BeginPaint(hwnd, &ps); + hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps); if (!hdc) return 1; hdcSrc = CreateCompatibleDC(0); @@ -3118,7 +3117,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2); SetRect(&rzone, 0, 0, r.right + 1, r.top - 1); - GetObjectA(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm); + GetObjectW(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm); if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD) { @@ -3241,7 +3240,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) hbr = GetSysColorBrush(COLOR_WINDOW); FillRect(hdc, &rzone, hbr); - GetObjectA(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm); + GetObjectW(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm); hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark); BitBlt(hdc, 0, offsety, min(bm.bmWidth, r.right), @@ -3267,7 +3266,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) DeleteDC(hdcSrc); - EndPaint(hwnd, &ps); + if (!hdcParam) EndPaint(hwnd, &ps); return 0; } @@ -3290,7 +3289,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); LPCPROPSHEETPAGEW ppshpage; int idx; - LOGFONTA logFont; + LOGFONTW logFont; /* Using PropSheetInfoStr to store extra data doesn't match the native * common control: native uses TCM_[GS]ETITEM @@ -3310,10 +3309,10 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT); /* Set up fonts */ - SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); - psInfo->hFont = CreateFontIndirectA (&logFont); + SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); + psInfo->hFont = CreateFontIndirectW (&logFont); logFont.lfWeight = FW_BOLD; - psInfo->hFontBold = CreateFontIndirectA (&logFont); + psInfo->hFontBold = CreateFontIndirectW (&logFont); /* * Small icon in the title bar. @@ -3397,7 +3396,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } case WM_PAINT: - PROPSHEET_Paint(hwnd); + PROPSHEET_Paint(hwnd, (HDC)wParam); return TRUE; case WM_DESTROY: diff --git a/reactos/lib/comctl32/rebar.c b/reactos/lib/comctl32/rebar.c index 1b0f4a793cc..74caef36918 100644 --- a/reactos/lib/comctl32/rebar.c +++ b/reactos/lib/comctl32/rebar.c @@ -17,6 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Oct. 19, 2004, by Robert Shearman. @@ -1245,8 +1246,9 @@ REBAR_ForceResize (REBAR_INFO *infoPtr) static VOID REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus) { + const static WCHAR strComboBox[] = { 'C','o','m','b','o','B','o','x',0 }; REBAR_BAND *lpBand; - CHAR szClassName[40]; + WCHAR szClassName[40]; UINT i; NMREBARCHILDSIZE rbcz; NMHDR heightchange; @@ -1291,9 +1293,9 @@ REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus) * set flag outside of loop */ - GetClassNameA (lpBand->hwndChild, szClassName, 40); - if (!lstrcmpA (szClassName, "ComboBox") || - !lstrcmpA (szClassName, WC_COMBOBOXEXA)) { + GetClassNameW (lpBand->hwndChild, szClassName, sizeof(szClassName)/sizeof(szClassName[0])); + if (!lstrcmpW (szClassName, strComboBox) || + !lstrcmpW (szClassName, WC_COMBOBOXEXW)) { INT nEditHeight, yPos; RECT rc; @@ -2276,7 +2278,7 @@ REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, REC lpBand->rcBand.right,lpBand->rcBand.bottom, clip->left, clip->top, clip->right, clip->bottom); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); if (lpBand->clrBack != CLR_NONE) SetBkColor (hdc, old); } @@ -2473,7 +2475,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, const POINT *ptsmove) if (imindBand == -1) imindBand = i; /* minimum size of each band is size of header plus */ /* size of minimum child plus offset of child from header plus */ - /* a one to separate each band. */ + /* one to separate each band. */ if (i < ihitBand) LHeaderSum += (band->lcx + SEP_WIDTH); else @@ -3755,7 +3757,7 @@ REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { - LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam; + LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam; RECT wnrc1, clrc1; if (TRACE_ON(rebar)) { @@ -4063,10 +4065,10 @@ REBAR_NCCalcSize (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) { - LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam; + LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam; REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); RECT wnrc1, clrc1; - NONCLIENTMETRICSA ncm; + NONCLIENTMETRICSW ncm; HFONT tfont; INT i; @@ -4098,37 +4100,35 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->iGrabbedBand = -1; infoPtr->hwndSelf = hwnd; infoPtr->DoRedraw = TRUE; - infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW); - infoPtr->hcurHorz = LoadCursorA (0, (LPSTR)IDC_SIZEWE); - infoPtr->hcurVert = LoadCursorA (0, (LPSTR)IDC_SIZENS); - infoPtr->hcurDrag = LoadCursorA (0, (LPSTR)IDC_SIZE); + infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW); + infoPtr->hcurHorz = LoadCursorW (0, (LPWSTR)IDC_SIZEWE); + infoPtr->hcurVert = LoadCursorW (0, (LPWSTR)IDC_SIZENS); + infoPtr->hcurDrag = LoadCursorW (0, (LPWSTR)IDC_SIZE); infoPtr->bUnicode = IsWindowUnicode (hwnd); infoPtr->fStatus = CREATE_RUNNING; infoPtr->hFont = GetStockObject (SYSTEM_FONT); /* issue WM_NOTIFYFORMAT to get unicode status of parent */ - i = SendMessageA(REBAR_GetNotifyParent (infoPtr), + i = SendMessageW(REBAR_GetNotifyParent (infoPtr), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { - ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", - i); + ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i); i = NFR_ANSI; } infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; /* add necessary styles to the requested styles */ infoPtr->dwStyle = cs->style | WS_VISIBLE | CCS_TOP; - SetWindowLongA (hwnd, GWL_STYLE, infoPtr->dwStyle); + SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle); /* get font handle for Caption Font */ - ncm.cbSize = sizeof(NONCLIENTMETRICSA); - SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, - ncm.cbSize, &ncm, 0); + ncm.cbSize = sizeof(ncm); + SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); /* if the font is bold, set to normal */ if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) { ncm.lfCaptionFont.lfWeight = FW_NORMAL; } - tfont = CreateFontIndirectA (&ncm.lfCaptionFont); + tfont = CreateFontIndirectW (&ncm.lfCaptionFont); if (tfont) { infoPtr->hFont = infoPtr->hDefaultFont = tfont; } @@ -4228,11 +4228,10 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) INT i; if (lParam == NF_REQUERY) { - i = SendMessageA(REBAR_GetNotifyParent (infoPtr), + i = SendMessageW(REBAR_GetNotifyParent (infoPtr), WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { - ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", - i); + ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i); i = NFR_ANSI; } infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; @@ -4473,7 +4472,7 @@ REBAR_WindowPosChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) /* Save the new origin of this window - used by _ForceResize */ infoPtr->origin.x = lpwp->x; infoPtr->origin.y = lpwp->y; - ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED, + ret = DefWindowProcW(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED, wParam, lParam); GetWindowRect(infoPtr->hwndSelf, &rc); TRACE("hwnd %p new pos (%ld,%ld)-(%ld,%ld)\n", @@ -4490,7 +4489,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam); if (!infoPtr && (uMsg != WM_NCCREATE)) - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); switch (uMsg) { /* case RB_BEGINDRAG: */ @@ -4707,7 +4706,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); } } @@ -4715,9 +4714,9 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) VOID REBAR_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = REBAR_WindowProc; wndClass.cbClsExtra = 0; @@ -4727,9 +4726,9 @@ REBAR_Register (void) #if GLATESTING wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0)); #endif - wndClass.lpszClassName = REBARCLASSNAMEA; + wndClass.lpszClassName = REBARCLASSNAMEW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); mindragx = GetSystemMetrics (SM_CXDRAG); mindragy = GetSystemMetrics (SM_CYDRAG); @@ -4740,5 +4739,5 @@ REBAR_Register (void) VOID REBAR_Unregister (void) { - UnregisterClassA (REBARCLASSNAMEA, NULL); + UnregisterClassW (REBARCLASSNAMEW, NULL); } diff --git a/reactos/lib/comctl32/syslink.c b/reactos/lib/comctl32/syslink.c index 34402f3a6f8..e39332d0119 100644 --- a/reactos/lib/comctl32/syslink.c +++ b/reactos/lib/comctl32/syslink.c @@ -17,11 +17,19 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES + * + * This code was audited for completeness against the documented features + * of Comctl32.dll version 6.0 on Apr. 4, 2005, by Dimitrie O. Paun. + * + * Unless otherwise noted, we believe this code to be complete, as per + * the specification mentioned above. + * If you discover missing features, or bugs, please note them below. + * * TODO: * - Fix SHIFT+TAB and TAB issue (wrong link is selected when control gets the focus) * - Better string parsing * - Improve word wrapping - * - Control styles?! * */ @@ -33,6 +41,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -40,10 +49,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(progress); INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT); -#define SYSLINK_Alloc(size) HeapAlloc(GetProcessHeap(), 0, (size)) -#define SYSLINK_Free(ptr) HeapFree(GetProcessHeap(), 0, (ptr)) -#define SYSLINK_ReAlloc(ptr, size) HeapReAlloc(GetProcessHeap(), 0, ptr, (size)) - typedef struct { int nChars; @@ -85,6 +90,8 @@ typedef struct _DOC_ITEM typedef struct { HWND Self; /* The window handle for this control */ + HWND Notify; /* The parent handle to receive notifications */ + DWORD Style; /* Styles for this control */ PDOC_ITEM Items; /* Address to the first document item */ BOOL HasFocus; /* Whether the control has the input focus */ int MouseDownID; /* ID of the link that the mouse button first selected */ @@ -115,8 +122,8 @@ static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem) { if(DocItem->Type == slLink) { - SYSLINK_Free(DocItem->u.Link.szID); - SYSLINK_Free(DocItem->u.Link.szUrl); + Free(DocItem->u.Link.szID); + Free(DocItem->u.Link.szUrl); } if(DocItem->Type == slLink && DocItem->u.Link.hRgn != NULL) @@ -127,18 +134,18 @@ static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem) /* we don't free Text because it's just a pointer to a character in the entire window text string */ - SYSLINK_Free(DocItem); + Free(DocItem); } /*********************************************************************** * SYSLINK_AppendDocItem * Create and append a new document item. */ -static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPWSTR Text, UINT textlen, +static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPCWSTR Text, UINT textlen, SL_ITEM_TYPE type, PDOC_ITEM LastItem) { PDOC_ITEM Item; - Item = SYSLINK_Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR))); + Item = Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR))); if(Item == NULL) { ERR("Failed to alloc DOC_ITEM structure!\n"); @@ -191,25 +198,16 @@ static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr) * Parses the window text string and creates a document. Returns the * number of document items created. */ -static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPWSTR Text) +static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text) { - WCHAR *current, *textstart, *linktext, *firsttag; - int taglen = 0, textlen, linklen, docitems = 0; + LPCWSTR current, textstart = NULL, linktext = NULL, firsttag = NULL; + int taglen = 0, textlen = 0, linklen = 0, docitems = 0; PDOC_ITEM Last = NULL; SL_ITEM_TYPE CurrentType = slText; - DWORD Style; - LPWSTR lpID, lpUrl; + LPCWSTR lpID, lpUrl; UINT lenId, lenUrl; - Style = GetWindowLongW(infoPtr->Self, GWL_STYLE); - - firsttag = NULL; - textstart = NULL; - linktext = NULL; - textlen = 0; - linklen = 0; - - for(current = (WCHAR*)Text; *current != 0;) + for(current = Text; *current != 0;) { if(*current == '<') { @@ -232,9 +230,8 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPWSTR Text) case ' ': { /* we expect parameters, parse them */ - LPWSTR *CurrentParameter = NULL; + LPCWSTR *CurrentParameter = NULL, tmp; UINT *CurrentParameterLen = NULL; - WCHAR *tmp; taglen = 3; tmp = current + taglen; @@ -362,7 +359,7 @@ CheckParameter: { int nc; - if(!(Style & WS_DISABLED)) + if(!(infoPtr->Style & WS_DISABLED)) { Last->u.Link.state |= LIS_ENABLED; } @@ -371,7 +368,7 @@ CheckParameter: { nc = min(lenId, strlenW(lpID)); nc = min(nc, MAX_LINKID_TEXT); - Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + Last->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(Last->u.Link.szID != NULL) { lstrcpynW(Last->u.Link.szID, lpID, nc + 1); @@ -384,7 +381,7 @@ CheckParameter: { nc = min(lenUrl, strlenW(lpUrl)); nc = min(nc, L_MAX_URL_LENGTH); - Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); + Last->u.Link.szUrl = Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); if(Last->u.Link.szUrl != NULL) { lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1); @@ -442,7 +439,7 @@ CheckParameter: { int nc; - if(!(Style & WS_DISABLED)) + if(!(infoPtr->Style & WS_DISABLED)) { Last->u.Link.state |= LIS_ENABLED; } @@ -451,7 +448,7 @@ CheckParameter: { nc = min(lenId, strlenW(lpID)); nc = min(nc, MAX_LINKID_TEXT); - Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + Last->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(Last->u.Link.szID != NULL) { lstrcpynW(Last->u.Link.szID, lpID, nc + 1); @@ -464,7 +461,7 @@ CheckParameter: { nc = min(lenUrl, strlenW(lpUrl)); nc = min(nc, L_MAX_URL_LENGTH); - Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); + Last->u.Link.szUrl = Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); if(Last->u.Link.szUrl != NULL) { lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1); @@ -479,7 +476,7 @@ CheckParameter: if(linktext != NULL && linklen > 0) { - /* we got a unclosed link, just display the text */ + /* we got an unclosed link, just display the text */ Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slText, Last); if(Last == NULL) { @@ -737,11 +734,11 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc) if(bl != NULL) { - bl = SYSLINK_ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK)); + bl = ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK)); } else { - bl = SYSLINK_Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK)); + bl = Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK)); } if(bl != NULL) @@ -879,13 +876,14 @@ static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc) * SYSLINK_Paint * Handles the WM_PAINT message. */ -static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr) +static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr, HDC hdcParam) { HDC hdc; PAINTSTRUCT ps; - hdc = BeginPaint (infoPtr->Self, &ps); + + hdc = hdcParam ? hdcParam : BeginPaint (infoPtr->Self, &ps); SYSLINK_Draw (infoPtr, hdc); - EndPaint (infoPtr->Self, &ps); + if (!hdcParam) EndPaint (infoPtr->Self, &ps); return 0; } @@ -939,7 +937,7 @@ static HFONT SYSLINK_SetFont (SYSLINK_INFO *infoPtr, HFONT hFont, BOOL bRedraw) * SYSLINK_SetText * Set new text for the SysLink control. */ -static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPWSTR Text) +static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPCWSTR Text) { int textlen; @@ -1038,7 +1036,7 @@ static LRESULT SYSLINK_SetItem (SYSLINK_INFO *infoPtr, PLITEM Item) { if(!di->u.Link.szID) { - di->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + di->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(!Item->szID) { ERR("Unable to allocate memory for link id\n"); @@ -1055,7 +1053,7 @@ static LRESULT SYSLINK_SetItem (SYSLINK_INFO *infoPtr, PLITEM Item) { if(!di->u.Link.szUrl) { - di->u.Link.szUrl = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + di->u.Link.szUrl = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(!Item->szUrl) { ERR("Unable to allocate memory for link url\n"); @@ -1241,7 +1239,7 @@ static LRESULT SYSLINK_SendParentNotify (SYSLINK_INFO *infoPtr, UINT code, PDOC_ nml.item.szUrl[0] = 0; } - return SendMessageW(GetParent(infoPtr->Self), WM_NOTIFY, (WPARAM)nml.hdr.idFrom, (LPARAM)&nml); + return SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)nml.hdr.idFrom, (LPARAM)&nml); } /*********************************************************************** @@ -1466,7 +1464,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, switch(message) { case WM_PAINT: - return SYSLINK_Paint (infoPtr); + return SYSLINK_Paint (infoPtr, (HDC)wParam); case WM_SETCURSOR: { @@ -1606,14 +1604,31 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, case WM_KILLFOCUS: return SYSLINK_KillFocus(infoPtr, (HWND)wParam); + case WM_ENABLE: + infoPtr->Style &= ~WS_DISABLED; + infoPtr->Style |= (wParam ? 0 : WS_DISABLED); + InvalidateRect (infoPtr->Self, NULL, FALSE); + return 0; + + case WM_STYLECHANGED: + if (wParam == GWL_STYLE) + { + infoPtr->Style = ((LPSTYLESTRUCT)lParam)->styleNew; + + InvalidateRect(infoPtr->Self, NULL, TRUE); + } + return 0; + case WM_CREATE: /* allocate memory for info struct */ - infoPtr = (SYSLINK_INFO *)SYSLINK_Alloc (sizeof(SYSLINK_INFO)); + infoPtr = Alloc (sizeof(SYSLINK_INFO)); if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ infoPtr->Self = hwnd; + infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent; + infoPtr->Style = ((LPCREATESTRUCTW)lParam)->style; infoPtr->Font = 0; infoPtr->LinkFont = 0; infoPtr->Items = NULL; @@ -1623,8 +1638,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, infoPtr->LinkColor = GetSysColor(COLOR_HIGHLIGHT); infoPtr->VisitedColor = GetSysColor(COLOR_HIGHLIGHT); TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd); - lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName); - SYSLINK_SetText(infoPtr, (LPWSTR)lParam); + SYSLINK_SetText(infoPtr, ((LPCREATESTRUCTW)lParam)->lpszName); return 0; case WM_DESTROY: @@ -1632,8 +1646,8 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, SYSLINK_ClearDoc(infoPtr); if(infoPtr->Font != 0) DeleteObject(infoPtr->Font); if(infoPtr->LinkFont != 0) DeleteObject(infoPtr->LinkFont); - SYSLINK_Free (infoPtr); SetWindowLongPtrW(hwnd, 0, 0); + Free (infoPtr); return 0; default: diff --git a/reactos/lib/comctl32/tab.c b/reactos/lib/comctl32/tab.c index 8fb27e89d85..3287b573cb4 100644 --- a/reactos/lib/comctl32/tab.c +++ b/reactos/lib/comctl32/tab.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * TODO: - * Unicode support (under construction) * * Styles: * TCIF_RTLREADING @@ -82,7 +81,7 @@ typedef struct USHORT uVItemPadding_s; /* Set amount of vertical padding, in pixels */ HFONT hFont; /* handle to the current font */ HCURSOR hcurArrow; /* handle to the current cursor */ - HIMAGELIST himl; /* handle to a image list (may be 0) */ + HIMAGELIST himl; /* handle to an image list (may be 0) */ HWND hwndToolTip; /* handle to tab's tooltip */ INT leftmostVisible; /* Used for scrolling, this member contains * the index of the first visible item */ @@ -144,7 +143,7 @@ TAB_SendSimpleNotify (const TAB_INFO *infoPtr, UINT code) (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr); } -static VOID +static void TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -162,25 +161,13 @@ TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, } static void -TAB_DumpItemExternalA(TCITEMA *pti, UINT iItem) -{ - if (TRACE_ON(tab)) { - TRACE("external tab %d, mask=0x%08x, dwState=0x%08x, dwStateMask=0x%08x, cchTextMax=0x%08x\n", - iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax); - TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextA=%s\n", - iItem, pti->iImage, pti->lParam, debugstr_a(pti->pszText)); - } -} - - -static void -TAB_DumpItemExternalW(TCITEMW *pti, UINT iItem) +TAB_DumpItemExternalT(TCITEMW *pti, UINT iItem, BOOL isW) { if (TRACE_ON(tab)) { TRACE("external tab %d, mask=0x%08x, dwState=0x%08lx, dwStateMask=0x%08lx, cchTextMax=0x%08x\n", iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax); TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextW=%s\n", - iItem, pti->iImage, pti->lParam, debugstr_w(pti->pszText)); + iItem, pti->iImage, pti->lParam, isW ? debugstr_w(pti->pszText) : debugstr_a((LPSTR)pti->pszText)); } } @@ -246,7 +233,7 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem) { if (iItem < 0 || iItem >= infoPtr->uNumItem) return 0; - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) { + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) { FIXME("Should set input focus\n"); } else { int oldFocus = infoPtr->uFocus; @@ -302,7 +289,7 @@ static BOOL TAB_InternalGetItemRect( RECT* selectedRect) { RECT tmpItemRect,clientRect; - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); /* Perform a sanity check and a trivial visibility check. */ if ( (infoPtr->uNumItem <= 0) || @@ -417,7 +404,11 @@ static BOOL TAB_InternalGetItemRect( } } - return TRUE; + /* Check for visibility */ + if (lStyle & TCS_VERTICAL) + return (itemRect->top < clientRect.bottom) && (itemRect->bottom > clientRect.top); + else + return (itemRect->left < clientRect.right) && (itemRect->right > clientRect.left); } static inline BOOL @@ -472,7 +463,7 @@ static LRESULT TAB_KeyUp(TAB_INFO* infoPtr, WPARAM keyCode) * This method is called whenever the focus goes in or out of this control * it is used to update the visual state of the control. */ -static VOID TAB_FocusChanging(const TAB_INFO *infoPtr) +static void TAB_FocusChanging(const TAB_INFO *infoPtr) { RECT selectedRect; BOOL isVisible; @@ -566,7 +557,7 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam) TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd, WM_LBUTTONDOWN, wParam, lParam); - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) { + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) { SetFocus (infoPtr->hwnd); } @@ -648,7 +639,7 @@ TAB_DrawLoneItemInterior(TAB_INFO* infoPtr, int iItem) * we can check if the mouse has left our window. If so, we un-highlight * the hot-tracked tab. */ -static VOID CALLBACK +static void CALLBACK TAB_HotTrackTimerProc ( HWND hwnd, /* handle of window for timer messages */ @@ -717,7 +708,7 @@ TAB_RecalcHotTrack if (out_redrawEnter != NULL) *out_redrawEnter = -1; - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_HOTTRACK) + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_HOTTRACK) { POINT pt; UINT flags; @@ -814,7 +805,7 @@ static LRESULT TAB_AdjustRect( WPARAM fLarger, LPRECT prc) { - DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); LONG *iRightBottom, *iLeftTop; TRACE ("hwnd=%p fLarger=%d (%ld,%ld)-(%ld,%ld)\n", infoPtr->hwnd, fLarger, prc->left, prc->top, prc->right, prc->bottom); @@ -903,8 +894,10 @@ static void TAB_SetupScrolling( TAB_INFO* infoPtr, const RECT* clientRect) { + static const WCHAR msctls_updown32W[] = { 'm','s','c','t','l','s','_','u','p','d','o','w','n','3','2',0 }; + static const WCHAR emptyW[] = { 0 }; INT maxRange = 0; - DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(hwnd, GWL_STYLE); if (infoPtr->needsScrolling) { @@ -953,16 +946,12 @@ static void TAB_SetupScrolling( */ if (infoPtr->hwndUpDown==0) { - infoPtr->hwndUpDown = CreateWindowA("msctls_updown32", - "", + infoPtr->hwndUpDown = CreateWindowW(msctls_updown32W, emptyW, WS_VISIBLE | WS_CHILD | UDS_HORZ, controlPos.left, controlPos.top, controlPos.right - controlPos.left, controlPos.bottom - controlPos.top, - hwnd, - NULL, - NULL, - NULL); + hwnd, NULL, NULL, NULL); } else { @@ -1016,8 +1005,8 @@ static void TAB_SetupScrolling( */ static void TAB_SetItemBounds (TAB_INFO *infoPtr) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); - TEXTMETRICA fontMetrics; + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); + TEXTMETRICW fontMetrics; UINT curItem; INT curItemLeftPos; INT curItemRowCount; @@ -1069,7 +1058,7 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr) int icon_height = 0; /* Use the current font to determine the height of a tab. */ - GetTextMetricsA(hdc, &fontMetrics); + GetTextMetricsW(hdc, &fontMetrics); /* Get the icon height */ if (infoPtr->himl) @@ -1374,7 +1363,7 @@ TAB_EraseTabInterior RECT* drawRect ) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); HBRUSH hbr = CreateSolidBrush (comctl32_color.clrBtnFace); BOOL deleteBrush = TRUE; RECT rTemp = *drawRect; @@ -1441,7 +1430,7 @@ TAB_DrawItemInterior RECT* drawRect ) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); RECT localRect; @@ -1757,7 +1746,8 @@ TAB_DrawItemInterior /* Draw the text */ if(lStyle & TCS_VERTICAL) /* if we are vertical rotate the text and each character */ { - LOGFONTA logfont; + static const WCHAR ArialW[] = { 'A','r','i','a','l',0 }; + LOGFONTW logfont; HFONT hFont = 0; INT nEscapement = 900; INT nOrientation = 900; @@ -1770,13 +1760,13 @@ TAB_DrawItemInterior /* to get a font with the escapement and orientation we are looking for, we need to */ /* call CreateFontIndirectA, which requires us to set the values of the logfont we pass in */ - if (!GetObjectA((infoPtr->hFont) ? + if (!GetObjectW((infoPtr->hFont) ? infoPtr->hFont : GetStockObject(SYSTEM_FONT), - sizeof(LOGFONTA),&logfont)) + sizeof(LOGFONTW),&logfont)) { INT iPointSize = 9; - lstrcpyA(logfont.lfFaceName, "Arial"); + lstrcpyW(logfont.lfFaceName, ArialW); logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); logfont.lfWeight = FW_NORMAL; @@ -1787,7 +1777,7 @@ TAB_DrawItemInterior logfont.lfEscapement = nEscapement; logfont.lfOrientation = nOrientation; - hFont = CreateFontIndirectA(&logfont); + hFont = CreateFontIndirectW(&logfont); SelectObject(hdc, hFont); if (item->pszText) @@ -1845,7 +1835,7 @@ static void TAB_DrawItem( HDC hdc, INT iItem) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); RECT itemRect; RECT selectedRect; BOOL isVisible; @@ -1957,7 +1947,7 @@ static void TAB_DrawItem( /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RIGHT|BF_TOP|BF_BOTTOM); @@ -1968,7 +1958,7 @@ static void TAB_DrawItem( r1.top = r.top; r1.right = r.right; r1.bottom = r1.top + ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.right--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT); @@ -1977,7 +1967,7 @@ static void TAB_DrawItem( r1.bottom = r.bottom; r1.right = r.right; r1.top = r1.bottom - ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.right--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT); @@ -1998,7 +1988,7 @@ static void TAB_DrawItem( /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_BOTTOM); @@ -2009,7 +1999,7 @@ static void TAB_DrawItem( r1.top = r.top; r1.right = r1.left + ROUND_CORNER_SIZE + 1; r1.bottom = r1.top + ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.left++; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT); @@ -2018,7 +2008,7 @@ static void TAB_DrawItem( r1.bottom = r.bottom; r1.right = r1.left + ROUND_CORNER_SIZE + 1; r1.top = r1.bottom - ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.left++; DrawEdge(hdc, &r1, EDGE_SUNKEN, BF_DIAGONAL_ENDTOPLEFT); } @@ -2052,7 +2042,7 @@ static void TAB_DrawItem( /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_BOTTOM|BF_RIGHT); @@ -2063,7 +2053,7 @@ static void TAB_DrawItem( r1.bottom = r.bottom; r1.right = r.right; r1.top = r1.bottom - ROUND_CORNER_SIZE - 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.bottom--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT); @@ -2072,7 +2062,7 @@ static void TAB_DrawItem( r1.bottom = r.bottom; r1.right = r1.left + ROUND_CORNER_SIZE; r1.top = r1.bottom - ROUND_CORNER_SIZE - 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.bottom--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT); @@ -2106,7 +2096,7 @@ static void TAB_DrawItem( /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_RIGHT); @@ -2117,7 +2107,7 @@ static void TAB_DrawItem( r1.top = r.top; r1.right = r.right; r1.bottom = r1.top + ROUND_CORNER_SIZE + 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.top++; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMRIGHT); @@ -2126,7 +2116,7 @@ static void TAB_DrawItem( r1.top = r.top; r1.right = r1.left + ROUND_CORNER_SIZE; r1.bottom = r1.top + ROUND_CORNER_SIZE + 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.top++; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT); } @@ -2149,7 +2139,7 @@ static void TAB_DrawItem( static void TAB_DrawBorder (TAB_INFO *infoPtr, HDC hdc) { RECT rect; - DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); GetClientRect (infoPtr->hwnd, &rect); @@ -2190,7 +2180,7 @@ static void TAB_Refresh (TAB_INFO *infoPtr, HDC hdc) hOldFont = SelectObject (hdc, infoPtr->hFont); - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) { for (i = 0; i < infoPtr->uNumItem; i++) TAB_DrawItem (infoPtr, hdc, i); @@ -2241,7 +2231,7 @@ static void TAB_EnsureSelectionVisible( TAB_INFO* infoPtr) { INT iSelected = infoPtr->iSelected; - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); INT iOrigLeftmostVisible = infoPtr->leftmostVisible; /* set the items row to the bottommost row or topmost row depending on @@ -2360,7 +2350,7 @@ static void TAB_EnsureSelectionVisible( static void TAB_InvalidateTabArea(TAB_INFO* infoPtr) { RECT clientRect, rInvalidate, rAdjClient; - DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); INT lastRow = infoPtr->uNumRows - 1; RECT rect; @@ -2439,10 +2429,10 @@ static inline LRESULT TAB_Paint (TAB_INFO *infoPtr, HDC hdcPaint) } static LRESULT -TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode) +TAB_InsertItemT (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode) { TAB_ITEM *item; - TCITEMA *pti; + TCITEMW *pti; INT iItem; RECT rect; @@ -2450,17 +2440,14 @@ TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode TRACE("Rect: %p T %li, L %li, B %li, R %li\n", infoPtr->hwnd, rect.top, rect.left, rect.bottom, rect.right); - pti = (TCITEMA *)lParam; + pti = (TCITEMW *)lParam; iItem = (INT)wParam; if (iItem < 0) return -1; if (iItem > infoPtr->uNumItem) iItem = infoPtr->uNumItem; - if (bUnicode) - TAB_DumpItemExternalW((TCITEMW*)pti, iItem); - else - TAB_DumpItemExternalA(pti, iItem); + TAB_DumpItemExternalT(pti, iItem, bUnicode); if (infoPtr->uNumItem == 0) { @@ -2502,9 +2489,9 @@ TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode if (pti->mask & TCIF_TEXT) { if (bUnicode) - Str_SetPtrW (&item->pszText, (WCHAR*)pti->pszText); + Str_SetPtrW (&item->pszText, pti->pszText); else - Str_SetPtrAtoW (&item->pszText, pti->pszText); + Str_SetPtrAtoW (&item->pszText, (LPSTR)pti->pszText); } if (pti->mask & TCIF_IMAGE) @@ -2532,7 +2519,7 @@ TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode static LRESULT TAB_SetItemSize (TAB_INFO *infoPtr, LPARAM lParam) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); LONG lResult = 0; BOOL bNeedPaint = FALSE; @@ -2600,7 +2587,7 @@ TAB_HighlightItem (TAB_INFO *infoPtr, INT iItem, BOOL fHighlight) } static LRESULT -TAB_SetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode) +TAB_SetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) { TAB_ITEM *wineItem; @@ -2609,10 +2596,7 @@ TAB_SetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode) if (iItem < 0 || iItem >= infoPtr->uNumItem) return FALSE; - if (bUnicode) - TAB_DumpItemExternalW((TCITEMW *)tabItem, iItem); - else - TAB_DumpItemExternalA(tabItem, iItem); + TAB_DumpItemExternalT(tabItem, iItem, bUnicode); wineItem = TAB_GetItem(infoPtr, iItem); @@ -2636,9 +2620,9 @@ TAB_SetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode) wineItem->pszText = NULL; } if (bUnicode) - Str_SetPtrW(&wineItem->pszText, (WCHAR*)tabItem->pszText); + Str_SetPtrW(&wineItem->pszText, tabItem->pszText); else - Str_SetPtrAtoW(&wineItem->pszText, tabItem->pszText); + Str_SetPtrAtoW(&wineItem->pszText, (LPSTR)tabItem->pszText); } /* Update and repaint tabs */ @@ -2655,7 +2639,7 @@ static inline LRESULT TAB_GetItemCount (const TAB_INFO *infoPtr) static LRESULT -TAB_GetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode) +TAB_GetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) { TAB_ITEM *wineItem; @@ -2681,15 +2665,12 @@ TAB_GetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode) if (tabItem->mask & TCIF_TEXT) { if (bUnicode) - Str_GetPtrW (wineItem->pszText, (WCHAR*)tabItem->pszText, tabItem->cchTextMax); + Str_GetPtrW (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax); else - Str_GetPtrWtoA (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax); + Str_GetPtrWtoA (wineItem->pszText, (LPSTR)tabItem->pszText, tabItem->cchTextMax); } - if (bUnicode) - TAB_DumpItemExternalW((TCITEMW*)tabItem, iItem); - else - TAB_DumpItemExternalA(tabItem, iItem); + TAB_DumpItemExternalT(tabItem, iItem, bUnicode); return TRUE; } @@ -2835,7 +2816,7 @@ static inline LRESULT TAB_Size (TAB_INFO *infoPtr) GetClientRect(parent, &parent_rect); cx=LOWORD (lParam); cy=HIWORD (lParam); - if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) + if (GetWindowLongW(hwnd, GWL_STYLE) & CCS_NORESIZE) uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); SetWindowPos (hwnd, 0, parent_rect.left, parent_rect.top, @@ -2857,14 +2838,14 @@ static inline LRESULT TAB_Size (TAB_INFO *infoPtr) static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) { TAB_INFO *infoPtr; - TEXTMETRICA fontMetrics; + TEXTMETRICW fontMetrics; HDC hdc; HFONT hOldFont; DWORD dwStyle; infoPtr = (TAB_INFO *)Alloc (sizeof(TAB_INFO)); - SetWindowLongA(hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwnd = hwnd; infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; @@ -2876,7 +2857,7 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->uVItemPadding_s = 3; infoPtr->hFont = 0; infoPtr->items = 0; - infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW); + infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW); infoPtr->iSelected = -1; infoPtr->iHotTracked = -1; infoPtr->uFocus = -1; @@ -2894,13 +2875,13 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) /* The tab control always has the WS_CLIPSIBLINGS style. Even if you don't specify it in CreateWindow. This is necessary in order for paint to work correctly. This follows windows behaviour. */ - dwStyle = GetWindowLongA(hwnd, GWL_STYLE); - SetWindowLongA(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS); + dwStyle = GetWindowLongW(hwnd, GWL_STYLE); + SetWindowLongW(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS); if (dwStyle & TCS_TOOLTIPS) { /* Create tooltip control */ infoPtr->hwndToolTip = - CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, + CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, 0, 0, 0); @@ -2927,7 +2908,7 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); /* Use the system font to determine the initial height of a tab. */ - GetTextMetricsA(hdc, &fontMetrics); + GetTextMetricsW(hdc, &fontMetrics); /* * Make sure there is enough space for the letters + growing the @@ -2957,6 +2938,8 @@ TAB_Destroy (TAB_INFO *infoPtr) if (!infoPtr) return 0; + SetWindowLongPtrW(infoPtr->hwnd, 0, 0); + if (infoPtr->items) { for (iItem = 0; iItem < infoPtr->uNumItem; iItem++) { if (TAB_GetItem(infoPtr, iItem)->pszText) @@ -2975,7 +2958,6 @@ TAB_Destroy (TAB_INFO *infoPtr) KillTimer(infoPtr->hwnd, TAB_HOTTRACK_TIMER); Free (infoPtr); - SetWindowLongA(infoPtr->hwnd, 0, 0); return 0; } @@ -3017,11 +2999,11 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case TCM_GETITEMA: case TCM_GETITEMW: - return TAB_GetItemAW (infoPtr, (INT)wParam, (LPTCITEMA)lParam, uMsg == TCM_GETITEMW); + return TAB_GetItemT (infoPtr, (INT)wParam, (LPTCITEMW)lParam, uMsg == TCM_GETITEMW); case TCM_SETITEMA: case TCM_SETITEMW: - return TAB_SetItemAW (infoPtr, (INT)wParam, (LPTCITEMA)lParam, uMsg == TCM_SETITEMW); + return TAB_SetItemT (infoPtr, (INT)wParam, (LPTCITEMW)lParam, uMsg == TCM_SETITEMW); case TCM_DELETEITEM: return TAB_DeleteItem (infoPtr, (INT)wParam); @@ -3043,7 +3025,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case TCM_INSERTITEMA: case TCM_INSERTITEMW: - return TAB_InsertItemAW (infoPtr, wParam, lParam, uMsg == TCM_INSERTITEMW); + return TAB_InsertItemT (infoPtr, wParam, lParam, uMsg == TCM_INSERTITEMW); case TCM_SETITEMEXTRA: return TAB_SetItemExtra (infoPtr, (int)wParam); @@ -3171,7 +3153,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } -VOID +void TAB_Register (void) { WNDCLASSW wndClass; @@ -3189,7 +3171,7 @@ TAB_Register (void) } -VOID +void TAB_Unregister (void) { UnregisterClassW (WC_TABCONTROLW, NULL); diff --git a/reactos/lib/comctl32/toolbar.c b/reactos/lib/comctl32/toolbar.c index 0056c21655c..b11ea510d01 100644 --- a/reactos/lib/comctl32/toolbar.c +++ b/reactos/lib/comctl32/toolbar.c @@ -21,15 +21,6 @@ * * NOTES * - * Differences between MSDN and actual native control operation: - * 1. MSDN says: "TBSTYLE_LIST: Creates a flat toolbar with button text - * to the right of the bitmap. Otherwise, this style is - * identical to TBSTYLE_FLAT." - * As implemented by both v4.71 and v5.80 of the native COMCTL32.DLL - * you can create a TBSTYLE_LIST without TBSTYLE_FLAT and the result - * is non-flat non-transparent buttons. Therefore TBSTYLE_LIST does - * *not* imply TBSTYLE_FLAT as documented. (GA 8/2001) - * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Mar. 14, 2004, by Robert Shearman. * @@ -66,6 +57,16 @@ * setparnt.exe, setrows.exe, toolwnd.exe. * - Microsoft's controlspy examples. * - Charles Petzold's 'Programming Windows': gadgets.exe + * + * Differences between MSDN and actual native control operation: + * 1. MSDN says: "TBSTYLE_LIST: Creates a flat toolbar with button text + * to the right of the bitmap. Otherwise, this style is + * identical to TBSTYLE_FLAT." + * As implemented by both v4.71 and v5.80 of the native COMCTL32.DLL + * you can create a TBSTYLE_LIST without TBSTYLE_FLAT and the result + * is non-flat non-transparent buttons. Therefore TBSTYLE_LIST does + * *not* imply TBSTYLE_FLAT as documented. (GA 8/2001) + * */ #include @@ -116,9 +117,9 @@ typedef struct typedef struct { - DWORD dwStructSize; /* size of TBBUTTON struct */ - INT nHeight; /* height of the toolbar */ - INT nWidth; /* width of the toolbar */ + DWORD dwStructSize; /* size of TBBUTTON struct */ + INT nHeight; /* height of the toolbar */ + INT nWidth; /* width of the toolbar */ RECT client_rect; RECT rcBound; /* bounding rectangle */ INT nButtonHeight; @@ -145,7 +146,7 @@ typedef struct INT iListGap; /* default gap between text and image for toolbar with list style */ HFONT hDefaultFont; HFONT hFont; /* text font */ - HIMAGELIST himlInt; /* image list created internally */ + HIMAGELIST himlInt; /* image list created internally */ PIMLENTRY *himlDef; /* default image list array */ INT cimlDef; /* default image list array count */ PIMLENTRY *himlHot; /* hot image list array */ @@ -162,9 +163,9 @@ typedef struct BOOL bDragOutSent; /* has TBN_DRAGOUT notification been sent for this drag? */ BOOL bUnicode; /* Notifications are ASCII (FALSE) or Unicode (TRUE)? */ BOOL bCaptured; /* mouse captured? */ - DWORD dwStyle; /* regular toolbar style */ - DWORD dwExStyle; /* extended toolbar style */ - DWORD dwDTFlags; /* DrawText flags */ + DWORD dwStyle; /* regular toolbar style */ + DWORD dwExStyle; /* extended toolbar style */ + DWORD dwDTFlags; /* DrawText flags */ COLORREF clrInsertMark; /* insert mark color */ COLORREF clrBtnHighlight; /* color for Flat Separator */ @@ -489,7 +490,7 @@ TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr) newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; oldcolor = SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); myrect.left = myrect.right; myrect.right = myrect.left + 1; @@ -497,7 +498,7 @@ TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr) newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); SetBkColor (hdc, oldcolor); } @@ -533,7 +534,7 @@ TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLB newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; oldcolor = SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); myrect.top = myrect.bottom; myrect.bottom = myrect.top + 1; @@ -541,7 +542,7 @@ TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLB newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); SetBkColor (hdc, oldcolor); } @@ -990,9 +991,9 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc) COLORREF oldclr; oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack); - ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0); if (hasDropDownArrow) - ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0); SetBkColor(hdc, oldclr); } } @@ -2531,7 +2532,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) /* copy the bitmap before adding it so that the user's bitmap * doesn't get modified. */ - GetObjectA ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp); hdcImage = CreateCompatibleDC(0); hdcBitmap = CreateCompatibleDC(0); @@ -2559,48 +2560,48 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) switch (lpAddBmp->nID) { case IDB_STD_SMALL_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_STD_SMALL)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_STD_SMALL)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_STD_LARGE_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_STD_LARGE)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_STD_LARGE)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_SMALL_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_VIEW_SMALL)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_VIEW_SMALL)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_LARGE_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_VIEW_LARGE)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_VIEW_LARGE)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_SMALL_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_HIST_SMALL)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_HIST_SMALL)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_LARGE_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_HIST_LARGE)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_HIST_LARGE)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); @@ -2614,7 +2615,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) } else { - hbmLoad = LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID); + hbmLoad = LoadBitmapW (lpAddBmp->hInst, (LPWSTR)lpAddBmp->nID); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); } @@ -2807,8 +2808,7 @@ TOOLBAR_AddStringA (HWND hwnd, WPARAM wParam, LPARAM lParam) INT len; TRACE("adding string from resource!\n"); - len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, - szString, 256); + len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, szString, sizeof(szString)); TRACE("len=%d \"%s\"\n", len, szString); nIndex = infoPtr->nNumStrings; @@ -3445,7 +3445,7 @@ TOOLBAR_GetButtonSize (HWND hwnd) return MAKELONG((WORD)infoPtr->nButtonWidth, (WORD)infoPtr->nButtonHeight); else - return MAKELONG(8,7); + return MAKELONG(23,22); } @@ -4331,7 +4331,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) /* copy the bitmap before adding it so that the user's bitmap * doesn't get modified. */ - GetObjectA (hBitmap, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW (hBitmap, sizeof(BITMAP), (LPVOID)&bmp); hdcImage = CreateCompatibleDC(0); hdcBitmap = CreateCompatibleDC(0); @@ -4430,7 +4430,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave) res = ERROR_FILE_NOT_FOUND; if (!res) { - nmtbr.pData = HeapAlloc(GetProcessHeap(), 0, dwSize); + nmtbr.pData = Alloc(dwSize); nmtbr.cbData = (UINT)dwSize; if (!nmtbr.pData) res = ERROR_OUTOFMEMORY; } @@ -4503,7 +4503,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave) if (infoPtr->nNumButtons > 0) ret = TRUE; } } - HeapFree(GetProcessHeap(), 0, nmtbr.pData); + Free (nmtbr.pData); RegCloseKey(hkey); return ret; @@ -4527,22 +4527,33 @@ TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSW lpSave) static LRESULT TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSA lpSave) { + LPWSTR pszValueName = 0, pszSubKey = 0; TBSAVEPARAMSW SaveW; + LRESULT result = 0; int len; if (lpSave == NULL) return 0; - SaveW.hkr = lpSave->hkr; - len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, NULL, 0); - SaveW.pszSubKey = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, (LPWSTR)SaveW.pszSubKey, len); + pszSubKey = Alloc(len * sizeof(WCHAR)); + if (pszSubKey) goto exit; + MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, pszSubKey, len); len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, NULL, 0); - SaveW.pszValueName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, (LPWSTR)SaveW.pszValueName, len); + pszValueName = Alloc(len * sizeof(WCHAR)); + if (!pszValueName) goto exit; + MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, pszValueName, len); - return TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW); + SaveW.pszValueName = pszValueName; + SaveW.pszSubKey = pszSubKey; + SaveW.hkr = lpSave->hkr; + result = TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW); + +exit: + Free (pszValueName); + Free (pszSubKey); + + return result; } @@ -5442,7 +5453,7 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); - LOGFONTA logFont; + LOGFONTW logFont; TRACE("hwnd = %p\n", hwnd); @@ -5483,13 +5494,13 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->bUnicode = infoPtr->hwndNotify && (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY)); - SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); - infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont); + SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); + infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont); if (dwStyle & TBSTYLE_TOOLTIPS) { /* Create tooltip control */ infoPtr->hwndToolTip = - CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, + CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, 0, 0, 0); @@ -5523,7 +5534,7 @@ TOOLBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) DestroyWindow (infoPtr->hwndToolTip); /* delete temporary buffer for tooltip text */ - HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); + Free (infoPtr->pszTooltipText); /* delete button data */ if (infoPtr->buttons) @@ -5653,7 +5664,7 @@ TOOLBAR_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam) if (nHit >= 0) TOOLBAR_LButtonDown (hwnd, wParam, lParam); - else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) + else if (GetWindowLongW (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) TOOLBAR_Customize (hwnd); return 0; @@ -6187,22 +6198,22 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) /* native control does: * Get a lot of colors and brushes * WM_NOTIFYFORMAT - * SystemParametersInfoA(0x1f, 0x3c, adr1, 0) - * CreateFontIndirectA(adr1) + * SystemParametersInfoW(0x1f, 0x3c, adr1, 0) + * CreateFontIndirectW(adr1) * CreateBitmap(0x27, 0x24, 1, 1, 0) * hdc = GetDC(toolbar) * GetSystemMetrics(0x48) - * fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, + * fnt2=CreateFontW(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, * 0, 0, 0, 0, "MARLETT") * oldfnt = SelectObject(hdc, fnt2) - * GetCharWidthA(hdc, 0x36, 0x36, adr2) - * GetTextMetricsA(hdc, adr3) + * GetCharWidthW(hdc, 0x36, 0x36, adr2) + * GetTextMetricsW(hdc, adr3) * SelectObject(hdc, oldfnt) * DeleteObject(fnt2) * ReleaseDC(hdc) * InvalidateRect(toolbar, 0, 1) - * SetWindowLongA(toolbar, 0, addr) - * SetWindowLongA(toolbar, -16, xxx) **sometimes** + * SetWindowLongW(toolbar, 0, addr) + * SetWindowLongW(toolbar, -16, xxx) **sometimes** * WM_STYLECHANGING * CallWinEx old new * ie 1 0x56000a4c 0x46000a4c 0x56008a4d @@ -6277,7 +6288,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm TRACE("button index = %d\n", index); - HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); + Free (infoPtr->pszTooltipText); infoPtr->pszTooltipText = NULL; if (index < 0) @@ -6307,7 +6318,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm /* need to allocate temporary buffer in infoPtr as there * isn't enough space in buffer passed to us by the * tooltip control */ - infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR)); if (infoPtr->pszTooltipText) { memcpy(infoPtr->pszTooltipText, tbgit.pszText, (len+1)*sizeof(WCHAR)); @@ -6345,7 +6356,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm /* need to allocate temporary buffer in infoPtr as there * isn't enough space in buffer passed to us by the * tooltip control */ - infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR)); if (infoPtr->pszTooltipText) { MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, len+1, infoPtr->pszTooltipText, (len+1)*sizeof(WCHAR)); @@ -6375,7 +6386,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm /* need to allocate temporary buffer in infoPtr as there * isn't enough space in buffer passed to us by the * tooltip control */ - infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR)); if (infoPtr->pszTooltipText) { memcpy(infoPtr->pszTooltipText, pszText, (len+1)*sizeof(WCHAR)); diff --git a/reactos/lib/comctl32/tooltips.c b/reactos/lib/comctl32/tooltips.c index e7499ad7353..7abe894b013 100644 --- a/reactos/lib/comctl32/tooltips.c +++ b/reactos/lib/comctl32/tooltips.c @@ -18,6 +18,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES + * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Sep. 08, 2004, by Robert Shearman. * @@ -214,7 +216,7 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc) if (infoPtr->nMaxTipWidth > -1) uFlags |= DT_WORDBREAK; - if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX) + if (GetWindowLongW (hwnd, GWL_STYLE) & TTS_NOPREFIX) uFlags |= DT_NOPREFIX; GetClientRect (hwnd, &rc); @@ -385,7 +387,7 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) { INT max_len = (ttnmdi.lpszText == &ttnmdi.szText[0]) ? sizeof(ttnmdi.szText)/sizeof(ttnmdi.szText[0]) : INFOTIPSIZE-1; - strncpyW(infoPtr->szTipText, ttnmdi.lpszText, max_len); + lstrcpynW(infoPtr->szTipText, ttnmdi.lpszText, max_len); if (ttnmdi.uFlags & TTF_DI_SETITEM) { INT len = max(strlenW(ttnmdi.lpszText), max_len); toolPtr->hinst = 0; @@ -610,8 +612,8 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr) rect.top = rect.bottom - size.cy; } - AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), - FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); + AdjustWindowRectEx (&rect, GetWindowLongW (hwnd, GWL_STYLE), + FALSE, GetWindowLongW (hwnd, GWL_EXSTYLE)); if (style & TTS_BALLOON) { @@ -782,8 +784,8 @@ TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr) rect.right = rect.left + size.cx; rect.bottom = rect.top + size.cy; - AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), - FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); + AdjustWindowRectEx (&rect, GetWindowLongW (hwnd, GWL_STYLE), + FALSE, GetWindowLongW (hwnd, GWL_EXSTYLE)); if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON) { @@ -945,7 +947,7 @@ TOOLTIPS_CheckTool (HWND hwnd, BOOL bShowTest) if (nTool == -1) return -1; - if (!(GetWindowLongA (hwnd, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest) { + if (!(GetWindowLongW (hwnd, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest) { if (!TOOLTIPS_IsWindowActive (GetWindow (hwnd, GW_OWNER))) return -1; } @@ -2395,8 +2397,8 @@ TOOLTIPS_MouseMessage (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static LRESULT TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) { - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); - DWORD dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE); + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); + DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE); dwStyle &= 0x0000FFFF; dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS); @@ -2405,10 +2407,10 @@ TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) * window region, therefore it is useless to us in balloon mode */ if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER; - SetWindowLongA (hwnd, GWL_STYLE, dwStyle); + SetWindowLongW (hwnd, GWL_STYLE, dwStyle); dwExStyle |= WS_EX_TOOLWINDOW; - SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle); + SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle); return TRUE; } diff --git a/reactos/lib/comctl32/treeview.c b/reactos/lib/comctl32/treeview.c index 0c4a5cc4e73..0bf386c33d9 100644 --- a/reactos/lib/comctl32/treeview.c +++ b/reactos/lib/comctl32/treeview.c @@ -19,6 +19,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES + * * Note that TREEVIEW_INFO * and HTREEITEM are the same thing. * * Note2: All items always! have valid (allocated) pszText field. @@ -239,6 +241,39 @@ TREEVIEW_GetItemIndex(TREEVIEW_INFO *infoPtr, HTREEITEM handle) return DPA_GetPtrIndex(infoPtr->items, handle); } +/* Checks if item has changed and needs to be redrawn */ +static inline BOOL item_changed (TREEVIEW_ITEM *tiOld, TREEVIEW_ITEM *tiNew, LPTVITEMEXW tvChange) +{ + /* Number of children has changed */ + if ((tvChange->mask & TVIF_CHILDREN) && (tiOld->cChildren != tiNew->cChildren)) + return TRUE; + + /* Image has changed and it's not a callback */ + if ((tvChange->mask & TVIF_IMAGE) && (tiOld->iImage != tiNew->iImage) && + tiNew->iImage != I_IMAGECALLBACK) + return TRUE; + + /* Selected image has changed and it's not a callback */ + if ((tvChange->mask & TVIF_SELECTEDIMAGE) && (tiOld->iSelectedImage != tiNew->iSelectedImage) && + tiNew->iSelectedImage != I_IMAGECALLBACK) + return TRUE; + + /* Text has changed and it's not a callback */ + if ((tvChange->mask & TVIF_TEXT) && (tiOld->pszText != tiNew->pszText) && + tiNew->pszText != LPSTR_TEXTCALLBACKW) + return TRUE; + + /* Indent has changed */ + if ((tvChange->mask & TVIF_INTEGRAL) && (tiOld->iIntegral != tiNew->iIntegral)) + return TRUE; + + /* Item state has changed */ + if ((tvChange->mask & TVIF_STATE) && ((tiOld->state ^ tiNew->state) & tvChange->stateMask )) + return TRUE; + + return FALSE; +} + /*************************************************************************** * This method checks that handle is an item for this tree. */ @@ -489,7 +524,6 @@ TREEVIEW_TVItemFromItem(TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem, TREE tvItem->state = item->state; tvItem->stateMask = 0; tvItem->iImage = item->iImage; - tvItem->iImage = item->iImage; tvItem->iSelectedImage = item->iSelectedImage; tvItem->cChildren = item->cChildren; tvItem->lParam = item->lParam; @@ -615,10 +649,10 @@ TREEVIEW_SendCustomDrawNotify(TREEVIEW_INFO *infoPtr, DWORD dwDrawStage, static BOOL TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc, - TREEVIEW_ITEM *wineItem, UINT uItemDrawState) + TREEVIEW_ITEM *wineItem, UINT uItemDrawState, + NMTVCUSTOMDRAW *nmcdhdr) { HWND hwnd = infoPtr->hwnd; - NMTVCUSTOMDRAW nmcdhdr; LPNMCUSTOMDRAW nmcd; DWORD dwDrawStage, dwItemSpec; UINT uItemState; @@ -634,7 +668,7 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc, if (wineItem == infoPtr->hotItem) uItemState |= CDIS_HOT; - nmcd = &nmcdhdr.nmcd; + nmcd = &nmcdhdr->nmcd; nmcd->hdr.hwndFrom = hwnd; nmcd->hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmcd->hdr.code = NM_CUSTOMDRAW; @@ -644,9 +678,7 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc, nmcd->dwItemSpec = dwItemSpec; nmcd->uItemState = uItemState; nmcd->lItemlParam = wineItem->lParam; - nmcdhdr.clrText = infoPtr->clrText; - nmcdhdr.clrTextBk = infoPtr->clrBk; - nmcdhdr.iLevel = wineItem->iLevel; + nmcdhdr->iLevel = wineItem->iLevel; TRACE("drawstage:%lx hdc:%p item:%lx, itemstate:%x, lItemlParam:%lx\n", nmcd->dwDrawStage, nmcd->hdc, nmcd->dwItemSpec, @@ -654,10 +686,8 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc, retval = TREEVIEW_SendRealNotify(infoPtr, (WPARAM)nmcd->hdr.idFrom, - (LPARAM)&nmcdhdr); + (LPARAM)nmcdhdr); - infoPtr->clrText = nmcdhdr.clrText; - infoPtr->clrBk = nmcdhdr.clrTextBk; return (BOOL)retval; } @@ -974,6 +1004,9 @@ TREEVIEW_AllocateItem(TREEVIEW_INFO *infoPtr) if (!newItem) return NULL; + newItem->iImage = -1; + newItem->iSelectedImage = -1; + if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1) { Free(newItem); @@ -2112,9 +2145,8 @@ TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW) /* The refresh updates everything, but we can't wait until then. */ TREEVIEW_ComputeItemInternalMetrics(infoPtr, wineItem); - /* if any of the items values changed, redraw the item */ - if(memcmp(&originalItem, wineItem, sizeof(TREEVIEW_ITEM)) || - (tvItem->stateMask & TVIS_BOLD)) + /* if any of the item's values changed and it's not a callback, redraw the item */ + if (item_changed(&originalItem, wineItem, tvItem)) { if (tvItem->mask & TVIF_INTEGRAL) { @@ -2263,10 +2295,14 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item) BOOL lar = ((infoPtr->dwStyle & (TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS)) > TVS_LINESATROOT); + HBRUSH hbr, hbrOld; if (!lar && item->iLevel == 0) return; + hbr = CreateSolidBrush(infoPtr->clrBk); + hbrOld = SelectObject(hdc, hbr); + centerx = (item->linesOffset + item->stateOffset) / 2; centery = (item->rect.top + item->rect.bottom) / 2; @@ -2333,15 +2369,10 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item) HPEN hNewPen = CreatePen(PS_SOLID, 0, infoPtr->clrLine); HPEN hOldPen = SelectObject(hdc, hNewPen); - HBRUSH hbr = CreateSolidBrush(infoPtr->clrBk); - HBRUSH hbrOld = SelectObject(hdc, hbr); Rectangle(hdc, centerx - rectsize - 1, centery - rectsize - 1, centerx + rectsize + 2, centery + rectsize + 2); - SelectObject(hdc, hbrOld); - DeleteObject(hbr); - SelectObject(hdc, hOldPen); DeleteObject(hNewPen); @@ -2371,6 +2402,8 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item) } } } + SelectObject(hdc, hbrOld); + DeleteObject(hbr); } static void @@ -2378,12 +2411,50 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem) { INT cditem; HFONT hOldFont; + COLORREF oldTextColor, oldTextBkColor; int centery; - - hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, wineItem)); + BOOL inFocus = (GetFocus() == infoPtr->hwnd); + NMTVCUSTOMDRAW nmcdhdr; TREEVIEW_UpdateDispInfo(infoPtr, wineItem, CALLBACK_MASK_ALL); + /* - If item is drop target or it is selected and window is in focus - + * use blue background (COLOR_HIGHLIGHT). + * - If item is selected, window is not in focus, but it has style + * TVS_SHOWSELALWAYS - use grey background (COLOR_BTNFACE) + * - Otherwise - use background color + */ + if ((wineItem->state & TVIS_DROPHILITED) || ((wineItem == infoPtr->focusedItem) && !(wineItem->state & TVIS_SELECTED)) || + ((wineItem->state & TVIS_SELECTED) && (!infoPtr->focusedItem) && + (inFocus || (infoPtr->dwStyle & TVS_SHOWSELALWAYS)))) + { + if ((wineItem->state & TVIS_DROPHILITED) || inFocus) + { + nmcdhdr.clrTextBk = GetSysColor(COLOR_HIGHLIGHT); + nmcdhdr.clrText = GetSysColor(COLOR_HIGHLIGHTTEXT); + } + else + { + nmcdhdr.clrTextBk = GetSysColor(COLOR_BTNFACE); + if (infoPtr->clrText == -1) + nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT); + else + nmcdhdr.clrText = infoPtr->clrText; + } + } + else + { + nmcdhdr.clrTextBk = infoPtr->clrBk; + if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem)) + nmcdhdr.clrText = comctl32_color.clrHighlight; + else if (infoPtr->clrText == -1) + nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT); + else + nmcdhdr.clrText = infoPtr->clrText; + } + + hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, wineItem)); + /* The custom draw handler can query the text rectangle, * so get ready. */ /* should already be known, set to 0 when changed */ @@ -2395,7 +2466,7 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem) if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) { cditem = TREEVIEW_SendCustomDrawItemNotify - (infoPtr, hdc, wineItem, CDDS_ITEMPREPAINT); + (infoPtr, hdc, wineItem, CDDS_ITEMPREPAINT, &nmcdhdr); TRACE("prepaint:cditem-app returns 0x%x\n", cditem); if (cditem & CDRF_SKIPDEFAULT) @@ -2410,6 +2481,10 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem) TREEVIEW_DrawItemLines(infoPtr, hdc, wineItem); + /* Set colors. Custom draw handler can change these so we do this after it. */ + oldTextColor = SetTextColor(hdc, nmcdhdr.clrText); + oldTextBkColor = SetBkColor(hdc, nmcdhdr.clrTextBk); + centery = (wineItem->rect.top + wineItem->rect.bottom) / 2; /* @@ -2435,7 +2510,7 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem) * non-selected image. */ - if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage)) + if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage >= 0)) { /* The item is currently selected */ imageIndex = wineItem->iSelectedImage; @@ -2467,87 +2542,31 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem) { if (wineItem->pszText) { - COLORREF oldTextColor = 0; - INT oldBkMode; - HBRUSH hbrBk = 0; - BOOL inFocus = (GetFocus() == infoPtr->hwnd); RECT rcText; - oldBkMode = SetBkMode(hdc, TRANSPARENT); - - /* - If item is drop target or it is selected and window is in focus - - * use blue background (COLOR_HIGHLIGHT). - * - If item is selected, window is not in focus, but it has style - * TVS_SHOWSELALWAYS - use grey background (COLOR_BTNFACE) - * - Otherwise - don't fill background - */ - if ((wineItem->state & TVIS_DROPHILITED) || ((wineItem == infoPtr->focusedItem) && !(wineItem->state & TVIS_SELECTED)) || - ((wineItem->state & TVIS_SELECTED) && (!infoPtr->focusedItem) && - (inFocus || (infoPtr->dwStyle & TVS_SHOWSELALWAYS)))) - { - if ((wineItem->state & TVIS_DROPHILITED) || inFocus) - { - hbrBk = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT)); - oldTextColor = - SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); - } - else - { - hbrBk = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); - - if (infoPtr->clrText == -1) - oldTextColor = - SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); - else - oldTextColor = SetTextColor(hdc, infoPtr->clrText); - } - } - else - { - if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem)) - oldTextColor = SetTextColor(hdc, comctl32_color.clrHighlight); - else if (infoPtr->clrText == -1) - oldTextColor = - SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); - else - oldTextColor = SetTextColor(hdc, infoPtr->clrText); - } - rcText.top = wineItem->rect.top; rcText.bottom = wineItem->rect.bottom; rcText.left = wineItem->textOffset; rcText.right = rcText.left + wineItem->textWidth + 4; - if (hbrBk) - { - FillRect(hdc, &rcText, hbrBk); - DeleteObject(hbrBk); - } + TRACE("drawing text %s at (%ld,%ld)-(%ld,%ld)\n", + debugstr_w(wineItem->pszText), + rcText.left, rcText.top, rcText.right, rcText.bottom); + /* Draw it */ + ExtTextOutW(hdc, rcText.left + 2, rcText.top + 1, + ETO_CLIPPED | ETO_OPAQUE, + &rcText, + wineItem->pszText, + lstrlenW(wineItem->pszText), + NULL); + /* Draw the box around the selected item */ if ((wineItem == infoPtr->selectedItem) && inFocus) { DrawFocusRect(hdc,&rcText); } - InflateRect(&rcText, -2, -1); /* allow for the focus rect */ - - TRACE("drawing text %s at (%ld,%ld)-(%ld,%ld)\n", - debugstr_w(wineItem->pszText), - rcText.left, rcText.top, rcText.right, rcText.bottom); - - /* Draw it */ - DrawTextW(hdc, - wineItem->pszText, - lstrlenW(wineItem->pszText), - &rcText, - DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); - - /* Restore the hdc state */ - SetTextColor(hdc, oldTextColor); - - if (oldBkMode != TRANSPARENT) - SetBkMode(hdc, oldBkMode); } } @@ -2591,10 +2610,13 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem) if (cditem & CDRF_NOTIFYPOSTPAINT) { cditem = TREEVIEW_SendCustomDrawItemNotify - (infoPtr, hdc, wineItem, CDDS_ITEMPOSTPAINT); + (infoPtr, hdc, wineItem, CDDS_ITEMPOSTPAINT, &nmcdhdr); TRACE("postpaint:cditem-app returns 0x%x\n", cditem); } + /* Restore the hdc state */ + SetTextColor(hdc, oldTextColor); + SetBkColor(hdc, oldTextBkColor); SelectObject(hdc, hOldFont); } @@ -2814,7 +2836,7 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, WPARAM wParam) BITMAP bitmap; hbitmap = GetCurrentObject(hdc, OBJ_BITMAP); if (!hbitmap) return 0; - GetObjectA(hbitmap, sizeof(BITMAP), &bitmap); + GetObjectW(hbitmap, sizeof(BITMAP), &bitmap); rc.left = 0; rc.top = 0; rc.right = bitmap.bmWidth; rc.bottom = bitmap.bmHeight; @@ -3807,7 +3829,7 @@ TREEVIEW_TrackMouse(TREEVIEW_INFO *infoPtr, POINT pt) while (1) { - if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) + if (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { if (msg.message == WM_MOUSEMOVE) { @@ -3829,7 +3851,7 @@ TREEVIEW_TrackMouse(TREEVIEW_INFO *infoPtr, POINT pt) break; } - DispatchMessageA(&msg); + DispatchMessageW(&msg); } if (GetCapture() != infoPtr->hwnd) @@ -4216,14 +4238,17 @@ TREEVIEW_DoSelectItem(TREEVIEW_INFO *infoPtr, INT action, HTREEITEM newSelect, TREEVIEW_EnsureVisible(infoPtr, infoPtr->selectedItem, FALSE); + if (prevSelect) + TREEVIEW_Invalidate(infoPtr, prevSelect); + if (newSelect) + TREEVIEW_Invalidate(infoPtr, newSelect); + TREEVIEW_SendTreeviewNotify(infoPtr, TVN_SELCHANGEDW, cause, TVIF_HANDLE | TVIF_STATE | TVIF_PARAM, prevSelect, newSelect); - TREEVIEW_Invalidate(infoPtr, prevSelect); - TREEVIEW_Invalidate(infoPtr, newSelect); break; case TVGN_DROPHILITE: @@ -4242,9 +4267,12 @@ TREEVIEW_DoSelectItem(TREEVIEW_INFO *infoPtr, INT action, HTREEITEM newSelect, break; case TVGN_FIRSTVISIBLE: - TREEVIEW_EnsureVisible(infoPtr, newSelect, FALSE); - TREEVIEW_SetFirstVisible(infoPtr, newSelect, TRUE); - TREEVIEW_Invalidate(infoPtr, NULL); + if (newSelect != NULL) + { + TREEVIEW_EnsureVisible(infoPtr, newSelect, FALSE); + TREEVIEW_SetFirstVisible(infoPtr, newSelect, TRUE); + TREEVIEW_Invalidate(infoPtr, NULL); + } break; } @@ -4381,10 +4409,18 @@ static INT TREEVIEW_ProcessLetterKeys( idx=infoPtr->root->firstChild; } do { + /* At the end point, sort out wrapping */ if (idx == NULL) { + + /* If endidx is null, stop at the last item (ie top to bottom) */ if (endidx == NULL) break; + + /* Otherwise, start again at the very beginning */ idx=infoPtr->root->firstChild; + + /* But if we are stopping on the first child, end now! */ + if (idx == endidx) break; } /* get item */ @@ -5180,7 +5216,7 @@ TREEVIEW_Notify(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) } return 0; } - return DefWindowProcA(infoPtr->hwnd, WM_NOTIFY, wParam, lParam); + return DefWindowProcW(infoPtr->hwnd, WM_NOTIFY, wParam, lParam); } static INT TREEVIEW_NotifyFormat (TREEVIEW_INFO *infoPtr, HWND hwndFrom, UINT nCommand) @@ -5289,8 +5325,8 @@ TREEVIEW_SetFocus(TREEVIEW_INFO *infoPtr) TVC_UNKNOWN); } - TREEVIEW_SendSimpleNotify(infoPtr, NM_SETFOCUS); TREEVIEW_Invalidate(infoPtr, infoPtr->selectedItem); + TREEVIEW_SendSimpleNotify(infoPtr, NM_SETFOCUS); return 0; } @@ -5299,8 +5335,9 @@ TREEVIEW_KillFocus(TREEVIEW_INFO *infoPtr) { TRACE("\n"); - TREEVIEW_SendSimpleNotify(infoPtr, NM_KILLFOCUS); TREEVIEW_Invalidate(infoPtr, infoPtr->selectedItem); + UpdateWindow(infoPtr->hwnd); + TREEVIEW_SendSimpleNotify(infoPtr, NM_KILLFOCUS); return 0; } @@ -5567,7 +5604,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if ((uMsg >= WM_USER) && (uMsg < WM_APP)) TRACE("Unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); def: - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } } @@ -5577,28 +5614,28 @@ def: VOID TREEVIEW_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; TRACE("\n"); - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = TREEVIEW_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(TREEVIEW_INFO *); - wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wndClass.hbrBackground = 0; - wndClass.lpszClassName = WC_TREEVIEWA; + wndClass.lpszClassName = WC_TREEVIEWW; - RegisterClassA(&wndClass); + RegisterClassW(&wndClass); } VOID TREEVIEW_Unregister(void) { - UnregisterClassA(WC_TREEVIEWA, NULL); + UnregisterClassW(WC_TREEVIEWW, NULL); } diff --git a/reactos/lib/comctl32/updown.c b/reactos/lib/comctl32/updown.c index e88ddf69a37..9dc705aad42 100644 --- a/reactos/lib/comctl32/updown.c +++ b/reactos/lib/comctl32/updown.c @@ -49,6 +49,7 @@ typedef struct { HWND Self; /* Handle to this up-down control */ HWND Notify; /* Handle to the parent window */ + DWORD dwStyle; /* The GWL_STYLE for this window */ UINT AccelCount; /* Number of elements in AccelVect */ UDACCEL* AccelVect; /* Vector containing AccelCount elements */ INT AccelIndex; /* Current accel index, -1 if not accel'ing */ @@ -97,7 +98,7 @@ typedef struct static const WCHAR BUDDY_UPDOWN_HWND[] = { 'b', 'u', 'd', 'd', 'y', 'U', 'p', 'D', 'o', 'w', 'n', 'H', 'W', 'N', 'D', 0 }; static const WCHAR BUDDY_SUPERCLASS_WNDPROC[] = { 'b', 'u', 'd', 'd', 'y', 'S', 'u', 'p', 'p', 'e', 'r', - 'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 }; + 'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 }; static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action); /*********************************************************************** @@ -140,7 +141,7 @@ static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta) { /* check if we can do the modification first */ if(!UPDOWN_InBounds (infoPtr, infoPtr->CurVal+delta)) { - if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & UDS_WRAP) { + if (infoPtr->dwStyle & UDS_WRAP) { delta += (delta < 0 ? -1 : 1) * (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1) * (infoPtr->MinVal - infoPtr->MaxVal) + @@ -160,9 +161,7 @@ static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta) */ static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); - - return ( ((dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) && + return ( ((infoPtr->dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) && UPDOWN_IsBuddyEdit(infoPtr) ); } @@ -176,8 +175,6 @@ static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr) */ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); - GetClientRect (infoPtr->Self, rect); /* @@ -185,7 +182,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow) * border. */ if (UPDOWN_HasBuddyBorder(infoPtr)) { - if (dwStyle & UDS_ALIGNLEFT) + if (infoPtr->dwStyle & UDS_ALIGNLEFT) rect->left += DEFAULT_BUDDYBORDER; else rect->right -= DEFAULT_BUDDYBORDER; @@ -195,7 +192,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow) /* now figure out if we need a space away from the buddy */ if ( IsWindow(infoPtr->Buddy) ) { - if (dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER; + if (infoPtr->dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER; else rect->left += DEFAULT_BUDDYSPACER; } @@ -204,7 +201,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow) * separation between the buttons will lay. We make sure that we * round the uneven numbers by adding 1. */ - if (dwStyle & UDS_HORZ) { + if (infoPtr->dwStyle & UDS_HORZ) { int len = rect->right - rect->left + 1; /* compute the width */ if (arrow & FLAG_INCR) rect->left = rect->left + len/2; @@ -264,7 +261,7 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr) WCHAR txt[20], sep, *src, *dst; int newVal; - if (!IsWindow(infoPtr->Buddy)) + if (!((infoPtr->dwStyle & UDS_SETBUDDYINT) && IsWindow(infoPtr->Buddy))) return FALSE; /*if the buddy is a list window, we must set curr index */ @@ -273,7 +270,10 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr) if(newVal < 0) return FALSE; } else { /* we have a regular window, so will get the text */ - if (!GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt))) return FALSE; + /* note that a zero-length string is a legitimate value for 'txt', + * and ought to result in a successful conversion to '0'. */ + if (GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt)) < 0) + return FALSE; sep = UPDOWN_GetThousandSep(); @@ -306,7 +306,8 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr) WCHAR txt[20]; int len; - if (!IsWindow(infoPtr->Buddy)) return FALSE; + if (!((infoPtr->dwStyle & UDS_SETBUDDYINT) && IsWindow(infoPtr->Buddy))) + return FALSE; TRACE("set new value(%d) to buddy.\n", infoPtr->CurVal); @@ -321,7 +322,7 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr) /* Do thousands separation if necessary */ - if (!(GetWindowLongW (infoPtr->Self, GWL_STYLE) & UDS_NOTHOUSANDS) && (len > 3)) { + if (!(infoPtr->dwStyle & UDS_NOTHOUSANDS) && (len > 3)) { WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt; WCHAR sep = UPDOWN_GetThousandSep(); int start = len % 3; @@ -347,7 +348,6 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr) */ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); BOOL pressed, hot; RECT rect; @@ -356,7 +356,7 @@ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc) GetClientRect(infoPtr->Self, &rect); DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_BOTTOM | BF_TOP | - (dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); + (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); } /* Draw the incr button */ @@ -364,20 +364,20 @@ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc) pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR); hot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN); DrawFrameControl(hdc, &rect, DFC_SCROLL, - (dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | - ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | + (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | + ((infoPtr->dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | (pressed ? DFCS_PUSHED : 0) | - (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); + (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); /* Draw the decr button */ UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR); pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR); hot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN); DrawFrameControl(hdc, &rect, DFC_SCROLL, - (dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | - ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | + (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | + ((infoPtr->dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | (pressed ? DFCS_PUSHED : 0) | - (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); + (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); return 0; } @@ -455,7 +455,6 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud) { static const WCHAR editW[] = { 'E', 'd', 'i', 't', 0 }; static const WCHAR listboxW[] = { 'L', 'i', 's', 't', 'b', 'o', 'x', 0 }; - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); RECT budRect; /* new coord for the buddy */ int x, width; /* new x position and width for the up-down */ WNDPROC baseWndProc; @@ -489,7 +488,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud) infoPtr->BuddyType = BUDDY_TYPE_LISTBOX; } - if(dwStyle & UDS_ARROWKEYS){ + if(infoPtr->dwStyle & UDS_ARROWKEYS){ /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property when we reset the upDown ctrl buddy to another buddy because it is not good to break the window proc chain. */ @@ -504,10 +503,10 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud) MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Buddy), (POINT *)(&budRect.left), 2); /* now do the positioning */ - if (dwStyle & UDS_ALIGNLEFT) { + if (infoPtr->dwStyle & UDS_ALIGNLEFT) { x = budRect.left; budRect.left += DEFAULT_WIDTH + DEFAULT_XSEP; - } else if (dwStyle & UDS_ALIGNRIGHT) { + } else if (infoPtr->dwStyle & UDS_ALIGNRIGHT) { budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP; x = budRect.right+DEFAULT_XSEP; } else { @@ -531,7 +530,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud) * We nudge the control or change its size to overlap. */ if (UPDOWN_HasBuddyBorder(infoPtr)) { - if(dwStyle & UDS_ALIGNLEFT) + if(infoPtr->dwStyle & UDS_ALIGNLEFT) width += DEFAULT_BUDDYBORDER; else x -= DEFAULT_BUDDYBORDER; @@ -563,7 +562,6 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud) */ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); NM_UPDOWN ni; TRACE("%d by %d\n", action, delta); @@ -588,12 +586,12 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action) TRACE("new %d, delta: %d\n", infoPtr->CurVal, ni.iDelta); /* Now take care about our buddy */ - if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); + UPDOWN_SetBuddyInt (infoPtr); } } /* Also, notify it. This message is sent in any case. */ - SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, + SendMessageW( infoPtr->Notify, (infoPtr->dwStyle & UDS_HORZ) ? WM_HSCROLL : WM_VSCROLL, MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), (LPARAM)infoPtr->Self); } @@ -652,7 +650,6 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr) */ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT y) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); POINT pt = { x, y }; RECT rect; int temp, arrow; @@ -679,7 +676,7 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT if (infoPtr->Flags & FLAG_ARROW) { /* Update the CurVal if necessary */ - if (dwStyle & UDS_SETBUDDYINT) UPDOWN_GetBuddyInt (infoPtr); + UPDOWN_GetBuddyInt (infoPtr); /* Set up the correct flags */ infoPtr->Flags |= FLAG_PRESSED; @@ -731,7 +728,6 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); int temp; TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n", hwnd, message, wParam, lParam); @@ -742,13 +738,13 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L switch(message) { case WM_CREATE: - SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~WS_BORDER); infoPtr = (UPDOWN_INFO*)Alloc (sizeof(UPDOWN_INFO)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ infoPtr->Self = hwnd; - infoPtr->Notify = ((LPCREATESTRUCTA)lParam)->hwndParent; + infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent; + infoPtr->dwStyle = ((LPCREATESTRUCTW)lParam)->style; infoPtr->AccelCount = 0; infoPtr->AccelVect = 0; infoPtr->AccelIndex = -1; @@ -759,8 +755,10 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L infoPtr->Buddy = 0; /* No buddy window yet */ infoPtr->Flags = 0; /* And no flags */ + SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle & ~WS_BORDER); + /* Do we pick the buddy win ourselves? */ - if (dwStyle & UDS_AUTOBUDDY) + if (infoPtr->dwStyle & UDS_AUTOBUDDY) UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV)); TRACE("UpDown Ctrl creation, hwnd=%p\n", hwnd); @@ -777,10 +775,19 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L break; case WM_ENABLE: - if (dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr); + infoPtr->dwStyle &= ~WS_DISABLED; + infoPtr->dwStyle |= (wParam ? 0 : WS_DISABLED); + if (infoPtr->dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr); InvalidateRect (infoPtr->Self, NULL, FALSE); break; + case WM_STYLECHANGED: + if (wParam == GWL_STYLE) { + infoPtr->dwStyle = ((LPSTYLESTRUCT)lParam)->styleNew; + InvalidateRect (infoPtr->Self, NULL, FALSE); + } + break; + case WM_TIMER: /* is this the auto-press timer? */ if(wParam == TIMER_AUTOPRESS) { @@ -828,7 +835,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L (infoPtr->Flags & FLAG_ARROW) ) { SendMessageW( infoPtr->Notify, - dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, + (infoPtr->dwStyle & UDS_HORZ) ? WM_HSCROLL : WM_VSCROLL, MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), (LPARAM)hwnd); if (UPDOWN_IsBuddyEdit(infoPtr)) @@ -844,7 +851,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L break; case WM_KEYDOWN: - if((dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr)) + if((infoPtr->dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr)) return UPDOWN_KeyPressed(infoPtr, (int)wParam); break; @@ -910,7 +917,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L } wParam = infoPtr->CurVal; infoPtr->CurVal = temp; - if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); + UPDOWN_SetBuddyInt (infoPtr); return wParam; /* return prev value */ case UDM_GETRANGE: @@ -950,7 +957,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L } temp = infoPtr->CurVal; /* save prev value */ infoPtr->CurVal = (int)lParam; /* set the new value */ - if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); + UPDOWN_SetBuddyInt (infoPtr); return temp; /* return prev value */ case UDM_GETUNICODEFORMAT: diff --git a/reactos/lib/comdlg32/colordlg.c b/reactos/lib/comdlg32/colordlg.c index a9ff14f38ba..096e1bb9c08 100644 --- a/reactos/lib/comdlg32/colordlg.c +++ b/reactos/lib/comdlg32/colordlg.c @@ -65,7 +65,7 @@ static const COLORREF predefcolors[6][8]= /* Chose Color PRIVATE Structure: * * This structure is duplicated in the 16 bit code with - * a extra member + * an extra member */ typedef struct CCPRIVATE diff --git a/reactos/lib/comdlg32/colordlg16.c b/reactos/lib/comdlg32/colordlg16.c index fb6f17244e3..0e70485d979 100644 --- a/reactos/lib/comdlg32/colordlg16.c +++ b/reactos/lib/comdlg32/colordlg16.c @@ -46,7 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); /* Chose Color PRIVATE Structure: * * This is a duplicate of the 32bit code with - * a extra member + * an extra member */ typedef struct CCPRIVATE { diff --git a/reactos/lib/comdlg32/filedlg.c b/reactos/lib/comdlg32/filedlg.c index 926bf9c3781..41dd83ffde0 100644 --- a/reactos/lib/comdlg32/filedlg.c +++ b/reactos/lib/comdlg32/filedlg.c @@ -462,16 +462,17 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType) if(ofn->lpstrFile) { fodInfos.filename = MemAlloc(ofn->nMaxFile*sizeof(WCHAR)); - strncpyW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); + lstrcpynW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); } else fodInfos.filename = NULL; if(ofn->lpstrInitialDir) { - DWORD len = strlenW(ofn->lpstrInitialDir); - fodInfos.initdir = MemAlloc((len+1)*sizeof(WCHAR)); - strcpyW(fodInfos.initdir,ofn->lpstrInitialDir); + /* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */ + DWORD len = strlenW(ofn->lpstrInitialDir)+1; + fodInfos.initdir = MemAlloc(len*sizeof(WCHAR)); + memcpy(fodInfos.initdir,ofn->lpstrInitialDir,len*sizeof(WCHAR)); } else fodInfos.initdir = NULL; @@ -853,7 +854,7 @@ HRESULT FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID buffer) /* Prepend the current path */ n = strlenW(lpstrCurrentDir) + 1; - strncpyW( bufW, lpstrCurrentDir, size ); + memcpy( bufW, lpstrCurrentDir, min(n,size) * sizeof(WCHAR)); if(nofnInfos; - strncpyW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile); + lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile); if (ofn->Flags & OFN_ALLOWMULTISELECT) ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0'; } @@ -2064,7 +2065,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) if(fodInfos->unicode) { LPOPENFILENAMEW ofn = fodInfos->ofnInfos; - strncpyW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); + lstrcpynW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); } else { @@ -2406,7 +2407,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode) /*********************************************************************** * FILEDLG95_FILETYPE_SearchExt * - * searches for a extension in the filetype box + * searches for an extension in the filetype box */ static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPCWSTR lpstrExt) { @@ -2958,7 +2959,7 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd) /* allocate the buffer */ if (nFiles <= 1) nLength = MAX_PATH; - lpstrAllFile = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength); + lpstrAllFile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength); lpstrAllFile[0] = '\0'; /* Generate the string for the edit control */ diff --git a/reactos/lib/comdlg32/filedlgbrowser.c b/reactos/lib/comdlg32/filedlgbrowser.c index 787b52ac2ad..e4ae8bd2704 100644 --- a/reactos/lib/comdlg32/filedlgbrowser.c +++ b/reactos/lib/comdlg32/filedlgbrowser.c @@ -95,6 +95,49 @@ extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode); * Helper functions */ +#define add_flag(a) if (flags & a) {strcat(str, #a );strcat(str," ");} +static void COMDLG32_DumpSBSPFlags(UINT uflags) +{ + if (TRACE_ON(commdlg)) + { + unsigned int i; + static const struct { + DWORD mask; + const char *name; + } flags[] = { +#define FE(x) { x, #x} + /* SBSP_DEFBROWSER == 0 */ + FE(SBSP_SAMEBROWSER), + FE(SBSP_NEWBROWSER), + + /* SBSP_DEFMODE == 0 */ + FE(SBSP_OPENMODE), + FE(SBSP_EXPLOREMODE), + FE(SBSP_HELPMODE), + FE(SBSP_NOTRANSFERHIST), + + /* SBSP_ABSOLUTE == 0 */ + FE(SBSP_RELATIVE), + FE(SBSP_PARENT), + FE(SBSP_NAVIGATEBACK), + FE(SBSP_NAVIGATEFORWARD), + FE(SBSP_ALLOW_AUTONAVIGATE), + + FE(SBSP_NOAUTOSELECT), + FE(SBSP_WRITENOHISTORY), + + FE(SBSP_REDIRECT), + FE(SBSP_INITIATEDBYHLINKFRAME), + }; +#undef FE + DPRINTF("SBSP Flags: %08x =", uflags); + for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) + if (flags[i].mask & uflags) + DPRINTF("%s ", flags[i].name); + DPRINTF("\n"); + } +} + static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos *fodInfos) { char lpstrPath[MAX_PATH]; @@ -314,10 +357,8 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, IShellBrowserImpl *This = (IShellBrowserImpl *)iface; - TRACE("(%p)(pidl=%p,flags=0x%08x(%s))\n", This, pidl, wFlags, - (wFlags & SBSP_RELATIVE) ? "SBSP_RELATIVE" : - (wFlags & SBSP_PARENT) ? "SBSP_PARENT" : - (wFlags & SBSP_ABSOLUTE) ? "SBSP_ABSOLUTE" : "SBPS_????"); + TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags); + COMDLG32_DumpSBSPFlags(wFlags); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); @@ -720,7 +761,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowse fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); - /* If the selected object is not a folder, send a IDOK command to parent window */ + /* If the selected object is not a folder, send an IDOK command to parent window */ if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) { HRESULT hRes; diff --git a/reactos/lib/comdlg32/printdlg.c b/reactos/lib/comdlg32/printdlg.c index c9eb8ac5488..322b3d10135 100644 --- a/reactos/lib/comdlg32/printdlg.c +++ b/reactos/lib/comdlg32/printdlg.c @@ -86,14 +86,14 @@ static WCHAR wszFakeDocumentText[1024]; */ BOOL PRINTDLG_OpenDefaultPrinter(HANDLE *hprn) { - char buf[260]; - DWORD dwBufLen = sizeof(buf); + WCHAR buf[260]; + DWORD dwBufLen = sizeof(buf) / sizeof(buf[0]); BOOL res; - if(!GetDefaultPrinterA(buf, &dwBufLen)) + if(!GetDefaultPrinterW(buf, &dwBufLen)) return FALSE; - res = OpenPrinterA(buf, hprn, NULL); + res = OpenPrinterW(buf, hprn, NULL); if (!res) - FIXME("Could not open printer %s?!\n",buf); + WARN("Could not open printer %s\n", debugstr_w(buf)); return res; } @@ -459,7 +459,7 @@ static BOOL PRINTDLG_PaperSizeA( goto out; } - Names = (char*)HeapAlloc(GetProcessHeap(),0,NrOfEntries*64); + Names = HeapAlloc(GetProcessHeap(),0,NrOfEntries*64); if (NrOfEntries != (ret=DeviceCapabilitiesA(devname,portname,DC_PAPERNAMES,Names,dm))) { FIXME("Number of returned vals %d is not %d\n",NrOfEntries,ret); goto out; @@ -517,7 +517,7 @@ static BOOL PRINTDLG_PaperSizeW( goto out; } - Names = (WCHAR*)HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*NrOfEntries*64); + Names = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*NrOfEntries*64); if (NrOfEntries != (ret=DeviceCapabilitiesW(devname,portname,DC_PAPERNAMES,Names,dm))) { FIXME("Number of returned vals %d is not %d\n",NrOfEntries,ret); goto out; @@ -3026,6 +3026,7 @@ HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA lpPrintDlgExA) FIXME("stub\n"); return E_NOTIMPL; } + /*********************************************************************** * PrintDlgExW (COMDLG32.@) */ diff --git a/reactos/lib/comdlg32/printdlg16.c b/reactos/lib/comdlg32/printdlg16.c index ab84cc7a3bc..95af3ed63ae 100644 --- a/reactos/lib/comdlg32/printdlg16.c +++ b/reactos/lib/comdlg32/printdlg16.c @@ -427,7 +427,7 @@ BOOL16 WINAPI PrintDlg16( ptr16 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PRINT_PTRA16)); ptr16->lpPrintDlg16 = lppd; PrintStructures = &ptr16->print32; - PrintStructures->lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA)); + PrintStructures->lpPrintDlg = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA)); #define CVAL(x) PrintStructures->lpPrintDlg->x = lppd->x; #define MVAL(x) PrintStructures->lpPrintDlg->x = MapSL(lppd->x); CVAL(Flags); diff --git a/reactos/lib/cpl/access/En.rc b/reactos/lib/cpl/access/En.rc new file mode 100644 index 00000000000..09bff05da3a --- /dev/null +++ b/reactos/lib/cpl/access/En.rc @@ -0,0 +1,109 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +IDI_CPLACCESS ICON "resources/applet.ico" + + +IDD_PROPPAGEKEYBOARD DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Keyboard" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "StickyKeys",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + LTEXT "Use StickyKeys if you want to use Shift, Ctrl, or Alt key by pressing one key at at time.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + CHECKBOX "Use StickyKeys",IDC_STICKY_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + PUSHBUTTON "&Settings",IDC_STICKY_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + GROUPBOX "FilterKeys",-1,PROPSHEETPADDING,LABELLINE(8)+5,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(7)+2 + LTEXT "Use FilterKeys if you want Reactos to ignore brief or repeated keystrokes, or slow the repeat rate.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + CHECKBOX "Use FilterKeys",IDC_FILTER_BOX,(4*PROPSHEETPADDING),LABELLINE(13)+2,(15*PROPSHEETPADDING),14 + PUSHBUTTON "&Settings",IDC_FILTER_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(13)+2,(15*PROPSHEETPADDING),14 + GROUPBOX "ToggleKeys",-1,PROPSHEETPADDING,LABELLINE(16)+3,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + LTEXT "Use ToggleKeys if you want to hear tones when pressing Caps Lock, Num Lock, and Scroll Lock.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(18)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) + CHECKBOX "Use ToggleKeys",IDC_TOGGLE_BOX,(4*PROPSHEETPADDING),LABELLINE(20)+2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) + PUSHBUTTON "&Settings",IDC_TOGGLE_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(20)+2,(15*PROPSHEETPADDING),14 +// CHECKBOX "Show extra keyboard help in programs",IDC_KEYBOARD_EXTRA +END + + +IDD_PROPPAGESOUND DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Sound" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "SoundSentry",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + LTEXT "Use SoundSentry if you want Reactos to generate visual warnings when your system makes a sound.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + CHECKBOX "Use &SoundSentry",IDC_SENTRY_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + PUSHBUTTON "&Settings",IDC_SENTRY_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + + GROUPBOX "ShowSounds",-1,PROPSHEETPADDING,LABELLINE(8)+5,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(7)+2 + LTEXT "Use ShowSounds to tell your programs to display captions for the speech and sounds they make.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + CHECKBOX "Use S&howSounds",IDC_SSHOW_BOX,(4*PROPSHEETPADDING),LABELLINE(12)+2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) +END + + +IDD_PROPPAGEDISPLAY DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Display" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "High Contrast",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + LTEXT "Use this option if you want Reactos to use colors and fonts designed for easy reading.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + CHECKBOX "&Use High Contrast",IDC_CONTRAST_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + PUSHBUTTON "&Settings",IDC_CONTRAST_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 +END + + + +IDD_PROPPAGEMOUSE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Mouse" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "MouseKeys",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + LTEXT "Use this option if you want to control the pointer with the numeric keypad on your keyboard.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + CHECKBOX "Use &MouseKeys",IDC_MOUSE_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + PUSHBUTTON "&Settings",IDC_MOUSE_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 +END + + +IDD_PROPPAGEGENERAL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "General" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Automatic Reset",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) + CHECKBOX "&Turn off accessibility features after idle for:",IDC_RESET_BOX,(2*PROPSHEETPADDING),LABELLINE(2)-2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) + + //POPUP IDC_RESET_POPUP, GRAYED + //{ + // MENUITEM "5 Minutes", IDC_RESET_5 + // MENUITEM "10 Minutes", IDC_RESET_10 + // MENUITEM "15 Minutes", IDC_RESET_15 + // MENUITEM "20 Minutes", IDC_RESET_20 + // MENUITEM "25 Minutes", IDC_RESET_25 + // MENUITEM "30 Minutes", IDC_RESET_30 + //} + + GROUPBOX "Notification",-1,PROPSHEETPADDING,LABELLINE(7)-2,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) + CHECKBOX "Give warning message when turning a feature on",IDC_NOTIFICATION_MESSAGE,(2*PROPSHEETPADDING),LABELLINE(8)-2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) + CHECKBOX "Make a sound when turning a feature on or off",IDC_NOTIFICATION_SOUND,(2*PROPSHEETPADDING),LABELLINE(10)-2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) + + + GROUPBOX "SerialKey Devices",-1,PROPSHEETPADDING,LABELLINE(13)-4,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) + LTEXT "SerialKey devices allow alternative access to keyboard and mouse features.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(14)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) + CHECKBOX "Support &SerialKey devices",IDC_SERIAL_BOX,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(16)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) + + PUSHBUTTON "S&ettings",IDC_SERIAL_BUTTON,180,LABELLINE(16)-4,50,LABELLINE(1) + + GROUPBOX "Administrative options",-1,PROPSHEETPADDING,LABELLINE(19)-4,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) + + CHECKBOX "Apply all settings to l&ogon desktop",IDC_ADMIN_LOGON_BOX,(PROPSHEETPADDING*2),LABELLINE(20)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) + CHECKBOX "Apply all settings to &defaults for new users",IDC_ADMIN_USERS_BOX,(2*PROPSHEETPADDING),LABELLINE(22)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) +END + + +STRINGTABLE +BEGIN + IDS_CPLSYSTEMNAME "Accessibility" + IDS_CPLSYSTEMDESCRIPTION "Customizes accessibility features for your computer." +END + diff --git a/reactos/lib/cpl/access/access.rc b/reactos/lib/cpl/access/access.rc index dae44aee125..ededd3069ed 100644 --- a/reactos/lib/cpl/access/access.rc +++ b/reactos/lib/cpl/access/access.rc @@ -6,111 +6,4 @@ #define REACTOS_STR_INTERNAL_NAME "access\0" #define REACTOS_STR_ORIGINAL_FILENAME "access.cpl\0" #include - -LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT - -IDI_CPLACCESS ICON "resources/applet.ico" - - -IDD_PROPPAGEKEYBOARD DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Keyboard" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "StickyKeys",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING - LTEXT "Use StickyKeys if you want to use Shift, Ctrl, or Alt key by pressing one key at at time.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) - CHECKBOX "Use StickyKeys",IDC_STICKY_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 - PUSHBUTTON "&Settings",IDC_STICKY_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 - GROUPBOX "FilterKeys",-1,PROPSHEETPADDING,LABELLINE(8)+5,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(7)+2 - LTEXT "Use FilterKeys if you want Reactos to ignore brief or repeated keystrokes, or slow the repeat rate.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) - CHECKBOX "Use FilterKeys",IDC_FILTER_BOX,(4*PROPSHEETPADDING),LABELLINE(13)+2,(15*PROPSHEETPADDING),14 - PUSHBUTTON "&Settings",IDC_FILTER_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(13)+2,(15*PROPSHEETPADDING),14 - GROUPBOX "ToggleKeys",-1,PROPSHEETPADDING,LABELLINE(16)+3,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING - LTEXT "Use ToggleKeys if you want to hear tones when pressing Caps Lock, Num Lock, and Scroll Lock.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(18)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) - CHECKBOX "Use ToggleKeys",IDC_TOGGLE_BOX,(4*PROPSHEETPADDING),LABELLINE(20)+2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) - PUSHBUTTON "&Settings",IDC_TOGGLE_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(20)+2,(15*PROPSHEETPADDING),14 -// CHECKBOX "Show extra keyboard help in programs",IDC_KEYBOARD_EXTRA -END - - -IDD_PROPPAGESOUND DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Sound" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "SoundSentry",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING - LTEXT "Use SoundSentry if you want Reactos to generate visual warnings when your system makes a sound.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) - CHECKBOX "Use &SoundSentry",IDC_SENTRY_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 - PUSHBUTTON "&Settings",IDC_SENTRY_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 - - GROUPBOX "ShowSounds",-1,PROPSHEETPADDING,LABELLINE(8)+5,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(7)+2 - LTEXT "Use ShowSounds to tell your programs to display captions for the speech and sounds they make.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) - CHECKBOX "Use S&howSounds",IDC_SSHOW_BOX,(4*PROPSHEETPADDING),LABELLINE(12)+2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) -END - - -IDD_PROPPAGEDISPLAY DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Display" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "High Contrast",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING - LTEXT "Use this option if you want Reactos to use colors and fonts designed for easy reading.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) - CHECKBOX "&Use High Contrast",IDC_CONTRAST_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 - PUSHBUTTON "&Settings",IDC_CONTRAST_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 -END - - -IDD_PROPPAGEMOUSE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Mouse" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "MouseKeys",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING - LTEXT "Use this option if you want to control the pointer with the numeric keypad on your keyboard.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) - CHECKBOX "Use &MouseKeys",IDC_MOUSE_BOX,(4*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 - PUSHBUTTON "&Settings",IDC_MOUSE_BUTTON,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 -END - - -IDD_PROPPAGEGENERAL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "General" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Automatic Reset",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) - CHECKBOX "&Turn off accessibility features after idle for:",IDC_RESET_BOX,(2*PROPSHEETPADDING),LABELLINE(2)-2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) - - //POPUP IDC_RESET_POPUP, GRAYED - //{ - // MENUITEM "5 Minutes", IDC_RESET_5 - // MENUITEM "10 Minutes", IDC_RESET_10 - // MENUITEM "15 Minutes", IDC_RESET_15 - // MENUITEM "20 Minutes", IDC_RESET_20 - // MENUITEM "25 Minutes", IDC_RESET_25 - // MENUITEM "30 Minutes", IDC_RESET_30 - //} - - GROUPBOX "Notification",-1,PROPSHEETPADDING,LABELLINE(7)-2,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) - CHECKBOX "Give warning message when turning a feature on",IDC_NOTIFICATION_MESSAGE,(2*PROPSHEETPADDING),LABELLINE(8)-2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) - CHECKBOX "Make a sound when turning a feature on or off",IDC_NOTIFICATION_SOUND,(2*PROPSHEETPADDING),LABELLINE(10)-2,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) - - - GROUPBOX "SerialKey Devices",-1,PROPSHEETPADDING,LABELLINE(13)-4,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) - LTEXT "SerialKey devices allow alternative access to keyboard and mouse features.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(14)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) - CHECKBOX "Support &SerialKey devices",IDC_SERIAL_BOX,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(16)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) - - PUSHBUTTON "S&ettings",IDC_SERIAL_BUTTON,180,LABELLINE(16)-4,50,LABELLINE(1) - - GROUPBOX "Administrative options",-1,PROPSHEETPADDING,LABELLINE(19)-4,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(5) - - CHECKBOX "Apply all settings to l&ogon desktop",IDC_ADMIN_LOGON_BOX,(PROPSHEETPADDING*2),LABELLINE(20)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(2) - CHECKBOX "Apply all settings to &defaults for new users",IDC_ADMIN_USERS_BOX,(2*PROPSHEETPADDING),LABELLINE(22)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) -END - - -STRINGTABLE -BEGIN - IDS_CPLSYSTEMNAME "Accessibility" - IDS_CPLSYSTEMDESCRIPTION "Customizes accessibility features for your computer." -END +#include "En.rc" diff --git a/reactos/lib/cpl/appwiz/Cz.rc b/reactos/lib/cpl/appwiz/Cz.rc new file mode 100644 index 00000000000..eaf41514dca --- /dev/null +++ b/reactos/lib/cpl/appwiz/Cz.rc @@ -0,0 +1,50 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_PROPPAGEINSTALL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace/Odstranìní" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDI_CPLSYSTEM,-1,PROPSHEETPADDING,18,16,16 + LTEXT "Pro nainstalování nové aplikace, klepnìte na Instalovat...",-1,36,18,PROPSHEETWIDTH-48,8 + PUSHBUTTON "&Instalovat...", IDC_INSTALL, PROPSHEETWIDTH-(72), 36, 60, 14 + LTEXT "", -1, PROPSHEETPADDING, 63, PROPSHEETWIDTH-12, 1, NOT WS_GROUP | SS_SUNKEN + + ICON IDI_CPLSYSTEM,-1,PROPSHEETPADDING,76,16,16 + LTEXT "Následující aplikace mohou být automaticky odstranìny. K odstranìní aplikace nebo k nastavení jejích komponent, ji vyberte ze seznamu a klepnìte na tlaèítko Pøidat/Odebrat.",-1,36,72,PROPSHEETWIDTH-48,32 + LISTBOX IDC_SOFTWARELIST, PROPSHEETPADDING, 105, PROPSHEETWIDTH-12, 88, LBS_STANDARD | WS_TABSTOP + PUSHBUTTON "Pøidat/&Odebrat", IDC_ADDREMOVE, PROPSHEETWIDTH-72, 198, 60, 14 +END + +IDD_PROPPAGEROSSETUP DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Nastavení systému ReactOS" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + +END + +IDD_FIRSTPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Vytvoøit odkaz..." +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Text1", -1, 115, 15, 160, 24 + LTEXT "Text2", -1, 115, 35, 160, 17 +END + +IDD_SUBMIT_REPORT DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Create link" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Text1",-1,10,0,225,40 + LTEXT "Text2",-1,10,40,120,20 + LTEXT "Text3",-1,10,55,120,20 +END + +STRINGTABLE +BEGIN + IDS_CPLSYSTEMNAME "Pøidat/Odebrat aplikace" + IDS_CPLSYSTEMDESCRIPTION "Nastaví aplikace a vytvoøí ikony." +END diff --git a/reactos/lib/cpl/appwiz/appwiz.rc b/reactos/lib/cpl/appwiz/appwiz.rc index 07cdf9e049b..7250ee1d9d5 100644 --- a/reactos/lib/cpl/appwiz/appwiz.rc +++ b/reactos/lib/cpl/appwiz/appwiz.rc @@ -25,8 +25,8 @@ IDI_CPLSYSTEM ICON "resources/applet.ico" * a neutral version. This is to get localized bitmaps for example. */ +#include "Cz.rc" #include "En.rc" #include "De.rc" #include "Dk.rc" #include "Ru.rc" - diff --git a/reactos/lib/cpl/control/Cz.rc b/reactos/lib/cpl/control/Cz.rc new file mode 100644 index 00000000000..912a2053d16 --- /dev/null +++ b/reactos/lib/cpl/control/Cz.rc @@ -0,0 +1,28 @@ +// Czech language resource file (potapnik, 2005-04-30) + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDM_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "&Soubor" + BEGIN + MENUITEM "&Zavøít", IDM_CLOSE + END + POPUP "&Zobrazení" + BEGIN + MENUITEM "&Velké ikony", IDM_LARGEICONS + MENUITEM "&Malé ikony", IDM_SMALLICONS + MENUITEM "&Seznam", IDM_LIST + MENUITEM "&Detaily", IDM_DETAILS + END + POPUP "&Nápovìda" + BEGIN + MENUITEM "&O aplikaci...", IDM_ABOUT + END +END + diff --git a/reactos/lib/cpl/control/Sv.rc b/reactos/lib/cpl/control/Sv.rc new file mode 100644 index 00000000000..a9c25f4015a --- /dev/null +++ b/reactos/lib/cpl/control/Sv.rc @@ -0,0 +1,28 @@ +// Swedish resources by Andreas Bjerkeholt 2005-04-28 + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDM_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "&Arkiv" + BEGIN + MENUITEM "&Stäng", IDM_CLOSE + END + POPUP "&Visa" + BEGIN + MENUITEM "Stora ikoner", IDM_LARGEICONS + MENUITEM "Små ikoner", IDM_SMALLICONS + MENUITEM "Lista", IDM_LIST + MENUITEM "Detaljerad lista", IDM_DETAILS + END + POPUP "Hjälp" + BEGIN + MENUITEM "Om", IDM_ABOUT + END +END + diff --git a/reactos/lib/cpl/control/control.rc b/reactos/lib/cpl/control/control.rc index 2cb7fd28251..0f9872ab98b 100644 --- a/reactos/lib/cpl/control/control.rc +++ b/reactos/lib/cpl/control/control.rc @@ -35,7 +35,9 @@ IDI_MAINICON ICON DISCARDABLE "resources/config.ico" * a neutral version. This is to get localized bitmaps for example. */ +#include "Cz.rc" #include "En.rc" #include "De.rc" #include "Dk.rc" #include "Ru.rc" +#include "Sv.rc" diff --git a/reactos/lib/cpl/desk/cz.rc b/reactos/lib/cpl/desk/cz.rc new file mode 100644 index 00000000000..dacf8136c9f --- /dev/null +++ b/reactos/lib/cpl/desk/cz.rc @@ -0,0 +1,104 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_BACKGROUND DIALOGEX DISCARDABLE 0, 0, 246, 228 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Pozadí" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "",IDC_BACKGROUND_PREVIEW,"Static",SS_OWNERDRAW,48,10, + 150,105,WS_EX_STATICEDGE + CONTROL "",IDC_BACKGROUND_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | + WS_BORDER | WS_TABSTOP,7,139,173,71 + LTEXT "Vyberte obrázek, který chcete použít jako pozadí:", + IDC_STATIC,8,127,180,8 + PUSHBUTTON "&Vybrat...",IDC_BROWSE_BUTTON,187,175,50,14 + PUSHBUTTON "&Barva...",IDC_COLOR_BUTTON,187,195,50,14 + LTEXT "Umístìní:",IDC_STATIC,187,138,36,8 + COMBOBOX IDC_PLACEMENT_COMBO,187,148,50,90,CBS_DROPDOWNLIST | + CBS_SORT | WS_VSCROLL | WS_TABSTOP +END + +IDD_SCREENSAVER DIALOGEX DISCARDABLE 0, 0, 246, 228 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Spoøiè obrazovky" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "&Spoøiè obrazovky",IDC_SCREENS_DUMMY, 5, 7, 238, 176 + + LTEXT "Seznam spoøièù:",IDC_STATIC,13, 24, 71, 9 + CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | + WS_BORDER | WS_TABSTOP,13, 34, 171, 109 + PUSHBUTTON "&Odebrat",IDC_SCREENS_DELETE, 189,47,39,10 + PUSHBUTTON "&Pøidat",IDC_SCREENS_POWER_BUTTON, 190,34,39,10 + + PUSHBUTTON "&Nastavení...",IDC_SCREENS_SETTINGS,140, 164, 48, 12,WS_GROUP + PUSHBUTTON "&Ukázka",IDC_SCREENS_TESTSC,192, 164, 43, 12 + + CONTROL "Pøi obnovení požadovat &heslo.",IDC_SCREENS_USEPASSCHK,"button", + BS_AUTOCHECKBOX | WS_TABSTOP,13, 161, 119, 18 + + LTEXT "&Èekat:",IDC_STATIC,13, 150, 17, 9 + EDITTEXT IDC_SCREENS_TIMEDELAY,33, 149, 31, 12,ES_RIGHT | WS_GROUP + CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT | + UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | + WS_BORDER | WS_GROUP,52, 149, 12, 12 + LTEXT "Minut než se spustí spoøiè obrazovky.",IDC_STATIC,70, 151, 147, 9 + + GROUPBOX "Šetøení &energie monitoru",IDC_SCREENS_DUMMY,5, 186, 238, 35 + LTEXT "Pro možnosti napájení monitoru klepnìta na tlaèítko Možnosti napájení.", + IDC_STATIC,16, 199, 155, 19 + PUSHBUTTON "M&ožnosti napájení",IDC_SCREENS_POWER_BUTTON,180, 202, 57, 12 +END + +IDD_APPEARANCE DIALOGEX DISCARDABLE 0, 0, 246, 228 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Vzhled" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "This space is intentionally left blank",IDC_STATIC,66, + 110,112,8 +END + +IDD_SETTINGS DIALOGEX DISCARDABLE 0, 0, 246, 228 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Nastavení" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Displej:",1820,3,140,30,8 + LTEXT "",IDC_SETTINGS_DEVICE,9,149,224,8 + GROUPBOX "&Velikost obrazovky",1818,3,160,115,43 + CONTROL "",IDC_SETTINGS_RESOLUTION,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP, + 30,170,58,17 + LTEXT "Ménì",1815,9,170,15,8,NOT WS_GROUP + LTEXT "Více",1816,93,170,21,8,NOT WS_GROUP + LTEXT "",IDC_SETTINGS_RESOLUTION_TEXT,10,190,100,10,NOT WS_GROUP | SS_CENTER + GROUPBOX "&Poèet barev",1817,125,160,115,43 + COMBOBOX IDC_SETTINGS_BPP,131,170,103,80,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | + WS_VSCROLL | WS_TABSTOP + CONTROL "",1813,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_SUNKEN, + 131,188,103,9 + PUSHBUTTON "R&ozšíøené nastavení...",IDC_SETTINGS_ADVANCED,306,205,56,14 +END + +STRINGTABLE +BEGIN + IDS_CPLNAME "Obrazovka" + IDS_CPLDESCRIPTION "Nastavení obrazovky, spoøièe, vzhledu a rozlišení." + + IDS_NONE "(Nic)" + IDS_CENTER "Vycentrovat" + IDS_STRETCH "Roztáhnout" + IDS_TILE "Dlaždice" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_COLOR_4BIT "16 barev" + IDS_COLOR_8BIT "256 barev" + IDS_COLOR_16BIT "High Color (16 Bit)" + IDS_COLOR_32BIT "True Color (24 Bit)" + IDS_COLOR_32BIT "True Color (32 Bit)" + IDS_PIXEL "%lux%lu bodù" +END diff --git a/reactos/lib/cpl/desk/de.rc b/reactos/lib/cpl/desk/de.rc index 463795b8c93..f997bb00834 100644 --- a/reactos/lib/cpl/desk/de.rc +++ b/reactos/lib/cpl/desk/de.rc @@ -9,13 +9,13 @@ BEGIN 150,105,WS_EX_STATICEDGE CONTROL "",IDC_BACKGROUND_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | - WS_BORDER | WS_TABSTOP,7,139,170,71 + WS_BORDER | WS_TABSTOP,7,139,173,71 LTEXT "Hintergrundbild:", IDC_STATIC,8,127,180,8 - PUSHBUTTON "&Durchsuchen...",IDC_BROWSE_BUTTON,181,175,60,14 - PUSHBUTTON "&Farbe...",IDC_COLOR_BUTTON,181,195,60,14 - LTEXT "Ausrichtung:",IDC_STATIC,181,138,45,8 - COMBOBOX IDC_PLACEMENT_COMBO,181,148,60,90,CBS_DROPDOWNLIST | + PUSHBUTTON "&Durchsuchen...",IDC_BROWSE_BUTTON,186,175,56,14 + PUSHBUTTON "&Farbe...",IDC_COLOR_BUTTON,186,195,56,14 + LTEXT "Ausrichtung:",IDC_STATIC,186,138,43,8 + COMBOBOX IDC_PLACEMENT_COMBO,186,148,50,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END diff --git a/reactos/lib/cpl/desk/desk.rc b/reactos/lib/cpl/desk/desk.rc index e56a80d2f70..ebba7d0e137 100644 --- a/reactos/lib/cpl/desk/desk.rc +++ b/reactos/lib/cpl/desk/desk.rc @@ -12,6 +12,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDC_DESK_ICON ICON "resources/applet.ico" +#include "cz.rc" #include "en.rc" #include "de.rc" diff --git a/reactos/lib/cpl/desk/en.rc b/reactos/lib/cpl/desk/en.rc index 518db78e4fe..8e8c8cad024 100644 --- a/reactos/lib/cpl/desk/en.rc +++ b/reactos/lib/cpl/desk/en.rc @@ -24,8 +24,32 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Screen Saver" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "This space is intentionally left blank",IDC_STATIC,66, - 110,112,8 + GROUPBOX "&Screen Saver",IDC_SCREENS_DUMMY, 5, 7, 238, 176 + + LTEXT "List of Screensavers:",IDC_STATIC,13, 24, 71, 9 + CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | + WS_BORDER | WS_TABSTOP,13, 34, 171, 109 + PUSHBUTTON "&Delete",IDC_SCREENS_DELETE, 189,47,39,10 + PUSHBUTTON "&Add",IDC_SCREENS_POWER_BUTTON, 190,34,39,10 + + PUSHBUTTON "Se&ttings...",IDC_SCREENS_SETTINGS,140, 164, 48, 12,WS_GROUP + PUSHBUTTON "Pre&view",IDC_SCREENS_TESTSC,192, 164, 43, 12 + + CONTROL "On Resume, &Password Protect.",IDC_SCREENS_USEPASSCHK,"button", + BS_AUTOCHECKBOX | WS_TABSTOP,13, 161, 119, 18 + + LTEXT "&Wait:",IDC_STATIC,13, 150, 17, 9 + EDITTEXT IDC_SCREENS_TIMEDELAY,33, 149, 31, 12,ES_RIGHT | WS_GROUP + CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT | + UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | + WS_BORDER | WS_GROUP,52, 149, 12, 12 + LTEXT "Minutes before showing Screensaver.",IDC_STATIC,70, 151, 147, 9 + + GROUPBOX "&Energy Saving features of monitor",IDC_SCREENS_DUMMY,5, 186, 238, 35 + LTEXT "To adjust the power settings for your monitor, click on Power Settings.", + IDC_STATIC,16, 199, 155, 19 + PUSHBUTTON "P&ower Settings",IDC_SCREENS_POWER_BUTTON,180, 202, 57, 12 END IDD_APPEARANCE DIALOGEX DISCARDABLE 0, 0, 246, 228 diff --git a/reactos/lib/cpl/desk/resource.h b/reactos/lib/cpl/desk/resource.h index 01bf3b643e6..3a9f6696481 100644 --- a/reactos/lib/cpl/desk/resource.h +++ b/reactos/lib/cpl/desk/resource.h @@ -28,6 +28,18 @@ #define IDC_COLOR_BUTTON 1003 #define IDC_PLACEMENT_COMBO 1004 +/* Screensaver Page */ +#define IDC_SCREENS_CHOICES 1010 +#define IDC_SCREENS_PREVIEW 1011 +#define IDC_SCREENS_POWER_BUTTON 1012 +#define IDC_SCREENS_SETTINGS 1013 +#define IDC_SCREENS_TESTSC 1014 +#define IDC_SCREENS_USEPASSCHK 1015 +#define IDC_SCREENS_TIMEDELAY 1016 +#define IDC_SCREENS_TIME 1017 +#define IDC_SCREENS_DELETE 1018 +#define IDC_SCREENS_DUMMY 5000 + #define IDS_CPLNAME 2000 #define IDS_CPLDESCRIPTION 2001 diff --git a/reactos/lib/cpl/desk/screensaver.c b/reactos/lib/cpl/desk/screensaver.c index c80337b2145..d97a8fb8652 100644 --- a/reactos/lib/cpl/desk/screensaver.c +++ b/reactos/lib/cpl/desk/screensaver.c @@ -12,23 +12,301 @@ #include #include "resource.h" +#include +#include +#include "desk.h" -INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) +#define MAX_SCREENSAVERS 100 + +void AddListViewItems2(); +void CheckRegScreenSaverIsSecure(); + +typedef struct { + BOOL bIsScreenSaver; /* Is this background a wallpaper */ + TCHAR szFilename[MAX_PATH]; + TCHAR szDisplayName[256]; +} ScreenSaverItem; + +int ImageListSelection = 0; +ScreenSaverItem g_ScreenSaverItems[MAX_SCREENSAVERS]; + +HWND g_hScreenBackgroundPage = NULL; +HWND g_hScreengroundList = NULL; +HWND ControlScreenSaverIsSecure = NULL; + +void ListViewItemAreChanged(int itemIndex) { - switch(uMsg) - { + ScreenSaverItem *ScreenSaverItem = NULL; + + ImageListSelection = itemIndex; + ScreenSaverItem = &g_ScreenSaverItems[ImageListSelection]; + + PropSheet_Changed(GetParent(g_hScreenBackgroundPage), g_hScreenBackgroundPage); +} + +INT_PTR +CALLBACK +ScreenSaverPageProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + g_hScreenBackgroundPage = hwndDlg; + + switch(uMsg) { case WM_INITDIALOG: - { - } break; - + { + g_hScreengroundList = GetDlgItem(g_hScreenBackgroundPage, IDC_SCREENS_CHOICES); + AddListViewItems2(); + CheckRegScreenSaverIsSecure(); + } break; case WM_COMMAND: - { + { + DWORD controlId = LOWORD(wParam); + DWORD command = HIWORD(wParam); + + switch(controlId) { + case IDC_SCREENS_POWER_BUTTON: // Start Powercfg.Cpl + { + if(command == BN_CLICKED) + WinExec("rundll32 shell32.dll,Control_RunDLL powercfg.cpl,,",SW_SHOWNORMAL); + } break; + case IDC_SCREENS_TESTSC: // Screensaver Preview + { + if(command == BN_CLICKED) + MessageBox(NULL, TEXT("That button doesn't do anything yet"), TEXT("Whoops"), MB_OK); + + } break; + case IDC_SCREENS_DELETE: // Delete Screensaver + { + if(command == BN_CLICKED) { + if (ImageListSelection == 0) // Can NOT delete None sry:-) + return FALSE; + DeleteFileW(g_ScreenSaverItems[ImageListSelection].szFilename); + } + } break; + case IDC_SCREENS_SETTINGS: // Screensaver Settings + { + if(command == BN_CLICKED) + MessageBox(NULL, TEXT("That button doesn't do anything yet"), TEXT("Whoops"), MB_OK); + } break; + case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure + { + if(command == BN_CLICKED) + MessageBox(NULL, TEXT("That button doesn't do anything yet"), TEXT("Whoops"), MB_OK); + } break; + case IDC_SCREENS_TIME: // Delay before show screensaver + { + } break; + default: + break; } break; + } + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch(lpnm->code) { + case PSN_APPLY: + { + return TRUE; + } break; + case LVN_ITEMCHANGED: + { + LPNMLISTVIEW nm = (LPNMLISTVIEW)lParam; + if((nm->uNewState & LVIS_SELECTED) == 0) + return FALSE; + ListViewItemAreChanged(nm->iItem); + break; + } break; + default: + break; + } + } break; } return FALSE; } +void CheckRegScreenSaverIsSecure() +{ + HKEY hKey; + TCHAR szBuffer[2]; + DWORD bufferSize = sizeof(szBuffer); + DWORD varType = REG_SZ; + LONG result; + + ControlScreenSaverIsSecure = GetDlgItem(g_hScreenBackgroundPage, IDC_SCREENS_USEPASSCHK); + + RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, &hKey); + result = RegQueryValueEx(hKey, TEXT("ScreenSaverIsSecure"), 0, &varType, (LPBYTE)szBuffer, &bufferSize); + if(result == ERROR_SUCCESS) + if(_ttoi(szBuffer) == 1) { + SendMessage(ControlScreenSaverIsSecure, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + goto End; + } + SendMessage(ControlScreenSaverIsSecure, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); +End: + RegCloseKey(hKey); +} + +/* Add the bitmaps in the C:\ReactOS directory and the current wallpaper if any */ +void AddListViewItems2() +{ + WIN32_FIND_DATA fd; + HANDLE hFind; + TCHAR szSearchPath[MAX_PATH]; + LV_ITEM listItem; + LV_COLUMN dummy; + RECT clientRect; + HKEY regKey; + SHFILEINFO sfi; + HIMAGELIST himl; + HIMAGELIST g_hScreenShellImageList = NULL; + TCHAR wallpaperFilename[MAX_PATH]; + DWORD bufferSize = sizeof(wallpaperFilename); + DWORD varType = REG_SZ; + LONG result; + UINT i = 0; + int g_ScreenlistViewItemCount = 0; + ScreenSaverItem *ScreenSaverItem = NULL; + + GetClientRect(g_hScreengroundList, &clientRect); + + ZeroMemory(&dummy, sizeof(LV_COLUMN)); + dummy.mask = LVCF_SUBITEM | LVCF_WIDTH; + dummy.iSubItem = 0; + dummy.cx = (clientRect.right - clientRect.left) - GetSystemMetrics(SM_CXVSCROLL); + + ListView_InsertColumn(g_hScreengroundList, 0, &dummy); + + /* Add the "None" item */ + ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount]; + + ScreenSaverItem->bIsScreenSaver = FALSE; + + LoadString(hApplet, + IDS_NONE, + ScreenSaverItem->szDisplayName, + sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR)); + + ZeroMemory(&listItem, sizeof(LV_ITEM)); + listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; + listItem.state = LVIS_SELECTED; + listItem.pszText = ScreenSaverItem->szDisplayName; + listItem.iImage = -1; + listItem.iItem = g_ScreenlistViewItemCount; + listItem.lParam = g_ScreenlistViewItemCount; + + ListView_InsertItem(g_hScreengroundList, &listItem); + ListView_SetItemState(g_hScreengroundList, g_ScreenlistViewItemCount, LVIS_SELECTED, LVIS_SELECTED); + + g_ScreenlistViewItemCount++; + + /* Add current screensaver if any */ + RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, ®Key); + + result = RegQueryValueEx(regKey, TEXT("SCRNSAVE.EXE"), 0, &varType, (LPBYTE)wallpaperFilename, &bufferSize); + + if((result == ERROR_SUCCESS) && (_tcslen(wallpaperFilename) > 0)) + { + himl = (HIMAGELIST)SHGetFileInfo(wallpaperFilename, + 0, + &sfi, + sizeof(sfi), + SHGFI_SYSICONINDEX | SHGFI_SMALLICON | + SHGFI_DISPLAYNAME); + + if(himl != NULL) + { + if(i++ == 0) + { + g_hScreenShellImageList = himl; + ListView_SetImageList(g_hScreengroundList, himl, LVSIL_SMALL); + } + + ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount]; + + ScreenSaverItem->bIsScreenSaver = TRUE; + + _tcscpy(ScreenSaverItem->szDisplayName, sfi.szDisplayName); + _tcscpy(ScreenSaverItem->szFilename, wallpaperFilename); + + ZeroMemory(&listItem, sizeof(LV_ITEM)); + listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; + listItem.state = LVIS_SELECTED; + listItem.pszText = ScreenSaverItem->szDisplayName; + listItem.iImage = sfi.iIcon; + listItem.iItem = g_ScreenlistViewItemCount; + listItem.lParam = g_ScreenlistViewItemCount; + + ListView_InsertItem(g_hScreengroundList, &listItem); + ListView_SetItemState(g_hScreengroundList, g_ScreenlistViewItemCount, LVIS_SELECTED, LVIS_SELECTED); + + g_ScreenlistViewItemCount++; + } + } + + RegCloseKey(regKey); + + /* Add all the screensavers in the C:\ReactOS\System32 directory. */ + + GetSystemDirectory(szSearchPath, MAX_PATH); + _tcscat(szSearchPath, TEXT("\\*.scr")); + + hFind = FindFirstFile(szSearchPath, &fd); + while(hFind != INVALID_HANDLE_VALUE) + { + /* Don't add any hidden screensavers */ + if((fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0) + { + TCHAR filename[MAX_PATH]; + + GetSystemDirectory(filename, MAX_PATH); + + _tcscat(filename, TEXT("\\")); + _tcscat(filename, fd.cFileName); + + himl = (HIMAGELIST)SHGetFileInfo(filename, + 0, + &sfi, + sizeof(sfi), + SHGFI_SYSICONINDEX | SHGFI_SMALLICON | + SHGFI_DISPLAYNAME); + + if(himl == NULL) + { + break; + } + + if(i++ == 0) + { + g_hScreenShellImageList = himl; + ListView_SetImageList(g_hScreengroundList, himl, LVSIL_SMALL); + } + + ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount]; + + ScreenSaverItem->bIsScreenSaver = TRUE; + + _tcscpy(ScreenSaverItem->szDisplayName, sfi.szDisplayName); + _tcscpy(ScreenSaverItem->szFilename, filename); + + ZeroMemory(&listItem, sizeof(LV_ITEM)); + listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; + listItem.pszText = ScreenSaverItem->szDisplayName; + listItem.state = 0; + listItem.iImage = sfi.iIcon; + listItem.iItem = g_ScreenlistViewItemCount; + listItem.lParam = g_ScreenlistViewItemCount; + + ListView_InsertItem(g_hScreengroundList, &listItem); + + g_ScreenlistViewItemCount++; + } + + if(!FindNextFile(hFind, &fd)) + hFind = INVALID_HANDLE_VALUE; + } +} + diff --git a/reactos/lib/cpl/intl/Sv.rc b/reactos/lib/cpl/intl/Sv.rc new file mode 100644 index 00000000000..2c0a9e5c4d5 --- /dev/null +++ b/reactos/lib/cpl/intl/Sv.rc @@ -0,0 +1,67 @@ +/* $Id: intl.rc 12852 2005-01-06 13:58:04Z mf $ */ +/* Swedish resources by Andreas Bjerkeholt (harteex@gmail.com) */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +IDD_GENERALPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Generellt" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 1",-1,73,74,90,8 +END + + +IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Tal" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 2",-1,73,74,90,8 +END + + +IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Valuta" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 3",-1,73,74,90,8 +END + + +IDD_TIMEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Tid" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 4",-1,73,74,90,8 +END + + +IDD_DATEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Datum" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 5",-1,73,74,90,8 +END + + +IDD_LOCALEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Inmatningsspråk" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Primärt språk", -1, 8, 11, 228, 74 + ICON IDC_FLAGS, IDC_ICON1, 12, 26, 21, 20, SS_ICON + LTEXT "Välj det språk och den region du vill använda:", -1, 38, 25, 193, 22 + COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP +END + + +STRINGTABLE +BEGIN + IDS_CPLNAME "Nationella inställningar" + IDS_CPLDESCRIPTION "Välj språk och format på tal, valuta, tid och datum." +END diff --git a/reactos/lib/cpl/intl/cz.rc b/reactos/lib/cpl/intl/cz.rc new file mode 100644 index 00000000000..54b028d294d --- /dev/null +++ b/reactos/lib/cpl/intl/cz.rc @@ -0,0 +1,84 @@ +/* $Id: intl.rc 12852 2005-01-06 13:58:04Z mf $ */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_GENERALPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Obecné nastavení" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 1",-1,73,74,90,8 +END + + +IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Èísla" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 2",-1,73,74,90,8 +END + + +IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Mìna" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 3",-1,73,74,90,8 +END + + +IDD_TIMEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Èas" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Ukázka", -1, 7, 7, 228, 33, WS_CHILD | WS_VISIBLE + LTEXT "Èas:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Formát èasu:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEFORMAT, 68, 50, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Oddìlovaè:", -1, 13, 70, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMESEPARATOR, 68, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Zkratka dopoledne:", -1, 13, 88, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEAMSYMBOL, 68, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Zkratka odpoledne:", -1, 13, 106, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEPMSYMBOL, 68, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "", -1, 7, 132, 228, 88, WS_VISIBLE + LTEXT "Zápis formátu èasu\n\n" + "h = hodina m = minuta s = vteøina t = dop. nebo odp.\n\n" + "h = 12-ti hodinový cyklus\n" + "H = 24-ti godinový cyklus\n\n" + "hh, mm, ss = poèáteèní nula\n" + "h, m, s = bez poèáteèní nuly", + -1, 13, 141, 214, 74, WS_CHILD |WS_VISIBLE | WS_GROUP +END + + +IDD_DATEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Datum" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 5",-1,73,74,90,8 +END + + +IDD_LOCALEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Jazyky" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Výchozí jazyk", -1, 8, 11, 228, 74 + ICON IDC_FLAGS, IDC_ICON1, 12, 26, 21, 20, SS_ICON + LTEXT "Vyberte jazyk, ve kterém bude systém zobrazovat dialogy a hlášení:", -1, 38, 25, 193, 22 + COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP +END + + +STRINGTABLE +BEGIN + IDS_CPLNAME "Regionální nastavení" + IDS_CPLDESCRIPTION "Nastavení jazyku a formátu data, èasu a mìny." +END diff --git a/reactos/lib/cpl/intl/de.rc b/reactos/lib/cpl/intl/de.rc index 5168f02f154..4a1c8840def 100644 --- a/reactos/lib/cpl/intl/de.rc +++ b/reactos/lib/cpl/intl/de.rc @@ -34,7 +34,25 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Uhrzeit" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Property Page 4",-1,73,74,90,8 + GROUPBOX "Darstellung", -1, 7, 7, 228, 33, WS_CHILD | WS_VISIBLE + LTEXT "Beispiel:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Zeitformat:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEFORMAT, 68, 50, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "&Trennzeichen:", -1, 13, 70, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMESEPARATOR, 68, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Symbol für &Vormittag:", -1, 13, 88, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEAMSYMBOL, 68, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Symbol für &Nachmittag:", -1, 13, 106, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEPMSYMBOL, 68, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "", -1, 7, 132, 228, 88, WS_VISIBLE + LTEXT "Zeitformat\n\n" + "h = Stunde m = Minute s = Sekunde t = Vor-/Nachmittag\n\n" + "h = 12 Stunden\n" + "H = 24 Stunden\n\n" + "hh, mm, ss = führende Null\n" + "h, m, s = keine führende Null", + -1, 13, 141, 214, 74, WS_CHILD |WS_VISIBLE | WS_GROUP END @@ -55,7 +73,7 @@ BEGIN GROUPBOX "Standardsprache", -1, 8, 11, 228, 74 ICON IDC_FLAGS, IDC_ICON1, 12, 26, 21, 20, SS_ICON LTEXT "Wählen Sie eine Sprache und Region aus welche Sie benutzen wollen:", -1, 38, 25, 193, 22 - COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP + COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP END diff --git a/reactos/lib/cpl/intl/en.rc b/reactos/lib/cpl/intl/en.rc index fd579b63ab3..5a48de3ed69 100644 --- a/reactos/lib/cpl/intl/en.rc +++ b/reactos/lib/cpl/intl/en.rc @@ -34,7 +34,25 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Time" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Property Page 4",-1,73,74,90,8 + GROUPBOX "Appearance sample", -1, 7, 7, 228, 33, WS_CHILD | WS_VISIBLE + LTEXT "Time sample:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Time format:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEFORMAT, 68, 50, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Time &separator:", -1, 13, 70, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMESEPARATOR, 68, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "A&M symbol:", -1, 13, 88, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEAMSYMBOL, 68, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "&PM symbol:", -1, 13, 106, 54, 10, WS_VISIBLE | WS_GROUP + COMBOBOX IDC_TIMEPMSYMBOL, 68, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "", -1, 7, 132, 228, 88, WS_VISIBLE + LTEXT "Time format notation\n\n" + "h = hour m = minute s = second t = am or pm\n\n" + "h = 12 hour\n" + "H = 24 hour\n\n" + "hh, mm, ss = leading zero\n" + "h, m, s = no leading zero", + -1, 13, 141, 214, 74, WS_CHILD |WS_VISIBLE | WS_GROUP END @@ -52,10 +70,10 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Input Locale" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Primary language", -1, 8, 11, 228, 74 + GROUPBOX "Primary language", -1, 8, 11, 228, 74 ICON IDC_FLAGS, IDC_ICON1, 12, 26, 21, 20, SS_ICON LTEXT "Select the primary language and region you want to use:", -1, 38, 25, 193, 22 - COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP + COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP END diff --git a/reactos/lib/cpl/intl/intl.rc b/reactos/lib/cpl/intl/intl.rc index 6fe063b6395..c10d86e1a1c 100644 --- a/reactos/lib/cpl/intl/intl.rc +++ b/reactos/lib/cpl/intl/intl.rc @@ -21,6 +21,9 @@ IDC_FLAGS ICON "resources/flags.ico" * a neutral version. This is to get localized bitmaps for example. */ +#include "cz.rc" #include "en.rc" #include "de.rc" +#include "sv.rc" + diff --git a/reactos/lib/cpl/intl/intl.xml b/reactos/lib/cpl/intl/intl.xml index cc89345b84c..2ffa77ee084 100644 --- a/reactos/lib/cpl/intl/intl.xml +++ b/reactos/lib/cpl/intl/intl.xml @@ -1,4 +1,4 @@ - + . diff --git a/reactos/lib/cpl/intl/locale.c b/reactos/lib/cpl/intl/locale.c index 86eecea69bb..46118eab6b3 100644 --- a/reactos/lib/cpl/intl/locale.c +++ b/reactos/lib/cpl/intl/locale.c @@ -23,234 +23,69 @@ * PURPOSE: Locale property page * PROGRAMMER: Eric Kohl * Klemens Friedl + * Aleksey Bragin */ +#define WINVER 0x0501 + #include #include #include +#include + #include "intl.h" #include "resource.h" +HWND hList; -// FIXME: -// * change registry function (-> "HKCR\MIME\Database\Rfc1766") - - - -typedef struct _TZ_INFO +BOOL CALLBACK LocalesEnumProc( + LPTSTR lpLocale // locale id +) { - LONG Bias; - LONG StandardBias; - LONG DaylightBias; - SYSTEMTIME StandardDate; - SYSTEMTIME DaylightDate; -} TZ_INFO, *PTZ_INFO; + LCID lcid; + TCHAR lang[255]; + int index; -typedef struct _TIMEZONE_ENTRY -{ - struct _TIMEZONE_ENTRY *Prev; - struct _TIMEZONE_ENTRY *Next; - WCHAR Description[64]; /* 'Display' */ - WCHAR StandardName[32]; /* 'Std' */ - WCHAR DaylightName[32]; /* 'Dlt' */ - TZ_INFO TimezoneInfo; /* 'TZI' */ - ULONG Index; /* 'Index' */ -} TIMEZONE_ENTRY, *PTIMEZONE_ENTRY; + //swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul? + lcid = wcstoul(lpLocale, NULL, 16); + GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)); + index = SendMessageW(hList, + CB_ADDSTRING, + 0, + (LPARAM)lang); -PTIMEZONE_ENTRY TimeZoneListHead = NULL; -PTIMEZONE_ENTRY TimeZoneListTail = NULL; + SendMessageW(hList, + CB_SETITEMDATA, + index, + (LPARAM)lcid); - - - -static PTIMEZONE_ENTRY -GetLargerTimeZoneEntry(DWORD Index) -{ - PTIMEZONE_ENTRY Entry; - - Entry = TimeZoneListHead; - while (Entry != NULL) - { - if (Entry->Index >= Index) - return Entry; - - Entry = Entry->Next; - } - - return NULL; + return TRUE; } static VOID -CreateTimeZoneList(VOID) +CreateLanguagesList(HWND hwnd) { + TCHAR langSel[255]; - WCHAR szKeyName[256]; - DWORD dwIndex; - DWORD dwNameSize; - DWORD dwValueSize; - LONG lError; - HKEY hZonesKey; - HKEY hZoneKey; - - PTIMEZONE_ENTRY Entry; - PTIMEZONE_ENTRY Current; - - - - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, - L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", - 0, - KEY_ALL_ACCESS, - &hZonesKey)) - return; - - dwIndex = 0; - while (TRUE) - { - dwNameSize = 256; - lError = RegEnumKeyExW(hZonesKey, - dwIndex, - szKeyName, - &dwNameSize, - NULL, - NULL, - NULL, - NULL); - if (lError != ERROR_SUCCESS && lError != ERROR_MORE_DATA) - break; - - - if (RegOpenKeyExW(hZonesKey, - szKeyName, - 0, - KEY_ALL_ACCESS, - &hZoneKey)) - break; - - - Entry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TIMEZONE_ENTRY)); - if (Entry == NULL) - { - RegCloseKey(hZonesKey); - break; - } - - dwValueSize = 64 * sizeof(WCHAR); - if (RegQueryValueExW(hZonesKey, - L"Display", - NULL, - NULL, - (LPBYTE)&Entry->Description, - &dwValueSize)) - { - RegCloseKey(hZonesKey); - break; - } - - dwValueSize = 32 * sizeof(WCHAR); - if (RegQueryValueExW(hZonesKey, - L"Std", - NULL, - NULL, - (LPBYTE)&Entry->StandardName, - &dwValueSize)) - { - RegCloseKey(hZonesKey); - break; - } - - dwValueSize = 32 * sizeof(WCHAR); - if (RegQueryValueExW(hZonesKey, - L"Dlt", - NULL, - NULL, - (LPBYTE)&Entry->DaylightName, - &dwValueSize)) - { - RegCloseKey(hZonesKey); - break; - } - - dwValueSize = sizeof(DWORD); - if (RegQueryValueExW(hZonesKey, - L"Index", - NULL, - NULL, - (LPBYTE)&Entry->Index, - &dwValueSize)) - { - RegCloseKey(hZonesKey); - break; - } - - dwValueSize = sizeof(TZ_INFO); - if (RegQueryValueExW(hZonesKey, - L"TZI", - NULL, - NULL, - (LPBYTE)&Entry->TimezoneInfo, - &dwValueSize)) - { - RegCloseKey(hZonesKey); - break; - } - - RegCloseKey(hZoneKey); - - if (TimeZoneListHead == NULL && - TimeZoneListTail == NULL) - { - Entry->Prev = NULL; - Entry->Next = NULL; - TimeZoneListHead = Entry; - TimeZoneListTail = Entry; - } - else - { - Current = GetLargerTimeZoneEntry(Entry->Index); - if (Current != NULL) - { - if (Current == TimeZoneListHead) - { - /* Prepend to head */ - Entry->Prev = NULL; - Entry->Next = TimeZoneListHead; - TimeZoneListHead->Prev = Entry; - TimeZoneListHead = Entry; - } - else - { - /* Insert before current */ - Entry->Prev = Current->Prev; - Entry->Next = Current; - Current->Prev->Next = Entry; - Current->Prev = Entry; - } - } - else - { - /* Append to tail */ - Entry->Prev = TimeZoneListTail; - Entry->Next = NULL; - TimeZoneListTail->Next = Entry; - TimeZoneListTail = Entry; - } - } - - dwIndex++; - } - - RegCloseKey(hZonesKey); + hList = hwnd; + EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED); + // Select current locale + GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user? + + SendMessageW(hList, + CB_SELECTSTRING, + -1, + (LPARAM)langSel); } - +/* static VOID -ShowTimeZoneList(HWND hwnd) +ShowLanguagesList(HWND hwnd) { TIME_ZONE_INFORMATION TimeZoneInfo; PTIMEZONE_ENTRY Entry; @@ -281,9 +116,7 @@ ShowTimeZoneList(HWND hwnd) (WPARAM)dwIndex, 0); } - - - +*/ /* Property page dialog callback */ INT_PTR CALLBACK @@ -292,16 +125,59 @@ LocalePageProc(HWND hwndDlg, WPARAM wParam, LPARAM lParam) { - switch(uMsg) - { - case WM_INITDIALOG: + switch(uMsg) + { + case WM_INITDIALOG: + CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST)); + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_LANGUAGELIST: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + } + break; - CreateTimeZoneList(); - ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST)); + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + if (lpnm->code == PSN_APPLY) + { + // Apply changes + LCID NewLcid; + int iCurSel; + char tmp[100]; - break; - } - return FALSE; + // Acquire new value + iCurSel = SendMessageW(hList, + CB_GETCURSEL, + 0, + 0); + if (iCurSel == CB_ERR) + break; + + NewLcid = SendMessageW(hList, + CB_GETITEMDATA, + iCurSel, + 0); + + if (NewLcid == CB_ERR) + break; + + + //TOOD: Actually set new locale + + sprintf(tmp, "%lx, cursel=%d", NewLcid, iCurSel); + MessageBoxA(hwndDlg, tmp, "debug", MB_OK); + } + } + break; + } + return FALSE; } diff --git a/reactos/lib/cpl/intl/resource.h b/reactos/lib/cpl/intl/resource.h index e54eac92ee8..503929dbf1a 100644 --- a/reactos/lib/cpl/intl/resource.h +++ b/reactos/lib/cpl/intl/resource.h @@ -3,16 +3,23 @@ #define IDC_CPLICON 1 -#define IDC_FLAGS 2 -#define IDC_ICON1 3 +#define IDC_FLAGS 2 +#define IDC_ICON1 3 #define IDD_GENERALPAGE 100 #define IDD_NUMBERSPAGE 101 #define IDD_CURRENCYPAGE 102 + #define IDD_TIMEPAGE 103 +#define IDC_TIMESAMPLE 107 +#define IDC_TIMEFORMAT 108 +#define IDC_TIMESEPARATOR 109 +#define IDC_TIMEAMSYMBOL 110 +#define IDC_TIMEPMSYMBOL 111 + #define IDD_DATEPAGE 104 #define IDD_LOCALEPAGE 105 -#define IDC_LANGUAGELIST 106 +#define IDC_LANGUAGELIST 106 #define IDS_CPLNAME 1000 #define IDS_CPLDESCRIPTION 1001 diff --git a/reactos/lib/cpl/intl/time.c b/reactos/lib/cpl/intl/time.c index ed4472e52fe..7a41b2f082b 100644 --- a/reactos/lib/cpl/intl/time.c +++ b/reactos/lib/cpl/intl/time.c @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id$ - * +/* * PROJECT: ReactOS International Control Panel * FILE: lib/cpl/intl/time.c * PURPOSE: Time property page @@ -31,19 +30,187 @@ #include "intl.h" #include "resource.h" +/* + * TODO: + * - Enumerate available time formats (use EnumTimeformatsW) + */ + +static VOID +UpdateTimeSample(HWND hWnd) +{ + WCHAR InBuffer[80]; + WCHAR OutBuffer[80]; + + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80); + + GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80); + + SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer); +} + /* Property page dialog callback */ INT_PTR CALLBACK TimePageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: + { + WCHAR Buffer[80]; + int nLen; + + /* Update the time format sample */ + UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE)); + + /* Get the time format (max. 80 characters) */ + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + CB_LIMITTEXT, 80, 0); + + /* FIXME: add available time formats to the list */ + + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80); + SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + CB_SETCURSEL, + 0, /* index */ + 0); + + /* Get the time separator (max. 4 characters) */ + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + CB_LIMITTEXT, 4, 0); + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80); + SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + CB_SETCURSEL, + 0, /* index */ + 0); + + /* Get the AM symbol (max. 9 characters) */ + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_LIMITTEXT, 9, 0); + nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80); + SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); + if (nLen != 0) + { + SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)L""); + } + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_SETCURSEL, + 0, /* index */ + 0); + + /* Get the PM symbol (max. 9 characters) */ + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_LIMITTEXT, 9, 0); + nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80); + SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); + if (nLen != 0) + { + SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)L""); + } + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_SETCURSEL, + 0, /* index */ + 0); + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_TIMEFORMAT: + case IDC_TIMESEPARATOR: + case IDC_TIMEAMSYMBOL: + case IDC_TIMEPMSYMBOL: + if (HIWORD(wParam) == CBN_SELCHANGE || + HIWORD(wParam) == CBN_EDITCHANGE) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + } + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + if (lpnm->code == PSN_APPLY) + { + WCHAR Buffer[80]; + int nIndex; + + /* Set time format */ + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + CB_GETCURSEL, 0, 0); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); + SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer); + + /* Set time separator */ + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + CB_GETCURSEL, 0, 0); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); + SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer); + + /* Set the AM symbol */ + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_GETCURSEL, 0, 0); + if (nIndex != CB_ERR) + { + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); + SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer); + } + else + { + SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, L""); + } + + /* Set the PM symbol */ + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_GETCURSEL, 0, 0); + if (nIndex != CB_ERR) + { + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); + SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer); + } + else + { + SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, L""); + } + + /* Update the time format sample */ + UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE)); + } + } break; } + return FALSE; } diff --git a/reactos/lib/cpl/main/En.rc b/reactos/lib/cpl/main/En.rc new file mode 100644 index 00000000000..7b8d4fd8f6f --- /dev/null +++ b/reactos/lib/cpl/main/En.rc @@ -0,0 +1,33 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +IDD_PROPPAGE1 DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Property Page 1" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 1",-1,73,74,90,8 +END + +IDD_PROPPAGE2 DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Property Page 2" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 2",-1,73,74,90,8 +END + +IDD_PROPPAGE3 DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Property Page 3" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 3",-1,73,74,90,8 +END + +STRINGTABLE +BEGIN + IDS_CPLNAME_1 "Mouse" + IDS_CPLDESCRIPTION_1 "Changes mouse settings." + IDS_CPLNAME_2 "Keyboard" + IDS_CPLDESCRIPTION_2 "Changes keyboard settings." +END diff --git a/reactos/lib/cpl/main/main.rc b/reactos/lib/cpl/main/main.rc index 20639f90b0d..92c2f20fe2d 100644 --- a/reactos/lib/cpl/main/main.rc +++ b/reactos/lib/cpl/main/main.rc @@ -13,37 +13,5 @@ IDC_CPLICON_1 ICON "resources/mouse.ico" IDC_CPLICON_2 ICON "resources/keyboard.ico" +#include "En.rc" -LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT - -IDD_PROPPAGE1 DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Property Page 1" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 1",-1,73,74,90,8 -END - -IDD_PROPPAGE2 DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Property Page 2" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 2",-1,73,74,90,8 -END - -IDD_PROPPAGE3 DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Property Page 3" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 3",-1,73,74,90,8 -END - -STRINGTABLE -BEGIN - IDS_CPLNAME_1 "Mouse" - IDS_CPLDESCRIPTION_1 "Changes mouse settings." - IDS_CPLNAME_2 "Keyboard" - IDS_CPLDESCRIPTION_2 "Changes keyboard settings." -END diff --git a/reactos/lib/cpl/ncpa/cz.rc b/reactos/lib/cpl/ncpa/cz.rc new file mode 100644 index 00000000000..7d3397cb8a0 --- /dev/null +++ b/reactos/lib/cpl/ncpa/cz.rc @@ -0,0 +1,87 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_PROPPAGENETWORK DIALOG DISCARDABLE 0, 0, 246, 228 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Sí" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Síové adaptéry",-1,9,9,217,8 + LISTBOX IDC_NETCARDLIST,9,21,229,73,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Pøidat",IDC_ADD,9,100,60,14 + PUSHBUTTON "&Odebrat",IDC_REMOVE,72,100,60,14 + PUSHBUTTON "&Vlastnosti",IDC_PROPERTIES,179,100,60,14 +END + +IDD_NETPROPERTIES DIALOG DISCARDABLE 0, 0, 246, 228 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Obecné nastavení" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Pøipojit prostøednictvím:", -1, 9,9,217,8 + EDITTEXT IDC_NETCARDNAME, 9, 21, 230, 12, WS_DISABLED | WS_BORDER | WS_TABSTOP + PUSHBUTTON "&Nastavit", IDC_CONFIGURE, 189, 38, 50, 14 + LTEXT "Vybrané komponenty jsou používány tímto pøipojením:", -1, 9, 59, 217, 8 + LISTBOX IDC_COMPONENTSLIST, 9, 71, 230, 67, LBS_STANDARD + PUSHBUTTON "&Instalovat", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Odstranit", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Vlastnosti", IDC_PROPERTIES, 174, 130, 65, 14 + GROUPBOX "Popis", -1, 9, 153, 230, 46, BS_GROUPBOX + LTEXT "Tak tady bude popis komponenty...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP + CHECKBOX "Po pøipojení zobrazit ikonu na hlavním panelu", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP +END + + +IDD_CARDPROPERTIES DIALOG DISCARDABLE 0, 0, 200,180 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Obecné nastavení" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Spojení", -1, 9, 8, 182, 58, BS_GROUPBOX + LTEXT "Status:", -1, 19, 20, 60, 8 + LTEXT "Doba pøipojení:", -1, 19, 34, 60, 8 + LTEXT "Rychlost:", -1, 19, 48, 60, 8 + GROUPBOX "Aktivita", -1, 9, 74, 182, 70, BS_GROUPBOX + RTEXT "Odesláno", -1, 26, 90, 60, 8 + ICON IDI_HORIZONTAL, -1, 90, 85, 18, 20 + ICON IDI_NETSTAT, -1, 110, 85, 18, 20 + ICON IDI_HORIZONTAL, -1, 130, 85, 18, 20 + LTEXT "Pøijato", -1, 149, 90, 37, 8 + LTEXT "Paketù:", -1, 17, 115, 32, 8 + RTEXT "000.000.000", IDC_SEND, 63, 115, 44, 8 + ICON IDI_VERTICAL, -1, 110, 108, 18, 20 + RTEXT "000.000.000", IDC_RECEIVED, 139, 115, 44, 8 + PUSHBUTTON "&Vlastnosti", IDC_PROPERTIES, 10, 150, 50, 14 + PUSHBUTTON "&Zakázat", IDC_ENDISABLE, 66, 150, 50, 14 +END + +IDD_TCPIPPROPERTIES DIALOG DISCARDABLE 0, 0, 246, 228 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Obecné nastavení" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Konfigurace IP adres mùže probìhnout automaticky, pokud to Vaše sí dovoluje. V opaèném pøípadì kontaktujte správce sítì pro správné nastavení.", -1, 9, 9, 228, 27 + CONTROL "Získat IP adresu automaticky", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP, 14, 43, 210, 12 + GROUPBOX "", -1, 9, 61, 228, 70, BS_GROUPBOX + CONTROL "&Použít následující IP adresu:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 105, 12 + LTEXT "IP adresa:", -1, 14, 75, 135, 8 + CONTROL "",IDC_IPADDR,"SysIPAddress32",0,150,75-2,80,12 + LTEXT "Maska podsítì:", -1, 14, 90, 135, 8 + CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",0,150,90-2,80,12 + LTEXT "Výchozí brána:", -1, 14, 105, 135, 8 + CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",0,150,105-2,80,12 + CONTROL "Získat adresy DNS serverù automaticky", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP, 14, 139, 210, 12 + GROUPBOX "", -1, 9, 157, 228, 47, BS_GROUPBOX + CONTROL "&Použít následující adresy DNS serverù", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 142, 12 + LTEXT "Upøednostòovaný DNS server:", -1, 14, 171, 135, 8 + CONTROL "",IDC_DNS1,"SysIPAddress32",0,150,171-2,80,12 + LTEXT "Záložní DNS server:", -1, 14, 186, 135, 8 + CONTROL "",IDC_DNS2,"SysIPAddress32",0,150,186-2,80,12 + PUSHBUTTON "&Rozšíøené", IDC_ADVANCED, 186, 209, 50, 14, WS_DISABLED | WS_TABSTOP +} + + +STRINGTABLE +BEGIN + IDS_CPLSYSTEMNAME "Síová nastavení" + IDS_CPLSYSTEMDESCRIPTION "Konigurace síových adaptérù a pøipojení" +END diff --git a/reactos/lib/cpl/ncpa/ncpa.rc b/reactos/lib/cpl/ncpa/ncpa.rc index 28c8de5480d..83634197f33 100644 --- a/reactos/lib/cpl/ncpa/ncpa.rc +++ b/reactos/lib/cpl/ncpa/ncpa.rc @@ -22,6 +22,8 @@ IDI_HORIZONTAL ICON "resources/HORIZ.ICO" IDI_VERTICAL ICON "resources/VERTIC.ICO" IDI_NETSTAT ICON "resources/NETCONN.ICO" +#include "cz.rc" #include "en.rc" #include "de.rc" #include "dk.rc" +#include "sv.rc" diff --git a/reactos/lib/cpl/ncpa/sv.rc b/reactos/lib/cpl/ncpa/sv.rc new file mode 100644 index 00000000000..6c456f2f337 --- /dev/null +++ b/reactos/lib/cpl/ncpa/sv.rc @@ -0,0 +1,89 @@ +/* Swedish resources by Kris "Wacko" Engeman */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +IDD_PROPPAGENETWORK DIALOG DISCARDABLE 0, 0, 246, 228 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Nätverksanslutningar" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Nätverksanslutningar",-1,9,9,217,8 + LISTBOX IDC_NETCARDLIST,9,21,229,73,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Lägg till",IDC_ADD,9,100,60,14 + PUSHBUTTON "&Ta bort",IDC_REMOVE,72,100,60,14 + PUSHBUTTON "&Egenskaper",IDC_PROPERTIES,179,100,60,14 +END + +IDD_NETPROPERTIES DIALOG DISCARDABLE 0, 0, 246, 228 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Allmänt" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Anslut med:", -1, 9,9,217,8 + EDITTEXT IDC_NETCARDNAME, 9, 21, 230, 12, WS_DISABLED | WS_BORDER | WS_TABSTOP + PUSHBUTTON "&Konfigurera", IDC_CONFIGURE, 189, 38, 50, 14 + LTEXT "Markerade komponenter används av denna anslutning:", -1, 9, 59, 217, 8 + LISTBOX IDC_COMPONENTSLIST, 9, 71, 230, 67, LBS_STANDARD + PUSHBUTTON "&Installera", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Avinstallera", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Egenskaper", IDC_PROPERTIES, 174, 130, 65, 14 + GROUPBOX "Beskrivning", -1, 9, 153, 230, 46, BS_GROUPBOX + LTEXT "Komponentens beskrivning visas här...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP + CHECKBOX "Visa ikon i meddelandefältet när jag är ansluten", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP +END + + +IDD_CARDPROPERTIES DIALOG DISCARDABLE 0, 0, 200,180 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Allmänt" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Anslutning", -1, 9, 8, 182, 58, BS_GROUPBOX + LTEXT "Status:", -1, 19, 20, 60, 8 + LTEXT "Varaktighet:", -1, 19, 34, 60, 8 + LTEXT "Hastighet:", -1, 19, 48, 60, 8 + GROUPBOX "Aktivitet", -1, 9, 74, 182, 70, BS_GROUPBOX + RTEXT "Skickat", -1, 26, 90, 60, 8 + ICON IDI_HORIZONTAL, -1, 90, 85, 18, 20 + ICON IDI_NETSTAT, -1, 110, 85, 18, 20 + ICON IDI_HORIZONTAL, -1, 130, 85, 18, 20 + LTEXT "Mottaget", -1, 149, 90, 37, 8 + LTEXT "Paket:", -1, 17, 115, 32, 8 + RTEXT "000.000.000", IDC_SEND, 63, 115, 44, 8 + ICON IDI_VERTICAL, -1, 110, 108, 18, 20 + RTEXT "000.000.000", IDC_RECEIVED, 139, 115, 44, 8 + PUSHBUTTON "&Egenskaper", IDC_PROPERTIES, 10, 150, 50, 14 + PUSHBUTTON "&Inaktivera", IDC_ENDISABLE, 66, 150, 50, 14 +END + +IDD_TCPIPPROPERTIES DIALOG DISCARDABLE 0, 0, 246, 228 +STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Allmänt" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Du kan erhålla en IP-adress automatiskt om ditt nätverk stödjer detta. Annars måste du kontakta nätverksadministratören för att få de korrekta inställningarna.", -1, 9, 9, 228, 27 + CONTROL "Erhåll en IP-adress automatiskt", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP, 14, 43, 210, 12 + GROUPBOX "", -1, 9, 61, 228, 70, BS_GROUPBOX + CONTROL "&Använd följande IP-adress:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 105, 12 + LTEXT "IP-adress:", -1, 14, 75, 135, 8 + CONTROL "",IDC_IPADDR,"SysIPAddress32",0,150,75-2,80,12 + LTEXT "Nätmask:", -1, 14, 90, 135, 8 + CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",0,150,90-2,80,12 + LTEXT "Standard-gateway:", -1, 14, 105, 135, 8 + CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",0,150,105-2,80,12 + CONTROL "Erhåll adress till DNS-server automatiskt", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP, 14, 139, 210, 12 + GROUPBOX "", -1, 9, 157, 228, 47, BS_GROUPBOX + CONTROL "&Använd följande adress till DNS-server:", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 142, 12 + LTEXT "Önskad DNS-server:", -1, 14, 171, 135, 8 + CONTROL "",IDC_DNS1,"SysIPAddress32",0,150,171-2,80,12 + LTEXT "Alternativ DNS-server:", -1, 14, 186, 135, 8 + CONTROL "",IDC_DNS2,"SysIPAddress32",0,150,186-2,80,12 + PUSHBUTTON "&Avancerat", IDC_ADVANCED, 186, 209, 50, 14, WS_DISABLED | WS_TABSTOP +} + + +STRINGTABLE +BEGIN + IDS_CPLSYSTEMNAME "Nätverksanslutningar" + IDS_CPLSYSTEMDESCRIPTION "Konfigurerar nätverksinställningar." +END diff --git a/reactos/lib/cpl/sysdm/cz.rc b/reactos/lib/cpl/sysdm/cz.rc new file mode 100644 index 00000000000..92fa65860a8 --- /dev/null +++ b/reactos/lib/cpl/sysdm/cz.rc @@ -0,0 +1,139 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +RC_LICENSE RTDATA "resources/gpl.txt" + +IDD_PROPPAGEGENERAL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Obecné informace" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Operaèní systém",-1,SYSTEM_COLUMN,LABELLINE(2),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT REACTOS_STR_PRODUCT_NAME,-1,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(3),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "Verze " REACTOS_STR_PRODUCT_VERSION,-1,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(4),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + + LTEXT "Poèítaè",-1,SYSTEM_COLUMN,LABELLINE(6),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_PROCESSORMANUFACTURER,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(7),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_PROCESSOR,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(8),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_PROCESSORSPEED,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(9),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_SYSTEMMEMORY,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(10),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + + EDITTEXT IDC_LICENSEMEMO,PROPSHEETPADDING,LABELLINE(13),PROPSHEETWIDTH-(2*PROPSHEETPADDING),PROPSHEETHEIGHT-LABELLINE(13)-PROPSHEETPADDING,ES_LEFT|WS_TABSTOP|WS_BORDER|WS_VSCROLL|WS_HSCROLL|WS_GROUP|ES_MULTILINE|ES_READONLY +END + +IDD_PROPPAGECOMPUTER DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Síová identifikace" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDI_DEVMGR, IDC_ICON1, PROPSHEETPADDING,LABELLINE(1)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "ReactOS používá následující informace k identifikaci Vašeho poèítaèe v síti.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(1)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + LTEXT "Název poèítaèe:",-1,PROPSHEETPADDING,LABELLINE(4)-4,17*PROPSHEETPADDING,LABELLINE(4)-4 + LTEXT "(Výchozí)",IDC_COMPUTERNAME,17*PROPSHEETPADDING,LABELLINE(4)-5,60,LABELLINE(4)-5 + LTEXT "Skupina:",IDC_WORKGROUPDOMAIN,PROPSHEETPADDING,LABELLINE(6)-6,17*PROPSHEETPADDING,LABELLINE(6)-6 + LTEXT "(Prázdné)",IDC_WORKGROUPDOMAIN_NAME,17*PROPSHEETPADDING,LABELLINE(6)-6,60,LABELLINE(6)-6 + LTEXT "Pro spuštìní Prùvodce identifikací v síti, klepnìte na Síová ID.",-1,PROPSHEETPADDING,LABELLINE(7)+5,PROPSHEETWIDTH-(12*PROPSHEETPADDING)-ICONSIZE,LABELLINE(8)+5 + PUSHBUTTON "&Síová ID...",IDC_NETWORK_ID,175,LABELLINE(7)+5,70,LABELLINE(1)+4 + LTEXT "Pro pøejmenování poèítaèe nebo nastavení domény, klepnìte na Vlastnosti.",-1,PROPSHEETPADDING,LABELLINE(11)+2,PROPSHEETWIDTH-(12*PROPSHEETPADDING)-ICONSIZE,LABELLINE(12)+2 + PUSHBUTTON "&Vlastnosti",IDC_NETWORK_PROPERTY,175,LABELLINE(11)+2,70,LABELLINE(1)+4 +END + +IDD_PROPPAGEHARDWARE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Hardware" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Prùvodce hardwarem",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + LTEXT "Prùvodce hardwarem pomáhá pøi instalaci, odstranìní, opravì, odpojení, vysunutí a konfiguraci hardwaru.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(2), ICONSIZE, ICONSIZE, SS_ICON + PUSHBUTTON "&Prùvodce hardwarem...",IDC_HARDWARE_WIZARD,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + + GROUPBOX "Správce zaøízení",-1,PROPSHEETPADDING,LABELLINE(8)+5,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(7)+2 + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(10)-3,ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Správce zaøízení zobrazuje veškerý hardware nainstalovaný ve Vašem poèítaèi. Spávce zaøízení použijte v pøípadì, že chcete zmìnit vlastnosti hardware.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + + PUSHBUTTON "&Správce zaøízení...",IDC_HARDWARE_DEVICE_MANAGER,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(13)+2,(15*PROPSHEETPADDING),14 + + GROUPBOX "Hardwarové profily",-1,PROPSHEETPADDING,LABELLINE(16)+3,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(18)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Hardwarové profily dovolují ukládat rùzná nastavení hardware Vašeho poèítaèe.",0,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(18)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + PUSHBUTTON "Hard&warové profily...",IDC_HARDWARE_PROFILE,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(20)+2,(15*PROPSHEETPADDING),14 +END + +IDD_PROPPAGEUSERPROFILE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Uživatelské profily" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDI_DEVMGR, IDC_ICON1, PROPSHEETPADDING,LABELLINE(1), ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Uživatelské profily obsahují informace vztahující se k pøihlášení. Na každém poèítaèi mohou být použity rozdílné profily, nebo mohou být nastaveny tzv. cestovní profily, které lze pøenášet libovolnì mezi rùznými poèítaèi.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(1),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(4) + LTEXT "Profily uložené v tomto poèítaèi:",-1,PROPSHEETPADDING,LABELLINE(6),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) + CONTROL "",IDC_USERPROFILE_LIST,"SysListView32",LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS|LVS_SORTASCENDING|WS_BORDER|WS_TABSTOP,PROPSHEETPADDING,LABELLINE(8),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(11),WS_EX_CLIENTEDGE + + PUSHBUTTON "Odstranit",IDC_USERPROFILE_DELETE,PROPSHEETPADDING,LABELLINE(20),60,LABELLINE(1)+2 + PUSHBUTTON "Zmìnit typ...",IDC_USERPROFILE_CHANGE,(PROPSHEETWIDTH/2)-30,LABELLINE(20),60,LABELLINE(1)+2 + PUSHBUTTON "Kopírovat...",IDC_USERPROFILE_COPY,PROPSHEETWIDTH-PROPSHEETPADDING-60,LABELLINE(20),60,LABELLINE(1)+2 +END + +IDD_PROPPAGEADVANCED DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Rozšíøené nastavení" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Výkon",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(2), ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Volby výkonu nastavují, jak aplikace používají pamì. Nastavení tìchto hodnot zásadnì ovlivòuje výkon systému.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + PUSHBUTTON "&Volby výkonu...",IDC_ENVVAR,PROPSHEETWIDTH-(20*PROPSHEETPADDING),LABELLINE(5)+2,(18*PROPSHEETPADDING),14 + GROUPBOX "Promìnné prostøedí",-1,PROPSHEETPADDING,LABELLINE(8)+2,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(10)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Promìnné prostøedí uchovávají cesty k urèitým systémovým informacím.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + PUSHBUTTON "&Promìnné prostøedí...",IDC_ENVVAR,PROPSHEETWIDTH-(20*PROPSHEETPADDING),LABELLINE(12)+2,(18*PROPSHEETPADDING),14 + GROUPBOX "&Spuštìní && zotavení",-1,PROPSHEETPADDING,LABELLINE(15)+3,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(17)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Spuštìní && zotavení nastavuje start poèítaèe a akce, které se vykonají pøi neoèekávaném zastavení chodu systému.",0,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(17)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + PUSHBUTTON "&Spuštìní && zotavení...",IDC_STAREC,PROPSHEETWIDTH-(20*PROPSHEETPADDING),LABELLINE(19)+2,(18*PROPSHEETPADDING),14 +END + +IDD_ENVIRONMENT_VARIABLES DIALOGEX 6, 18, 252, 245 +STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Promìnné prostøedí" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Uživatelské promìnné",-1,7,12,238,100 + LTEXT "&Promìnné:",-1,14,24,224,8 + CONTROL "",IDC_USER_VARIABLE_LIST,"SysListView32",LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS|LVS_SORTASCENDING|LVS_NOSORTHEADER|WS_VSCROLL|WS_HSCROLL|WS_TABSTOP,14,35,224,48,WS_EX_CLIENTEDGE + PUSHBUTTON "&Nová...",IDC_USER_VARIABLE_NEW,80,90,50,14 + PUSHBUTTON "&Zmìnit...",IDC_USER_VARIABLE_EDIT,134,90,50,14 + PUSHBUTTON "&Odstranit",IDC_USER_VARIABLE_DELETE,188,90,50,14 + + GROUPBOX "Systémové promìnné",-1,7,116,238,100 + LTEXT "P&romìnné:",-1,14,128,224,8 + CONTROL "",IDC_SYSTEM_VARIABLE_LIST,"SysListView32",LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS|LVS_SORTASCENDING|LVS_NOSORTHEADER|WS_VSCROLL|WS_HSCROLL|WS_TABSTOP,14,139,224,48,WS_EX_CLIENTEDGE + PUSHBUTTON "No&vá...",IDC_SYSTEM_VARIABLE_NEW,80,194,50,14 + PUSHBUTTON "Zm&ìnit...",IDC_SYSTEM_VARIABLE_EDIT,134,194,50,14 + PUSHBUTTON "Od&stranit",IDC_SYSTEM_VARIABLE_DELETE,188,194,50,14 + + DEFPUSHBUTTON "OK",IDOK,141,224,50,14,WS_GROUP + PUSHBUTTON "Storno",IDCANCEL,195,224,50,14 +END + + +IDD_EDIT_VARIABLE DIALOGEX 10, 15, 227, 71 +STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Zmìna promìnné" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Název &promìnné:",-1,7,14,50,8 + EDITTEXT IDC_VARIABLE_NAME,75,12,145,12,ES_AUTOHSCROLL + LTEXT "&Hodnota promìnné:",-1,7,32,50,8 + EDITTEXT IDC_VARIABLE_VALUE,75,30,145,12,ES_AUTOHSCROLL + + DEFPUSHBUTTON "OK",IDOK,116,50,50,14,WS_GROUP + PUSHBUTTON "Storno",IDCANCEL,170,50,50,14 +END + + +STRINGTABLE +BEGIN + IDS_CPLSYSTEMNAME "Systém" + IDS_CPLSYSTEMDESCRIPTION "Zobrazuje informace o Vašem poèítaèi, mìní rùzné systémové promìnné a hardwarové vlastnosti." +END diff --git a/reactos/lib/cpl/sysdm/sv.rc b/reactos/lib/cpl/sysdm/sv.rc new file mode 100644 index 00000000000..5a29c4abf78 --- /dev/null +++ b/reactos/lib/cpl/sysdm/sv.rc @@ -0,0 +1,141 @@ +//Swedish resources by Kris Engeman 2005-04-28 + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +RC_LICENSE RTDATA "resources/gpl.txt" + +IDD_PROPPAGEGENERAL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Allmänt" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Operativsystem",-1,SYSTEM_COLUMN,LABELLINE(2),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT REACTOS_STR_PRODUCT_NAME,-1,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(3),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "Version" REACTOS_STR_PRODUCT_VERSION,-1,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(4),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + + LTEXT "Dator",-1,SYSTEM_COLUMN,LABELLINE(6),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_PROCESSORMANUFACTURER,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(7),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_PROCESSOR,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(8),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_PROCESSORSPEED,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(9),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + LTEXT "",IDC_SYSTEMMEMORY,SYSTEM_COLUMN+PROPSHEETPADDING,LABELLINE(10),PROPSHEETWIDTH-SYSTEM_COLUMN-PROPSHEETPADDING,8 + + EDITTEXT IDC_LICENSEMEMO,PROPSHEETPADDING,LABELLINE(13),PROPSHEETWIDTH-(2*PROPSHEETPADDING),PROPSHEETHEIGHT-LABELLINE(13)-PROPSHEETPADDING,ES_LEFT|WS_TABSTOP|WS_BORDER|WS_VSCROLL|WS_HSCROLL|WS_GROUP|ES_MULTILINE|ES_READONLY +END + +IDD_PROPPAGECOMPUTER DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Nätverksidentitet" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDI_DEVMGR, IDC_ICON1, PROPSHEETPADDING,LABELLINE(1)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Windows använder följande information för att identifiera din dator på nätverket.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(1)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + LTEXT "Fullständigt datornamn:",-1,PROPSHEETPADDING,LABELLINE(4)-4,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(4)-4 + LTEXT "",IDC_COMPUTERNAME,120,LABELLINE(4)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(4)-5 + LTEXT "Arbetsgrupp:",IDC_WORKGROUPDOMAIN,PROPSHEETPADDING,LABELLINE(6)-6,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(6)-6 + LTEXT "",IDC_WORKGROUPDOMAIN_NAME,120,LABELLINE(6)-6,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(6)-6 + LTEXT "Klicka på Nätverksidentitet för att använda guiden Nätverksidentifikation för att ansluta till en domän och skapa en lokal användare.",-1,PROPSHEETPADDING,LABELLINE(7)+5,PROPSHEETWIDTH-(12*PROPSHEETPADDING)-ICONSIZE,LABELLINE(8)+5 + PUSHBUTTON "&Nätverksidentitet...",IDC_NETWORK_ID,175,LABELLINE(7)+5,70,LABELLINE(1)+4 + LTEXT "Klicka på egenskaper för att ansluta till en domän eller ändra datornamnet.",-1,PROPSHEETPADDING,LABELLINE(11)+2,PROPSHEETWIDTH-(12*PROPSHEETPADDING)-ICONSIZE,LABELLINE(12)+2 + PUSHBUTTON "&Egenskaper...",IDC_NETWORK_PROPERTY,175,LABELLINE(11)+2,70,LABELLINE(1)+4 +END + +IDD_PROPPAGEHARDWARE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Hårdvara" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Guiden anslut ny hårdvara",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + LTEXT "Guiden anslut ny hårdvara hjälper dig att installera, avinstallera, reparera, koppla ur, mata ut och konfigurera din hårdvara.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(2), ICONSIZE, ICONSIZE, SS_ICON + PUSHBUTTON "&Guiden anslut ny hårdvara...",IDC_HARDWARE_WIZARD,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(5)+2,(15*PROPSHEETPADDING),14 + + GROUPBOX "Enhetshanteraren",-1,PROPSHEETPADDING,LABELLINE(8)+5,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(7)+2 + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(10)-3,ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Enhetshanteraren visar all hårdvara i din dator.. Använd enhetshanteraren för att ändra egenskaper på dina enheter.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-3,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + + PUSHBUTTON "&Enhetshanteraren...",IDC_HARDWARE_DEVICE_MANAGER,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(13)+2,(15*PROPSHEETPADDING),14 + + GROUPBOX "Hårdvaruprofiler",-1,PROPSHEETPADDING,LABELLINE(16)+3,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(18)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Hårdvaruprofiler ger dig möjligheten att konfigurera och lagra olika hårdvarukonfigurationer..",0,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(18)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + PUSHBUTTON "Hårdvaruprofiler...",IDC_HARDWARE_PROFILE,PROPSHEETWIDTH-(17*PROPSHEETPADDING),LABELLINE(20)+2,(15*PROPSHEETPADDING),14 +END + +IDD_PROPPAGEUSERPROFILE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Användarprofiler" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDI_DEVMGR, IDC_ICON1, PROPSHEETPADDING,LABELLINE(1), ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Användarprofiler innehåller skrivbordsinställningar och annan information om ditt konto. Olika profiler kan skapas på varje dator du använder eller så kan du välja en central profil som är likadan på alla datorer du använder.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(1),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(4) + LTEXT "Användarprofiler på datorn:",-1,PROPSHEETPADDING,LABELLINE(6),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(1) + CONTROL "",IDC_USERPROFILE_LIST,"SysListView32",LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS|LVS_SORTASCENDING|WS_BORDER|WS_TABSTOP,PROPSHEETPADDING,LABELLINE(8),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(11),WS_EX_CLIENTEDGE + + PUSHBUTTON "Ta bort",IDC_USERPROFILE_DELETE,PROPSHEETPADDING,LABELLINE(20),60,LABELLINE(1)+2 + PUSHBUTTON "Ändra typ...",IDC_USERPROFILE_CHANGE,95,LABELLINE(20),60,LABELLINE(1)+2 + PUSHBUTTON "Kopiera till...",IDC_USERPROFILE_COPY,180,LABELLINE(20),60,LABELLINE(1)+2 +END + +IDD_PROPPAGEADVANCED DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Avancerat" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Prestanda",-1,PROPSHEETPADDING,LABELLINE(1),PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(2), ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Prestandainställningar kontrollerar hur program använder minne, vilket påverkar din dators hastighet.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(2),PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + PUSHBUTTON "&Prestandainställningar...",IDC_ENVVAR,PROPSHEETWIDTH-(20*PROPSHEETPADDING),LABELLINE(5)+2,(18*PROPSHEETPADDING),14 + GROUPBOX "Miljövariabler",-1,PROPSHEETPADDING,LABELLINE(8)+2,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(10)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Miljövariabler anger var din dator ska hämta viss typ av information.",-1,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(10)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(11) + PUSHBUTTON "&Miljövariabler...",IDC_ENVVAR,PROPSHEETWIDTH-(20*PROPSHEETPADDING),LABELLINE(12)+2,(18*PROPSHEETPADDING),14 + GROUPBOX "&Start och återställning",-1,PROPSHEETPADDING,LABELLINE(15)+3,PROPSHEETWIDTH-(2*PROPSHEETPADDING),LABELLINE(6)+PROPSHEETPADDING + ICON IDI_DEVMGR, IDC_ICON1, (2*PROPSHEETPADDING),LABELLINE(17)-5, ICONSIZE, ICONSIZE, SS_ICON + LTEXT "Start och återställning ställer in hur din dator ska starta och hur den ska bete sig om den stöter på ett fel.",0,(4*PROPSHEETPADDING)+ICONSIZE,LABELLINE(17)-5,PROPSHEETWIDTH-(6*PROPSHEETPADDING)-ICONSIZE,LABELLINE(3) + PUSHBUTTON "&Start och återställning...",IDC_STAREC,PROPSHEETWIDTH-(20*PROPSHEETPADDING),LABELLINE(19)+2,(18*PROPSHEETPADDING),14 +END + +IDD_ENVIRONMENT_VARIABLES DIALOGEX 6, 18, 252, 245 +STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Miljövariabler" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Användarvariabler",-1,7,12,238,100 + LTEXT "&Variabler:",-1,14,24,224,8 + CONTROL "",IDC_USER_VARIABLE_LIST,"SysListView32",LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS|LVS_SORTASCENDING|LVS_NOSORTHEADER|WS_VSCROLL|WS_HSCROLL|WS_TABSTOP,14,35,224,48,WS_EX_CLIENTEDGE + PUSHBUTTON "&Ny...",IDC_USER_VARIABLE_NEW,80,90,50,14 + PUSHBUTTON "&Redigera...",IDC_USER_VARIABLE_EDIT,134,90,50,14 + PUSHBUTTON "&Ta bort",IDC_USER_VARIABLE_DELETE,188,90,50,14 + + GROUPBOX "Systemvariabler",-1,7,116,238,100 + LTEXT "Variabler:",-1,14,128,224,8 + CONTROL "",IDC_SYSTEM_VARIABLE_LIST,"SysListView32",LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS|LVS_SORTASCENDING|LVS_NOSORTHEADER|WS_VSCROLL|WS_HSCROLL|WS_TABSTOP,14,139,224,48,WS_EX_CLIENTEDGE + PUSHBUTTON "Ny...",IDC_SYSTEM_VARIABLE_NEW,80,194,50,14 + PUSHBUTTON "Redigera...",IDC_SYSTEM_VARIABLE_EDIT,134,194,50,14 + PUSHBUTTON "Ta bort",IDC_SYSTEM_VARIABLE_DELETE,188,194,50,14 + + DEFPUSHBUTTON "OK",IDOK,141,224,50,14,WS_GROUP + PUSHBUTTON "Avbryt",IDCANCEL,195,224,50,14 +END + + +IDD_EDIT_VARIABLE DIALOGEX 10, 15, 227, 71 +STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Ändra variabel" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Variabelnamn:",-1,7,14,50,8 + EDITTEXT IDC_VARIABLE_NAME,75,12,145,12,ES_AUTOHSCROLL + LTEXT "Variabelvärde:",-1,7,32,50,8 + EDITTEXT IDC_VARIABLE_VALUE,75,30,145,12,ES_AUTOHSCROLL + + DEFPUSHBUTTON "OK",IDOK,116,50,50,14,WS_GROUP + PUSHBUTTON "Avbryt",IDCANCEL,170,50,50,14 +END + + +STRINGTABLE +BEGIN + IDS_CPLSYSTEMNAME "System" + IDS_CPLSYSTEMDESCRIPTION "Se information om din dator och ändra olika system- och hårdvaruinställningar." +END diff --git a/reactos/lib/cpl/sysdm/sysdm.rc b/reactos/lib/cpl/sysdm/sysdm.rc index 70e50a6da8f..2b0e66b29f7 100644 --- a/reactos/lib/cpl/sysdm/sysdm.rc +++ b/reactos/lib/cpl/sysdm/sysdm.rc @@ -17,7 +17,9 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT IDI_CPLSYSTEM ICON "resources/applet.ico" IDI_DEVMGR ICON "resources/devmgr.ico" +#include "cz.rc" #include "en.rc" #include "de.rc" #include "dk.rc" #include "fr.rc" +#include "sv.rc" diff --git a/reactos/lib/cpl/timedate/Cz.rc b/reactos/lib/cpl/timedate/Cz.rc new file mode 100644 index 00000000000..54b487f6346 --- /dev/null +++ b/reactos/lib/cpl/timedate/Cz.rc @@ -0,0 +1,42 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_DATETIMEPAGE DIALOGEX 0, 0, 252, 146 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Datum && Èas" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "&Datum", -1, 4, 2, 122, 125 + CONTROL "", IDC_DATEPICKER, "SysDateTimePick32", + DTS_SHORTDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, + 11, 17, 108, 12 + CONTROL "", IDC_MONTHCALENDAR, "SysMonthCal32", + WS_CHILD | WS_VISIBLE | WS_TABSTOP, + 11, 37, 108, 80 + GROUPBOX "&Èas", -1, 132, 2, 113, 125 + CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32", + DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, + 144, 17, 90, 12 + LTEXT "", IDC_TIMEZONE, 4, 136, 241, 8 +END + + +IDD_TIMEZONEPAGE DIALOGEX 0, 0, 252, 146 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Èasové pásmo" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + COMBOBOX IDC_TIMEZONELIST, 5, 4, 241, 136, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP + AUTOCHECKBOX "Provádìt zmìnu na letní èas a zpìt automaticky", + IDC_AUTODAYLIGHT, 5, 136, 241, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP +END + + +STRINGTABLE +BEGIN + IDS_CPLNAME "Datum/Èas" + IDS_CPLDESCRIPTION "Nastavuje datum, èas a zmìny èasového pásma." + IDS_TIMEZONETEXT "Aktuální èasové pásmo: %s" + IDS_TIMEZONEINVALID "Neplatné" + IDS_TIMEZONEUNKNOWN "Neznámé" +END diff --git a/reactos/lib/cpl/timedate/timedate.rc b/reactos/lib/cpl/timedate/timedate.rc index 657708af16f..1f98cb8f73f 100644 --- a/reactos/lib/cpl/timedate/timedate.rc +++ b/reactos/lib/cpl/timedate/timedate.rc @@ -17,6 +17,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDC_CPLICON ICON "resources/applet.ico" +#include "Cz.rc" #include "En.rc" #include "De.rc" #include "Dk.rc" diff --git a/reactos/lib/crtdll/stdlib/alloca.c b/reactos/lib/crtdll/stdlib/alloca.c index 53802465268..dfe9c905b1e 100644 --- a/reactos/lib/crtdll/stdlib/alloca.c +++ b/reactos/lib/crtdll/stdlib/alloca.c @@ -11,12 +11,8 @@ void *alloca(size_t s) if ( s == 0 ) return NULL; - - if ( (s & 0xfffffffc) != 0 ) - as += 4; - - as &= 0xfffffffc; - + as = (as + 3) & (~3); + __asm__ __volatile__( "mov %0, %%edx \n" // "popl %%ebp \n" diff --git a/reactos/lib/dhcpcapi/dhcpcapi.c b/reactos/lib/dhcpcapi/dhcpcapi.c new file mode 100644 index 00000000000..366ba546c71 --- /dev/null +++ b/reactos/lib/dhcpcapi/dhcpcapi.c @@ -0,0 +1,140 @@ +/* $Id: dllmain.c 12852 2005-01-06 13:58:04Z mf $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/dhcpcapi/dhcpcapi.c + * PURPOSE: Client API for DHCP + * PROGRAMMER: arty (ayerkes@speakeasy.net) + * UPDATE HISTORY: + * Created 12/04/2005 + */ + +#include +#include +#include +#include + +#define DHCP_TIMEOUT 1000 + +#define EXPORT __declspec(dllexport) WINAPI + +DWORD EXPORT DhcpCApiInitialize(LPDWORD Version) { + *Version = 2; + return 0; +} + +VOID EXPORT DhcpCApiCleanup() { +} + +DWORD EXPORT DhcpQueryHWInfo( DWORD AdapterIndex, + PDWORD MediaType, + PDWORD Mtu, + PDWORD Speed ) { + COMM_DHCP_REQ Req; + COMM_DHCP_REPLY Reply; + DWORD BytesRead; + BOOL Result; + + Req.Type = DhcpReqQueryHWInfo; + Req.AdapterIndex = AdapterIndex; + + Result = CallNamedPipe + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); + + if( !Reply.Reply ) return 0; + else { + *MediaType = Reply.QueryHWInfo.MediaType; + *Mtu = Reply.QueryHWInfo.Mtu; + *Speed = Reply.QueryHWInfo.Speed; + return 1; + } +} + +DWORD EXPORT DhcpLeaseIpAddress( DWORD AdapterIndex ) { + COMM_DHCP_REQ Req; + COMM_DHCP_REPLY Reply; + DWORD BytesRead; + BOOL Result; + + Req.Type = DhcpReqLeaseIpAddress; + Req.AdapterIndex = AdapterIndex; + + Result = CallNamedPipe + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); + + return Reply.Reply; +} + +DWORD EXPORT DhcpReleaseIpAddressLease( DWORD AdapterIndex ) { + COMM_DHCP_REQ Req; + COMM_DHCP_REPLY Reply; + DWORD BytesRead; + BOOL Result; + + Req.Type = DhcpReqReleaseIpAddress; + Req.AdapterIndex = AdapterIndex; + + Result = CallNamedPipe + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); + + return Reply.Reply; +} + +DWORD EXPORT DhcpRenewIpAddressLease( DWORD AdapterIndex ) { + COMM_DHCP_REQ Req; + COMM_DHCP_REPLY Reply; + DWORD BytesRead; + BOOL Result; + + Req.Type = DhcpReqRenewIpAddress; + Req.AdapterIndex = AdapterIndex; + + Result = CallNamedPipe + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); + + return Reply.Reply; +} + +DWORD EXPORT DhcpStaticRefreshParams( DWORD AdapterIndex, + DWORD Address, + DWORD Netmask ) { + COMM_DHCP_REQ Req; + COMM_DHCP_REPLY Reply; + DWORD BytesRead; + BOOL Result; + + Req.Type = DhcpReqStaticRefreshParams; + Req.AdapterIndex = AdapterIndex; + Req.Body.StaticRefreshParams.IPAddress = Address; + Req.Body.StaticRefreshParams.Netmask = Netmask; + + Result = CallNamedPipe + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); + + return Reply.Reply; +} + +INT STDCALL +DllMain(PVOID hinstDll, + ULONG dwReason, + PVOID reserved) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDll); + break; + + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + +/* EOF */ diff --git a/reactos/lib/dhcpcapi/dhcpcapi.def b/reactos/lib/dhcpcapi/dhcpcapi.def new file mode 100644 index 00000000000..e5b07606edf --- /dev/null +++ b/reactos/lib/dhcpcapi/dhcpcapi.def @@ -0,0 +1,16 @@ +; $Id: dhcpcapi.def 14337 2005-03-26 22:10:04Z $ +; +; dhcpcapi.def +; +; ReactOS Operating System +; +LIBRARY dhcpcapi.dll +EXPORTS +DhcpCApiInitialize@4 +DhcpCApiCleanup@0 +DhcpQueryHWInfo@16 +DhcpLeaseIpAddress@4 +DhcpReleaseIpAddressLease@4 +DhcpRenewIpAddressLease@4 +DhcpStaticRefreshParams@12 +; EOF diff --git a/reactos/lib/dhcpcapi/dhcpcapi.rc b/reactos/lib/dhcpcapi/dhcpcapi.rc new file mode 100644 index 00000000000..05666c1d2fe --- /dev/null +++ b/reactos/lib/dhcpcapi/dhcpcapi.rc @@ -0,0 +1,7 @@ +#include + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "DHCP Client API\0" +#define REACTOS_STR_INTERNAL_NAME "dhcpcapi\0" +#define REACTOS_STR_ORIGINAL_FILENAME "dhcpcapi.dll\0" +#include diff --git a/reactos/lib/dhcpcapi/makefile b/reactos/lib/dhcpcapi/makefile new file mode 100644 index 00000000000..70fb5b197d5 --- /dev/null +++ b/reactos/lib/dhcpcapi/makefile @@ -0,0 +1,27 @@ +# $Id: makefile 12852 2005-01-06 13:58:04Z mf $ + +PATH_TO_TOP = ../.. + +TARGET_TYPE = dynlink + +TARGET_NAME = dhcpcapi + +TARGET_CFLAGS = -Wall -Werror \ + -D__USE_W32API \ + -D_WIN32_IE=0x0500 \ + -D_WIN32_WINNT=0x501 \ + -DWINVER=0x600 \ + +TARGET_LFLAGS = -nostartfiles -nostdlib + +TARGET_SDKLIBS = ntdll.a kernel32.a + +TARGET_OBJECTS = dhcpcapi.o + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +include $(TOOLS_PATH)/depend.mk diff --git a/reactos/lib/directory.xml b/reactos/lib/directory.xml index 05fd22aa828..a8ce08f18df 100644 --- a/reactos/lib/directory.xml +++ b/reactos/lib/directory.xml @@ -106,9 +106,15 @@ + + + + + + diff --git a/reactos/lib/epsapi/enum/processes.c b/reactos/lib/epsapi/enum/processes.c index ad52618c452..75fb255bf86 100644 --- a/reactos/lib/epsapi/enum/processes.c +++ b/reactos/lib/epsapi/enum/processes.c @@ -38,9 +38,9 @@ #include NTSTATUS NTAPI -PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESSES *ProcessesAndThreads) +PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESS_INFORMATION *ProcessesAndThreads) { - PSYSTEM_PROCESSES pInfoBuffer = NULL; + PSYSTEM_PROCESS_INFORMATION pInfoBuffer = NULL; SIZE_T nSize = 0x8000; NTSTATUS Status; @@ -94,7 +94,7 @@ PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESSES *ProcessesAndThreads) } NTSTATUS NTAPI -PsaWalkProcessesAndThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, +PsaWalkProcessesAndThreads(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads, IN PPROC_ENUM_ROUTINE ProcessCallback, IN OUT PVOID ProcessCallbackContext, IN PTHREAD_ENUM_ROUTINE ThreadCallback, @@ -128,11 +128,11 @@ PsaWalkProcessesAndThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, if(ThreadCallback) { ULONG i; - PSYSTEM_THREADS pCurThread; + PSYSTEM_THREAD_INFORMATION pCurThread; /* scan the current process's thread list */ for(i = 0, pCurThread = PsaWalkFirstThread(ProcessesAndThreads); - i < ProcessesAndThreads->ThreadCount; + i < ProcessesAndThreads->NumberOfThreads; i++, pCurThread = PsaWalkNextThread(pCurThread)) { Status = ThreadCallback(pCurThread, ThreadCallbackContext); @@ -158,7 +158,7 @@ PsaEnumerateProcessesAndThreads(IN PPROC_ENUM_ROUTINE ProcessCallback, IN PTHREAD_ENUM_ROUTINE ThreadCallback, IN OUT PVOID ThreadCallbackContext) { - PSYSTEM_PROCESSES pInfoBuffer; + PSYSTEM_PROCESS_INFORMATION pInfoBuffer; NTSTATUS Status; if(ProcessCallback == NULL && ThreadCallback == NULL) @@ -194,7 +194,7 @@ PsaFreeCapture(IN PVOID Capture) } NTSTATUS NTAPI -PsaWalkProcesses(IN PSYSTEM_PROCESSES ProcessesAndThreads, +PsaWalkProcesses(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads, IN PPROC_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext) { @@ -206,7 +206,7 @@ PsaWalkProcesses(IN PSYSTEM_PROCESSES ProcessesAndThreads, } NTSTATUS NTAPI -PsaWalkThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, +PsaWalkThreads(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads, IN PTHREAD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext) { @@ -237,42 +237,42 @@ PsaEnumerateThreads(IN PTHREAD_ENUM_ROUTINE Callback, CallbackContext); } -PSYSTEM_PROCESSES FASTCALL -PsaWalkFirstProcess(IN PSYSTEM_PROCESSES ProcessesAndThreads) +PSYSTEM_PROCESS_INFORMATION FASTCALL +PsaWalkFirstProcess(IN PSYSTEM_PROCESS_INFORMATION ProcessesAndThreads) { return ProcessesAndThreads; } -PSYSTEM_PROCESSES FASTCALL -PsaWalkNextProcess(IN PSYSTEM_PROCESSES CurrentProcess) +PSYSTEM_PROCESS_INFORMATION FASTCALL +PsaWalkNextProcess(IN PSYSTEM_PROCESS_INFORMATION CurrentProcess) { - if(CurrentProcess->NextEntryDelta == 0) + if(CurrentProcess->NextEntryOffset == 0) { return NULL; } else { - return (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess + CurrentProcess->NextEntryDelta); + return (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess + CurrentProcess->NextEntryOffset); } } -PSYSTEM_THREADS FASTCALL -PsaWalkFirstThread(IN PSYSTEM_PROCESSES CurrentProcess) +PSYSTEM_THREAD_INFORMATION FASTCALL +PsaWalkFirstThread(IN PSYSTEM_PROCESS_INFORMATION CurrentProcess) { static SIZE_T nOffsetOfThreads = 0; /* get the offset of the Threads field */ - nOffsetOfThreads = offsetof(SYSTEM_PROCESSES, Threads); + nOffsetOfThreads = offsetof(SYSTEM_PROCESS_INFORMATION, TH); - return (PSYSTEM_THREADS)((ULONG_PTR)CurrentProcess + nOffsetOfThreads); + return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentProcess + nOffsetOfThreads); } -PSYSTEM_THREADS FASTCALL -PsaWalkNextThread(IN PSYSTEM_THREADS CurrentThread) +PSYSTEM_THREAD_INFORMATION FASTCALL +PsaWalkNextThread(IN PSYSTEM_THREAD_INFORMATION CurrentThread) { - return (PSYSTEM_THREADS)((ULONG_PTR)CurrentThread + - (offsetof(SYSTEM_PROCESSES, Threads[1]) - - offsetof(SYSTEM_PROCESSES, Threads[0]))); + return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentThread + + (offsetof(SYSTEM_PROCESS_INFORMATION, TH[1]) - + offsetof(SYSTEM_PROCESS_INFORMATION, TH[0]))); } /* EOF */ diff --git a/reactos/lib/glu32/libnurbs/nurbtess/sampleComp.cc b/reactos/lib/glu32/libnurbs/nurbtess/sampleComp.cc index a06c7046ec2..ec91eccb023 100644 --- a/reactos/lib/glu32/libnurbs/nurbtess/sampleComp.cc +++ b/reactos/lib/glu32/libnurbs/nurbtess/sampleComp.cc @@ -157,9 +157,9 @@ void sampleCompLeft(Real* topVertex, Real* botVertex, /*find out whether there is a trim vertex which is *inbetween the top and bot grid lines or not. */ - Int midIndex1; - Int midIndex2; - Int gridMidIndex1, gridMidIndex2; + Int midIndex1 = 0; + Int midIndex2 = 0; + Int gridMidIndex1 = 0, gridMidIndex2 = 0; //midIndex1: array[i] <= v, array[i-1] > v //midIndex2: array[i] >= v, array[i+1] < v // v(gridMidIndex1) >= v(midindex1) > v(gridMidIndex1+1) diff --git a/reactos/lib/glu32/libnurbs/nurbtess/sampleCompRight.cc b/reactos/lib/glu32/libnurbs/nurbtess/sampleCompRight.cc index 93474c38d28..baba014c0d2 100644 --- a/reactos/lib/glu32/libnurbs/nurbtess/sampleCompRight.cc +++ b/reactos/lib/glu32/libnurbs/nurbtess/sampleCompRight.cc @@ -72,7 +72,7 @@ void sampleCompRight(Real* topVertex, Real* botVertex, */ Int midIndex1; Int midIndex2; - Int gridMidIndex1, gridMidIndex2; + Int gridMidIndex1 =0, gridMidIndex2 =0; //midIndex1: array[i] <= v, array[i+1] > v //midIndex2: array[i] >= v, array[i+1] < v midIndex1 = rightChain->findIndexBelowGen(rightGridChain->get_v_value(gridIndex1), diff --git a/reactos/lib/glu32/libutil/mipmap.c b/reactos/lib/glu32/libutil/mipmap.c index 235733c8082..9ae20852e19 100644 --- a/reactos/lib/glu32/libutil/mipmap.c +++ b/reactos/lib/glu32/libutil/mipmap.c @@ -4862,6 +4862,7 @@ static void fill_image(const PixelStorageModes *psm, if (padding) { rowsize += psm->unpack_alignment - padding; } + start = (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize + (psm->unpack_skip_pixels * components / 8); elements_per_line = width * components; @@ -5102,7 +5103,7 @@ static void empty_image(const PixelStorageModes *psm, GLint group_size; GLint elements_per_line; GLubyte *start; - GLubyte *iter; + GLubyte *iter = NULL; const GLushort *iter2; GLint i, j, k; GLint myswap_bytes; @@ -5987,7 +5988,7 @@ static void scaleInternalPackedPixel(int components, int i,j,k,xindex; const char *temp, *temp0; - int outindex; + int outindex = 0; int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; @@ -7011,7 +7012,7 @@ static void emptyImage3D(const PixelStorageModes *psm, int groupSize; int rowSize; int padding; - GLubyte *start, *rowStart, *iter; + GLubyte *start, *rowStart, *iter=NULL; int elementsPerLine; const GLushort *iter2; int ii, jj, dd, k; @@ -7366,7 +7367,7 @@ static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth, GLint widthPowerOf2= nearestPower(width); GLint heightPowerOf2= nearestPower(height); GLint depthPowerOf2= nearestPower(depth); - GLint proxyWidth; + GLint proxyWidth ; do { /* compute level 1 width & height & depth, clamping each at 1 */ @@ -7379,7 +7380,7 @@ static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth, GLint depthAtLevelOne= (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; - GLenum proxyTarget; + GLenum proxyTarget = 0; assert(widthAtLevelOne > 0); assert(heightAtLevelOne > 0); assert(depthAtLevelOne > 0); diff --git a/reactos/lib/glu32/libutil/quad.c b/reactos/lib/glu32/libutil/quad.c index 923b812a514..fdc23b1dc23 100644 --- a/reactos/lib/glu32/libutil/quad.c +++ b/reactos/lib/glu32/libutil/quad.c @@ -448,7 +448,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, GLfloat sintemp, costemp; GLfloat deltaRadius; GLfloat radiusLow, radiusHigh; - GLfloat texLow, texHigh; + GLfloat texLow = 0, texHigh = 0; GLfloat angleOffset; GLint slices2; GLint finish; @@ -717,8 +717,8 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) GLfloat cosCache3b[CACHE_SIZE]; GLfloat angle; GLfloat zLow, zHigh; - GLfloat sintemp1, sintemp2, sintemp3, sintemp4; - GLfloat costemp1, costemp2, costemp3, costemp4; + GLfloat sintemp1, sintemp2=0, sintemp3=0, sintemp4=0; + GLfloat costemp1, costemp2=0, costemp3=0, costemp4=0; GLboolean needCache2, needCache3; GLint start, finish; diff --git a/reactos/lib/iphlpapi/ifenum_reactos.c b/reactos/lib/iphlpapi/ifenum_reactos.c index 6bd5c84e59a..603f6fee89a 100644 --- a/reactos/lib/iphlpapi/ifenum_reactos.c +++ b/reactos/lib/iphlpapi/ifenum_reactos.c @@ -77,7 +77,8 @@ NTSTATUS openTcpFile(PHANDLE tcpFile) { NULL ); status = ZwCreateFile( tcpFile, - SYNCHRONIZE | GENERIC_EXECUTE, + SYNCHRONIZE | GENERIC_EXECUTE | + GENERIC_READ | GENERIC_WRITE, &objectAttributes, &ioStatusBlock, NULL, diff --git a/reactos/lib/kbdru/Jamfile b/reactos/lib/kbdru/Jamfile new file mode 100644 index 00000000000..4a997aac331 --- /dev/null +++ b/reactos/lib/kbdru/Jamfile @@ -0,0 +1,15 @@ +SubDir ROS_TOP lib kbdru ; + +# This stuff should actually be moved to Jamrules +# in order to more easily support other compilers +CCFLAGS += -Wall -fno-builtin ; + +# NOTE - I'm no Jam expert, yet. This stuff should be +# abstracted into the Jamrules file. +LINKFLAGS = -nostartfiles -nostdlib -shared ; +LINKFLAGS += -Wl,--image-base,0x77F00000 -lgcc ; + +SRCS = kbdru + +SharedLibrary kbdru : $(SRCS) ; +LINKLIBS = ; diff --git a/reactos/lib/kbdru/kbdru.c b/reactos/lib/kbdru/kbdru.c new file mode 100644 index 00000000000..759d0bf724c --- /dev/null +++ b/reactos/lib/kbdru/kbdru.c @@ -0,0 +1,452 @@ +/* + * ReactOS Russian ASCII Keyboard layout + * Copyright (C) 2005 ReactOS + * Author: Aleksey Bragin + * License: LGPL, see: LGPL.txt + * + * Thanks to: http://www.barcodeman.com/altek/mule/scandoc.php + * and http://win.tue.nl/~aeb/linux/kbd/scancodes-1.html + */ + +#include +#include + +#ifdef _M_IA64 +#define ROSDATA static __declspec(allocate(".data")) +#else +#pragma data_seg(".data") +#define ROSDATA static +#endif + +#define VK_EMPTY 0xff /* The non-existent VK */ +#define KSHIFT 0x001 /* Shift modifier */ +#define KCTRL 0x002 /* Ctrl modifier */ +#define KALT 0x004 /* Alt modifier */ +#define KEXT 0x100 /* Extended key code */ +#define KMULTI 0x200 /* Multi-key */ +#define KSPEC 0x400 /* Special key */ +#define KNUMP 0x800 /* Number-pad */ +#define KNUMS 0xc00 /* Special + number pad */ +#define KMEXT 0x300 /* Multi + ext */ + +#define SHFT_INVALID 0x0F + +/* Thanks to http://asp.flaaten.dk/pforum/keycode/keycode.htm */ +#ifndef VK_OEM_1 +#define VK_OEM_1 0xba +#endif +#ifndef VK_OEM_PLUS +#define VK_OEM_PLUS 0xbb +#endif +#ifndef VK_OEM_COMMA +#define VK_OEM_COMMA 0xbc +#endif +#ifndef VK_OEM_MINUS +#define VK_OEM_MINUS 0xbd +#endif +#ifndef VK_OEM_PERIOD +#define VK_OEM_PERIOD 0xbe +#endif +#ifndef VK_OEM_2 +#define VK_OEM_2 0xbf +#endif +#ifndef VK_OEM_3 +#define VK_OEM_3 0xc0 +#endif +#ifndef VK_OEM_4 +#define VK_OEM_4 0xdb +#endif +#ifndef VK_OEM_5 +#define VK_OEM_5 0xdc +#endif +#ifndef VK_OEM_6 +#define VK_OEM_6 0xdd +#endif +#ifndef VK_OEM_7 +#define VK_OEM_7 0xde +#endif +#ifndef VK_OEM_8 +#define VK_OEM_8 0xdf +#endif +#ifndef VK_OEM_AX +#define VK_OEM_AX 0xe1 +#endif +#ifndef VK_OEM_102 +#define VK_OEM_102 0xe1 +#endif + +ROSDATA USHORT scancode_to_vk[] = { + /* Numbers Row */ + /* - 00 - */ + /* 1 ... 2 ... 3 ... 4 ... */ + VK_EMPTY, VK_ESCAPE, '1', '2', + '3', '4', '5', '6', + '7', '8', '9', '0', + VK_OEM_MINUS, VK_OEM_PLUS, VK_BACK, + /* - 0f - */ + /* First Letters Row */ + VK_TAB, 'Q', 'W', 'E', + 'R', 'T', 'Y', 'U', + 'I', 'O', 'P', + VK_OEM_4, VK_OEM_6, VK_RETURN, + /* - 1d - */ + /* Second Letters Row */ + VK_LCONTROL, + 'A', 'S', 'D', 'F', + 'G', 'H', 'J', 'K', + 'L', VK_OEM_1, VK_OEM_7, VK_OEM_3, + VK_LSHIFT, VK_OEM_5, + /* - 2c - */ + /* Third letters row */ + 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', VK_OEM_COMMA, + VK_OEM_PERIOD,VK_OEM_2, VK_RSHIFT | KEXT, + /* - 37 - */ + /* Bottom Row */ + 0x26a, VK_LMENU, VK_SPACE, VK_CAPITAL, + + /* - 3b - */ + /* F-Keys */ + VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, + VK_F7, VK_F8, VK_F9, VK_F10, + /* - 45 - */ + /* Locks */ + VK_NUMLOCK | KMEXT, + VK_SCROLL | KMULTI, + /* - 47 - */ + /* Number-Pad */ + VK_HOME | KNUMS, VK_UP | KNUMS, VK_PRIOR | KNUMS, VK_SUBTRACT, + VK_LEFT | KNUMS, VK_CLEAR | KNUMS, VK_RIGHT | KNUMS, VK_ADD, + VK_END | KNUMS, VK_DOWN | KNUMS, VK_NEXT | KNUMS, + VK_INSERT | KNUMS, VK_DELETE | KNUMS, + /* - 54 - */ + /* Presumably PrtSc */ + VK_SNAPSHOT, + /* - 55 - */ + /* Oddities, and the remaining standard F-Keys */ + VK_EMPTY, VK_OEM_102, VK_F11, VK_F12, + /* - 59 - */ + VK_CLEAR, VK_OEM_WSCTRL,VK_OEM_FINISH,VK_OEM_JUMP, VK_EREOF, /* EREOF */ + VK_OEM_BACKTAB, VK_OEM_AUTO, VK_EMPTY, VK_ZOOM, /* ZOOM */ + VK_HELP, + /* - 64 - */ + /* Even more F-Keys (for example, NCR keyboards from the early 90's) */ + VK_F13, VK_F14, VK_F15, VK_F16, VK_F17, VK_F18, VK_F19, VK_F20, + VK_F21, VK_F22, VK_F23, + /* - 6f - */ + /* Not sure who uses these codes */ + VK_OEM_PA3, VK_EMPTY, VK_OEM_RESET, + /* - 72 - */ + VK_EMPTY, 0xc1, VK_EMPTY, VK_EMPTY, + /* - 76 - */ + /* One more f-key */ + VK_F24, + /* - 77 - */ + VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, + VK_OEM_PA1, VK_TAB, 0xc2, 0, /* PA1 */ + 0, + /* - 80 - */ + 0 +}; + +ROSDATA VSC_VK extcode0_to_vk[] = { + { 0x10, VK_MEDIA_PREV_TRACK | KEXT }, + { 0x19, VK_MEDIA_NEXT_TRACK | KEXT }, + { 0x1D, VK_RCONTROL | KEXT }, + { 0x20, VK_VOLUME_MUTE | KEXT }, + { 0x21, VK_LAUNCH_APP2 | KEXT }, + { 0x22, VK_MEDIA_PLAY_PAUSE | KEXT }, + { 0x24, VK_MEDIA_STOP | KEXT }, + { 0x2E, VK_VOLUME_DOWN | KEXT }, + { 0x30, VK_VOLUME_UP | KEXT }, + { 0x32, VK_BROWSER_HOME | KEXT }, + { 0x35, VK_DIVIDE | KEXT }, + { 0x37, VK_SNAPSHOT | KEXT }, + { 0x38, VK_RMENU | KEXT }, + { 0x47, VK_HOME | KEXT }, + { 0x48, VK_UP | KEXT }, + { 0x49, VK_PRIOR | KEXT }, + { 0x4B, VK_LEFT | KEXT }, + { 0x4D, VK_RIGHT | KEXT }, + { 0x4F, VK_END | KEXT }, + { 0x50, VK_DOWN | KEXT }, + { 0x51, VK_NEXT | KEXT }, + { 0x52, VK_INSERT | KEXT }, + { 0x53, VK_DELETE | KEXT }, + { 0x5B, VK_LWIN | KEXT }, + { 0x5C, VK_RWIN | KEXT }, + { 0x5D, VK_APPS | KEXT }, + { 0x5F, VK_SLEEP | KEXT }, + { 0x65, VK_BROWSER_SEARCH | KEXT }, + { 0x66, VK_BROWSER_FAVORITES | KEXT }, + { 0x67, VK_BROWSER_REFRESH | KEXT }, + { 0x68, VK_BROWSER_STOP | KEXT }, + { 0x69, VK_BROWSER_FORWARD | KEXT }, + { 0x6A, VK_BROWSER_BACK | KEXT }, + { 0x6B, VK_LAUNCH_APP1 | KEXT }, + { 0x6C, VK_LAUNCH_MAIL | KEXT }, + { 0x6D, VK_LAUNCH_MEDIA_SELECT | KEXT }, + { 0x1C, VK_RETURN | KEXT }, + { 0x46, VK_CANCEL | KEXT }, + { 0, 0 }, +}; + +ROSDATA VSC_VK extcode1_to_vk[] = { + { 0x1d, VK_PAUSE}, + { 0, 0 }, +}; + +ROSDATA VK_TO_BIT modifier_keys[] = { + { VK_SHIFT, KSHIFT }, + { VK_CONTROL, KCTRL }, + { VK_MENU, KALT }, + { 0, 0 } +}; + +typedef struct _mymod { + PVOID mod_keys; + WORD maxmod; + BYTE mod_max[7]; +} INTERNAL_KBD_MODIFIERS; + +ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { + modifier_keys, + 3, + { 0, 1, 2, 3, 0, 0, 0xC0 } /* Modifier bit order, NONE, SHIFT, CTRL, ALT, MENU, SHIFT + MENU, CTRL + MENU */ +}; + +#define NOCAPS 0 +#define CAPS KSHIFT /* Caps -> shift */ + +ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { + {VK_OEM_3, CAPS, 0x451, 0x401}, + { '1', NOCAPS, '1', '!' }, + { '3', NOCAPS, '3', 0x2116 }, + { '4', NOCAPS, '4', ';' }, + { '5', NOCAPS, '5', '%' }, + { '7', NOCAPS, '7', '?' }, + { '8', NOCAPS, '8', '*' }, + { '9', NOCAPS, '9', '(' }, + { '0', NOCAPS, '0', ')' }, + { VK_OEM_PLUS, NOCAPS, '=', '+' }, + + /* First letter row */ + { 'Q', CAPS, 0x439, 0x419 }, + { 'W', CAPS, 0x446, 0x426 }, + { 'E', CAPS, 0x443, 0x423 }, + { 'R', CAPS, 0x43a, 0x41a }, + { 'T', CAPS, 0x435, 0x415 }, + { 'Y', CAPS, 0x43d, 0x41d }, + { 'U', CAPS, 0x433, 0x413 }, + { 'I', CAPS, 0x448, 0x428 }, + { 'O', CAPS, 0x449, 0x429 }, + { 'P', CAPS, 0x437, 0x417 }, + { VK_OEM_4, CAPS, 0x445, 0x425 }, + { VK_OEM_6, CAPS, 0x44a, 0x42a }, + + /* Second letter row */ + { 'A', CAPS, 0x444, 0x424 }, + { 'S', CAPS, 0x44b, 0x42b }, + { 'D', CAPS, 0x432, 0x412 }, + { 'F', CAPS, 0x430, 0x410 }, + { 'G', CAPS, 0x43f, 0x41f }, + { 'H', CAPS, 0x440, 0x420 }, + { 'J', CAPS, 0x43e, 0x41e }, + { 'K', CAPS, 0x43b, 0x41b }, + { 'L', CAPS, 0x434, 0x414 }, + { VK_OEM_1, CAPS, 0x436, 0x416 }, + { VK_OEM_7, CAPS, 0x44d, 0x42d }, + + /* Third letter row */ + { 'Z', CAPS, 0x44f, 0x42f }, + { 'X', CAPS, 0x447, 0x427 }, + { 'C', CAPS, 0x441, 0x421 }, + { 'V', CAPS, 0x43c, 0x41c }, + { 'B', CAPS, 0x438, 0x418 }, + { 'N', CAPS, 0x442, 0x422 }, + { 'M', CAPS, 0x44c, 0x42c }, + { VK_OEM_COMMA,CAPS, 0x431, 0x411 }, + { VK_OEM_PERIOD,CAPS, 0x44e, 0x42e }, + { VK_OEM_2, NOCAPS, '.', ',' }, + + /* Specials */ + { 0x6e, NOCAPS, ',', ','}, + { VK_TAB, NOCAPS, 9, 9}, + { VK_ADD, NOCAPS, '+', '+' }, + { VK_DIVIDE, NOCAPS, '/', '/' }, + { VK_MULTIPLY, NOCAPS, '*', '*' }, + { VK_SUBTRACT, NOCAPS, '-', '-' }, + { 0, 0 } +}; + +ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { + /* Normal, Shifted, Ctrl */ + /* Legacy (telnet-style) ascii escapes */ + { VK_OEM_5, NOCAPS, 0x5c,0x2f, 0x1c }, + { VK_OEM_102, NOCAPS, 0x5c,0x2f, 0x1c }, + { VK_BACK, NOCAPS, 0x8, 0x8, 0x7f }, + { VK_ESCAPE, NOCAPS, 0x1b, 0x1b, 0x1b }, + { VK_RETURN,NOCAPS, '\r', '\r', '\n' }, + { VK_SPACE, NOCAPS, ' ', ' ', ' ' }, + { VK_CANCEL, NOCAPS, 0x03, 0x03, 0x03 }, + { 0,0 } +}; + +ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { + /* Normal, Shifted, Ctrl, Ctrl-Alt */ + /* Legacy Ascii generators */ + { '2', NOCAPS, '2', '\"', WCH_NONE,0}, + { '6', NOCAPS, '6', ':', WCH_NONE,0x001e}, + { VK_OEM_MINUS, NOCAPS, 0x2d, '_', WCH_NONE, 0x001f}, // different '-' + { 0, 0 } +}; + +ROSDATA VK_TO_WCHARS1 keypad_numbers[] = { + { VK_NUMPAD0, 0, '0' }, + { VK_NUMPAD1, 0, '1' }, + { VK_NUMPAD2, 0, '2' }, + { VK_NUMPAD3, 0, '3' }, + { VK_NUMPAD4, 0, '4' }, + { VK_NUMPAD5, 0, '5' }, + { VK_NUMPAD6, 0, '6' }, + { VK_NUMPAD7, 0, '7' }, + { VK_NUMPAD8, 0, '8' }, + { VK_NUMPAD9, 0, '9' }, + { 0,0 } +}; + +#define vk_master(n,x) { (PVK_TO_WCHARS1)x, n, sizeof(x[0]) } + +ROSDATA VK_TO_WCHAR_TABLE vk_to_wchar_master_table[] = { + vk_master(3,key_to_chars_3mod), + vk_master(4,key_to_chars_4mod), + vk_master(2,key_to_chars_2mod), + vk_master(1,keypad_numbers), + { 0,0,0 } +}; + +ROSDATA VSC_LPWSTR key_names[] = { + { 0x01, L"Esc" }, + { 0x0e, L"Backspace" }, + { 0x0f, L"Tab" }, + { 0x1c, L"Enter" }, + { 0x1d, L"Ctrl" }, + { 0x2a, L"Shift" }, + { 0x36, L"Right Shift" }, + { 0x37, L"Num *" }, + { 0x38, L"Alt" }, + { 0x39, L"Space" }, + { 0x3a, L"Caps Lock" }, + { 0x3b, L"F1" }, + { 0x3c, L"F2" }, + { 0x3d, L"F3" }, + { 0x3e, L"F4" }, + { 0x3f, L"F5" }, + { 0x40, L"F6" }, + { 0x41, L"F7" }, + { 0x42, L"F8" }, + { 0x43, L"F9" }, + { 0x44, L"F10" }, + { 0x45, L"Pause" }, + { 0x46, L"Scroll Lock" }, + { 0x47, L"Num 7" }, + { 0x48, L"Num 8" }, + { 0x49, L"Num 9" }, + { 0x4a, L"Num -" }, + { 0x4b, L"Num 4" }, + { 0x4c, L"Num 5" }, + { 0x4d, L"Num 6" }, + { 0x4e, L"Num +" }, + { 0x4f, L"Num 1" }, + { 0x50, L"Num 2" }, + { 0x51, L"Num 3" }, + { 0x52, L"Num 0" }, + { 0x53, L"Num Del" }, + { 0x54, L"Sys Req" }, + { 0x57, L"F11" }, + { 0x58, L"F12" }, + { 0x7c, L"F13" }, + { 0x7d, L"F14" }, + { 0x7e, L"F15" }, + { 0x7f, L"F16" }, + { 0x80, L"F17" }, + { 0x81, L"F18" }, + { 0x82, L"F19" }, + { 0x83, L"F20" }, + { 0x84, L"F21" }, + { 0x85, L"F22" }, + { 0x86, L"F23" }, + { 0x87, L"F24" }, + { 0, NULL } +}; + +ROSDATA VSC_LPWSTR extended_key_names[] = { + { 0x1c, L"Num Enter" }, + { 0x1d, L"Right Control" }, + { 0x35, L"Num /" }, + { 0x37, L"Prnt Scrn" }, + { 0x38, L"Right Alt" }, + { 0x45, L"Num Lock" }, + { 0x46, L"Break" }, + { 0x47, L"Home" }, + { 0x48, L"Up" }, + { 0x49, L"Page Up" }, + { 0x4b, L"Left" }, +//{ 0x4c, L"Center" }, + { 0x4d, L"Right" }, + { 0x4f, L"End" }, + { 0x50, L"Down" }, + { 0x51, L"Page Down" }, + { 0x52, L"Insert" }, + { 0x53, L"Delete" }, + { 0x54, L"" }, + { 0x56, L"Help" }, + { 0x5b, L"Left " }, + { 0x5c, L"Right " }, + { 0x5d, L"Application" }, + { 0, NULL } +}; + +/* Finally, the master table */ +ROSDATA KBDTABLES keyboard_layout_table = { + /* modifier assignments */ + (PMODIFIERS)&modifier_bits, + + /* character from vk tables */ + vk_to_wchar_master_table, + + /* diacritical marks */ + NULL, + + /* Key names */ + (VSC_LPWSTR *)key_names, + (VSC_LPWSTR *)extended_key_names, + NULL, /* Dead key names */ + + /* scan code to virtual key maps */ + scancode_to_vk, + sizeof(scancode_to_vk) / sizeof(scancode_to_vk[0]), + extcode0_to_vk, + extcode1_to_vk, + + MAKELONG(0,1), /* Version 1.0 */ + + /* Ligatures -- Russian doesn't have any */ + 0, + 0, + NULL +}; + +PKBDTABLES STDCALL KbdLayerDescriptor() { + return &keyboard_layout_table; +} + +INT STDCALL +DllMain( + PVOID hinstDll, + ULONG dwReason, + PVOID reserved) +{ + return 1; +} + diff --git a/reactos/lib/kbdru/kbdru.def b/reactos/lib/kbdru/kbdru.def new file mode 100644 index 00000000000..a0984619bec --- /dev/null +++ b/reactos/lib/kbdru/kbdru.def @@ -0,0 +1,8 @@ +; +; ReactOS Operating System +; +LIBRARY kbdru.dll + +EXPORTS +KbdLayerDescriptor@0 +;EOF diff --git a/reactos/lib/kbdru/kbdru.rc b/reactos/lib/kbdru/kbdru.rc new file mode 100644 index 00000000000..ad2fefc8d82 --- /dev/null +++ b/reactos/lib/kbdru/kbdru.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS RU Keyboard Layout\0" +#define REACTOS_STR_INTERNAL_NAME "kbdru\0" +#define REACTOS_STR_ORIGINAL_FILENAME "kbdru.dll\0" +#include diff --git a/reactos/lib/kbdru/makefile b/reactos/lib/kbdru/makefile new file mode 100644 index 00000000000..035ed931f66 --- /dev/null +++ b/reactos/lib/kbdru/makefile @@ -0,0 +1,39 @@ +# $Id: makefile 12852 2005-01-06 13:58:04Z mf $ + +PATH_TO_TOP = ../.. + +TARGET_TYPE = dynlink + +TARGET_NAME = kbdru + +TARGET_BASE = 0x5500000 + +TARGET_CFLAGS = -I$(PATH_TO_TOP)/ntoskrnl/include + +# require os code to explicitly request A/W version of structs/functions +TARGET_CFLAGS += -D_DISABLE_TIDENTS + +TARGET_LFLAGS = -nostartfiles -nostdlib + +TARGET_SDKLIBS = + +TARGET_GCCLIBS = gcc + +TARGET_PCH = + +TARGET_CLEAN = + +TARGET_OBJECTS = kbdru.o + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +include $(TOOLS_PATH)/depend.mk + +%/TAGS: + etags -o $(@D)/TAGS $(@D)/\*.c + +etags: ./TAGS diff --git a/reactos/lib/kbdsg/Jamfile b/reactos/lib/kbdsg/Jamfile new file mode 100644 index 00000000000..77d7ba3877b --- /dev/null +++ b/reactos/lib/kbdsg/Jamfile @@ -0,0 +1,15 @@ +SubDir ROS_TOP lib kbdsg ; + +# This stuff should actually be moved to Jamrules +# in order to more easily support other compilers +CCFLAGS += -Wall -fno-builtin ; + +# NOTE - I'm no Jam expert, yet. This stuff should be +# abstracted into the Jamrules file. +LINKFLAGS = -nostartfiles -nostdlib -shared ; +LINKFLAGS += -Wl,--image-base,0x77F00000 -lgcc ; + +SRCS = kbdsg + +SharedLibrary kbdsg : $(SRCS) ; +LINKLIBS = ; diff --git a/reactos/lib/kbdsg/kbdsg.c b/reactos/lib/kbdsg/kbdsg.c new file mode 100644 index 00000000000..d95765677c3 --- /dev/null +++ b/reactos/lib/kbdsg/kbdsg.c @@ -0,0 +1,529 @@ +/* + * ReactOS German (Switzerland) ASCII Keyboard layout + * Copyright (C) 2005 ReactOS + * License: LGPL, see: LGPL.txt + * + * Thanks to: http://www.barcodeman.com/altek/mule/scandoc.php + * and http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html + * and http://www.unicode.org/charts/ + */ + + +#include +#include + +#ifdef _M_IA64 +#define ROSDATA static __declspec(allocate(".data")) +#else +#pragma data_seg(".data") +#define ROSDATA static +#endif + +#define VK_EMPTY 0xff /* The non-existent VK */ +#define KSHIFT 0x001 /* Shift modifier */ +#define KCTRL 0x002 /* Ctrl modifier */ +#define KALT 0x004 /* Alt modifier */ +#define KEXT 0x100 /* Extended key code */ +#define KMULTI 0x200 /* Multi-key */ +#define KSPEC 0x400 /* Special key */ +#define KNUMP 0x800 /* Number-pad */ +#define KNUMS 0xc00 /* Special + number pad */ +#define KMEXT 0x300 /* Multi + ext */ + +#define SHFT_INVALID 0x0F + +/* Thanks to http://asp.flaaten.dk/pforum/keycode/keycode.htm */ +#ifndef VK_OEM_1 +#define VK_OEM_1 0xba +#endif +#ifndef VK_OEM_PLUS +#define VK_OEM_PLUS 0xbb /* actually this is ¨ ! ] on the Swiss German Keyboard */ +#endif +#ifndef VK_OEM_COMMA +#define VK_OEM_COMMA 0xbc +#endif +#ifndef VK_OEM_MINUS +#define VK_OEM_MINUS 0xbd +#endif +#ifndef VK_OEM_PERIOD +#define VK_OEM_PERIOD 0xbe +#endif +#ifndef VK_OEM_2 +#define VK_OEM_2 0xbf +#endif +#ifndef VK_OEM_3 +#define VK_OEM_3 0xc0 +#endif +#ifndef VK_OEM_4 +#define VK_OEM_4 0xdb +#endif +#ifndef VK_OEM_5 +#define VK_OEM_5 0xdc +#endif +#ifndef VK_OEM_6 +#define VK_OEM_6 0xdd +#endif +#ifndef VK_OEM_7 +#define VK_OEM_7 0xde +#endif +#ifndef VK_OEM_8 +#define VK_OEM_8 0xdf +#endif +#ifndef VK_OEM_102 +#define VK_OEM_102 0xe1 +#endif + +ROSDATA USHORT scancode_to_vk[] = { + /* Numbers Row */ + /* - 00 - */ + /* 1 ... 2 ... 3 ... 4 ... */ + VK_EMPTY, VK_ESCAPE, '1', '2', + '3', '4', '5', '6', + '7', '8', '9', '0', + VK_OEM_4, VK_OEM_6, VK_BACK, + /* - 0f - */ + /* First Letters Row */ + VK_TAB, 'Q', 'W', 'E', + 'R', 'T', 'Z', 'U', + 'I', 'O', 'P', + VK_OEM_1, VK_OEM_PLUS, VK_RETURN, + /* - 1d - */ + /* Second Letters Row */ + VK_LCONTROL, + 'A', 'S', 'D', 'F', + 'G', 'H', 'J', 'K', + 'L', VK_OEM_3, VK_OEM_7, VK_OEM_5, + /* - 2c - */ + /* Third letters row */ + VK_LSHIFT, VK_OEM_2, + 'Y', 'X', 'C', 'V', + 'B', 'N', 'M', VK_OEM_COMMA, + VK_OEM_PERIOD, VK_OEM_MINUS, VK_RSHIFT, + /* - 37 - */ + /* Bottom Row */ + VK_MULTIPLY, VK_LMENU, VK_SPACE, VK_CAPITAL, + + /* - 3b - */ + /* F-Keys */ + VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, + VK_F7, VK_F8, VK_F9, VK_F10, + /* - 45 - */ + /* Locks */ + VK_NUMLOCK | KMEXT, + VK_SCROLL | KMULTI, + /* - 47 - */ + /* Number-Pad */ + VK_HOME | KNUMS, VK_UP | KNUMS, VK_PRIOR | KNUMS, VK_SUBTRACT, + VK_LEFT | KNUMS, VK_CLEAR | KNUMS, VK_RIGHT | KNUMS, VK_ADD, + VK_END | KNUMS, VK_DOWN | KNUMS, VK_NEXT | KNUMS, + VK_INSERT | KNUMS, VK_DELETE | KNUMS, + /* - 54 - */ + /* Presumably PrtSc */ + VK_SNAPSHOT, + /* - 55 - */ + /* Oddities, and the remaining standard F-Keys */ + VK_EMPTY, VK_OEM_102, VK_F11, VK_F12, + /* - 59 - */ + VK_CLEAR, VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, /* EREOF */ + VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, /* ZOOM */ + VK_HELP, + /* - 64 - */ + /* Even more F-Keys (for example, NCR keyboards from the early 90's) */ + VK_F13, VK_F14, VK_F15, VK_F16, VK_F17, VK_F18, VK_F19, VK_F20, + VK_F21, VK_F22, VK_F23, + /* - 6f - */ + /* Not sure who uses these codes */ + VK_EMPTY, VK_EMPTY, VK_EMPTY, + /* - 72 - */ + VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, + /* - 76 - */ + /* One more f-key */ + VK_F24, + /* - 77 - */ + VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, + VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, /* PA1 */ + VK_EMPTY, + /* - 80 - */ + 0 +}; + +ROSDATA VSC_VK extcode0_to_vk[] = { + { 0x10, VK_MEDIA_PREV_TRACK | KEXT }, + { 0x19, VK_MEDIA_NEXT_TRACK | KEXT }, + { 0x1D, VK_RCONTROL | KEXT }, + { 0x20, VK_VOLUME_MUTE | KEXT }, + { 0x21, VK_LAUNCH_APP2 | KEXT }, + { 0x22, VK_MEDIA_PLAY_PAUSE | KEXT }, + { 0x24, VK_MEDIA_STOP | KEXT }, + { 0x2E, VK_VOLUME_DOWN | KEXT }, + { 0x30, VK_VOLUME_UP | KEXT }, + { 0x32, VK_BROWSER_HOME | KEXT }, + { 0x35, VK_DIVIDE | KEXT }, + { 0x37, VK_SNAPSHOT | KEXT }, + { 0x38, VK_RMENU | KEXT }, + { 0x47, VK_HOME | KEXT }, + { 0x48, VK_UP | KEXT }, + { 0x49, VK_PRIOR | KEXT }, + { 0x4B, VK_LEFT | KEXT }, + { 0x4D, VK_RIGHT | KEXT }, + { 0x4F, VK_END | KEXT }, + { 0x50, VK_DOWN | KEXT }, + { 0x51, VK_NEXT | KEXT }, + { 0x52, VK_INSERT | KEXT }, + { 0x53, VK_DELETE | KEXT }, + { 0x5B, VK_LWIN | KEXT }, + { 0x5C, VK_RWIN | KEXT }, + { 0x5D, VK_APPS | KEXT }, + { 0x5F, VK_SLEEP | KEXT }, + { 0x65, VK_BROWSER_SEARCH | KEXT }, + { 0x66, VK_BROWSER_FAVORITES | KEXT }, + { 0x67, VK_BROWSER_REFRESH | KEXT }, + { 0x68, VK_BROWSER_STOP | KEXT }, + { 0x69, VK_BROWSER_FORWARD | KEXT }, + { 0x6A, VK_BROWSER_BACK | KEXT }, + { 0x6B, VK_LAUNCH_APP1 | KEXT }, + { 0x6C, VK_LAUNCH_MAIL | KEXT }, + { 0x6D, VK_LAUNCH_MEDIA_SELECT | KEXT }, + { 0x1C, VK_RETURN | KEXT }, + { 0x46, VK_CANCEL | KEXT }, + { 0, 0 }, +}; + +ROSDATA VSC_VK extcode1_to_vk[] = { + { 0x1d, VK_PAUSE}, + { 0, 0 }, +}; + +ROSDATA VK_TO_BIT modifier_keys[] = { + { VK_SHIFT, KSHIFT }, + { VK_CONTROL, KCTRL }, + { VK_MENU, KALT }, + { 0, 0 } +}; + +typedef struct _mymod { + PVOID mod_keys; + WORD maxmod; + BYTE mod_max[7]; +} INTERNAL_KBD_MODIFIERS; + +ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { + modifier_keys, + 6, + { 0, 1, 3, 4, SHFT_INVALID, SHFT_INVALID, 2 } /* Modifier bit order, NONE, SHIFT, CTRL, ALT, MENU, SHIFT + MENU, CTRL + MENU */ +}; + + +/* ############################################ */ +/* ############################################ */ +/* ############################################ */ +/* ############################################ */ +/* ############################################ */ + +#define NOCAPS 0 +#define CAPS KSHIFT /* Caps -> shift */ + +ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { + { VK_OEM_5, NOCAPS, 0xa7, 0xb0}, /* § ° */ + + /* Normal vs Shifted */ + /* The numbers */ + /* Ctrl-2 generates NUL */ + { 0xff, NOCAPS, 0xa7, 0x9B }, /* what is this for? */ + { '4', NOCAPS, '4', 0xE7 }, + { '5', NOCAPS, '5', '%' }, + { '9', NOCAPS, '9', ')' }, + { '0', NOCAPS, '0', '=' }, + + /* First letter row */ + { 'W', CAPS, 'w', 'W' }, + { 'R', CAPS, 'r', 'R' }, + { 'T', CAPS, 't', 'T' }, + { 'Z', CAPS, 'z', 'Z' }, + { 'U', CAPS, 'u', 'U' }, + { 'I', CAPS, 'i', 'I' }, + { 'O', CAPS, 'o', 'O' }, + { 'P', CAPS, 'p', 'P' }, + /* Second letter row */ + { 'A', CAPS, 'a', 'A' }, + { 'S', CAPS, 's', 'S' }, + { 'D', CAPS, 'd', 'D' }, + { 'F', CAPS, 'f', 'F' }, + { 'G', CAPS, 'g', 'G' }, + { 'H', CAPS, 'h', 'H' }, + { 'J', CAPS, 'j', 'J' }, + { 'K', CAPS, 'k', 'K' }, + { 'L', CAPS, 'l', 'L' }, + /* Third letter row */ + { 'Y', CAPS, 'y', 'Y' }, + { 'X', CAPS, 'x', 'X' }, + { 'V', CAPS, 'v', 'V' }, + { 'B', CAPS, 'b', 'B' }, + { 'N', CAPS, 'n', 'N' }, + + /* Specials */ + { VK_OEM_COMMA, NOCAPS, ',', ';' }, + { VK_OEM_PERIOD, NOCAPS, '.', ':' }, + { VK_OEM_MINUS, NOCAPS, '-', '_' }, + { VK_DECIMAL, NOCAPS, '.', '.' }, + { VK_TAB, NOCAPS, '\t', '\t' }, + { VK_ADD, NOCAPS, '+', '+' }, + { VK_DIVIDE, NOCAPS, 0x2f, 0x2f }, /* '/' */ + { VK_MULTIPLY, NOCAPS, '*', '*' }, + { VK_SUBTRACT, NOCAPS, '-', '-' }, + { 0, 0 } +}; + +ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { + /* Normal, Shifted, Alt Gr */ + /* Legacy (telnet-style) ascii escapes */ + { VK_OEM_4, NOCAPS, '\'' , '?' , WCH_DEAD }, /* ' ? ´ */ + { 0xff, NOCAPS, WCH_NONE, WCH_NONE, 0xb4 }, + { 'Q', CAPS, 'q', 'Q', '@' }, + { 'C', CAPS, 'c', 'C', 0xa9}, /* c C Copyright-Sign */ + { 'E', CAPS, 'e', 'E', 0x20ac }, /* e E € */ + { 'M', CAPS, 'm', 'M', 0xb5 }, /* m M mu-Sign */ + { VK_OEM_102, NOCAPS, '<', '>', '\\' }, + { 0,0 } +}; + +ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { + /* Normal, Shifted, Alt Gr, C-S-x */ + /* Legacy Ascii generators */ + { VK_BACK, NOCAPS, '\b', '\b', WCH_NONE, 0x7f }, + { VK_ESCAPE, NOCAPS, 0x1b, 0x1b, WCH_NONE, 0x1b }, + { VK_RETURN, NOCAPS, '\r', '\r', WCH_NONE, '\n' }, + { VK_SPACE, NOCAPS, ' ', ' ', WCH_NONE, ' ' }, + { VK_CANCEL, NOCAPS, 0x03, 0x03, WCH_NONE, 0x03 }, + { 0, 0 } +}; + +ROSDATA VK_TO_WCHARS5 key_to_chars_5mod[] = { + /* Normal, Shifted, Alt Gr, Ctrl */ + { '1', NOCAPS, '1', '+', '|', WCH_NONE, 0x00 }, + { '2', NOCAPS, '2', '\"', '@', WCH_NONE, 0x00 }, + { '3', NOCAPS, '3', '*', '#', WCH_NONE, 0x00 }, + { '6', NOCAPS, '6', '&', 0xac, WCH_NONE, 0x00 }, + { '7', NOCAPS, '7', '/', 0xa6, WCH_NONE, 0x00 }, + { '8', NOCAPS, '8', '(', 0xa2, WCH_NONE, 0x00 }, + { VK_OEM_1, KCTRL, 0xfc, 0xe8, 0x5b, 0Xdc, 0xc8 }, /* ü è [ Ü È */ + { VK_OEM_2, NOCAPS, 0x24, 0xa3, 0x7d, WCH_NONE, 0x00 }, /* $ £ } */ + { VK_OEM_3, KCTRL, 0xf6, 0xe9, WCH_NONE, 0xd6, 0xc9 }, /* ö é Ö É*/ + { VK_OEM_6, NOCAPS, WCH_DEAD, WCH_DEAD, WCH_DEAD, WCH_NONE, 0x00 }, /* ^ ` ~ */ + { 0xff, NOCAPS, 0x5e , 0x27 , 0x7e , WCH_NONE, 0x00 }, + { VK_OEM_7, KCTRL, 0xe4, 0xe0, 0x7b, 0xc4, 0xc0 }, /* ä à { Ä À */ + { VK_OEM_PLUS, NOCAPS, WCH_DEAD, 0x21 , 0x5D , WCH_NONE, 0x00 }, /* ¨ ! ] */ + { 0xff, NOCAPS, 0xa8 , WCH_NONE, WCH_NONE, WCH_NONE, 0x00 }, + { 0, 0 } +}; + +ROSDATA VK_TO_WCHARS1 keypad_numbers[] = { + { VK_DECIMAL, 0, '.' }, /* I have no idea why this has to be like this. Shouldn't it be a "."? */ + { VK_NUMPAD0, 0, '0' }, + { VK_NUMPAD1, 0, '1' }, + { VK_NUMPAD2, 0, '2' }, + { VK_NUMPAD3, 0, '3' }, + { VK_NUMPAD4, 0, '4' }, + { VK_NUMPAD5, 0, '5' }, + { VK_NUMPAD6, 0, '6' }, + { VK_NUMPAD7, 0, '7' }, + { VK_NUMPAD8, 0, '8' }, + { VK_NUMPAD9, 0, '9' }, +// { VK_BACK, 0, '\010' }, + { 0,0 } +}; + +#define vk_master(n,x) { (PVK_TO_WCHARS1)x, n, sizeof(x[0]) } + +ROSDATA VK_TO_WCHAR_TABLE vk_to_wchar_master_table[] = { + vk_master(3,key_to_chars_3mod), + vk_master(4,key_to_chars_4mod), + vk_master(5,key_to_chars_5mod), + vk_master(2,key_to_chars_2mod), + vk_master(1,keypad_numbers), + { 0,0,0 } +}; + +ROSDATA VSC_LPWSTR key_names[] = { + { 0x00, L"" }, + { 0x01, L"Esc" }, + { 0x0e, L"R\x00fc" L"ck" }, + { 0x0f, L"Tabulator" }, + { 0x1c, L"Eingabe" }, + { 0x1d, L"Ctrl" }, + { 0x2a, L"Umschalt Links" }, + { 0x36, L"Umschalt Rechts" }, + { 0x37, L" (Zehnertastatur)" }, + { 0x38, L"Alt" }, + { 0x39, L"Leer" }, + { 0x3a, L"Caps Lock" }, + { 0x3b, L"F1" }, + { 0x3c, L"F2" }, + { 0x3d, L"F3" }, + { 0x3e, L"F4" }, + { 0x3f, L"F5" }, + { 0x40, L"F6" }, + { 0x41, L"F7" }, + { 0x42, L"F8" }, + { 0x43, L"F9" }, + { 0x44, L"F10" }, + { 0x45, L"Pause" }, + { 0x46, L"Rollen-Feststell" }, + { 0x47, L"7 (Zehnertastatur)" }, + { 0x48, L"8 (Zehnertastatur)" }, + { 0x49, L"9 (Zehnertastatur)" }, + { 0x4a, L"- (Zehnertastatur)" }, + { 0x4b, L"4 (Zehnertastatur)" }, + { 0x4c, L"5 (Zehnertastatur)" }, + { 0x4d, L"6 (Zehnertastatur)" }, + { 0x4e, L"+ (Zehnertastatur)" }, + { 0x4f, L"1 (Zehnertastatur)" }, + { 0x50, L"2 (Zehnertastatur)" }, + { 0x51, L"3 (Zehnertastatur)" }, + { 0x52, L"0 (Zehnertastatur)" }, + { 0x53, L"Punkt (Zehnertastatur)" }, + { 0x54, L"Sys Req" }, + { 0x57, L"F11" }, + { 0x58, L"F12" }, + { 0x7c, L"F13" }, + { 0x7d, L"F14" }, + { 0x7e, L"F15" }, + { 0x7f, L"F16" }, + { 0x80, L"F17" }, + { 0x81, L"F18" }, + { 0x82, L"F19" }, + { 0x83, L"F20" }, + { 0x84, L"F21" }, + { 0x85, L"F22" }, + { 0x86, L"F23" }, + { 0x87, L"F24" }, + { 0, NULL }, +}; + +ROSDATA VSC_LPWSTR extended_key_names[] = { + { 0x1c, L"Eingabe (Zehnertastatur" }, + { 0x1d, L"Strg-Rechts" }, + { 0x35, L" (Zehnertastatur)" }, + { 0x37, L"Druck" }, + { 0x38, L"Alt Gr" }, + { 0x45, L"Num-Feststell" }, + { 0x46, L"Untbr" }, + { 0x47, L"Pos1" }, + { 0x48, L"Nach-Oben" }, + { 0x49, L"Bild-Nach-Oben" }, + { 0x4b, L"Nach-Links" }, +//{ 0x4c, L"Center" }, + { 0x4d, L"Nach-Rechts" }, + { 0x4f, L"Ende" }, + { 0x50, L"Nach-Unten" }, + { 0x51, L"Bild-Nach-Unten" }, + { 0x52, L"Einfg" }, + { 0x53, L"Entf" }, + { 0x54, L"" }, + { 0x55, L"Hilfe" }, + { 0x56, L"Linke " }, + { 0x5b, L"Rechte " }, + { 0, NULL }, +}; + +ROSDATA DEADKEY_LPWSTR dead_key_names[] = { + L"\x00b4" L"Akut", + L"`" L"Gravis", + L"^" L"Zirkumflex", + NULL +}; + +#define DEADTRANS(ch, accent, comp, flags) MAKELONG(ch, accent), comp, flags + +ROSDATA DEADKEY dead_key[] = { + { DEADTRANS(L'a', L'^', 0xe2, 0x00) },/* ^ */ + { DEADTRANS(L'e', L'^', 0xea, 0x00) }, + { DEADTRANS(L'i', L'^', 0xee, 0x00) }, + { DEADTRANS(L'o', L'^', 0xf4, 0x00) }, + { DEADTRANS(L'u', L'^', 0xfb, 0x00) }, + { DEADTRANS(L'A', L'^', 0xc2, 0x00) }, + { DEADTRANS(L'E', L'^', 0xca, 0x00) }, + { DEADTRANS(L'I', L'^', 0xce, 0x00) }, + { DEADTRANS(L'O', L'^', 0xd4, 0x00) }, + { DEADTRANS(L'U', L'^', 0xdb, 0x00) }, + { DEADTRANS(L' ', L'^', L'^', 0x00) }, + { DEADTRANS(L'a', 0xb4, 0xe1, 0x00) }, /* ´ */ + { DEADTRANS(L'e', 0xb4, 0xe9, 0x00) }, + { DEADTRANS(L'i', 0xb4, 0xed, 0x00) }, + { DEADTRANS(L'o', 0xb4, 0xf3, 0x00) }, + { DEADTRANS(L'u', 0xb4, 0xfa, 0x00) }, + { DEADTRANS(L'y', 0xb4, 0xfd, 0x00) }, + { DEADTRANS(L'A', 0xb4, 0xc1, 0x00) }, + { DEADTRANS(L'E', 0xb4, 0xc9, 0x00) }, + { DEADTRANS(L'I', 0xb4, 0xcd, 0x00) }, + { DEADTRANS(L'O', 0xb4, 0xd3, 0x00) }, + { DEADTRANS(L'U', 0xb4, 0xda, 0x00) }, + { DEADTRANS(L'Y', 0xb4, 0xdd, 0x00) }, + { DEADTRANS(L' ', 0xb4, 0xb4, 0x00) }, + { DEADTRANS(L'a', L'`', 0xe0, 0x00) }, /* ` */ + { DEADTRANS(L'e', L'`', 0xe8, 0x00) }, + { DEADTRANS(L'i', L'`', 0xec, 0x00) }, + { DEADTRANS(L'o', L'`', 0xf2, 0x00) }, + { DEADTRANS(L'u', L'`', 0xf9, 0x00) }, + { DEADTRANS(L'A', L'`', 0xc0, 0x00) }, + { DEADTRANS(L'E', L'`', 0xc8, 0x00) }, + { DEADTRANS(L'I', L'`', 0xcc, 0x00) }, + { DEADTRANS(L'O', L'`', 0xd2, 0x00) }, + { DEADTRANS(L'U', L'`', 0xd9, 0x00) }, + { DEADTRANS(L' ', L'`', L'`', 0x00) }, + { DEADTRANS(L' ', 0xa8, 0xa8, 0x00) }, /* ¨ */ + { DEADTRANS(L'a', 0xa8, 0xe4, 0x00) }, + { DEADTRANS(L'e', 0xa8, 0xeb, 0x00) }, + { DEADTRANS(L'i', 0xa8, 0xef, 0x00) }, + { DEADTRANS(L'o', 0xa8, 0xf6, 0x00) }, + { DEADTRANS(L'u', 0xa8, 0xfc, 0x00) }, + { DEADTRANS(L'y', 0xa8, 0xff, 0x00) }, + { DEADTRANS(L'A', 0xa8, 0xc4, 0x00) }, + { DEADTRANS(L'E', 0xa8, 0xcb, 0x00) }, + { DEADTRANS(L'I', 0xa8, 0xcf, 0x00) }, + { DEADTRANS(L'O', 0xa8, 0xd6, 0x00) }, + { DEADTRANS(L'U', 0xa8, 0xdc, 0x00) }, + { DEADTRANS(L' ', 0x7e, 0x7e, 0x00) }, /* ~ */ + { DEADTRANS(L'a', 0x7e, 0xe3, 0x00) }, + { DEADTRANS(L'o', 0x7e, 0xf5, 0x00) }, + { DEADTRANS(L'n', 0x7e, 0xf1, 0x00) }, + { DEADTRANS(L'A', 0x7e, 0xc3, 0x00) }, + { DEADTRANS(L'O', 0x7e, 0xd5, 0x00) }, + { DEADTRANS(L'N', 0x7e, 0xd1, 0x00) }, + { 0, 0 } +}; + +/* Finally, the master table */ +ROSDATA KBDTABLES keyboard_layout_table = { + /* modifier assignments */ + (PMODIFIERS)&modifier_bits, + + /* character from vk tables */ + vk_to_wchar_master_table, + + /* diacritical marks -- currently implemented by wine code */ + dead_key, + + /* Key names */ + (VSC_LPWSTR *)key_names, + (VSC_LPWSTR *)extended_key_names, + dead_key_names, /* Dead key names */ + + /* scan code to virtual key maps */ + scancode_to_vk, + sizeof(scancode_to_vk) / sizeof(scancode_to_vk[0]), + extcode0_to_vk, + extcode1_to_vk, + + MAKELONG(1,1), /* Version 1.0 */ + + /* Ligatures -- German doesn't have any */ + 0, + 0, + NULL +}; + +PKBDTABLES STDCALL KbdLayerDescriptor() { + return &keyboard_layout_table; +} + diff --git a/reactos/lib/kbdsg/kbdsg.def b/reactos/lib/kbdsg/kbdsg.def new file mode 100644 index 00000000000..529859364c2 --- /dev/null +++ b/reactos/lib/kbdsg/kbdsg.def @@ -0,0 +1,8 @@ +; +; ReactOS Operating System +; +LIBRARY kbdsg.dll + +EXPORTS +KbdLayerDescriptor@0 +;EOF diff --git a/reactos/lib/kbdsg/kbdsg.rc b/reactos/lib/kbdsg/kbdsg.rc new file mode 100644 index 00000000000..68e70ab759e --- /dev/null +++ b/reactos/lib/kbdsg/kbdsg.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS German (Switzerland) Keyboard Layout\0" +#define REACTOS_STR_INTERNAL_NAME "kbdsg\0" +#define REACTOS_STR_ORIGINAL_FILENAME "kbdsg.dll\0" +#include diff --git a/reactos/lib/kbdsg/makefile b/reactos/lib/kbdsg/makefile new file mode 100644 index 00000000000..0103e505e8d --- /dev/null +++ b/reactos/lib/kbdsg/makefile @@ -0,0 +1,41 @@ +# $Id$ + +PATH_TO_TOP = ../.. + +TARGET_TYPE = dynlink + +TARGET_NAME = kbdsg + +TARGET_BASE = 0x5500000 + +TARGET_ENTRY = 0x00000000 + +TARGET_CFLAGS = -I$(PATH_TO_TOP)/ntoskrnl/include + +# require os code to explicitly request A/W version of structs/functions +TARGET_CFLAGS += -D_DISABLE_TIDENTS + +TARGET_LFLAGS = -nostartfiles -nostdlib + +TARGET_SDKLIBS = + +TARGET_GCCLIBS = gcc + +TARGET_PCH = + +TARGET_CLEAN = + +TARGET_OBJECTS = kbdsg.o + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +include $(TOOLS_PATH)/depend.mk + +%/TAGS: + etags -o $(@D)/TAGS $(@D)/\*.c + +etags: ./TAGS diff --git a/reactos/lib/kernel32/file/delete.c b/reactos/lib/kernel32/file/delete.c index b643c844bf2..06b88f1ff00 100644 --- a/reactos/lib/kernel32/file/delete.c +++ b/reactos/lib/kernel32/file/delete.c @@ -66,20 +66,19 @@ DeleteFileW ( DPRINT("NtPathU \'%wZ\'\n", &NtPathU); - ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); - ObjectAttributes.RootDirectory = NULL; - ObjectAttributes.ObjectName = &NtPathU; - ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE| OBJ_INHERIT; - ObjectAttributes.SecurityDescriptor = NULL; - ObjectAttributes.SecurityQualityOfService = NULL; + InitializeObjectAttributes(&ObjectAttributes, + &NtPathU, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); Status = NtCreateFile (&FileHandle, - FILE_WRITE_ATTRIBUTES, + DELETE, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, - 0, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_NON_DIRECTORY_FILE, NULL, diff --git a/reactos/lib/kernel32/file/npipe.c b/reactos/lib/kernel32/file/npipe.c index 3d41ff7efca..b39b2ddbf13 100644 --- a/reactos/lib/kernel32/file/npipe.c +++ b/reactos/lib/kernel32/file/npipe.c @@ -180,7 +180,7 @@ CreateNamedPipeW(LPCWSTR lpName, nMaxInstances = ULONG_MAX; } - DefaultTimeOut.QuadPart = nDefaultTimeOut * -10000; + DefaultTimeOut.QuadPart = nDefaultTimeOut * -10000LL; Status = NtCreateNamedPipeFile(&PipeHandle, DesiredAccess, @@ -273,7 +273,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, return(FALSE); } - WaitPipe.Timeout.QuadPart = nTimeOut * -10000; + WaitPipe.Timeout.QuadPart = nTimeOut * -10000LL; Status = NtFsControlFile(FileHandle, NULL, @@ -428,7 +428,7 @@ SetNamedPipeHandleState(HANDLE hNamedPipe, if (lpCollectDataTimeout != NULL) { - SetState.Timeout.QuadPart = (*lpCollectDataTimeout) * -10000; + SetState.Timeout.QuadPart = (*lpCollectDataTimeout) * -10000LL; } else { diff --git a/reactos/lib/kernel32/locale_rc.rc b/reactos/lib/kernel32/locale_rc.rc index 96006ef68d9..75faf2f7fd1 100644 --- a/reactos/lib/kernel32/locale_rc.rc +++ b/reactos/lib/kernel32/locale_rc.rc @@ -24,16 +24,10 @@ #define LGRPID_RES_BASE 0x2000 -#include "nls/deu.nls" /* 0x0407 LANG_GERMAN, SUBLANG_GERMAN */ -#include "nls/fra.nls" /* 0x040c LANG_FRENCH, SUBLANG_FRENCH */ -#include "nls/enu.nls" /* 0x0409 LANG_ENGLISH, SUBLANG_ENGLISH_US */ -#include "nls/eng.nls" /* 0x0809 LANG_ENGLISH, SUBLANG_ENGLISH_UK */ - /* add languages in numerical order of main language (last two digits) * it is much easier to find the missing holes that way */ -#if 0 //TODO - +#if 0 #include "nls/ara.nls" /* 0x0401 LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA */ #include "nls/ari.nls" /* 0x0801 LANG_ARABIC, SUBLANG_ARABIC_IRAQ */ #include "nls/are.nls" /* 0x0c01 LANG_ARABIC, SUBLANG_ARABIC_EGYPT */ @@ -50,6 +44,7 @@ #include "nls/aru.nls" /* 0x3801 LANG_ARABIC, SUBLANG_ARABIC_UAE */ #include "nls/arh.nls" /* 0x3c01 LANG_ARABIC, SUBLANG_ARABIC_BAHRAIN */ #include "nls/arq.nls" /* 0x4001 LANG_ARABIC, SUBLANG_ARABIC_QATAR */ +#endif #include "nls/bgr.nls" /* 0x0402 LANG_BULGARIAN, SUBLANG_DEFAULT */ @@ -57,9 +52,9 @@ #include "nls/cht.nls" /* 0x0404 LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL */ #include "nls/chs.nls" /* 0x0804 LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED */ -#include "nls/zhh.nls" /* 0x0c04 LANG_CHINESE, SUBLANG_CHINESE_HONGKONG */ +//#include "nls/zhh.nls" /* 0x0c04 LANG_CHINESE, SUBLANG_CHINESE_HONGKONG */ #include "nls/zhi.nls" /* 0x1004 LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE */ -#include "nls/zhm.nls" /* 0x1404 LANG_CHINESE, SUBLANG_CHINESE_MACAU */ +//#include "nls/zhm.nls" /* 0x1404 LANG_CHINESE, SUBLANG_CHINESE_MACAU */ #include "nls/csy.nls" /* 0x0405 LANG_CZECH, SUBLANG_DEFAULT */ @@ -91,7 +86,7 @@ #include "nls/esm.nls" /* 0x080a LANG_SPANISH, SUBLANG_SPANISH_MEXICAN */ #include "nls/esn.nls" /* 0x0c0a LANG_SPANISH, SUBLANG_SPANISH_MODERN */ #include "nls/esg.nls" /* 0x100a LANG_SPANISH, SUBLANG_SPANISH_GUATEMALA */ -#include "nls/esc.nls" /* 0x140a LANG_SPANISH, SUBLANG_SPANISH_COSTA_RICA */ +//#include "nls/esc.nls" /* 0x140a LANG_SPANISH, SUBLANG_SPANISH_COSTA_RICA */ #include "nls/esa.nls" /* 0x180a LANG_SPANISH, SUBLANG_SPANISH_PANAMA */ #include "nls/esd.nls" /* 0x1c0a LANG_SPANISH, SUBLANG_SPANISH_DOMINICAN_REPUBLIC */ #include "nls/esv.nls" /* 0x200a LANG_SPANISH, SUBLANG_SPANISH_VENEZUELA */ @@ -126,9 +121,9 @@ #include "nls/ita.nls" /* 0x0410 LANG_ITALIAN, SUBLANG_ITALIAN */ #include "nls/its.nls" /* 0x0810 LANG_ITALIAN, SUBLANG_ITALIAN_SWISS */ -#include "nls/jpn.nls" /* 0x0411 LANG_JAPANESE, SUBLANG_DEFAULT */ +//#include "nls/jpn.nls" /* 0x0411 LANG_JAPANESE, SUBLANG_DEFAULT */ -#include "nls/kor.nls" /* 0x0412 LANG_KOREAN, SUBLANG_KOREAN */ +//#include "nls/kor.nls" /* 0x0412 LANG_KOREAN, SUBLANG_KOREAN */ #include "nls/nld.nls" /* 0x0413 LANG_DUTCH, SUBLANG_DUTCH */ #include "nls/nlb.nls" /* 0x0813 LANG_DUTCH, SUBLANG_DUTCH_BELGIAN */ @@ -160,7 +155,7 @@ #include "nls/trk.nls" /* 0x041f LANG_TURKISH, SUBLANG_DEFAULT */ -#include "nls/urd.nls" /* 0x0420 LANG_URDU, SUBLANG_URDU_PAKISTAN */ +//#include "nls/urd.nls" /* 0x0420 LANG_URDU, SUBLANG_URDU_PAKISTAN */ #include "nls/ind.nls" /* 0x0421 LANG_INDONESIAN, SUBLANG_DEFAULT */ @@ -174,16 +169,16 @@ #include "nls/lvi.nls" /* 0x0426 LANG_LATVIAN, SUBLANG_DEFAULT */ -#include "nls/lth.nls" /* 0x0427 LANG_LITHUANIAN, SUBLANG_LITHUANIAN */ +//#include "nls/lth.nls" /* 0x0427 LANG_LITHUANIAN, SUBLANG_LITHUANIAN */ -#include "nls/far.nls" /* 0x0429 LANG_FARSI, SUBLANG_DEFAULT */ +//#include "nls/far.nls" /* 0x0429 LANG_FARSI, SUBLANG_DEFAULT */ -#include "nls/vit.nls" /* 0x042a LANG_VIETNAMESE, SUBLANG_DEFAULT */ +//#include "nls/vit.nls" /* 0x042a LANG_VIETNAMESE, SUBLANG_DEFAULT */ -#include "nls/hye.nls" /* 0x042b LANG_ARMENIAN, SUBLANG_DEFAULT */ +//#include "nls/hye.nls" /* 0x042b LANG_ARMENIAN, SUBLANG_DEFAULT */ -#include "nls/azl.nls" /* 0x042c LANG_AZERI, SUBLANG_AZERI_LATIN */ -#include "nls/aze.nls" /* 0x082c LANG_AZERI, SUBLANG_AZERI_CYRILLIC */ +//#include "nls/azl.nls" /* 0x042c LANG_AZERI, SUBLANG_AZERI_LATIN */ +//#include "nls/aze.nls" /* 0x082c LANG_AZERI, SUBLANG_AZERI_CYRILLIC */ #include "nls/euq.nls" /* 0x042d LANG_BASQUE, SUBLANG_DEFAULT */ @@ -191,72 +186,65 @@ #include "nls/afk.nls" /* 0x0436 LANG_AFRIKAANS, SUBLANG_DEFAULT */ -#include "nls/kat.nls" /* 0x0437 LANG_GEORGIAN, SUBLANG_DEFAULT */ +//#include "nls/kat.nls" /* 0x0437 LANG_GEORGIAN, SUBLANG_DEFAULT */ #include "nls/fos.nls" /* 0x0438 LANG_FAEROESE, SUBLANG_DEFAULT */ -#include "nls/hin.nls" /* 0x0439 LANG_HINDI, SUBLANG_DEFAULT */ +//#include "nls/hin.nls" /* 0x0439 LANG_HINDI, SUBLANG_DEFAULT */ #include "nls/msl.nls" /* 0x043e LANG_MALAY, SUBLANG_MALAY_MALAYSIA */ #include "nls/msb.nls" /* 0x083e LANG_MALAY, SUBLANG_MALAY_BRUNEI_DARUSSALAM */ -#include "nls/kkz.nls" /* 0x043f LANG_KAZAK, SUBLANG_DEFAULT */ +//#include "nls/kkz.nls" /* 0x043f LANG_KAZAK, SUBLANG_DEFAULT */ -#include "nls/kyr.nls" /* 0x0440 LANG_KYRGYZ, SUBLANG_DEFAULT */ +//#include "nls/kyr.nls" /* 0x0440 LANG_KYRGYZ, SUBLANG_DEFAULT */ #include "nls/swk.nls" /* 0x0441 LANG_SWAHILI, SUBLANG_DEFAULT */ -#include "nls/uzl.nls" /* 0x0443 LANG_UZBEK, SUBLANG_UZBEK_LATIN */ +//#include "nls/uzl.nls" /* 0x0443 LANG_UZBEK, SUBLANG_UZBEK_LATIN */ #include "nls/uzb.nls" /* 0x0843 LANG_UZBEK, SUBLANG_UZBEK_CYRILLIC */ -#include "nls/ttt.nls" /* 0x0444 LANG_TATAR, SUBLANG_DEFAULT */ +//#include "nls/ttt.nls" /* 0x0444 LANG_TATAR, SUBLANG_DEFAULT */ -#include "nls/pan.nls" /* 0x0446 LANG_PUNJABI, SUBLANG_DEFAULT */ +//#include "nls/pan.nls" /* 0x0446 LANG_PUNJABI, SUBLANG_DEFAULT */ -#include "nls/guj.nls" /* 0x0447 LANG_GUJARATI, SUBLANG_DEFAULT */ +//#include "nls/guj.nls" /* 0x0447 LANG_GUJARATI, SUBLANG_DEFAULT */ -#include "nls/tam.nls" /* 0x0449 LANG_TAMIL, SUBLANG_DEFAULT */ +//#include "nls/tam.nls" /* 0x0449 LANG_TAMIL, SUBLANG_DEFAULT */ -#include "nls/tel.nls" /* 0x044a LANG_TELUGU, SUBLANG_DEFAULT */ +//#include "nls/tel.nls" /* 0x044a LANG_TELUGU, SUBLANG_DEFAULT */ -#include "nls/kan.nls" /* 0x044b LANG_KANNADA, SUBLANG_DEFAULT */ +//#include "nls/kan.nls" /* 0x044b LANG_KANNADA, SUBLANG_DEFAULT */ -#include "nls/mar.nls" /* 0x044e LANG_MARATHI, SUBLANG_DEFAULT */ +//#include "nls/mar.nls" /* 0x044e LANG_MARATHI, SUBLANG_DEFAULT */ -#include "nls/san.nls" /* 0x044f LANG_SANSKRIT, SUBLANG_DEFAULT */ +//#include "nls/san.nls" /* 0x044f LANG_SANSKRIT, SUBLANG_DEFAULT */ -#include "nls/mon.nls" /* 0x0450 LANG_MONGOLIAN, SUBLANG_DEFAULT */ +//#include "nls/mon.nls" /* 0x0450 LANG_MONGOLIAN, SUBLANG_DEFAULT */ #include "nls/glc.nls" /* 0x0456 LANG_GALICIAN, SUBLANG_DEFAULT */ -#include "nls/knk.nls" /* 0x0457 LANG_KONKANI, SUBLANG_DEFAULT */ +//#include "nls/knk.nls" /* 0x0457 LANG_KONKANI, SUBLANG_DEFAULT */ -#include "nls/syr.nls" /* 0x045a LANG_SYRIAC, SUBLANG_DEFAULT */ +//#include "nls/syr.nls" /* 0x045a LANG_SYRIAC, SUBLANG_DEFAULT */ -#include "nls/div.nls" /* 0x0465 LANG_DIVEHI, SUBLANG_DEFAULT */ +//#include "nls/div.nls" /* 0x0465 LANG_DIVEHI, SUBLANG_DEFAULT */ -#endif //TODO - - -#if 0 /* Wine extensions */ -#include "nls/nls.nls" /* 0x0c13 LANG_DUTCH, SUBLANG_DUTCH_SURINAM */ +//#include "nls/nls.nls" /* 0x0c13 LANG_DUTCH, SUBLANG_DUTCH_SURINAM */ -#include "nls/gae.nls" /* 0x043c LANG_GAELIC, SUBLANG_GAELIC */ -#include "nls/gdh.nls" /* 0x083c LANG_GAELIC, SUBLANG_GAELIC_SCOTTISH */ -#include "nls/gdv.nls" /* 0x0c3c LANG_GAELIC, SUBLANG_GAELIC_MANX */ +//#include "nls/gae.nls" /* 0x043c LANG_GAELIC, SUBLANG_GAELIC */ +//#include "nls/gdh.nls" /* 0x083c LANG_GAELIC, SUBLANG_GAELIC_SCOTTISH */ +//#include "nls/gdv.nls" /* 0x0c3c LANG_GAELIC, SUBLANG_GAELIC_MANX */ -#include "nls/eox.nls" /* 0x048f LANG_ESPERANTO, SUBLANG_DEFAULT */ +//#include "nls/eox.nls" /* 0x048f LANG_ESPERANTO, SUBLANG_DEFAULT */ -#include "nls/wal.nls" /* 0x0490 LANG_WALON, SUBLANG_DEFAULT */ +//#include "nls/wal.nls" /* 0x0490 LANG_WALON, SUBLANG_DEFAULT */ -#include "nls/cor.nls" /* 0x0491 LANG_CORNISH, SUBLANG_DEFAULT */ +//#include "nls/cor.nls" /* 0x0491 LANG_CORNISH, SUBLANG_DEFAULT */ -#include "nls/cym.nls" /* 0x0492 LANG_WELSH, SUBLANG_DEFAULT */ - -#include "nls/brf.nls" /* 0x0493 LANG_BRETON, SUBLANG_DEFAULT */ - -#endif +//#include "nls/cym.nls" /* 0x0492 LANG_WELSH, SUBLANG_DEFAULT */ +//#include "nls/brf.nls" /* 0x0493 LANG_BRETON, SUBLANG_DEFAULT */ diff --git a/reactos/lib/kernel32/misc/lang.c b/reactos/lib/kernel32/misc/lang.c index 3d5a0f0b117..f7160ee3a87 100644 --- a/reactos/lib/kernel32/misc/lang.c +++ b/reactos/lib/kernel32/misc/lang.c @@ -23,6 +23,8 @@ //static LCID SystemLocale = MAKELCID(LANG_ENGLISH, SORT_DEFAULT); +//static RTL_CRITICAL_SECTION LocalesListLock; + /****************************************************************************** * @implemented @@ -281,7 +283,7 @@ EnumSystemLocalesA ( /* - * @unimplemented + * @implemented */ BOOL STDCALL @@ -290,8 +292,91 @@ EnumSystemLocalesW ( DWORD dwFlags ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + NTSTATUS result; + HANDLE langKey; + UNICODE_STRING langKeyName; + OBJECT_ATTRIBUTES objectAttributes; + ULONG index, length; + unsigned char fullInfo[sizeof(KEY_VALUE_FULL_INFORMATION)+255*2]; //FIXME: MAX_PATH*2 + PKEY_VALUE_FULL_INFORMATION pFullInfo; + + //TODO: Combine with EnumSystemLocalesA - maybe by having one common part, driven by some + // unicode/non-unicode flag. + + //FIXME: dwFlags is really not used, sorry + + // Check if enum proc is a real one + if (lpLocaleEnumProc == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + // Open language registry key + //FIXME: Should we use critical section here? + + RtlRosInitUnicodeStringFromLiteral(&langKeyName, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\Locale"); + + InitializeObjectAttributes(&objectAttributes, + &langKeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + result = NtOpenKey(&langKey, + KEY_READ, + &objectAttributes); + + if (!NT_SUCCESS(result)) + return result; + + DPRINT1("Registry key succesfully opened\n"); + + length = sizeof(KEY_VALUE_FULL_INFORMATION) + 255*2;//MAX_PATH*sizeof(WCHAR); + pFullInfo = (PKEY_VALUE_FULL_INFORMATION)&fullInfo; + RtlZeroMemory(pFullInfo, length); + + index = 0; + + result = NtEnumerateValueKey(langKey, + index, + KeyValueFullInformation, + pFullInfo, + length, + &length); + + DPRINT1("First enumerate call result=%x\n", result); + while (result != STATUS_NO_MORE_ENTRIES) + { + int i; + WCHAR lpLocale[9]; + + // TODO: Here we should check, in case dwFlags & LCID_INSTALLED is specified, + // if this locale is really installed + // but for now we skip it + + for (i=0; i<8; i++) + lpLocale[i] = pFullInfo->Name[i]; + + lpLocale[8]=0; + + DPRINT1("Locale=%S\n", lpLocale); + + // Call Enum func + if (!lpLocaleEnumProc((LPWSTR)lpLocale)) + break; + + // Zero previous values + RtlZeroMemory(pFullInfo, length); + + index++; + result = NtEnumerateValueKey(langKey, index,KeyValueFullInformation, pFullInfo, length, &length); + } + + NtClose(langKey); + + return STATUS_SUCCESS; } diff --git a/reactos/lib/kernel32/misc/nls.c b/reactos/lib/kernel32/misc/nls.c index 8ecee401051..51bda6d1af8 100755 --- a/reactos/lib/kernel32/misc/nls.c +++ b/reactos/lib/kernel32/misc/nls.c @@ -93,8 +93,10 @@ NlsInit() InitializeObjectAttributes(&ObjectAttributes, &DirName, OBJ_CASE_INSENSITIVE | OBJ_PERMANENT, NULL, NULL); - NtCreateDirectoryObject(&Handle, DIRECTORY_ALL_ACCESS, &ObjectAttributes); - NtClose(Handle); + if (NT_SUCCESS(NtCreateDirectoryObject(&Handle, DIRECTORY_ALL_ACCESS, &ObjectAttributes))) + { + NtClose(Handle); + } /* Setup ANSI code page. */ AnsiCodePage.CodePage = CP_ACP; diff --git a/reactos/lib/kernel32/misc/toolhelp.c b/reactos/lib/kernel32/misc/toolhelp.c index 0ccb5f67da5..e818a53a7bf 100644 --- a/reactos/lib/kernel32/misc/toolhelp.c +++ b/reactos/lib/kernel32/misc/toolhelp.c @@ -1114,8 +1114,8 @@ CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID) PDEBUG_BUFFER HeapDebug, ModuleDebug; PVOID ProcThrdInfo; ULONG ProcThrdInfoSize; - HANDLE hSnapShotSection; NTSTATUS Status; + HANDLE hSnapShotSection = NULL; if(th32ProcessID == 0) { diff --git a/reactos/lib/kernel32/nls/afk.nls b/reactos/lib/kernel32/nls/afk.nls new file mode 100644 index 00000000000..248e2b475eb --- /dev/null +++ b/reactos/lib/kernel32/nls/afk.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Afrikaans + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_AFRIKAANS, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "27" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "27" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0436" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0436" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "nm" + LOCALE_SABBREVCTRYNAME "ZAF" + LOCALE_SABBREVDAYNAME1 "Maan" + LOCALE_SABBREVDAYNAME2 "Dins" + LOCALE_SABBREVDAYNAME3 "Woen" + LOCALE_SABBREVDAYNAME4 "Dond" + LOCALE_SABBREVDAYNAME5 "Vry" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Son" + LOCALE_SABBREVLANGNAME "AFK" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mei" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Des" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "South Africa" + LOCALE_SCURRENCY "R" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Maandag" + LOCALE_SDAYNAME2 "Dinsdag" + LOCALE_SDAYNAME3 "Woensdag" + LOCALE_SDAYNAME4 "Donderdag" + LOCALE_SDAYNAME5 "Vrydag" + LOCALE_SDAYNAME6 "Saterdag" + LOCALE_SDAYNAME7 "Sondag" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "South Africa" + LOCALE_SENGCURRNAME "South African Rand" + LOCALE_SENGLANGUAGE "Afrikaans" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ZAR" + LOCALE_SISO3166CTRYNAME "ZA" + LOCALE_SISO639LANGNAME "af" + LOCALE_SLANGUAGE "Afrikaans" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Januarie" + LOCALE_SMONTHNAME2 "Februarie" + LOCALE_SMONTHNAME3 "Maart" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mei" + LOCALE_SMONTHNAME6 "Junie" + LOCALE_SMONTHNAME7 "Julie" + LOCALE_SMONTHNAME8 "Augustus" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "Desember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Suid Afrika" + LOCALE_SNATIVECURRNAME "Rand" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Afrikaans" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy/MM/dd" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/bel.nls b/reactos/lib/kernel32/nls/bel.nls new file mode 100644 index 00000000000..73f98aee810 --- /dev/null +++ b/reactos/lib/kernel32/nls/bel.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Belarusian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1251) + +STRINGTABLE LANGUAGE LANG_BELARUSIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "375" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1251" + LOCALE_IDEFAULTCODEPAGE "866" + LOCALE_IDEFAULTCOUNTRY "375" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0423" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10007" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "1251" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0423" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "BLR" + LOCALE_SABBREVDAYNAME1 "ïí" + LOCALE_SABBREVDAYNAME2 "à¢" + LOCALE_SABBREVDAYNAME3 "ñð" + LOCALE_SABBREVDAYNAME4 "÷ö" + LOCALE_SABBREVDAYNAME5 "ïò" + LOCALE_SABBREVDAYNAME6 "ñá" + LOCALE_SABBREVDAYNAME7 "íä" + LOCALE_SABBREVLANGNAME "BEL" + LOCALE_SABBREVMONTHNAME1 "Ñòó" + LOCALE_SABBREVMONTHNAME2 "Ëþò" + LOCALE_SABBREVMONTHNAME3 "Ñàê" + LOCALE_SABBREVMONTHNAME4 "Êðà" + LOCALE_SABBREVMONTHNAME5 "Ìàé" + LOCALE_SABBREVMONTHNAME6 "×ýð" + LOCALE_SABBREVMONTHNAME7 "˳ï" + LOCALE_SABBREVMONTHNAME8 "Æí³" + LOCALE_SABBREVMONTHNAME9 "Âåð" + LOCALE_SABBREVMONTHNAME10 "Êàñ" + LOCALE_SABBREVMONTHNAME11 "˳ñ" + LOCALE_SABBREVMONTHNAME12 "Ñíå" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Belarus" + LOCALE_SCURRENCY "ðóá." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ïàíÿäçåëàê" + LOCALE_SDAYNAME2 "à¢òîðàê" + LOCALE_SDAYNAME3 "ñåðàäà" + LOCALE_SDAYNAME4 "÷àöâåð" + LOCALE_SDAYNAME5 "ïÿòí³öà" + LOCALE_SDAYNAME6 "ñóáîòà" + LOCALE_SDAYNAME7 "íÿäçåëÿ" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Belarus" + LOCALE_SENGCURRNAME "Belarusian Ruble" + LOCALE_SENGLANGUAGE "Belarusian" + LOCALE_SGROUPING "3;3" + LOCALE_SINTLSYMBOL "BYR" + LOCALE_SISO3166CTRYNAME "BY" + LOCALE_SISO639LANGNAME "be" + LOCALE_SLANGUAGE "Belarusian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;3" + LOCALE_SMONTHNAME1 "Ñòóäçåíü" + LOCALE_SMONTHNAME2 "Ëþòû" + LOCALE_SMONTHNAME3 "Ñàêàâ³ê" + LOCALE_SMONTHNAME4 "Êðàñàâ³ê" + LOCALE_SMONTHNAME5 "Ìàé" + LOCALE_SMONTHNAME6 "×ýðâåíü" + LOCALE_SMONTHNAME7 "˳ïåíü" + LOCALE_SMONTHNAME8 "Æí³âåíü" + LOCALE_SMONTHNAME9 "Âåðàñåíü" + LOCALE_SMONTHNAME10 "Êàñòðû÷í³ê" + LOCALE_SMONTHNAME11 "˳ñòàïàä" + LOCALE_SMONTHNAME12 "Ñíåæàíü" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Áåëàðóñü" + LOCALE_SNATIVECURRNAME "ðóáåëü" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Áåëàðóñêàÿ" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/bgr.nls b/reactos/lib/kernel32/nls/bgr.nls new file mode 100644 index 00000000000..44d2aac1cad --- /dev/null +++ b/reactos/lib/kernel32/nls/bgr.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Bulgarian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1251) + +STRINGTABLE LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "359" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1251" + LOCALE_IDEFAULTCODEPAGE "866" + LOCALE_IDEFAULTCOUNTRY "359" + LOCALE_IDEFAULTEBCDICCODEPAGE "20420" + LOCALE_IDEFAULTLANGUAGE "0402" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10007" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "1251" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0402" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "BGR" + LOCALE_SABBREVDAYNAME1 "ïîíåäåëíèê" + LOCALE_SABBREVDAYNAME2 "âòîðíèê" + LOCALE_SABBREVDAYNAME3 "ñðÿäà" + LOCALE_SABBREVDAYNAME4 "÷åòâúðòúê" + LOCALE_SABBREVDAYNAME5 "ïåòúê" + LOCALE_SABBREVDAYNAME6 "ñúáîòà" + LOCALE_SABBREVDAYNAME7 "íåäåëÿ" + LOCALE_SABBREVLANGNAME "BGR" + LOCALE_SABBREVMONTHNAME1 "ßíóàðè" + LOCALE_SABBREVMONTHNAME2 "Ôåâðóàðè" + LOCALE_SABBREVMONTHNAME3 "Ìàðò" + LOCALE_SABBREVMONTHNAME4 "Àïðèë" + LOCALE_SABBREVMONTHNAME5 "Ìàé" + LOCALE_SABBREVMONTHNAME6 "Þíè" + LOCALE_SABBREVMONTHNAME7 "Þëè" + LOCALE_SABBREVMONTHNAME8 "Àâãóñò" + LOCALE_SABBREVMONTHNAME9 "Ñåïòåìâðè" + LOCALE_SABBREVMONTHNAME10 "Îêòîìâðè" + LOCALE_SABBREVMONTHNAME11 "Íîåìâðè" + LOCALE_SABBREVMONTHNAME12 "Äåêåìâðè" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Bulgaria" + LOCALE_SCURRENCY "ëâ" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ïîíåäåëíèê" + LOCALE_SDAYNAME2 "âòîðíèê" + LOCALE_SDAYNAME3 "ñðÿäà" + LOCALE_SDAYNAME4 "÷åòâúðòúê" + LOCALE_SDAYNAME5 "ïåòúê" + LOCALE_SDAYNAME6 "ñúáîòà" + LOCALE_SDAYNAME7 "íåäåëÿ" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Bulgaria" + LOCALE_SENGCURRNAME "Bulgarian Lev" + LOCALE_SENGLANGUAGE "Bulgarian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "BGL" + LOCALE_SISO3166CTRYNAME "BG" + LOCALE_SISO639LANGNAME "bg" + LOCALE_SLANGUAGE "Bulgarian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dd MMMM yyyy 'ã.'" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "ßíóàðè" + LOCALE_SMONTHNAME2 "Ôåâðóàðè" + LOCALE_SMONTHNAME3 "Ìàðò" + LOCALE_SMONTHNAME4 "Àïðèë" + LOCALE_SMONTHNAME5 "Ìàé" + LOCALE_SMONTHNAME6 "Þíè" + LOCALE_SMONTHNAME7 "Þëè" + LOCALE_SMONTHNAME8 "Àâãóñò" + LOCALE_SMONTHNAME9 "Ñåïòåìâðè" + LOCALE_SMONTHNAME10 "Îêòîìâðè" + LOCALE_SMONTHNAME11 "Íîåìâðè" + LOCALE_SMONTHNAME12 "Äåêåìâðè" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Áúëãàðèÿ" + LOCALE_SNATIVECURRNAME "ëâ." + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "áúëãàðñêè" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.M.yyyy 'ã.'" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy 'ã.'" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/cat.nls b/reactos/lib/kernel32/nls/cat.nls new file mode 100644 index 00000000000..283c937a6a0 --- /dev/null +++ b/reactos/lib/kernel32/nls/cat.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Catalan + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_CATALAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0003\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "34" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "34" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "040a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0403" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ESP" + LOCALE_SABBREVDAYNAME1 "dl." + LOCALE_SABBREVDAYNAME2 "dt." + LOCALE_SABBREVDAYNAME3 "dc." + LOCALE_SABBREVDAYNAME4 "dj." + LOCALE_SABBREVDAYNAME5 "dv." + LOCALE_SABBREVDAYNAME6 "ds." + LOCALE_SABBREVDAYNAME7 "dg." + LOCALE_SABBREVLANGNAME "CAT" + LOCALE_SABBREVMONTHNAME1 "gen" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "març" + LOCALE_SABBREVMONTHNAME4 "abr" + LOCALE_SABBREVMONTHNAME5 "maig" + LOCALE_SABBREVMONTHNAME6 "juny" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "ag" + LOCALE_SABBREVMONTHNAME9 "set" + LOCALE_SABBREVMONTHNAME10 "oct" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "des" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Spain" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "dilluns" + LOCALE_SDAYNAME2 "dimarts" + LOCALE_SDAYNAME3 "dimecres" + LOCALE_SDAYNAME4 "dijous" + LOCALE_SDAYNAME5 "divendres" + LOCALE_SDAYNAME6 "dissabte" + LOCALE_SDAYNAME7 "diumenge" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Spain" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Catalan" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "ES" + LOCALE_SISO639LANGNAME "ca" + LOCALE_SLANGUAGE "Catalan" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d' / 'MMMM' / 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "gener" + LOCALE_SMONTHNAME2 "febrer" + LOCALE_SMONTHNAME3 "març" + LOCALE_SMONTHNAME4 "abril" + LOCALE_SMONTHNAME5 "maig" + LOCALE_SMONTHNAME6 "juny" + LOCALE_SMONTHNAME7 "juliol" + LOCALE_SMONTHNAME8 "agost" + LOCALE_SMONTHNAME9 "setembre" + LOCALE_SMONTHNAME10 "octubre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "desembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Espanya" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "català" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM' / 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/chs.nls b/reactos/lib/kernel32/nls/chs.nls new file mode 100644 index 00000000000..90dd26a3523 --- /dev/null +++ b/reactos/lib/kernel32/nls/chs.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Chinese (PRC) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(936) + +STRINGTABLE LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +{ +//FIXME LOCALE_FONTSIGNATURE L"\x02af\x8000\x6cf8\x184f\x0010\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0000\x0004\x0000\x0000" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "86" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "936" + LOCALE_IDEFAULTCODEPAGE "936" + LOCALE_IDEFAULTCOUNTRY "86" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0804" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10008" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "936" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0804" + LOCALE_ILDATE "2" + LOCALE_ILZERO "0" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "1" + LOCALE_ITLZERO "0" + LOCALE_S1159 "ÉÏÎç" + LOCALE_S2359 "ÏÂÎç" + LOCALE_SABBREVCTRYNAME "CHN" + LOCALE_SABBREVDAYNAME1 "ÐÇÆÚÒ»" + LOCALE_SABBREVDAYNAME2 "ÐÇÆÚ¶þ" + LOCALE_SABBREVDAYNAME3 "ÐÇÆÚÈý" + LOCALE_SABBREVDAYNAME4 "ÐÇÆÚËÄ" + LOCALE_SABBREVDAYNAME5 "ÐÇÆÚÎå" + LOCALE_SABBREVDAYNAME6 "ÐÇÆÚÁù" + LOCALE_SABBREVDAYNAME7 "ÐÇÆÚÈÕ" + LOCALE_SABBREVLANGNAME "CHS" + LOCALE_SABBREVMONTHNAME1 "Ò»ÔÂ" + LOCALE_SABBREVMONTHNAME2 "¶þÔÂ" + LOCALE_SABBREVMONTHNAME3 "ÈýÔÂ" + LOCALE_SABBREVMONTHNAME4 "ËÄÔÂ" + LOCALE_SABBREVMONTHNAME5 "ÎåÔÂ" + LOCALE_SABBREVMONTHNAME6 "ÁùÔÂ" + LOCALE_SABBREVMONTHNAME7 "ÆßÔÂ" + LOCALE_SABBREVMONTHNAME8 "°ËÔÂ" + LOCALE_SABBREVMONTHNAME9 "¾ÅÔÂ" + LOCALE_SABBREVMONTHNAME10 "Ê®ÔÂ" + LOCALE_SABBREVMONTHNAME11 "ʮһÔÂ" + LOCALE_SABBREVMONTHNAME12 "Ê®¶þÔÂ" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "People's Republic of China" + LOCALE_SCURRENCY "£¤" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "ÐÇÆÚÒ»" + LOCALE_SDAYNAME2 "ÐÇÆÚ¶þ" + LOCALE_SDAYNAME3 "ÐÇÆÚÈý" + LOCALE_SDAYNAME4 "ÐÇÆÚËÄ" + LOCALE_SDAYNAME5 "ÐÇÆÚÎå" + LOCALE_SDAYNAME6 "ÐÇÆÚÁù" + LOCALE_SDAYNAME7 "ÐÇÆÚÈÕ" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "People's Republic of China" + LOCALE_SENGCURRNAME "PRC Yuan Renminbi" + LOCALE_SENGLANGUAGE "Chinese" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CNY" + LOCALE_SISO3166CTRYNAME "CN" + LOCALE_SISO639LANGNAME "zh" + LOCALE_SLANGUAGE "Chinese (PRC)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "yyyy'Äê'M'ÔÂ'd'ÈÕ'" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Ò»ÔÂ" + LOCALE_SMONTHNAME2 "¶þÔÂ" + LOCALE_SMONTHNAME3 "ÈýÔÂ" + LOCALE_SMONTHNAME4 "ËÄÔÂ" + LOCALE_SMONTHNAME5 "ÎåÔÂ" + LOCALE_SMONTHNAME6 "ÁùÔÂ" + LOCALE_SMONTHNAME7 "ÆßÔÂ" + LOCALE_SMONTHNAME8 "°ËÔÂ" + LOCALE_SMONTHNAME9 "¾ÅÔÂ" + LOCALE_SMONTHNAME10 "Ê®ÔÂ" + LOCALE_SMONTHNAME11 "ʮһÔÂ" + LOCALE_SMONTHNAME12 "Ê®¶þÔÂ" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "ÖлªÈËÃñ¹²ºÍ¹ú" + LOCALE_SNATIVECURRNAME "ÈËÃñ±Ò" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "ÖÐÎÄ(¼òÌå)" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy-M-d" + LOCALE_SSORTNAME "Pronunciation" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "yyyy'Äê'M'ÔÂ'" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/cht.nls b/reactos/lib/kernel32/nls/cht.nls new file mode 100644 index 00000000000..378bd6f8c99 --- /dev/null +++ b/reactos/lib/kernel32/nls/cht.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Chinese (Taiwan) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(950) + +STRINGTABLE LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL +{ +//FIXME LOCALE_FONTSIGNATURE L"\x00a3\x8000\x7878\x38c9\x0016\x0000\x0000\x0000\x0000\x0010\x0000\x0000\x0000\x0010\x0000\x0000" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "886" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "950" + LOCALE_IDEFAULTCODEPAGE "950" + LOCALE_IDEFAULTCOUNTRY "886" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0404" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10002" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "950" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0404" + LOCALE_ILDATE "2" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "2" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "1" + LOCALE_ITLZERO "1" + LOCALE_S1159 "¤W¤È" + LOCALE_S2359 "¤U¤È" + LOCALE_SABBREVCTRYNAME "TWN" + LOCALE_SABBREVDAYNAME1 "¬P´Á¤@" + LOCALE_SABBREVDAYNAME2 "¬P´Á¤G" + LOCALE_SABBREVDAYNAME3 "¬P´Á¤T" + LOCALE_SABBREVDAYNAME4 "¬P´Á¥|" + LOCALE_SABBREVDAYNAME5 "¬P´Á¤­" + LOCALE_SABBREVDAYNAME6 "¬P´Á¤»" + LOCALE_SABBREVDAYNAME7 "¬P´Á¤é" + LOCALE_SABBREVLANGNAME "CHT" + LOCALE_SABBREVMONTHNAME1 "¤@¤ë" + LOCALE_SABBREVMONTHNAME2 "¤G¤ë" + LOCALE_SABBREVMONTHNAME3 "¤T¤ë" + LOCALE_SABBREVMONTHNAME4 "¥|¤ë" + LOCALE_SABBREVMONTHNAME5 "¤­¤ë" + LOCALE_SABBREVMONTHNAME6 "¤»¤ë" + LOCALE_SABBREVMONTHNAME7 "¤C¤ë" + LOCALE_SABBREVMONTHNAME8 "¤K¤ë" + LOCALE_SABBREVMONTHNAME9 "¤E¤ë" + LOCALE_SABBREVMONTHNAME10 "¢Ì¤ë" + LOCALE_SABBREVMONTHNAME11 "¢Ì¤@¤ë" + LOCALE_SABBREVMONTHNAME12 "¢Ì¤G¤ë" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Taiwan" + LOCALE_SCURRENCY "NT$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "¬P´Á¤@" + LOCALE_SDAYNAME2 "¬P´Á¤G" + LOCALE_SDAYNAME3 "¬P´Á¤T" + LOCALE_SDAYNAME4 "¬P´Á¥|" + LOCALE_SDAYNAME5 "¬P´Á¤­" + LOCALE_SDAYNAME6 "¬P´Á¤»" + LOCALE_SDAYNAME7 "¬P´Á¤é" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Taiwan" + LOCALE_SENGCURRNAME "New Taiwan Dollar" + LOCALE_SENGLANGUAGE "Chinese" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "TWD" + LOCALE_SISO3166CTRYNAME "TW" + LOCALE_SISO639LANGNAME "zh" + LOCALE_SLANGUAGE "Chinese (Taiwan)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "yyyy'¦~'M'¤ë'd'¤é'" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "¤@¤ë" + LOCALE_SMONTHNAME2 "¤G¤ë" + LOCALE_SMONTHNAME3 "¤T¤ë" + LOCALE_SMONTHNAME4 "¥|¤ë" + LOCALE_SMONTHNAME5 "¤­¤ë" + LOCALE_SMONTHNAME6 "¤»¤ë" + LOCALE_SMONTHNAME7 "¤C¤ë" + LOCALE_SMONTHNAME8 "¤K¤ë" + LOCALE_SMONTHNAME9 "¤E¤ë" + LOCALE_SMONTHNAME10 "¢Ì¤ë" + LOCALE_SMONTHNAME11 "¢Ì¤@¤ë" + LOCALE_SMONTHNAME12 "¢Ì¤G¤ë" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "¥xÆW" + LOCALE_SNATIVECURRNAME "·s¥x¹ô" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "¤¤¤å(ÁcÅé)" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy/M/d" + LOCALE_SSORTNAME "Stroke Count" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "tt hh:mm:ss" + LOCALE_SYEARMONTH "yyyy'¦~'M'¤ë'" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/csy.nls b/reactos/lib/kernel32/nls/csy.nls new file mode 100644 index 00000000000..58b8181420f --- /dev/null +++ b/reactos/lib/kernel32/nls/csy.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Czech + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_CZECH, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "420" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "420" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0405" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0405" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "dop." + LOCALE_S2359 "odp." + LOCALE_SABBREVCTRYNAME "CZE" + LOCALE_SABBREVDAYNAME1 "po" + LOCALE_SABBREVDAYNAME2 "út" + LOCALE_SABBREVDAYNAME3 "st" + LOCALE_SABBREVDAYNAME4 "èt" + LOCALE_SABBREVDAYNAME5 "pá" + LOCALE_SABBREVDAYNAME6 "so" + LOCALE_SABBREVDAYNAME7 "ne" + LOCALE_SABBREVLANGNAME "CSY" + LOCALE_SABBREVMONTHNAME1 "I" + LOCALE_SABBREVMONTHNAME2 "II" + LOCALE_SABBREVMONTHNAME3 "III" + LOCALE_SABBREVMONTHNAME4 "IV" + LOCALE_SABBREVMONTHNAME5 "V" + LOCALE_SABBREVMONTHNAME6 "VI" + LOCALE_SABBREVMONTHNAME7 "VII" + LOCALE_SABBREVMONTHNAME8 "VIII" + LOCALE_SABBREVMONTHNAME9 "IX" + LOCALE_SABBREVMONTHNAME10 "X" + LOCALE_SABBREVMONTHNAME11 "XI" + LOCALE_SABBREVMONTHNAME12 "XII" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Czech Republic" + LOCALE_SCURRENCY "Kè" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "pondìlí" + LOCALE_SDAYNAME2 "úterý" + LOCALE_SDAYNAME3 "støeda" + LOCALE_SDAYNAME4 "ètvrtek" + LOCALE_SDAYNAME5 "pátek" + LOCALE_SDAYNAME6 "sobota" + LOCALE_SDAYNAME7 "nedìle" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Czech Republic" + LOCALE_SENGCURRNAME "Czech Koruna" + LOCALE_SENGLANGUAGE "Czech" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CZK" + LOCALE_SISO3166CTRYNAME "CZ" + LOCALE_SISO639LANGNAME "cs" + LOCALE_SLANGUAGE "Czech" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "leden" + LOCALE_SMONTHNAME2 "únor" + LOCALE_SMONTHNAME3 "bøezen" + LOCALE_SMONTHNAME4 "duben" + LOCALE_SMONTHNAME5 "kvìten" + LOCALE_SMONTHNAME6 "èerven" + LOCALE_SMONTHNAME7 "èervenec" + LOCALE_SMONTHNAME8 "srpen" + LOCALE_SMONTHNAME9 "záøí" + LOCALE_SMONTHNAME10 "øíjen" + LOCALE_SMONTHNAME11 "listopad" + LOCALE_SMONTHNAME12 "prosinec" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Èeská republika" + LOCALE_SNATIVECURRNAME "Koruna Èeská" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "èeština" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/dan.nls b/reactos/lib/kernel32/nls/dan.nls new file mode 100644 index 00000000000..037caa3c9ab --- /dev/null +++ b/reactos/lib/kernel32/nls/dan.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Danish + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_DANISH, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "45" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "45" + LOCALE_IDEFAULTEBCDICCODEPAGE "20277" + LOCALE_IDEFAULTLANGUAGE "0406" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0406" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "12" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "DNK" + LOCALE_SABBREVDAYNAME1 "ma" + LOCALE_SABBREVDAYNAME2 "ti" + LOCALE_SABBREVDAYNAME3 "on" + LOCALE_SABBREVDAYNAME4 "to" + LOCALE_SABBREVDAYNAME5 "fr" + LOCALE_SABBREVDAYNAME6 "lø" + LOCALE_SABBREVDAYNAME7 "sø" + LOCALE_SABBREVLANGNAME "DAN" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "maj" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Denmark" + LOCALE_SCURRENCY "kr" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "mandag" + LOCALE_SDAYNAME2 "tirsdag" + LOCALE_SDAYNAME3 "onsdag" + LOCALE_SDAYNAME4 "torsdag" + LOCALE_SDAYNAME5 "fredag" + LOCALE_SDAYNAME6 "lørdag" + LOCALE_SDAYNAME7 "søndag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Denmark" + LOCALE_SENGCURRNAME "Danish Krone" + LOCALE_SENGLANGUAGE "Danish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "DKK" + LOCALE_SISO3166CTRYNAME "DK" + LOCALE_SISO639LANGNAME "da" + LOCALE_SLANGUAGE "Danish" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januar" + LOCALE_SMONTHNAME2 "februar" + LOCALE_SMONTHNAME3 "marts" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "maj" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "august" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Danmark" + LOCALE_SNATIVECURRNAME "Dansk krone" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "dansk" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd-MM-yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/dea.nls b/reactos/lib/kernel32/nls/dea.nls new file mode 100644 index 00000000000..bb7b04e3009 --- /dev/null +++ b/reactos/lib/kernel32/nls/dea.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for German (Austria) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0093\x0000\x0000\xcdd4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "43" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "43" + LOCALE_IDEFAULTEBCDICCODEPAGE "20273" + LOCALE_IDEFAULTLANGUAGE "0c07" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0c07" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "9" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "AUT" + LOCALE_SABBREVDAYNAME1 "Mo" + LOCALE_SABBREVDAYNAME2 "Di" + LOCALE_SABBREVDAYNAME3 "Mi" + LOCALE_SABBREVDAYNAME4 "Do" + LOCALE_SABBREVDAYNAME5 "Fr" + LOCALE_SABBREVDAYNAME6 "Sa" + LOCALE_SABBREVDAYNAME7 "So" + LOCALE_SABBREVLANGNAME "DEA" + LOCALE_SABBREVMONTHNAME1 "Jän" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mär" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mai" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dez" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Austria" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "Montag" + LOCALE_SDAYNAME2 "Dienstag" + LOCALE_SDAYNAME3 "Mittwoch" + LOCALE_SDAYNAME4 "Donnerstag" + LOCALE_SDAYNAME5 "Freitag" + LOCALE_SDAYNAME6 "Samstag" + LOCALE_SDAYNAME7 "Sonntag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Austria" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "German" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "AT" + LOCALE_SISO639LANGNAME "de" + LOCALE_SLANGUAGE "German (Austria)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, dd. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Jänner" + LOCALE_SMONTHNAME2 "Februar" + LOCALE_SMONTHNAME3 "März" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mai" + LOCALE_SMONTHNAME6 "Juni" + LOCALE_SMONTHNAME7 "Juli" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "Dezember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Österreich" + LOCALE_SNATIVECURRNAME "Euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Deutsch" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/dec.nls b/reactos/lib/kernel32/nls/dec.nls new file mode 100644 index 00000000000..8945277e43d --- /dev/null +++ b/reactos/lib/kernel32/nls/dec.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for German (Liechtenstein) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_LIECHTENSTEIN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0093\x0000\x0000\xcdd4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "41" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "41" + LOCALE_IDEFAULTEBCDICCODEPAGE "20273" + LOCALE_IDEFAULTLANGUAGE "1407" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1407" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "LIE" + LOCALE_SABBREVDAYNAME1 "Mo" + LOCALE_SABBREVDAYNAME2 "Di" + LOCALE_SABBREVDAYNAME3 "Mi" + LOCALE_SABBREVDAYNAME4 "Do" + LOCALE_SABBREVDAYNAME5 "Fr" + LOCALE_SABBREVDAYNAME6 "Sa" + LOCALE_SABBREVDAYNAME7 "So" + LOCALE_SABBREVLANGNAME "DEC" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mrz" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mai" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dez" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Liechtenstein" + LOCALE_SCURRENCY "CHF" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "Montag" + LOCALE_SDAYNAME2 "Dienstag" + LOCALE_SDAYNAME3 "Mittwoch" + LOCALE_SDAYNAME4 "Donnerstag" + LOCALE_SDAYNAME5 "Freitag" + LOCALE_SDAYNAME6 "Samstag" + LOCALE_SDAYNAME7 "Sonntag" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Liechtenstein" + LOCALE_SENGCURRNAME "Swiss Franc" + LOCALE_SENGLANGUAGE "German" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CHF" + LOCALE_SISO3166CTRYNAME "LI" + LOCALE_SISO639LANGNAME "de" + LOCALE_SLANGUAGE "German (Liechtenstein)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Januar" + LOCALE_SMONTHNAME2 "Februar" + LOCALE_SMONTHNAME3 "März" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mai" + LOCALE_SMONTHNAME6 "Juni" + LOCALE_SMONTHNAME7 "Juli" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "Dezember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "'" + LOCALE_SNATIVECTRYNAME "Liechtenstein" + LOCALE_SNATIVECURRNAME "Schweizer Franken" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Deutsch" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "'" + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/del.nls b/reactos/lib/kernel32/nls/del.nls new file mode 100644 index 00000000000..8ff15581e41 --- /dev/null +++ b/reactos/lib/kernel32/nls/del.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for German (Luxembourg) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_LUXEMBOURG +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0093\x0000\x0000\xcdd4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "352" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "352" + LOCALE_IDEFAULTEBCDICCODEPAGE "20273" + LOCALE_IDEFAULTLANGUAGE "1007" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1007" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "LUX" + LOCALE_SABBREVDAYNAME1 "Mo" + LOCALE_SABBREVDAYNAME2 "Di" + LOCALE_SABBREVDAYNAME3 "Mi" + LOCALE_SABBREVDAYNAME4 "Do" + LOCALE_SABBREVDAYNAME5 "Fr" + LOCALE_SABBREVDAYNAME6 "Sa" + LOCALE_SABBREVDAYNAME7 "So" + LOCALE_SABBREVLANGNAME "DEL" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mrz" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mai" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dez" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Luxembourg" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "Montag" + LOCALE_SDAYNAME2 "Dienstag" + LOCALE_SDAYNAME3 "Mittwoch" + LOCALE_SDAYNAME4 "Donnerstag" + LOCALE_SDAYNAME5 "Freitag" + LOCALE_SDAYNAME6 "Samstag" + LOCALE_SDAYNAME7 "Sonntag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Luxembourg" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "German" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "LU" + LOCALE_SISO639LANGNAME "de" + LOCALE_SLANGUAGE "German (Luxembourg)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Januar" + LOCALE_SMONTHNAME2 "Februar" + LOCALE_SMONTHNAME3 "März" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mai" + LOCALE_SMONTHNAME6 "Juni" + LOCALE_SMONTHNAME7 "Juli" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "Dezember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Luxemburg" + LOCALE_SNATIVECURRNAME "Euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Deutsch" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/des.nls b/reactos/lib/kernel32/nls/des.nls new file mode 100644 index 00000000000..992dd0a1bdd --- /dev/null +++ b/reactos/lib/kernel32/nls/des.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for German (Switzerland) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_SWISS +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0093\x0000\x0000\xcdd4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "41" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "41" + LOCALE_IDEFAULTEBCDICCODEPAGE "20273" + LOCALE_IDEFAULTLANGUAGE "0807" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0807" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "CHE" + LOCALE_SABBREVDAYNAME1 "Mo" + LOCALE_SABBREVDAYNAME2 "Di" + LOCALE_SABBREVDAYNAME3 "Mi" + LOCALE_SABBREVDAYNAME4 "Do" + LOCALE_SABBREVDAYNAME5 "Fr" + LOCALE_SABBREVDAYNAME6 "Sa" + LOCALE_SABBREVDAYNAME7 "So" + LOCALE_SABBREVLANGNAME "DES" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mrz" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mai" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dez" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Switzerland" + LOCALE_SCURRENCY "SFr." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "Montag" + LOCALE_SDAYNAME2 "Dienstag" + LOCALE_SDAYNAME3 "Mittwoch" + LOCALE_SDAYNAME4 "Donnerstag" + LOCALE_SDAYNAME5 "Freitag" + LOCALE_SDAYNAME6 "Samstag" + LOCALE_SDAYNAME7 "Sonntag" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Switzerland" + LOCALE_SENGCURRNAME "Swiss Franc" + LOCALE_SENGLANGUAGE "German" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CHF" + LOCALE_SISO3166CTRYNAME "CH" + LOCALE_SISO639LANGNAME "de" + LOCALE_SLANGUAGE "German (Switzerland)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Januar" + LOCALE_SMONTHNAME2 "Februar" + LOCALE_SMONTHNAME3 "März" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mai" + LOCALE_SMONTHNAME6 "Juni" + LOCALE_SMONTHNAME7 "Juli" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "Dezember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "'" + LOCALE_SNATIVECTRYNAME "Schweiz" + LOCALE_SNATIVECURRNAME "Schweizer Franken" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Deutsch" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "'" + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ell.nls b/reactos/lib/kernel32/nls/ell.nls new file mode 100644 index 00000000000..20f4287ec87 --- /dev/null +++ b/reactos/lib/kernel32/nls/ell.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Greek + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1253) + +STRINGTABLE LANGUAGE LANG_GREEK, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x008b\x8000\x3849\x1000\x0000\x0000\x0000\x0000\x0008\x0000\x0000\x1000\x0008\x0000\x0000\x1001" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "30" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1253" + LOCALE_IDEFAULTCODEPAGE "737" + LOCALE_IDEFAULTCOUNTRY "30" + LOCALE_IDEFAULTEBCDICCODEPAGE "20273" + LOCALE_IDEFAULTLANGUAGE "0408" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10006" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28597" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0408" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "ðì" + LOCALE_S2359 "ìì" + LOCALE_SABBREVCTRYNAME "GRC" + LOCALE_SABBREVDAYNAME1 "Äåõ" + LOCALE_SABBREVDAYNAME2 "Ôñé" + LOCALE_SABBREVDAYNAME3 "Ôåô" + LOCALE_SABBREVDAYNAME4 "Ðåì" + LOCALE_SABBREVDAYNAME5 "Ðáñ" + LOCALE_SABBREVDAYNAME6 "Óáâ" + LOCALE_SABBREVDAYNAME7 "Êõñ" + LOCALE_SABBREVLANGNAME "ELL" + LOCALE_SABBREVMONTHNAME1 "Éáí" + LOCALE_SABBREVMONTHNAME2 "Öåâ" + LOCALE_SABBREVMONTHNAME3 "Ìáñ" + LOCALE_SABBREVMONTHNAME4 "Áðñ" + LOCALE_SABBREVMONTHNAME5 "Ìáú" + LOCALE_SABBREVMONTHNAME6 "Éïõí" + LOCALE_SABBREVMONTHNAME7 "Éïõë" + LOCALE_SABBREVMONTHNAME8 "Áõã" + LOCALE_SABBREVMONTHNAME9 "Óåð" + LOCALE_SABBREVMONTHNAME10 "Ïêô" + LOCALE_SABBREVMONTHNAME11 "Íïå" + LOCALE_SABBREVMONTHNAME12 "Äåê" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Greece" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "ÄåõôÝñá" + LOCALE_SDAYNAME2 "Ôñßôç" + LOCALE_SDAYNAME3 "ÔåôÜñôç" + LOCALE_SDAYNAME4 "ÐÝìðôç" + LOCALE_SDAYNAME5 "ÐáñáóêåõÞ" + LOCALE_SDAYNAME6 "ÓÜââáôï" + LOCALE_SDAYNAME7 "ÊõñéáêÞ" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Greece" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Greek" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "GR" + LOCALE_SISO639LANGNAME "el" + LOCALE_SLANGUAGE "Greek" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "ÉáíïõÜñéïò" + LOCALE_SMONTHNAME2 "ÖåâñïõÜñéïò" + LOCALE_SMONTHNAME3 "ÌÜñôéïò" + LOCALE_SMONTHNAME4 "Áðñßëéïò" + LOCALE_SMONTHNAME5 "ÌÜéïò" + LOCALE_SMONTHNAME6 "Éïýíéïò" + LOCALE_SMONTHNAME7 "Éïýëéïò" + LOCALE_SMONTHNAME8 "Áýãïõóôïò" + LOCALE_SMONTHNAME9 "ÓåðôÝìâñéïò" + LOCALE_SMONTHNAME10 "Ïêôþâñéïò" + LOCALE_SMONTHNAME11 "ÍïÝìâñéïò" + LOCALE_SMONTHNAME12 "ÄåêÝìâñéïò" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "ÅëëÜäá" + LOCALE_SNATIVECURRNAME "åõñþ" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "åëëçíéêÜ" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/M/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ena.nls b/reactos/lib/kernel32/nls/ena.nls new file mode 100644 index 00000000000..41679ba0d52 --- /dev/null +++ b/reactos/lib/kernel32/nls/ena.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Australia) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "61" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "61" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0c09" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0c09" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "AUS" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENA" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Australia" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Australia" + LOCALE_SENGCURRNAME "Australian Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "AUD" + LOCALE_SISO3166CTRYNAME "AU" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Australia)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, d MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Australia" + LOCALE_SNATIVECURRNAME "Australian Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/enb.nls b/reactos/lib/kernel32/nls/enb.nls new file mode 100644 index 00000000000..6cba884a92d --- /dev/null +++ b/reactos/lib/kernel32/nls/enb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Caribbean) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CARIBBEAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "1" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "0" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "1" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "2c09" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "2409" + LOCALE_ILDATE "0" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "1" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "CAR" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENB" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Caribbean" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Caribbean" + LOCALE_SENGCURRNAME "US Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "USD" + LOCALE_SISO3166CTRYNAME "CB" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Caribbean)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, MMMM dd, yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Caribbean" + LOCALE_SNATIVECURRNAME "US Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "MM/dd/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/enc.nls b/reactos/lib/kernel32/nls/enc.nls new file mode 100644 index 00000000000..b707ab304a6 --- /dev/null +++ b/reactos/lib/kernel32/nls/enc.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Canada) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "2" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "2" + LOCALE_IDEFAULTEBCDICCODEPAGE "037" + LOCALE_IDEFAULTLANGUAGE "1009" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1009" + LOCALE_ILDATE "0" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "CAN" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENC" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Canada" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Canada" + LOCALE_SENGCURRNAME "Canadian Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CAD" + LOCALE_SISO3166CTRYNAME "CA" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Canada)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "MMMM d, yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Canada" + LOCALE_SNATIVECURRNAME "Canadian Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/eng.nls b/reactos/lib/kernel32/nls/eng.nls index 502416bc13a..8af659bdb58 100644 --- a/reactos/lib/kernel32/nls/eng.nls +++ b/reactos/lib/kernel32/nls/eng.nls @@ -22,7 +22,7 @@ STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK { -//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x01ff\x003f\x8000\xffff" +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x01ff\x003f\x8000\xffff" LOCALE_ICALENDARTYPE "1" LOCALE_ICENTURY "1" LOCALE_ICOUNTRY "44" diff --git a/reactos/lib/kernel32/nls/eni.nls b/reactos/lib/kernel32/nls/eni.nls new file mode 100644 index 00000000000..2997db1c0d9 --- /dev/null +++ b/reactos/lib/kernel32/nls/eni.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Ireland) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_EIRE +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "353" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "353" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "1809" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1809" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "IRL" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENI" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Ireland" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Ireland" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "IE" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Ireland)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Eire" + LOCALE_SNATIVECURRNAME "Euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/enj.nls b/reactos/lib/kernel32/nls/enj.nls new file mode 100644 index 00000000000..becb190fe26 --- /dev/null +++ b/reactos/lib/kernel32/nls/enj.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Jamaica) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_JAMAICA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "1" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "1" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "2009" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "2009" + LOCALE_ILDATE "0" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "1" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "JAM" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENJ" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Jamaica" + LOCALE_SCURRENCY "J$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Jamaica" + LOCALE_SENGCURRNAME "Jamaican Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "JMD" + LOCALE_SISO3166CTRYNAME "JM" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Jamaica)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, MMMM dd, yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Jamaica" + LOCALE_SNATIVECURRNAME "Jamaican Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/enl.nls b/reactos/lib/kernel32/nls/enl.nls new file mode 100644 index 00000000000..d4de8607f58 --- /dev/null +++ b/reactos/lib/kernel32/nls/enl.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Belize) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_BELIZE +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "501" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "501" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "2809" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "2809" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "BLZ" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENL" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Belize" + LOCALE_SCURRENCY "BZ$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Belize" + LOCALE_SENGCURRNAME "Belize Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "BZD" + LOCALE_SISO3166CTRYNAME "BZ" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Belize)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Belize" + LOCALE_SNATIVECURRNAME "Belize Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/enp.nls b/reactos/lib/kernel32/nls/enp.nls new file mode 100644 index 00000000000..d0602ff0c97 --- /dev/null +++ b/reactos/lib/kernel32/nls/enp.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Philippines) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_PHILIPPINES +{ +//FIXME LOCALE_FONTSIGNATURE L"\x00af\x8000\x38cb\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x8000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "63" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "0" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "437" + LOCALE_IDEFAULTCOUNTRY "63" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "3409" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "3409" + LOCALE_ILDATE "0" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "1" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "PHL" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENP" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Republic of the Philippines" + LOCALE_SCURRENCY "Php" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Republic of the Philippines" + LOCALE_SENGCURRNAME "Philippine Peso" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "PHP" + LOCALE_SISO3166CTRYNAME "PH" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Philippines)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, MMMM dd, yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Philippines" + LOCALE_SNATIVECURRNAME "Philippine Peso" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "M/d/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ens.nls b/reactos/lib/kernel32/nls/ens.nls new file mode 100644 index 00000000000..2a701a6b996 --- /dev/null +++ b/reactos/lib/kernel32/nls/ens.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (South Africa) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_SOUTH_AFRICA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x00af\x8000\x38cb\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x8000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "27" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "437" + LOCALE_IDEFAULTCOUNTRY "27" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "1c09" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1c09" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "ZAF" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENS" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "South Africa" + LOCALE_SCURRENCY "R" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "South Africa" + LOCALE_SENGCURRNAME "South African Rand" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ZAR" + LOCALE_SISO3166CTRYNAME "ZA" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (South Africa)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "South Africa" + LOCALE_SNATIVECURRNAME "Rand" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy/MM/dd" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ent.nls b/reactos/lib/kernel32/nls/ent.nls new file mode 100644 index 00000000000..094d6d9d9cf --- /dev/null +++ b/reactos/lib/kernel32/nls/ent.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Trinidad) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_TRINIDAD +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "1" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "1" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "2c09" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "2c09" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "TTO" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENT" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Trinidad and Tobago" + LOCALE_SCURRENCY "TT$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Trinidad and Tobago" + LOCALE_SENGCURRNAME "Trinidad Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "TTD" + LOCALE_SISO3166CTRYNAME "TT" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Trinidad)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Trinidad y Tobago" + LOCALE_SNATIVECURRNAME "Trinidad Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/enw.nls b/reactos/lib/kernel32/nls/enw.nls new file mode 100644 index 00000000000..00a57c61e9e --- /dev/null +++ b/reactos/lib/kernel32/nls/enw.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (Zimbabwe) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_ZIMBABWE +{ +//FIXME LOCALE_FONTSIGNATURE L"\x00af\x8000\x38cb\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x8000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "263" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "0" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "437" + LOCALE_IDEFAULTCOUNTRY "263" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "3009" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "3009" + LOCALE_ILDATE "0" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "1" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "ZWE" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENW" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Zimbabwe" + LOCALE_SCURRENCY "Z$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Zimbabwe" + LOCALE_SENGCURRNAME "Zimbabwe Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ZWD" + LOCALE_SISO3166CTRYNAME "ZW" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (Zimbabwe)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, MMMM dd, yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Zimbabwe" + LOCALE_SNATIVECURRNAME "Zimbabwe Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "M/d/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/enz.nls b/reactos/lib/kernel32/nls/enz.nls new file mode 100644 index 00000000000..3369ec4cc1b --- /dev/null +++ b/reactos/lib/kernel32/nls/enz.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for English (New Zealand) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_NZ +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "64" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "64" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "1409" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1409" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "NZL" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "ENZ" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "New Zealand" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "New Zealand" + LOCALE_SENGCURRNAME "New Zealand Dollar" + LOCALE_SENGLANGUAGE "English" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "NZD" + LOCALE_SISO3166CTRYNAME "NZ" + LOCALE_SISO639LANGNAME "en" + LOCALE_SLANGUAGE "English (New Zealand)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, d MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "New Zealand" + LOCALE_SNATIVECURRNAME "New Zealand Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "English" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esa.nls b/reactos/lib/kernel32/nls/esa.nls new file mode 100644 index 00000000000..f1810b4c912 --- /dev/null +++ b/reactos/lib/kernel32/nls/esa.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Panama) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_PANAMA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "507" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "0" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "507" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "180a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "180a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "PAN" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESA" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Panama" + LOCALE_SCURRENCY "B/." + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Panama" + LOCALE_SENGCURRNAME "Panamanian Balboa" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "PAB" + LOCALE_SISO3166CTRYNAME "PA" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Panama)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Panamá" + LOCALE_SNATIVECURRNAME "Balboa" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "MM/dd/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esb.nls b/reactos/lib/kernel32/nls/esb.nls new file mode 100644 index 00000000000..d3ff4df9bde --- /dev/null +++ b/reactos/lib/kernel32/nls/esb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Bolivia) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_BOLIVIA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "591" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "591" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "400a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "400a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "BOL" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESB" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Bolivia" + LOCALE_SCURRENCY "$b" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Bolivia" + LOCALE_SENGCURRNAME "Boliviano" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "BOB" + LOCALE_SISO3166CTRYNAME "BO" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Bolivia)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Bolivia" + LOCALE_SNATIVECURRNAME "Boliviano" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esd.nls b/reactos/lib/kernel32/nls/esd.nls new file mode 100644 index 00000000000..d900dff8798 --- /dev/null +++ b/reactos/lib/kernel32/nls/esd.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Dominican Republic) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_DOMINICAN_REPUBLIC +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "1" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "1" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "1c0a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1c0a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "DOM" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESD" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Dominican Republic" + LOCALE_SCURRENCY "RD$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Dominican Republic" + LOCALE_SENGCURRNAME "Dominican Peso" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "DOP" + LOCALE_SISO3166CTRYNAME "DO" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Dominican Republic)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "República Dominicana" + LOCALE_SNATIVECURRNAME "Peso" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ese.nls b/reactos/lib/kernel32/nls/ese.nls new file mode 100644 index 00000000000..1bc6599f687 --- /dev/null +++ b/reactos/lib/kernel32/nls/ese.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (El Salvador) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_EL_SALVADOR +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "503" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "503" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "440a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "440a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "SLV" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESE" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "El Salvador" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "El Salvador" + LOCALE_SENGCURRNAME "US Dollar" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "USD" + LOCALE_SISO3166CTRYNAME "SV" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (El Salvador)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "El Salvador" + LOCALE_SNATIVECURRNAME "US Dolar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esf.nls b/reactos/lib/kernel32/nls/esf.nls new file mode 100644 index 00000000000..7e0e0f0d620 --- /dev/null +++ b/reactos/lib/kernel32/nls/esf.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Ecuador) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_ECUADOR +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "593" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "593" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "300a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "300a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ECU" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESF" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Ecuador" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Ecuador" + LOCALE_SENGCURRNAME "US Dollar" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "USD" + LOCALE_SISO3166CTRYNAME "EC" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Ecuador)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Ecuador" + LOCALE_SNATIVECURRNAME "US Dolar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esg.nls b/reactos/lib/kernel32/nls/esg.nls new file mode 100644 index 00000000000..0e7ed7a9b7d --- /dev/null +++ b/reactos/lib/kernel32/nls/esg.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Guatemala) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_GUATEMALA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "502" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "502" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "100a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "100a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "GTM" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESG" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Guatemala" + LOCALE_SCURRENCY "Q" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Guatemala" + LOCALE_SENGCURRNAME "Guatemalan Quetzal" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "GTQ" + LOCALE_SISO3166CTRYNAME "GT" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Guatemala)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Guatemala" + LOCALE_SNATIVECURRNAME "Quetzal" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esh.nls b/reactos/lib/kernel32/nls/esh.nls new file mode 100644 index 00000000000..90fa44e118f --- /dev/null +++ b/reactos/lib/kernel32/nls/esh.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Honduras) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_HONDURAS +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "504" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "504" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "480a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "480a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "12" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "HND" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESH" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Honduras" + LOCALE_SCURRENCY "L." + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Honduras" + LOCALE_SENGCURRNAME "Honduran Lempira" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "HNL" + LOCALE_SISO3166CTRYNAME "HN" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Honduras)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Honduras" + LOCALE_SNATIVECURRNAME "Lempira" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esi.nls b/reactos/lib/kernel32/nls/esi.nls new file mode 100644 index 00000000000..30d7642a6d7 --- /dev/null +++ b/reactos/lib/kernel32/nls/esi.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Nicaragua) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_NICARAGUA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "505" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "505" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "4c0a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "4c0a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "NIC" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESI" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Nicaragua" + LOCALE_SCURRENCY "C$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Nicaragua" + LOCALE_SENGCURRNAME "Nicaraguan Cordoba Oro" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "NIO" + LOCALE_SISO3166CTRYNAME "NI" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Nicaragua)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Nicaragua" + LOCALE_SNATIVECURRNAME "Córdoba" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esl.nls b/reactos/lib/kernel32/nls/esl.nls new file mode 100644 index 00000000000..8ac3edaea02 --- /dev/null +++ b/reactos/lib/kernel32/nls/esl.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Chile) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_CHILE +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "56" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "56" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "340a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "340a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "9" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "CHL" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESL" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Chile" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Chile" + LOCALE_SENGCURRNAME "Chilean Peso" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CLP" + LOCALE_SISO3166CTRYNAME "CL" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Chile)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Chile" + LOCALE_SNATIVECURRNAME "Peso" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd-MM-yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esm.nls b/reactos/lib/kernel32/nls/esm.nls new file mode 100644 index 00000000000..45edc0593d7 --- /dev/null +++ b/reactos/lib/kernel32/nls/esm.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Mexico) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MEXICAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "52" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "52" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "080a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "080a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "MEX" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESM" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Mexico" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Mexico" + LOCALE_SENGCURRNAME "Mexican Nuevo Peso" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "MXN" + LOCALE_SISO3166CTRYNAME "MX" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Mexico)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "México" + LOCALE_SNATIVECURRNAME "Peso" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esn.nls b/reactos/lib/kernel32/nls/esn.nls new file mode 100644 index 00000000000..24b51fe4be7 --- /dev/null +++ b/reactos/lib/kernel32/nls/esn.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (International Sort) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "34" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "34" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "0c0a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0c0a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ESP" + LOCALE_SABBREVDAYNAME1 "lun" + LOCALE_SABBREVDAYNAME2 "mar" + LOCALE_SABBREVDAYNAME3 "mié" + LOCALE_SABBREVDAYNAME4 "jue" + LOCALE_SABBREVDAYNAME5 "vie" + LOCALE_SABBREVDAYNAME6 "sáb" + LOCALE_SABBREVDAYNAME7 "dom" + LOCALE_SABBREVLANGNAME "ESN" + LOCALE_SABBREVMONTHNAME1 "ene" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "abr" + LOCALE_SABBREVMONTHNAME5 "may" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "ago" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "oct" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Spain" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "lunes" + LOCALE_SDAYNAME2 "martes" + LOCALE_SDAYNAME3 "miércoles" + LOCALE_SDAYNAME4 "jueves" + LOCALE_SDAYNAME5 "viernes" + LOCALE_SDAYNAME6 "sábado" + LOCALE_SDAYNAME7 "domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Spain" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "ES" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (International Sort)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "enero" + LOCALE_SMONTHNAME2 "febrero" + LOCALE_SMONTHNAME3 "marzo" + LOCALE_SMONTHNAME4 "abril" + LOCALE_SMONTHNAME5 "mayo" + LOCALE_SMONTHNAME6 "junio" + LOCALE_SMONTHNAME7 "julio" + LOCALE_SMONTHNAME8 "agosto" + LOCALE_SMONTHNAME9 "septiembre" + LOCALE_SMONTHNAME10 "octubre" + LOCALE_SMONTHNAME11 "noviembre" + LOCALE_SMONTHNAME12 "diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "España" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "International" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/eso.nls b/reactos/lib/kernel32/nls/eso.nls new file mode 100644 index 00000000000..9ae4fda6369 --- /dev/null +++ b/reactos/lib/kernel32/nls/eso.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Colombia) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_COLOMBIA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "57" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "57" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "240a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "240a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "COL" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESO" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Colombia" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Colombia" + LOCALE_SENGCURRNAME "Colombian Peso" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "COP" + LOCALE_SISO3166CTRYNAME "CO" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Colombia)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Colombia" + LOCALE_SNATIVECURRNAME "Peso" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esp.nls b/reactos/lib/kernel32/nls/esp.nls new file mode 100644 index 00000000000..e892c383c77 --- /dev/null +++ b/reactos/lib/kernel32/nls/esp.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Traditional Sort) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "34" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "34" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "040a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "040a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ESP" + LOCALE_SABBREVDAYNAME1 "lun" + LOCALE_SABBREVDAYNAME2 "mar" + LOCALE_SABBREVDAYNAME3 "mié" + LOCALE_SABBREVDAYNAME4 "jue" + LOCALE_SABBREVDAYNAME5 "vie" + LOCALE_SABBREVDAYNAME6 "sáb" + LOCALE_SABBREVDAYNAME7 "dom" + LOCALE_SABBREVLANGNAME "ESP" + LOCALE_SABBREVMONTHNAME1 "ene" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "abr" + LOCALE_SABBREVMONTHNAME5 "may" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "ago" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "oct" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Spain" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "lunes" + LOCALE_SDAYNAME2 "martes" + LOCALE_SDAYNAME3 "miércoles" + LOCALE_SDAYNAME4 "jueves" + LOCALE_SDAYNAME5 "viernes" + LOCALE_SDAYNAME6 "sábado" + LOCALE_SDAYNAME7 "domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Spain" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "ES" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Traditional Sort)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "enero" + LOCALE_SMONTHNAME2 "febrero" + LOCALE_SMONTHNAME3 "marzo" + LOCALE_SMONTHNAME4 "abril" + LOCALE_SMONTHNAME5 "mayo" + LOCALE_SMONTHNAME6 "junio" + LOCALE_SMONTHNAME7 "julio" + LOCALE_SMONTHNAME8 "agosto" + LOCALE_SMONTHNAME9 "septiembre" + LOCALE_SMONTHNAME10 "octubre" + LOCALE_SMONTHNAME11 "noviembre" + LOCALE_SMONTHNAME12 "diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "España" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Traditional" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esr.nls b/reactos/lib/kernel32/nls/esr.nls new file mode 100644 index 00000000000..27d4e576ec5 --- /dev/null +++ b/reactos/lib/kernel32/nls/esr.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Peru) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_PERU +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "51" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "51" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "280a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "280a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "12" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "PER" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESR" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Peru" + LOCALE_SCURRENCY "S/." + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Peru" + LOCALE_SENGCURRNAME "Peruvian Nuevo Sol" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "PEN" + LOCALE_SISO3166CTRYNAME "PE" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Peru)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Perú" + LOCALE_SNATIVECURRNAME "Nuevo Sol" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ess.nls b/reactos/lib/kernel32/nls/ess.nls new file mode 100644 index 00000000000..15df53af0b5 --- /dev/null +++ b/reactos/lib/kernel32/nls/ess.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Argentina) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_ARGENTINA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "54" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "54" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "2c0a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "2c0a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "ARG" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESS" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Argentina" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Argentina" + LOCALE_SENGCURRNAME "Argentine Peso" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ARS" + LOCALE_SISO3166CTRYNAME "AR" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Argentina)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Argentina" + LOCALE_SNATIVECURRNAME "Peso" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esu.nls b/reactos/lib/kernel32/nls/esu.nls new file mode 100644 index 00000000000..4bcac6c03f8 --- /dev/null +++ b/reactos/lib/kernel32/nls/esu.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Puerto Rico) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_PUERTO_RICO +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "1" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "1" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "500a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "500a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "PRI" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESU" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Puerto Rico" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Puerto Rico" + LOCALE_SENGCURRNAME "US Dollar" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "USD" + LOCALE_SISO3166CTRYNAME "PR" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Puerto Rico)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Puerto Rico" + LOCALE_SNATIVECURRNAME "US Dollar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esv.nls b/reactos/lib/kernel32/nls/esv.nls new file mode 100644 index 00000000000..cbfda79508f --- /dev/null +++ b/reactos/lib/kernel32/nls/esv.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Venezuela) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_VENEZUELA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "58" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "58" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "200a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "200a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "12" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "VEN" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESV" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Venezuela" + LOCALE_SCURRENCY "Bs" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Venezuela" + LOCALE_SENGCURRNAME "Venezuelan Bolivar" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "VEB" + LOCALE_SISO3166CTRYNAME "VE" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Venezuela)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Republica Bolivariana de Venezuela" + LOCALE_SNATIVECURRNAME "Bolívar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esy.nls b/reactos/lib/kernel32/nls/esy.nls new file mode 100644 index 00000000000..de77fd0426f --- /dev/null +++ b/reactos/lib/kernel32/nls/esy.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Uruguay) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_URUGUAY +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "598" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "598" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "380a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "380a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "URY" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESY" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Uruguay" + LOCALE_SCURRENCY "$U" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Uruguay" + LOCALE_SENGCURRNAME "Peso Uruguayo" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "UYU" + LOCALE_SISO3166CTRYNAME "UY" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Uruguay)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Uruguay" + LOCALE_SNATIVECURRNAME "Peso" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/esz.nls b/reactos/lib/kernel32/nls/esz.nls new file mode 100644 index 00000000000..d1d7b5371bc --- /dev/null +++ b/reactos/lib/kernel32/nls/esz.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Spanish (Paraguay) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_PARAGUAY +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "595" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "595" + LOCALE_IDEFAULTEBCDICCODEPAGE "20284" + LOCALE_IDEFAULTLANGUAGE "3c0a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "3c0a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "14" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "PRY" + LOCALE_SABBREVDAYNAME1 "Lun" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mié" + LOCALE_SABBREVDAYNAME4 "Jue" + LOCALE_SABBREVDAYNAME5 "Vie" + LOCALE_SABBREVDAYNAME6 "Sáb" + LOCALE_SABBREVDAYNAME7 "Dom" + LOCALE_SABBREVLANGNAME "ESZ" + LOCALE_SABBREVMONTHNAME1 "Ene" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Paraguay" + LOCALE_SCURRENCY "Gs" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Lunes" + LOCALE_SDAYNAME2 "Martes" + LOCALE_SDAYNAME3 "Miércoles" + LOCALE_SDAYNAME4 "Jueves" + LOCALE_SDAYNAME5 "Viernes" + LOCALE_SDAYNAME6 "Sábado" + LOCALE_SDAYNAME7 "Domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Paraguay" + LOCALE_SENGCURRNAME "Paraguay Guarani" + LOCALE_SENGLANGUAGE "Spanish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "PYG" + LOCALE_SISO3166CTRYNAME "PY" + LOCALE_SISO639LANGNAME "es" + LOCALE_SLANGUAGE "Spanish (Paraguay)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Enero" + LOCALE_SMONTHNAME2 "Febrero" + LOCALE_SMONTHNAME3 "Marzo" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Mayo" + LOCALE_SMONTHNAME6 "Junio" + LOCALE_SMONTHNAME7 "Julio" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Septiembre" + LOCALE_SMONTHNAME10 "Octubre" + LOCALE_SMONTHNAME11 "Noviembre" + LOCALE_SMONTHNAME12 "Diciembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Paraguay" + LOCALE_SNATIVECURRNAME "Guaraní" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Español" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "hh:mm:ss tt" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/eti.nls b/reactos/lib/kernel32/nls/eti.nls new file mode 100644 index 00000000000..f40d2d39150 --- /dev/null +++ b/reactos/lib/kernel32/nls/eti.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Estonian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1257) + +STRINGTABLE LANGUAGE LANG_ESTONIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0007\x8000\x3848\x1000\x0000\x0000\x0000\x0000\x0080\x0000\x0000\x0800\x0092\x0000\x0000\xcdd4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "372" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1257" + LOCALE_IDEFAULTCODEPAGE "775" + LOCALE_IDEFAULTCOUNTRY "372" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0425" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0425" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "EL" + LOCALE_S2359 "PL" + LOCALE_SABBREVCTRYNAME "EST" + LOCALE_SABBREVDAYNAME1 "E" + LOCALE_SABBREVDAYNAME2 "T" + LOCALE_SABBREVDAYNAME3 "K" + LOCALE_SABBREVDAYNAME4 "N" + LOCALE_SABBREVDAYNAME5 "R" + LOCALE_SABBREVDAYNAME6 "L" + LOCALE_SABBREVDAYNAME7 "P" + LOCALE_SABBREVLANGNAME "ETI" + LOCALE_SABBREVMONTHNAME1 "jaan" + LOCALE_SABBREVMONTHNAME2 "veebr" + LOCALE_SABBREVMONTHNAME3 "märts" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "juuni" + LOCALE_SABBREVMONTHNAME7 "juuli" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sept" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dets" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Estonia" + LOCALE_SCURRENCY "kr" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "esmaspäev" + LOCALE_SDAYNAME2 "teisipäev" + LOCALE_SDAYNAME3 "kolmapäev" + LOCALE_SDAYNAME4 "neljapäev" + LOCALE_SDAYNAME5 "reede" + LOCALE_SDAYNAME6 "laupäev" + LOCALE_SDAYNAME7 "pühapäev" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Estonia" + LOCALE_SENGCURRNAME "Estonian Kroon" + LOCALE_SENGLANGUAGE "Estonian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EEK" + LOCALE_SISO3166CTRYNAME "EE" + LOCALE_SISO639LANGNAME "et" + LOCALE_SLANGUAGE "Estonian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy'. a.'" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "jaanuar" + LOCALE_SMONTHNAME2 "veebruar" + LOCALE_SMONTHNAME3 "märts" + LOCALE_SMONTHNAME4 "aprill" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juuni" + LOCALE_SMONTHNAME7 "juuli" + LOCALE_SMONTHNAME8 "august" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktoober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "detsember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Eesti" + LOCALE_SNATIVECURRNAME "Kroon" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "eesti" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy'. a.'" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/euq.nls b/reactos/lib/kernel32/nls/euq.nls new file mode 100644 index 00000000000..88d405e33d7 --- /dev/null +++ b/reactos/lib/kernel32/nls/euq.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Basque + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_BASQUE, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "34" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "34" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "042d" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "042d" + LOCALE_ILDATE "2" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ESP" + LOCALE_SABBREVDAYNAME1 "al." + LOCALE_SABBREVDAYNAME2 "as." + LOCALE_SABBREVDAYNAME3 "az." + LOCALE_SABBREVDAYNAME4 "og." + LOCALE_SABBREVDAYNAME5 "or." + LOCALE_SABBREVDAYNAME6 "lr." + LOCALE_SABBREVDAYNAME7 "ig." + LOCALE_SABBREVLANGNAME "EUQ" + LOCALE_SABBREVMONTHNAME1 "urt." + LOCALE_SABBREVMONTHNAME2 "ots." + LOCALE_SABBREVMONTHNAME3 "mar." + LOCALE_SABBREVMONTHNAME4 "api." + LOCALE_SABBREVMONTHNAME5 "mai." + LOCALE_SABBREVMONTHNAME6 "eka." + LOCALE_SABBREVMONTHNAME7 "uzt." + LOCALE_SABBREVMONTHNAME8 "abu." + LOCALE_SABBREVMONTHNAME9 "ira." + LOCALE_SABBREVMONTHNAME10 "urr." + LOCALE_SABBREVMONTHNAME11 "aza." + LOCALE_SABBREVMONTHNAME12 "abe." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Spain" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "astelehena" + LOCALE_SDAYNAME2 "asteartea" + LOCALE_SDAYNAME3 "asteazkena" + LOCALE_SDAYNAME4 "osteguna" + LOCALE_SDAYNAME5 "ostirala" + LOCALE_SDAYNAME6 "larunbata" + LOCALE_SDAYNAME7 "igandea" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Spain" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Basque" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "ES" + LOCALE_SISO639LANGNAME "eu" + LOCALE_SLANGUAGE "Basque" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, yyyy.'eko' MMMM'k 'd" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "urtarrila" + LOCALE_SMONTHNAME2 "otsaila" + LOCALE_SMONTHNAME3 "martxoa" + LOCALE_SMONTHNAME4 "apirila" + LOCALE_SMONTHNAME5 "maiatza" + LOCALE_SMONTHNAME6 "ekaina" + LOCALE_SMONTHNAME7 "uztaila" + LOCALE_SMONTHNAME8 "abuztua" + LOCALE_SMONTHNAME9 "iraila" + LOCALE_SMONTHNAME10 "urria" + LOCALE_SMONTHNAME11 "azaroa" + LOCALE_SMONTHNAME12 "abendua" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Espainia" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "euskara" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy/MM/dd" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "yyyy.'eko' MMMM" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/fin.nls b/reactos/lib/kernel32/nls/fin.nls new file mode 100644 index 00000000000..5ab719586fc --- /dev/null +++ b/reactos/lib/kernel32/nls/fin.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Finnish + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "358" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "358" + LOCALE_IDEFAULTEBCDICCODEPAGE "20278" + LOCALE_IDEFAULTLANGUAGE "040b" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "040b" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "FIN" + LOCALE_SABBREVDAYNAME1 "ma" + LOCALE_SABBREVDAYNAME2 "ti" + LOCALE_SABBREVDAYNAME3 "ke" + LOCALE_SABBREVDAYNAME4 "to" + LOCALE_SABBREVDAYNAME5 "pe" + LOCALE_SABBREVDAYNAME6 "la" + LOCALE_SABBREVDAYNAME7 "su" + LOCALE_SABBREVLANGNAME "FIN" + LOCALE_SABBREVMONTHNAME1 "tammi" + LOCALE_SABBREVMONTHNAME2 "helmi" + LOCALE_SABBREVMONTHNAME3 "maalis" + LOCALE_SABBREVMONTHNAME4 "huhti" + LOCALE_SABBREVMONTHNAME5 "touko" + LOCALE_SABBREVMONTHNAME6 "kesä" + LOCALE_SABBREVMONTHNAME7 "heinä" + LOCALE_SABBREVMONTHNAME8 "elo" + LOCALE_SABBREVMONTHNAME9 "syys" + LOCALE_SABBREVMONTHNAME10 "loka" + LOCALE_SABBREVMONTHNAME11 "marras" + LOCALE_SABBREVMONTHNAME12 "joulu" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Finland" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "maanantai" + LOCALE_SDAYNAME2 "tiistai" + LOCALE_SDAYNAME3 "keskiviikko" + LOCALE_SDAYNAME4 "torstai" + LOCALE_SDAYNAME5 "perjantai" + LOCALE_SDAYNAME6 "lauantai" + LOCALE_SDAYNAME7 "sunnuntai" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Finland" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Finnish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "FI" + LOCALE_SISO639LANGNAME "fi" + LOCALE_SLANGUAGE "Finnish" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM'ta 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "tammikuu" + LOCALE_SMONTHNAME2 "helmikuu" + LOCALE_SMONTHNAME3 "maaliskuu" + LOCALE_SMONTHNAME4 "huhtikuu" + LOCALE_SMONTHNAME5 "toukokuu" + LOCALE_SMONTHNAME6 "kesäkuu" + LOCALE_SMONTHNAME7 "heinäkuu" + LOCALE_SMONTHNAME8 "elokuu" + LOCALE_SMONTHNAME9 "syyskuu" + LOCALE_SMONTHNAME10 "lokakuu" + LOCALE_SMONTHNAME11 "marraskuu" + LOCALE_SMONTHNAME12 "joulukuu" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Suomi" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "suomi" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/fos.nls b/reactos/lib/kernel32/nls/fos.nls new file mode 100644 index 00000000000..5a7aa426907 --- /dev/null +++ b/reactos/lib/kernel32/nls/fos.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Faeroese + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_FAEROESE, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "298" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "298" + LOCALE_IDEFAULTEBCDICCODEPAGE "20277" + LOCALE_IDEFAULTLANGUAGE "0438" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10079" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0438" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "12" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "FRO" + LOCALE_SABBREVDAYNAME1 "mán" + LOCALE_SABBREVDAYNAME2 "týs" + LOCALE_SABBREVDAYNAME3 "mik" + LOCALE_SABBREVDAYNAME4 "hós" + LOCALE_SABBREVDAYNAME5 "frí" + LOCALE_SABBREVDAYNAME6 "leyg" + LOCALE_SABBREVDAYNAME7 "sun" + LOCALE_SABBREVLANGNAME "FOS" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "des" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Faeroe Islands" + LOCALE_SCURRENCY "kr" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "mánadagur" + LOCALE_SDAYNAME2 "týsdagur" + LOCALE_SDAYNAME3 "mikudagur" + LOCALE_SDAYNAME4 "hósdagur" + LOCALE_SDAYNAME5 "fríggjadagur" + LOCALE_SDAYNAME6 "leygardagur" + LOCALE_SDAYNAME7 "sunnudagur" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Faeroe Islands" + LOCALE_SENGCURRNAME "Danish Krone" + LOCALE_SENGLANGUAGE "Faeroese" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "DKK" + LOCALE_SISO3166CTRYNAME "FO" + LOCALE_SISO639LANGNAME "fo" + LOCALE_SLANGUAGE "Faeroese" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januar" + LOCALE_SMONTHNAME2 "februar" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "apríl" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "august" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "desember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Føroyar" + LOCALE_SNATIVECURRNAME "Dansk krone" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "føroyskt" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd-MM-yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME "." + LOCALE_STIMEFORMAT "HH.mm.ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/frb.nls b/reactos/lib/kernel32/nls/frb.nls new file mode 100644 index 00000000000..d0e9a521692 --- /dev/null +++ b/reactos/lib/kernel32/nls/frb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for French (Belgium) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_BELGIAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "32" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "32" + LOCALE_IDEFAULTEBCDICCODEPAGE "20297" + LOCALE_IDEFAULTLANGUAGE "080c" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "080c" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "BEL" + LOCALE_SABBREVDAYNAME1 "lun." + LOCALE_SABBREVDAYNAME2 "mar." + LOCALE_SABBREVDAYNAME3 "mer." + LOCALE_SABBREVDAYNAME4 "jeu." + LOCALE_SABBREVDAYNAME5 "ven." + LOCALE_SABBREVDAYNAME6 "sam." + LOCALE_SABBREVDAYNAME7 "dim." + LOCALE_SABBREVLANGNAME "FRB" + LOCALE_SABBREVMONTHNAME1 "janv." + LOCALE_SABBREVMONTHNAME2 "févr." + LOCALE_SABBREVMONTHNAME3 "mars" + LOCALE_SABBREVMONTHNAME4 "avr." + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "juin" + LOCALE_SABBREVMONTHNAME7 "juil." + LOCALE_SABBREVMONTHNAME8 "août" + LOCALE_SABBREVMONTHNAME9 "sept." + LOCALE_SABBREVMONTHNAME10 "oct." + LOCALE_SABBREVMONTHNAME11 "nov." + LOCALE_SABBREVMONTHNAME12 "déc." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Belgium" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "lundi" + LOCALE_SDAYNAME2 "mardi" + LOCALE_SDAYNAME3 "mercredi" + LOCALE_SDAYNAME4 "jeudi" + LOCALE_SDAYNAME5 "vendredi" + LOCALE_SDAYNAME6 "samedi" + LOCALE_SDAYNAME7 "dimanche" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Belgium" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "French" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "BE" + LOCALE_SISO639LANGNAME "fr" + LOCALE_SLANGUAGE "French (Belgium)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janvier" + LOCALE_SMONTHNAME2 "février" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "avril" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juin" + LOCALE_SMONTHNAME7 "juillet" + LOCALE_SMONTHNAME8 "août" + LOCALE_SMONTHNAME9 "septembre" + LOCALE_SMONTHNAME10 "octobre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "décembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Belgique" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "français" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Europe occidentale et États-Unis d'Amérique" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Europe centrale" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltique" + LGRPID_GREEK+LGRPID_RES_BASE "Grec" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillique" + LGRPID_TURKISH+LGRPID_RES_BASE "Turc" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japonais" + LGRPID_KOREAN+LGRPID_RES_BASE "Coréen" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Chinois traditionnel" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Chinois simplifié" + LGRPID_THAI+LGRPID_RES_BASE "Thaï" + LGRPID_HEBREW+LGRPID_RES_BASE "Hébreu" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabe" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamien" + LGRPID_INDIC+LGRPID_RES_BASE "Indien" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Géorgien" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Arménian" +} diff --git a/reactos/lib/kernel32/nls/frc.nls b/reactos/lib/kernel32/nls/frc.nls new file mode 100644 index 00000000000..c81520e6fff --- /dev/null +++ b/reactos/lib/kernel32/nls/frc.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for French (Canada) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_CANADIAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "2" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "2" + LOCALE_IDEFAULTEBCDICCODEPAGE "20297" + LOCALE_IDEFAULTLANGUAGE "0c0c" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0c0c" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "4" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "1" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "CAN" + LOCALE_SABBREVDAYNAME1 "lun." + LOCALE_SABBREVDAYNAME2 "mar." + LOCALE_SABBREVDAYNAME3 "mer." + LOCALE_SABBREVDAYNAME4 "jeu." + LOCALE_SABBREVDAYNAME5 "ven." + LOCALE_SABBREVDAYNAME6 "sam." + LOCALE_SABBREVDAYNAME7 "dim." + LOCALE_SABBREVLANGNAME "FRC" + LOCALE_SABBREVMONTHNAME1 "janv." + LOCALE_SABBREVMONTHNAME2 "févr." + LOCALE_SABBREVMONTHNAME3 "mars" + LOCALE_SABBREVMONTHNAME4 "avr." + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "juin" + LOCALE_SABBREVMONTHNAME7 "juil." + LOCALE_SABBREVMONTHNAME8 "août" + LOCALE_SABBREVMONTHNAME9 "sept." + LOCALE_SABBREVMONTHNAME10 "oct." + LOCALE_SABBREVMONTHNAME11 "nov." + LOCALE_SABBREVMONTHNAME12 "déc." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Canada" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "lundi" + LOCALE_SDAYNAME2 "mardi" + LOCALE_SDAYNAME3 "mercredi" + LOCALE_SDAYNAME4 "jeudi" + LOCALE_SDAYNAME5 "vendredi" + LOCALE_SDAYNAME6 "samedi" + LOCALE_SDAYNAME7 "dimanche" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Canada" + LOCALE_SENGCURRNAME "Canadian Dollar" + LOCALE_SENGLANGUAGE "French" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CAD" + LOCALE_SISO3166CTRYNAME "CA" + LOCALE_SISO639LANGNAME "fr" + LOCALE_SLANGUAGE "French (Canada)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d MMMM, yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janvier" + LOCALE_SMONTHNAME2 "février" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "avril" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juin" + LOCALE_SMONTHNAME7 "juillet" + LOCALE_SMONTHNAME8 "août" + LOCALE_SMONTHNAME9 "septembre" + LOCALE_SMONTHNAME10 "octobre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "décembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Canada" + LOCALE_SNATIVECURRNAME "Dollar canadien" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "français" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy-MM-dd" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Europe occidentale et États-Unis d'Amérique" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Europe centrale" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltique" + LGRPID_GREEK+LGRPID_RES_BASE "Grec" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillique" + LGRPID_TURKISH+LGRPID_RES_BASE "Turc" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japonais" + LGRPID_KOREAN+LGRPID_RES_BASE "Coréen" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Chinois traditionnel" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Chinois simplifié" + LGRPID_THAI+LGRPID_RES_BASE "Thaï" + LGRPID_HEBREW+LGRPID_RES_BASE "Hébreu" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabe" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamien" + LGRPID_INDIC+LGRPID_RES_BASE "Indien" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Géorgien" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Arménian" +} diff --git a/reactos/lib/kernel32/nls/frl.nls b/reactos/lib/kernel32/nls/frl.nls new file mode 100644 index 00000000000..618ce53c205 --- /dev/null +++ b/reactos/lib/kernel32/nls/frl.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for French (Luxembourg) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_LUXEMBOURG +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "352" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "352" + LOCALE_IDEFAULTEBCDICCODEPAGE "20297" + LOCALE_IDEFAULTLANGUAGE "140c" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "140c" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "LUX" + LOCALE_SABBREVDAYNAME1 "lun." + LOCALE_SABBREVDAYNAME2 "mar." + LOCALE_SABBREVDAYNAME3 "mer." + LOCALE_SABBREVDAYNAME4 "jeu." + LOCALE_SABBREVDAYNAME5 "ven." + LOCALE_SABBREVDAYNAME6 "sam." + LOCALE_SABBREVDAYNAME7 "dim." + LOCALE_SABBREVLANGNAME "FRL" + LOCALE_SABBREVMONTHNAME1 "janv." + LOCALE_SABBREVMONTHNAME2 "févr." + LOCALE_SABBREVMONTHNAME3 "mars" + LOCALE_SABBREVMONTHNAME4 "avr." + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "juin" + LOCALE_SABBREVMONTHNAME7 "juil." + LOCALE_SABBREVMONTHNAME8 "août" + LOCALE_SABBREVMONTHNAME9 "sept." + LOCALE_SABBREVMONTHNAME10 "oct." + LOCALE_SABBREVMONTHNAME11 "nov." + LOCALE_SABBREVMONTHNAME12 "déc." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Luxembourg" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "lundi" + LOCALE_SDAYNAME2 "mardi" + LOCALE_SDAYNAME3 "mercredi" + LOCALE_SDAYNAME4 "jeudi" + LOCALE_SDAYNAME5 "vendredi" + LOCALE_SDAYNAME6 "samedi" + LOCALE_SDAYNAME7 "dimanche" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Luxembourg" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "French" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "LU" + LOCALE_SISO639LANGNAME "fr" + LOCALE_SLANGUAGE "French (Luxembourg)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janvier" + LOCALE_SMONTHNAME2 "février" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "avril" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juin" + LOCALE_SMONTHNAME7 "juillet" + LOCALE_SMONTHNAME8 "août" + LOCALE_SMONTHNAME9 "septembre" + LOCALE_SMONTHNAME10 "octobre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "décembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Luxembourg" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "français" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Europe occidentale et États-Unis d'Amérique" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Europe centrale" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltique" + LGRPID_GREEK+LGRPID_RES_BASE "Grec" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillique" + LGRPID_TURKISH+LGRPID_RES_BASE "Turc" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japonais" + LGRPID_KOREAN+LGRPID_RES_BASE "Coréen" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Chinois traditionnel" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Chinois simplifié" + LGRPID_THAI+LGRPID_RES_BASE "Thaï" + LGRPID_HEBREW+LGRPID_RES_BASE "Hébreu" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabe" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamien" + LGRPID_INDIC+LGRPID_RES_BASE "Indien" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Géorgien" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Arménian" +} diff --git a/reactos/lib/kernel32/nls/frm.nls b/reactos/lib/kernel32/nls/frm.nls new file mode 100644 index 00000000000..b1f950ce3a4 --- /dev/null +++ b/reactos/lib/kernel32/nls/frm.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for French (Monaco) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_MONACO +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "377" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "377" + LOCALE_IDEFAULTEBCDICCODEPAGE "20297" + LOCALE_IDEFAULTLANGUAGE "180c" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "180c" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "MCO" + LOCALE_SABBREVDAYNAME1 "lun." + LOCALE_SABBREVDAYNAME2 "mar." + LOCALE_SABBREVDAYNAME3 "mer." + LOCALE_SABBREVDAYNAME4 "jeu." + LOCALE_SABBREVDAYNAME5 "ven." + LOCALE_SABBREVDAYNAME6 "sam." + LOCALE_SABBREVDAYNAME7 "dim." + LOCALE_SABBREVLANGNAME "FRM" + LOCALE_SABBREVMONTHNAME1 "janv." + LOCALE_SABBREVMONTHNAME2 "févr." + LOCALE_SABBREVMONTHNAME3 "mars" + LOCALE_SABBREVMONTHNAME4 "avr." + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "juin" + LOCALE_SABBREVMONTHNAME7 "juil." + LOCALE_SABBREVMONTHNAME8 "août" + LOCALE_SABBREVMONTHNAME9 "sept." + LOCALE_SABBREVMONTHNAME10 "oct." + LOCALE_SABBREVMONTHNAME11 "nov." + LOCALE_SABBREVMONTHNAME12 "déc." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Principality of Monaco" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "lundi" + LOCALE_SDAYNAME2 "mardi" + LOCALE_SDAYNAME3 "mercredi" + LOCALE_SDAYNAME4 "jeudi" + LOCALE_SDAYNAME5 "vendredi" + LOCALE_SDAYNAME6 "samedi" + LOCALE_SDAYNAME7 "dimanche" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Principality of Monaco" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "French" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "MC" + LOCALE_SISO639LANGNAME "fr" + LOCALE_SLANGUAGE "French (Monaco)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janvier" + LOCALE_SMONTHNAME2 "février" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "avril" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juin" + LOCALE_SMONTHNAME7 "juillet" + LOCALE_SMONTHNAME8 "août" + LOCALE_SMONTHNAME9 "septembre" + LOCALE_SMONTHNAME10 "octobre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "décembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Principauté de Monaco" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "français" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Europe occidentale et États-Unis d'Amérique" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Europe centrale" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltique" + LGRPID_GREEK+LGRPID_RES_BASE "Grec" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillique" + LGRPID_TURKISH+LGRPID_RES_BASE "Turc" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japonais" + LGRPID_KOREAN+LGRPID_RES_BASE "Coréen" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Chinois traditionnel" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Chinois simplifié" + LGRPID_THAI+LGRPID_RES_BASE "Thaï" + LGRPID_HEBREW+LGRPID_RES_BASE "Hébreu" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabe" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamien" + LGRPID_INDIC+LGRPID_RES_BASE "Indien" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Géorgien" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Arménian" +} diff --git a/reactos/lib/kernel32/nls/frs.nls b/reactos/lib/kernel32/nls/frs.nls new file mode 100644 index 00000000000..10fd9d6e3ff --- /dev/null +++ b/reactos/lib/kernel32/nls/frs.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for French (Switzerland) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_SWISS +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "41" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "41" + LOCALE_IDEFAULTEBCDICCODEPAGE "20297" + LOCALE_IDEFAULTLANGUAGE "100c" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "100c" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "CHE" + LOCALE_SABBREVDAYNAME1 "lun." + LOCALE_SABBREVDAYNAME2 "mar." + LOCALE_SABBREVDAYNAME3 "mer." + LOCALE_SABBREVDAYNAME4 "jeu." + LOCALE_SABBREVDAYNAME5 "ven." + LOCALE_SABBREVDAYNAME6 "sam." + LOCALE_SABBREVDAYNAME7 "dim." + LOCALE_SABBREVLANGNAME "FRS" + LOCALE_SABBREVMONTHNAME1 "janv." + LOCALE_SABBREVMONTHNAME2 "févr." + LOCALE_SABBREVMONTHNAME3 "mars" + LOCALE_SABBREVMONTHNAME4 "avr." + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "juin" + LOCALE_SABBREVMONTHNAME7 "juil." + LOCALE_SABBREVMONTHNAME8 "août" + LOCALE_SABBREVMONTHNAME9 "sept." + LOCALE_SABBREVMONTHNAME10 "oct." + LOCALE_SABBREVMONTHNAME11 "nov." + LOCALE_SABBREVMONTHNAME12 "déc." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Switzerland" + LOCALE_SCURRENCY "SFr." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "lundi" + LOCALE_SDAYNAME2 "mardi" + LOCALE_SDAYNAME3 "mercredi" + LOCALE_SDAYNAME4 "jeudi" + LOCALE_SDAYNAME5 "vendredi" + LOCALE_SDAYNAME6 "samedi" + LOCALE_SDAYNAME7 "dimanche" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Switzerland" + LOCALE_SENGCURRNAME "Swiss Franc" + LOCALE_SENGLANGUAGE "French" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CHF" + LOCALE_SISO3166CTRYNAME "CH" + LOCALE_SISO639LANGNAME "fr" + LOCALE_SLANGUAGE "French (Switzerland)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janvier" + LOCALE_SMONTHNAME2 "février" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "avril" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juin" + LOCALE_SMONTHNAME7 "juillet" + LOCALE_SMONTHNAME8 "août" + LOCALE_SMONTHNAME9 "septembre" + LOCALE_SMONTHNAME10 "octobre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "décembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "'" + LOCALE_SNATIVECTRYNAME "Suisse" + LOCALE_SNATIVECURRNAME "Franc suisse" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "français" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "'" + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Europe occidentale et États-Unis d'Amérique" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Europe centrale" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltique" + LGRPID_GREEK+LGRPID_RES_BASE "Grec" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillique" + LGRPID_TURKISH+LGRPID_RES_BASE "Turc" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japonais" + LGRPID_KOREAN+LGRPID_RES_BASE "Coréen" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Chinois traditionnel" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Chinois simplifié" + LGRPID_THAI+LGRPID_RES_BASE "Thaï" + LGRPID_HEBREW+LGRPID_RES_BASE "Hébreu" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabe" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamien" + LGRPID_INDIC+LGRPID_RES_BASE "Indien" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Géorgien" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Arménian" +} diff --git a/reactos/lib/kernel32/nls/glc.nls b/reactos/lib/kernel32/nls/glc.nls new file mode 100644 index 00000000000..6b3193062f0 --- /dev/null +++ b/reactos/lib/kernel32/nls/glc.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Galician + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_GALICIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0003\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "0" + LOCALE_ICOUNTRY "34" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "34" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "040a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0456" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "a.m." + LOCALE_S2359 "p.m." + LOCALE_SABBREVCTRYNAME "ESP" + LOCALE_SABBREVDAYNAME1 "luns" + LOCALE_SABBREVDAYNAME2 "mar" + LOCALE_SABBREVDAYNAME3 "mér" + LOCALE_SABBREVDAYNAME4 "xov" + LOCALE_SABBREVDAYNAME5 "ven" + LOCALE_SABBREVDAYNAME6 "sab" + LOCALE_SABBREVDAYNAME7 "dom" + LOCALE_SABBREVLANGNAME "GLC" + LOCALE_SABBREVMONTHNAME1 "xan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "abr" + LOCALE_SABBREVMONTHNAME5 "maio" + LOCALE_SABBREVMONTHNAME6 "xuñ" + LOCALE_SABBREVMONTHNAME7 "xull" + LOCALE_SABBREVMONTHNAME8 "ago" + LOCALE_SABBREVMONTHNAME9 "set" + LOCALE_SABBREVMONTHNAME10 "out" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Spain" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "luns" + LOCALE_SDAYNAME2 "martes" + LOCALE_SDAYNAME3 "mércores" + LOCALE_SDAYNAME4 "xoves" + LOCALE_SDAYNAME5 "venres" + LOCALE_SDAYNAME6 "sábado" + LOCALE_SDAYNAME7 "domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Spain" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Galician" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "ES" + LOCALE_SISO639LANGNAME "gl" + LOCALE_SLANGUAGE "Galician" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, dd' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "xaneiro" + LOCALE_SMONTHNAME2 "febreiro" + LOCALE_SMONTHNAME3 "marzo" + LOCALE_SMONTHNAME4 "abril" + LOCALE_SMONTHNAME5 "maio" + LOCALE_SMONTHNAME6 "xuño" + LOCALE_SMONTHNAME7 "xullo" + LOCALE_SMONTHNAME8 "agosto" + LOCALE_SMONTHNAME9 "setembro" + LOCALE_SMONTHNAME10 "outubro" + LOCALE_SMONTHNAME11 "novembro" + LOCALE_SMONTHNAME12 "decembro" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "España" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "galego" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM'de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/heb.nls b/reactos/lib/kernel32/nls/heb.nls new file mode 100644 index 00000000000..7d4e1c0e060 --- /dev/null +++ b/reactos/lib/kernel32/nls/heb.nls @@ -0,0 +1,155 @@ +/* + * Locale definitions for Hebrew + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * Copyright 2003 Shachar Shemesh + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1255) + +STRINGTABLE LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x18ab\x8000\x38cb\x1000\x0000\x0000\x0000\x0800\x0020\x0000\x0000\x0020\x0020\x0000\x0000\x0020" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "972" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1255" + LOCALE_IDEFAULTCODEPAGE "862" + LOCALE_IDEFAULTCOUNTRY "972" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "040d" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10005" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28598" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "040d" + LOCALE_ILDATE "1" + LOCALE_ILZERO "0" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "8" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "ISR" + LOCALE_SABBREVDAYNAME1 "á" + LOCALE_SABBREVDAYNAME2 "â" + LOCALE_SABBREVDAYNAME3 "ã" + LOCALE_SABBREVDAYNAME4 "ä" + LOCALE_SABBREVDAYNAME5 "å" + LOCALE_SABBREVDAYNAME6 "ù" + LOCALE_SABBREVDAYNAME7 "à" + LOCALE_SABBREVLANGNAME "HEB" + LOCALE_SABBREVMONTHNAME1 "éðåàø" + LOCALE_SABBREVMONTHNAME2 "ôáøåàø" + LOCALE_SABBREVMONTHNAME3 "îøõ" + LOCALE_SABBREVMONTHNAME4 "àôøéì" + LOCALE_SABBREVMONTHNAME5 "îàé" + LOCALE_SABBREVMONTHNAME6 "éåðé" + LOCALE_SABBREVMONTHNAME7 "éåìé" + LOCALE_SABBREVMONTHNAME8 "àåâåñè" + LOCALE_SABBREVMONTHNAME9 "ñôèîáø" + LOCALE_SABBREVMONTHNAME10 "àå÷èåáø" + LOCALE_SABBREVMONTHNAME11 "ðåáîáø" + LOCALE_SABBREVMONTHNAME12 "ãöîáø" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Israel" + LOCALE_SCURRENCY "¤" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "éåí ùðé" + LOCALE_SDAYNAME2 "éåí ùìéùé" + LOCALE_SDAYNAME3 "éåí øáéòé" + LOCALE_SDAYNAME4 "éåí çîéùé" + LOCALE_SDAYNAME5 "éåí ùéùé" + LOCALE_SDAYNAME6 "ùáú" + LOCALE_SDAYNAME7 "éåí øàùåï" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Israel" + LOCALE_SENGCURRNAME "Israeli New Shekel" + LOCALE_SENGLANGUAGE "Hebrew" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ILS" + LOCALE_SISO3166CTRYNAME "IL" + LOCALE_SISO639LANGNAME "he" + LOCALE_SLANGUAGE "Hebrew" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "éðåàø" + LOCALE_SMONTHNAME2 "ôáøåàø" + LOCALE_SMONTHNAME3 "îøõ" + LOCALE_SMONTHNAME4 "àôøéì" + LOCALE_SMONTHNAME5 "îàé" + LOCALE_SMONTHNAME6 "éåðé" + LOCALE_SMONTHNAME7 "éåìé" + LOCALE_SMONTHNAME8 "àåâåñè" + LOCALE_SMONTHNAME9 "ñôèîáø" + LOCALE_SMONTHNAME10 "àå÷èåáø" + LOCALE_SMONTHNAME11 "ðåáîáø" + LOCALE_SMONTHNAME12 "ãöîáø" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "éùøàì" + LOCALE_SNATIVECURRNAME "ù÷ì çãù" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "òáøéú" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "îòøá àéøåôä åàøöåú äáøéú" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "îøëæ àéøåôä" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "éååðéú" + LGRPID_CYRILLIC+LGRPID_RES_BASE "÷øéìéú" + LGRPID_TURKISH+LGRPID_RES_BASE "èåø÷éú" + LGRPID_JAPANESE+LGRPID_RES_BASE "éôðéú" + LGRPID_KOREAN+LGRPID_RES_BASE "÷åøéàðéú" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "ñéðéú îñåøúéú" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "ñéðéú îôåùèú" + LGRPID_THAI+LGRPID_RES_BASE "úàéìðãéú" + LGRPID_HEBREW+LGRPID_RES_BASE "òáøéú" + LGRPID_ARABIC+LGRPID_RES_BASE "òøáéú" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "åéàèðîéú" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "àøîðéú" +} diff --git a/reactos/lib/kernel32/nls/hrv.nls b/reactos/lib/kernel32/nls/hrv.nls new file mode 100644 index 00000000000..98af8ab6786 --- /dev/null +++ b/reactos/lib/kernel32/nls/hrv.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Croatian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "385" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "385" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "041a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10082" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "041a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "2" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "HRV" + LOCALE_SABBREVDAYNAME1 "pon" + LOCALE_SABBREVDAYNAME2 "uto" + LOCALE_SABBREVDAYNAME3 "sri" + LOCALE_SABBREVDAYNAME4 "èet" + LOCALE_SABBREVDAYNAME5 "pet" + LOCALE_SABBREVDAYNAME6 "sub" + LOCALE_SABBREVDAYNAME7 "ned" + LOCALE_SABBREVLANGNAME "HRV" + LOCALE_SABBREVMONTHNAME1 "sij" + LOCALE_SABBREVMONTHNAME2 "vlj" + LOCALE_SABBREVMONTHNAME3 "ožu" + LOCALE_SABBREVMONTHNAME4 "tra" + LOCALE_SABBREVMONTHNAME5 "svi" + LOCALE_SABBREVMONTHNAME6 "lip" + LOCALE_SABBREVMONTHNAME7 "srp" + LOCALE_SABBREVMONTHNAME8 "kol" + LOCALE_SABBREVMONTHNAME9 "ruj" + LOCALE_SABBREVMONTHNAME10 "lis" + LOCALE_SABBREVMONTHNAME11 "stu" + LOCALE_SABBREVMONTHNAME12 "pro" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Croatia" + LOCALE_SCURRENCY "kn" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ponedjeljak" + LOCALE_SDAYNAME2 "utorak" + LOCALE_SDAYNAME3 "srijeda" + LOCALE_SDAYNAME4 "èetvrtak" + LOCALE_SDAYNAME5 "petak" + LOCALE_SDAYNAME6 "subota" + LOCALE_SDAYNAME7 "nedjelja" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Croatia" + LOCALE_SENGCURRNAME "Croatian Kuna" + LOCALE_SENGLANGUAGE "Croatian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "HRK" + LOCALE_SISO3166CTRYNAME "HR" + LOCALE_SISO639LANGNAME "hr" + LOCALE_SLANGUAGE "Croatian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "sijeèanj" + LOCALE_SMONTHNAME2 "veljaèa" + LOCALE_SMONTHNAME3 "ožujak" + LOCALE_SMONTHNAME4 "travanj" + LOCALE_SMONTHNAME5 "svibanj" + LOCALE_SMONTHNAME6 "lipanj" + LOCALE_SMONTHNAME7 "srpanj" + LOCALE_SMONTHNAME8 "kolovoz" + LOCALE_SMONTHNAME9 "rujan" + LOCALE_SMONTHNAME10 "listopad" + LOCALE_SMONTHNAME11 "studeni" + LOCALE_SMONTHNAME12 "prosinac" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Hrvatska" + LOCALE_SNATIVECURRNAME "hrvatska kuna" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "hrvatski" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/hun.nls b/reactos/lib/kernel32/nls/hun.nls new file mode 100644 index 00000000000..3e31d5c69d0 --- /dev/null +++ b/reactos/lib/kernel32/nls/hun.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Hungarian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "36" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "36" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "040e" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "040e" + LOCALE_ILDATE "2" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "de." + LOCALE_S2359 "du." + LOCALE_SABBREVCTRYNAME "HUN" + LOCALE_SABBREVDAYNAME1 "H" + LOCALE_SABBREVDAYNAME2 "K" + LOCALE_SABBREVDAYNAME3 "Sze" + LOCALE_SABBREVDAYNAME4 "Cs" + LOCALE_SABBREVDAYNAME5 "P" + LOCALE_SABBREVDAYNAME6 "Szo" + LOCALE_SABBREVDAYNAME7 "V" + LOCALE_SABBREVLANGNAME "HUN" + LOCALE_SABBREVMONTHNAME1 "jan." + LOCALE_SABBREVMONTHNAME2 "febr." + LOCALE_SABBREVMONTHNAME3 "márc." + LOCALE_SABBREVMONTHNAME4 "ápr." + LOCALE_SABBREVMONTHNAME5 "máj." + LOCALE_SABBREVMONTHNAME6 "jún." + LOCALE_SABBREVMONTHNAME7 "júl." + LOCALE_SABBREVMONTHNAME8 "aug." + LOCALE_SABBREVMONTHNAME9 "szept." + LOCALE_SABBREVMONTHNAME10 "okt." + LOCALE_SABBREVMONTHNAME11 "nov." + LOCALE_SABBREVMONTHNAME12 "dec." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Hungary" + LOCALE_SCURRENCY "Ft" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "hétfõ" + LOCALE_SDAYNAME2 "kedd" + LOCALE_SDAYNAME3 "szerda" + LOCALE_SDAYNAME4 "csütörtök" + LOCALE_SDAYNAME5 "péntek" + LOCALE_SDAYNAME6 "szombat" + LOCALE_SDAYNAME7 "vasárnap" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Hungary" + LOCALE_SENGCURRNAME "Hungarian Forint" + LOCALE_SENGLANGUAGE "Hungarian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "HUF" + LOCALE_SISO3166CTRYNAME "HU" + LOCALE_SISO639LANGNAME "hu" + LOCALE_SLANGUAGE "Hungarian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "yyyy. MMMM d." + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "január" + LOCALE_SMONTHNAME2 "február" + LOCALE_SMONTHNAME3 "március" + LOCALE_SMONTHNAME4 "április" + LOCALE_SMONTHNAME5 "május" + LOCALE_SMONTHNAME6 "június" + LOCALE_SMONTHNAME7 "július" + LOCALE_SMONTHNAME8 "augusztus" + LOCALE_SMONTHNAME9 "szeptember" + LOCALE_SMONTHNAME10 "október" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Magyarország" + LOCALE_SNATIVECURRNAME "Forint" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Magyar" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy. MM. dd." + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "yyyy. MMMM" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ind.nls b/reactos/lib/kernel32/nls/ind.nls new file mode 100644 index 00000000000..913d4d98bb8 --- /dev/null +++ b/reactos/lib/kernel32/nls/ind.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Indonesian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "62" + LOCALE_ICURRDIGITS "0" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "62" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0421" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "0" + LOCALE_ILANGUAGE "0421" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "IDN" + LOCALE_SABBREVDAYNAME1 "Sen" + LOCALE_SABBREVDAYNAME2 "Sel" + LOCALE_SABBREVDAYNAME3 "Rabu" + LOCALE_SABBREVDAYNAME4 "Kamis" + LOCALE_SABBREVDAYNAME5 "Jumat" + LOCALE_SABBREVDAYNAME6 "Sabtu" + LOCALE_SABBREVDAYNAME7 "Minggu" + LOCALE_SABBREVLANGNAME "IND" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mei" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Agust" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nop" + LOCALE_SABBREVMONTHNAME12 "Des" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Indonesia" + LOCALE_SCURRENCY "Rp" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Senin" + LOCALE_SDAYNAME2 "Selasa" + LOCALE_SDAYNAME3 "Rabu" + LOCALE_SDAYNAME4 "Kamis" + LOCALE_SDAYNAME5 "Jumat" + LOCALE_SDAYNAME6 "Sabtu" + LOCALE_SDAYNAME7 "Minggu" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Indonesia" + LOCALE_SENGCURRNAME "Indonesian Rupiah" + LOCALE_SENGLANGUAGE "Indonesian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "IDR" + LOCALE_SISO3166CTRYNAME "ID" + LOCALE_SISO639LANGNAME "id" + LOCALE_SLANGUAGE "Indonesian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Januari" + LOCALE_SMONTHNAME2 "Februari" + LOCALE_SMONTHNAME3 "Maret" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mei" + LOCALE_SMONTHNAME6 "Juni" + LOCALE_SMONTHNAME7 "Juli" + LOCALE_SMONTHNAME8 "Agustus" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "Nopember" + LOCALE_SMONTHNAME12 "Desember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Indonesia" + LOCALE_SNATIVECURRNAME "Rupiah" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Bahasa Indonesia" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/isl.nls b/reactos/lib/kernel32/nls/isl.nls new file mode 100644 index 00000000000..d95cb8070bd --- /dev/null +++ b/reactos/lib/kernel32/nls/isl.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Icelandic + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ICELANDIC, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0003\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "354" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "354" + LOCALE_IDEFAULTEBCDICCODEPAGE "20871" + LOCALE_IDEFAULTLANGUAGE "040f" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10079" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "040f" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ISL" + LOCALE_SABBREVDAYNAME1 "mán." + LOCALE_SABBREVDAYNAME2 "þri." + LOCALE_SABBREVDAYNAME3 "mið." + LOCALE_SABBREVDAYNAME4 "fim." + LOCALE_SABBREVDAYNAME5 "fös." + LOCALE_SABBREVDAYNAME6 "lau." + LOCALE_SABBREVDAYNAME7 "sun." + LOCALE_SABBREVLANGNAME "ISL" + LOCALE_SABBREVMONTHNAME1 "jan." + LOCALE_SABBREVMONTHNAME2 "feb." + LOCALE_SABBREVMONTHNAME3 "mar." + LOCALE_SABBREVMONTHNAME4 "apr." + LOCALE_SABBREVMONTHNAME5 "maí" + LOCALE_SABBREVMONTHNAME6 "jún." + LOCALE_SABBREVMONTHNAME7 "júl." + LOCALE_SABBREVMONTHNAME8 "ágú." + LOCALE_SABBREVMONTHNAME9 "sep." + LOCALE_SABBREVMONTHNAME10 "okt." + LOCALE_SABBREVMONTHNAME11 "nóv." + LOCALE_SABBREVMONTHNAME12 "des." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Iceland" + LOCALE_SCURRENCY "kr." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "mánudagur" + LOCALE_SDAYNAME2 "þriðjudagur" + LOCALE_SDAYNAME3 "miðvikudagur" + LOCALE_SDAYNAME4 "fimmtudagur" + LOCALE_SDAYNAME5 "föstudagur" + LOCALE_SDAYNAME6 "laugardagur" + LOCALE_SDAYNAME7 "sunnudagur" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Iceland" + LOCALE_SENGCURRNAME "Icelandic Krona" + LOCALE_SENGLANGUAGE "Icelandic" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ISK" + LOCALE_SISO3166CTRYNAME "IS" + LOCALE_SISO639LANGNAME "is" + LOCALE_SLANGUAGE "Icelandic" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janúar" + LOCALE_SMONTHNAME2 "febrúar" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "apríl" + LOCALE_SMONTHNAME5 "maí" + LOCALE_SMONTHNAME6 "júní" + LOCALE_SMONTHNAME7 "júlí" + LOCALE_SMONTHNAME8 "ágúst" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "október" + LOCALE_SMONTHNAME11 "nóvember" + LOCALE_SMONTHNAME12 "desember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Ísland" + LOCALE_SNATIVECURRNAME "Króna" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "íslenska" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ita.nls b/reactos/lib/kernel32/nls/ita.nls new file mode 100644 index 00000000000..46da383634a --- /dev/null +++ b/reactos/lib/kernel32/nls/ita.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Italian (Italy) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "39" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "39" + LOCALE_IDEFAULTEBCDICCODEPAGE "20280" + LOCALE_IDEFAULTLANGUAGE "0410" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0410" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "9" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ITA" + LOCALE_SABBREVDAYNAME1 "lun" + LOCALE_SABBREVDAYNAME2 "mar" + LOCALE_SABBREVDAYNAME3 "mer" + LOCALE_SABBREVDAYNAME4 "gio" + LOCALE_SABBREVDAYNAME5 "ven" + LOCALE_SABBREVDAYNAME6 "sab" + LOCALE_SABBREVDAYNAME7 "dom" + LOCALE_SABBREVLANGNAME "ITA" + LOCALE_SABBREVMONTHNAME1 "gen" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mag" + LOCALE_SABBREVMONTHNAME6 "giu" + LOCALE_SABBREVMONTHNAME7 "lug" + LOCALE_SABBREVMONTHNAME8 "ago" + LOCALE_SABBREVMONTHNAME9 "set" + LOCALE_SABBREVMONTHNAME10 "ott" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Italy" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "lunedì" + LOCALE_SDAYNAME2 "martedì" + LOCALE_SDAYNAME3 "mercoledì" + LOCALE_SDAYNAME4 "giovedì" + LOCALE_SDAYNAME5 "venerdì" + LOCALE_SDAYNAME6 "sabato" + LOCALE_SDAYNAME7 "domenica" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Italy" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Italian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "IT" + LOCALE_SISO639LANGNAME "it" + LOCALE_SLANGUAGE "Italian (Italy)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "gennaio" + LOCALE_SMONTHNAME2 "febbraio" + LOCALE_SMONTHNAME3 "marzo" + LOCALE_SMONTHNAME4 "aprile" + LOCALE_SMONTHNAME5 "maggio" + LOCALE_SMONTHNAME6 "giugno" + LOCALE_SMONTHNAME7 "luglio" + LOCALE_SMONTHNAME8 "agosto" + LOCALE_SMONTHNAME9 "settembre" + LOCALE_SMONTHNAME10 "ottobre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "dicembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Italia" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "italiano" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME "." + LOCALE_STIMEFORMAT "H.mm.ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/its.nls b/reactos/lib/kernel32/nls/its.nls new file mode 100644 index 00000000000..8d563e61c4e --- /dev/null +++ b/reactos/lib/kernel32/nls/its.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Italian (Switzerland) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN_SWISS +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "41" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "41" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0810" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0810" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "2" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "CHE" + LOCALE_SABBREVDAYNAME1 "lun" + LOCALE_SABBREVDAYNAME2 "mar" + LOCALE_SABBREVDAYNAME3 "mer" + LOCALE_SABBREVDAYNAME4 "gio" + LOCALE_SABBREVDAYNAME5 "ven" + LOCALE_SABBREVDAYNAME6 "sab" + LOCALE_SABBREVDAYNAME7 "dom" + LOCALE_SABBREVLANGNAME "ITS" + LOCALE_SABBREVMONTHNAME1 "gen" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mag" + LOCALE_SABBREVMONTHNAME6 "gio" + LOCALE_SABBREVMONTHNAME7 "lug" + LOCALE_SABBREVMONTHNAME8 "ago" + LOCALE_SABBREVMONTHNAME9 "set" + LOCALE_SABBREVMONTHNAME10 "ott" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dic" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Switzerland" + LOCALE_SCURRENCY "SFr." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "lunedì" + LOCALE_SDAYNAME2 "martedì" + LOCALE_SDAYNAME3 "mercoledì" + LOCALE_SDAYNAME4 "giovedì" + LOCALE_SDAYNAME5 "venerdì" + LOCALE_SDAYNAME6 "sabato" + LOCALE_SDAYNAME7 "domenica" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Switzerland" + LOCALE_SENGCURRNAME "Swiss Franc" + LOCALE_SENGLANGUAGE "Italian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "CHF" + LOCALE_SISO3166CTRYNAME "CH" + LOCALE_SISO639LANGNAME "it" + LOCALE_SLANGUAGE "Italian (Switzerland)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "gennaio" + LOCALE_SMONTHNAME2 "febbraio" + LOCALE_SMONTHNAME3 "marzo" + LOCALE_SMONTHNAME4 "aprile" + LOCALE_SMONTHNAME5 "maggio" + LOCALE_SMONTHNAME6 "giugno" + LOCALE_SMONTHNAME7 "luglio" + LOCALE_SMONTHNAME8 "agosto" + LOCALE_SMONTHNAME9 "settembre" + LOCALE_SMONTHNAME10 "ottobre" + LOCALE_SMONTHNAME11 "novembre" + LOCALE_SMONTHNAME12 "dicembre" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "'" + LOCALE_SNATIVECTRYNAME "Svizzera" + LOCALE_SNATIVECURRNAME "Franco svizzero" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "italiano" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "'" + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/lvi.nls b/reactos/lib/kernel32/nls/lvi.nls new file mode 100644 index 00000000000..54efe2cac93 --- /dev/null +++ b/reactos/lib/kernel32/nls/lvi.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Latvian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1257) + +STRINGTABLE LANGUAGE LANG_LATVIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0007\x8000\x3848\x1000\x0000\x0000\x0000\x0000\x0080\x0000\x0000\x0800\x0092\x0000\x0000\xcdd4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "371" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1257" + LOCALE_IDEFAULTCODEPAGE "775" + LOCALE_IDEFAULTCOUNTRY "371" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0426" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28603" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0426" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "9" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "LVA" + LOCALE_SABBREVDAYNAME1 "Pr" + LOCALE_SABBREVDAYNAME2 "Ot" + LOCALE_SABBREVDAYNAME3 "Tr" + LOCALE_SABBREVDAYNAME4 "Ce" + LOCALE_SABBREVDAYNAME5 "Pk" + LOCALE_SABBREVDAYNAME6 "Se" + LOCALE_SABBREVDAYNAME7 "Sv" + LOCALE_SABBREVLANGNAME "LVI" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mai" + LOCALE_SABBREVMONTHNAME6 "Jûn" + LOCALE_SABBREVMONTHNAME7 "Jûl" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Latvia" + LOCALE_SCURRENCY "Ls" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "pirmdiena" + LOCALE_SDAYNAME2 "otrdiena" + LOCALE_SDAYNAME3 "treðdiena" + LOCALE_SDAYNAME4 "ceturtdiena" + LOCALE_SDAYNAME5 "piektdiena" + LOCALE_SDAYNAME6 "sestdiena" + LOCALE_SDAYNAME7 "svçtdiena" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Latvia" + LOCALE_SENGCURRNAME "Latvian Lats" + LOCALE_SENGLANGUAGE "Latvian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "LVL" + LOCALE_SISO3166CTRYNAME "LV" + LOCALE_SISO639LANGNAME "lv" + LOCALE_SLANGUAGE "Latvian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, yyyy'. gada 'd. MMMM" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janvâris" + LOCALE_SMONTHNAME2 "februâris" + LOCALE_SMONTHNAME3 "marts" + LOCALE_SMONTHNAME4 "aprîlis" + LOCALE_SMONTHNAME5 "maijs" + LOCALE_SMONTHNAME6 "jûnijs" + LOCALE_SMONTHNAME7 "jûlijs" + LOCALE_SMONTHNAME8 "augusts" + LOCALE_SMONTHNAME9 "septembris" + LOCALE_SMONTHNAME10 "oktobris" + LOCALE_SMONTHNAME11 "novembris" + LOCALE_SMONTHNAME12 "decembris" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Latvija" + LOCALE_SNATIVECURRNAME "Lats" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "latvieðu" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy.MM.dd." + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "yyyy. MMMM" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/mki.nls b/reactos/lib/kernel32/nls/mki.nls new file mode 100644 index 00000000000..aeeb37ed243 --- /dev/null +++ b/reactos/lib/kernel32/nls/mki.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for FYRO Macedonian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1251) + +STRINGTABLE LANGUAGE LANG_MACEDONIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "389" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1251" + LOCALE_IDEFAULTCODEPAGE "866" + LOCALE_IDEFAULTCOUNTRY "389" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "042f" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10007" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28595" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "042f" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "MKD" + LOCALE_SABBREVDAYNAME1 "ïîí" + LOCALE_SABBREVDAYNAME2 "âòð" + LOCALE_SABBREVDAYNAME3 "ñðä" + LOCALE_SABBREVDAYNAME4 "÷åò" + LOCALE_SABBREVDAYNAME5 "ïåò" + LOCALE_SABBREVDAYNAME6 "ñàá" + LOCALE_SABBREVDAYNAME7 "íåä" + LOCALE_SABBREVLANGNAME "MKI" + LOCALE_SABBREVMONTHNAME1 "¼àí" + LOCALE_SABBREVMONTHNAME2 "ôåâ" + LOCALE_SABBREVMONTHNAME3 "ìàð" + LOCALE_SABBREVMONTHNAME4 "àïð" + LOCALE_SABBREVMONTHNAME5 "ìà¼" + LOCALE_SABBREVMONTHNAME6 "¼óí" + LOCALE_SABBREVMONTHNAME7 "¼óë" + LOCALE_SABBREVMONTHNAME8 "àâã" + LOCALE_SABBREVMONTHNAME9 "ñåï" + LOCALE_SABBREVMONTHNAME10 "îêò" + LOCALE_SABBREVMONTHNAME11 "íîå" + LOCALE_SABBREVMONTHNAME12 "äåê" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Former Yugoslav Republic of Macedonia" + LOCALE_SCURRENCY "äåí." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ïîíåäåëíèê" + LOCALE_SDAYNAME2 "âòîðíèê" + LOCALE_SDAYNAME3 "ñðåäà" + LOCALE_SDAYNAME4 "÷åòâðòîê" + LOCALE_SDAYNAME5 "ïåòîê" + LOCALE_SDAYNAME6 "ñàáîòà" + LOCALE_SDAYNAME7 "íåäåëà" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Former Yugoslav Republic of Macedonia" + LOCALE_SENGCURRNAME "Macedonian Denar" + LOCALE_SENGLANGUAGE "FYRO Macedonian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "MKD" + LOCALE_SISO3166CTRYNAME "MK" + LOCALE_SISO639LANGNAME "mk" + LOCALE_SLANGUAGE "FYRO Macedonian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "¼àíóàðè" + LOCALE_SMONTHNAME2 "ôåâðóàðè" + LOCALE_SMONTHNAME3 "ìàðò" + LOCALE_SMONTHNAME4 "àïðèë" + LOCALE_SMONTHNAME5 "ìà¼" + LOCALE_SMONTHNAME6 "¼óíè" + LOCALE_SMONTHNAME7 "¼óëè" + LOCALE_SMONTHNAME8 "àâãóñò" + LOCALE_SMONTHNAME9 "ñåïòåìâðè" + LOCALE_SMONTHNAME10 "îêòîìâðè" + LOCALE_SMONTHNAME11 "íîåìâðè" + LOCALE_SMONTHNAME12 "äåêåìâðè" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Ìàêåäîíè¼à" + LOCALE_SNATIVECURRNAME "äåíàð" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "ìàêåäîíñêè ¼àçèê" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/msb.nls b/reactos/lib/kernel32/nls/msb.nls new file mode 100644 index 00000000000..2d4bafa3892 --- /dev/null +++ b/reactos/lib/kernel32/nls/msb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Malay (Brunei Darussalam) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_MALAY, SUBLANG_MALAY_BRUNEI_DARUSSALAM +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "673" + LOCALE_ICURRDIGITS "0" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "673" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "083e" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "0" + LOCALE_ILANGUAGE "083e" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "BRN" + LOCALE_SABBREVDAYNAME1 "Isnin" + LOCALE_SABBREVDAYNAME2 "Sel" + LOCALE_SABBREVDAYNAME3 "Rabu" + LOCALE_SABBREVDAYNAME4 "Khamis" + LOCALE_SABBREVDAYNAME5 "Jumaat" + LOCALE_SABBREVDAYNAME6 "Sabtu" + LOCALE_SABBREVDAYNAME7 "Ahad" + LOCALE_SABBREVLANGNAME "MSB" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mac" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mei" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ogos" + LOCALE_SABBREVMONTHNAME9 "Sept" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dis" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Brunei Darussalam" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Isnin" + LOCALE_SDAYNAME2 "Selasa" + LOCALE_SDAYNAME3 "Rabu" + LOCALE_SDAYNAME4 "Khamis" + LOCALE_SDAYNAME5 "Jumaat" + LOCALE_SDAYNAME6 "Sabtu" + LOCALE_SDAYNAME7 "Ahad" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Brunei Darussalam" + LOCALE_SENGCURRNAME "Brunei Dollar" + LOCALE_SENGLANGUAGE "Malay" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "BND" + LOCALE_SISO3166CTRYNAME "BN" + LOCALE_SISO639LANGNAME "ms" + LOCALE_SLANGUAGE "Malay (Brunei Darussalam)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Januari" + LOCALE_SMONTHNAME2 "Februari" + LOCALE_SMONTHNAME3 "Mac" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mei" + LOCALE_SMONTHNAME6 "Jun" + LOCALE_SMONTHNAME7 "Julai" + LOCALE_SMONTHNAME8 "Ogos" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "Disember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Brunei Darussalam" + LOCALE_SNATIVECURRNAME "Ringgit Brunei" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Bahasa Malaysia" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/msl.nls b/reactos/lib/kernel32/nls/msl.nls new file mode 100644 index 00000000000..adfcb1c79c7 --- /dev/null +++ b/reactos/lib/kernel32/nls/msl.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Malay (Malaysia) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_MALAY, SUBLANG_MALAY_MALAYSIA +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "60" + LOCALE_ICURRDIGITS "0" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "60" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "043e" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "0" + LOCALE_ILANGUAGE "043e" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "MYS" + LOCALE_SABBREVDAYNAME1 "Isnin" + LOCALE_SABBREVDAYNAME2 "Sel" + LOCALE_SABBREVDAYNAME3 "Rabu" + LOCALE_SABBREVDAYNAME4 "Khamis" + LOCALE_SABBREVDAYNAME5 "Jumaat" + LOCALE_SABBREVDAYNAME6 "Sabtu" + LOCALE_SABBREVDAYNAME7 "Ahad" + LOCALE_SABBREVLANGNAME "MSL" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mac" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "Mei" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ogos" + LOCALE_SABBREVMONTHNAME9 "Sept" + LOCALE_SABBREVMONTHNAME10 "Okt" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dis" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Malaysia" + LOCALE_SCURRENCY "R" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Isnin" + LOCALE_SDAYNAME2 "Selasa" + LOCALE_SDAYNAME3 "Rabu" + LOCALE_SDAYNAME4 "Khamis" + LOCALE_SDAYNAME5 "Jumaat" + LOCALE_SDAYNAME6 "Sabtu" + LOCALE_SDAYNAME7 "Ahad" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Malaysia" + LOCALE_SENGCURRNAME "Malaysian Ringgit" + LOCALE_SENGLANGUAGE "Malay" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "MYR" + LOCALE_SISO3166CTRYNAME "MY" + LOCALE_SISO639LANGNAME "ms" + LOCALE_SLANGUAGE "Malay (Malaysia)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dd MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Januari" + LOCALE_SMONTHNAME2 "Februari" + LOCALE_SMONTHNAME3 "Mac" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "Mei" + LOCALE_SMONTHNAME6 "Jun" + LOCALE_SMONTHNAME7 "Julai" + LOCALE_SMONTHNAME8 "Ogos" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "Oktober" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "Disember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Malaysia" + LOCALE_SNATIVECURRNAME "Ringgit Malaysia" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Bahasa Malaysia" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/nlb.nls b/reactos/lib/kernel32/nls/nlb.nls new file mode 100644 index 00000000000..af696cd4247 --- /dev/null +++ b/reactos/lib/kernel32/nls/nlb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Dutch (Belgium) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_DUTCH, SUBLANG_DUTCH_BELGIAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "32" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "32" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0813" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0813" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "BEL" + LOCALE_SABBREVDAYNAME1 "ma" + LOCALE_SABBREVDAYNAME2 "di" + LOCALE_SABBREVDAYNAME3 "wo" + LOCALE_SABBREVDAYNAME4 "do" + LOCALE_SABBREVDAYNAME5 "vr" + LOCALE_SABBREVDAYNAME6 "za" + LOCALE_SABBREVDAYNAME7 "zo" + LOCALE_SABBREVLANGNAME "NLB" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mrt" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mei" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Belgium" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "maandag" + LOCALE_SDAYNAME2 "dinsdag" + LOCALE_SDAYNAME3 "woensdag" + LOCALE_SDAYNAME4 "donderdag" + LOCALE_SDAYNAME5 "vrijdag" + LOCALE_SDAYNAME6 "zaterdag" + LOCALE_SDAYNAME7 "zondag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Belgium" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Dutch" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "BE" + LOCALE_SISO639LANGNAME "nl" + LOCALE_SLANGUAGE "Dutch (Belgium)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januari" + LOCALE_SMONTHNAME2 "februari" + LOCALE_SMONTHNAME3 "maart" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "mei" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "augustus" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "België" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Nederlands" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/MM/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/nld.nls b/reactos/lib/kernel32/nls/nld.nls new file mode 100644 index 00000000000..a2cdf03c785 --- /dev/null +++ b/reactos/lib/kernel32/nls/nld.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Dutch (Netherlands) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_DUTCH, SUBLANG_DUTCH +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "31" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "31" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0413" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0413" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "11" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "2" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "2" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "NLD" + LOCALE_SABBREVDAYNAME1 "ma" + LOCALE_SABBREVDAYNAME2 "di" + LOCALE_SABBREVDAYNAME3 "wo" + LOCALE_SABBREVDAYNAME4 "do" + LOCALE_SABBREVDAYNAME5 "vr" + LOCALE_SABBREVDAYNAME6 "za" + LOCALE_SABBREVDAYNAME7 "zo" + LOCALE_SABBREVLANGNAME "NLD" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mrt" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mei" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Netherlands" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "maandag" + LOCALE_SDAYNAME2 "dinsdag" + LOCALE_SDAYNAME3 "woensdag" + LOCALE_SDAYNAME4 "donderdag" + LOCALE_SDAYNAME5 "vrijdag" + LOCALE_SDAYNAME6 "zaterdag" + LOCALE_SDAYNAME7 "zondag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Netherlands" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Dutch" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "NL" + LOCALE_SISO639LANGNAME "nl" + LOCALE_SLANGUAGE "Dutch (Netherlands)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januari" + LOCALE_SMONTHNAME2 "februari" + LOCALE_SMONTHNAME3 "maart" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "mei" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "augustus" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Nederland" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Nederlands" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d-M-yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "West Europa en Verenigde Staten" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Centraal Europa" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltisch" + LGRPID_GREEK+LGRPID_RES_BASE "Grieks" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillisch" + LGRPID_TURKISH+LGRPID_RES_BASE "Turks" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japans" + LGRPID_KOREAN+LGRPID_RES_BASE "Koreaans" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditioneel Chinees" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Vereenvoudigd Chinees" + LGRPID_THAI+LGRPID_RES_BASE "Thais" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebreeuws" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabisch" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamees" + LGRPID_INDIC+LGRPID_RES_BASE "Indisch" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgisch" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armeens" +} diff --git a/reactos/lib/kernel32/nls/non.nls b/reactos/lib/kernel32/nls/non.nls new file mode 100644 index 00000000000..faca556ea77 --- /dev/null +++ b/reactos/lib/kernel32/nls/non.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Norwegian (Nynorsk) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "47" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "47" + LOCALE_IDEFAULTEBCDICCODEPAGE "20277" + LOCALE_IDEFAULTLANGUAGE "0814" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0814" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "12" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "NOR" + LOCALE_SABBREVDAYNAME1 "må" + LOCALE_SABBREVDAYNAME2 "ty" + LOCALE_SABBREVDAYNAME3 "on" + LOCALE_SABBREVDAYNAME4 "to" + LOCALE_SABBREVDAYNAME5 "fr" + LOCALE_SABBREVDAYNAME6 "la" + LOCALE_SABBREVDAYNAME7 "su" + LOCALE_SABBREVLANGNAME "NON" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "des" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Norway" + LOCALE_SCURRENCY "kr" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "måndag" + LOCALE_SDAYNAME2 "tysdag" + LOCALE_SDAYNAME3 "onsdag" + LOCALE_SDAYNAME4 "torsdag" + LOCALE_SDAYNAME5 "fredag" + LOCALE_SDAYNAME6 "laurdag" + LOCALE_SDAYNAME7 "sundag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Norway" + LOCALE_SENGCURRNAME "Norwegian Krone" + LOCALE_SENGLANGUAGE "Norwegian (Nynorsk)" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "NOK" + LOCALE_SISO3166CTRYNAME "NO" + LOCALE_SISO639LANGNAME "nn" + LOCALE_SLANGUAGE "Norwegian (Nynorsk)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januar" + LOCALE_SMONTHNAME2 "februar" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "august" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "desember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Noreg" + LOCALE_SNATIVECURRNAME "Norsk krone" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "norsk (nynorsk)" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/nor.nls b/reactos/lib/kernel32/nls/nor.nls new file mode 100644 index 00000000000..ffc6d47504b --- /dev/null +++ b/reactos/lib/kernel32/nls/nor.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Norwegian (Bokmal) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "47" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "2" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "47" + LOCALE_IDEFAULTEBCDICCODEPAGE "20277" + LOCALE_IDEFAULTLANGUAGE "0414" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0414" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "12" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "4" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "4" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "NOR" + LOCALE_SABBREVDAYNAME1 "ma" + LOCALE_SABBREVDAYNAME2 "ti" + LOCALE_SABBREVDAYNAME3 "on" + LOCALE_SABBREVDAYNAME4 "to" + LOCALE_SABBREVDAYNAME5 "fr" + LOCALE_SABBREVDAYNAME6 "lø" + LOCALE_SABBREVDAYNAME7 "sø" + LOCALE_SABBREVLANGNAME "NOR" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "des" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Norway" + LOCALE_SCURRENCY "kr" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "mandag" + LOCALE_SDAYNAME2 "tirsdag" + LOCALE_SDAYNAME3 "onsdag" + LOCALE_SDAYNAME4 "torsdag" + LOCALE_SDAYNAME5 "fredag" + LOCALE_SDAYNAME6 "lørdag" + LOCALE_SDAYNAME7 "søndag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Norway" + LOCALE_SENGCURRNAME "Norwegian Krone" + LOCALE_SENGLANGUAGE "Norwegian (Bokmål)" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "NOK" + LOCALE_SISO3166CTRYNAME "NO" + LOCALE_SISO639LANGNAME "nb" + LOCALE_SLANGUAGE "Norwegian (Bokmal)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januar" + LOCALE_SMONTHNAME2 "februar" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "august" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "desember" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Norge" + LOCALE_SNATIVECURRNAME "Norsk krone" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "norsk (bokmål)" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/plk.nls b/reactos/lib/kernel32/nls/plk.nls new file mode 100644 index 00000000000..0f1279be5ff --- /dev/null +++ b/reactos/lib/kernel32/nls/plk.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Polish + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_POLISH, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "48" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "48" + LOCALE_IDEFAULTEBCDICCODEPAGE "20880" + LOCALE_IDEFAULTLANGUAGE "0415" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0415" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "POL" + LOCALE_SABBREVDAYNAME1 "Pn" + LOCALE_SABBREVDAYNAME2 "Wt" + LOCALE_SABBREVDAYNAME3 "Œr" + LOCALE_SABBREVDAYNAME4 "Cz" + LOCALE_SABBREVDAYNAME5 "Pt" + LOCALE_SABBREVDAYNAME6 "So" + LOCALE_SABBREVDAYNAME7 "N" + LOCALE_SABBREVLANGNAME "PLK" + LOCALE_SABBREVMONTHNAME1 "sty" + LOCALE_SABBREVMONTHNAME2 "lut" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "kwi" + LOCALE_SABBREVMONTHNAME5 "maj" + LOCALE_SABBREVMONTHNAME6 "cze" + LOCALE_SABBREVMONTHNAME7 "lip" + LOCALE_SABBREVMONTHNAME8 "sie" + LOCALE_SABBREVMONTHNAME9 "wrz" + LOCALE_SABBREVMONTHNAME10 "paŸ" + LOCALE_SABBREVMONTHNAME11 "lis" + LOCALE_SABBREVMONTHNAME12 "gru" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Poland" + LOCALE_SCURRENCY "z³" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "poniedzia³ek" + LOCALE_SDAYNAME2 "wtorek" + LOCALE_SDAYNAME3 "œroda" + LOCALE_SDAYNAME4 "czwartek" + LOCALE_SDAYNAME5 "pi¹tek" + LOCALE_SDAYNAME6 "sobota" + LOCALE_SDAYNAME7 "niedziela" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Poland" + LOCALE_SENGCURRNAME "Polish Zloty" + LOCALE_SENGLANGUAGE "Polish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "PLN" + LOCALE_SISO3166CTRYNAME "PL" + LOCALE_SISO639LANGNAME "pl" + LOCALE_SLANGUAGE "Polish" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "styczeñ" + LOCALE_SMONTHNAME2 "luty" + LOCALE_SMONTHNAME3 "marzec" + LOCALE_SMONTHNAME4 "kwiecieñ" + LOCALE_SMONTHNAME5 "maj" + LOCALE_SMONTHNAME6 "czerwiec" + LOCALE_SMONTHNAME7 "lipiec" + LOCALE_SMONTHNAME8 "sierpieñ" + LOCALE_SMONTHNAME9 "wrzesieñ" + LOCALE_SMONTHNAME10 "paŸdziernik" + LOCALE_SMONTHNAME11 "listopad" + LOCALE_SMONTHNAME12 "grudzieñ" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Polska" + LOCALE_SNATIVECURRNAME "Z³oty" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "polski" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy-MM-dd" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ptb.nls b/reactos/lib/kernel32/nls/ptb.nls new file mode 100644 index 00000000000..a6cf15fb6de --- /dev/null +++ b/reactos/lib/kernel32/nls/ptb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Portuguese (Brazil) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "55" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "55" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0416" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0416" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "BRA" + LOCALE_SABBREVDAYNAME1 "seg" + LOCALE_SABBREVDAYNAME2 "ter" + LOCALE_SABBREVDAYNAME3 "qua" + LOCALE_SABBREVDAYNAME4 "qui" + LOCALE_SABBREVDAYNAME5 "sex" + LOCALE_SABBREVDAYNAME6 "sáb" + LOCALE_SABBREVDAYNAME7 "dom" + LOCALE_SABBREVLANGNAME "PTB" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "fev" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "abr" + LOCALE_SABBREVMONTHNAME5 "mai" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "ago" + LOCALE_SABBREVMONTHNAME9 "set" + LOCALE_SABBREVMONTHNAME10 "out" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dez" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Brazil" + LOCALE_SCURRENCY "R$ " + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "segunda-feira" + LOCALE_SDAYNAME2 "terça-feira" + LOCALE_SDAYNAME3 "quarta-feira" + LOCALE_SDAYNAME4 "quinta-feira" + LOCALE_SDAYNAME5 "sexta-feira" + LOCALE_SDAYNAME6 "sábado" + LOCALE_SDAYNAME7 "domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Brazil" + LOCALE_SENGCURRNAME "Brazilian Real" + LOCALE_SENGLANGUAGE "Portuguese" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "BRL" + LOCALE_SISO3166CTRYNAME "BR" + LOCALE_SISO639LANGNAME "pt" + LOCALE_SLANGUAGE "Portuguese (Brazil)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janeiro" + LOCALE_SMONTHNAME2 "fevereiro" + LOCALE_SMONTHNAME3 "março" + LOCALE_SMONTHNAME4 "abril" + LOCALE_SMONTHNAME5 "maio" + LOCALE_SMONTHNAME6 "junho" + LOCALE_SMONTHNAME7 "julho" + LOCALE_SMONTHNAME8 "agosto" + LOCALE_SMONTHNAME9 "setembro" + LOCALE_SMONTHNAME10 "outubro" + LOCALE_SMONTHNAME11 "novembro" + LOCALE_SMONTHNAME12 "dezembro" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Brasil" + LOCALE_SNATIVECURRNAME "Real" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Português" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/M/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Europa Ocidental e Estados Unidos" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Europa Central" + LGRPID_BALTIC+LGRPID_RES_BASE "Báltico" + LGRPID_GREEK+LGRPID_RES_BASE "Grego" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cirílico" + LGRPID_TURKISH+LGRPID_RES_BASE "Turco" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japonês" + LGRPID_KOREAN+LGRPID_RES_BASE "Coreano" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Chinês Tradicional" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Chinês Simplificado" + LGRPID_THAI+LGRPID_RES_BASE "Tailandês" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebraico" + LGRPID_ARABIC+LGRPID_RES_BASE "Árabe" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamita" + LGRPID_INDIC+LGRPID_RES_BASE "Indiano" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgiano" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armênio" +} diff --git a/reactos/lib/kernel32/nls/ptg.nls b/reactos/lib/kernel32/nls/ptg.nls new file mode 100644 index 00000000000..9b58805f191 --- /dev/null +++ b/reactos/lib/kernel32/nls/ptg.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Portuguese (Portugal) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "351" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "351" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0816" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0816" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "PRT" + LOCALE_SABBREVDAYNAME1 "seg" + LOCALE_SABBREVDAYNAME2 "ter" + LOCALE_SABBREVDAYNAME3 "qua" + LOCALE_SABBREVDAYNAME4 "qui" + LOCALE_SABBREVDAYNAME5 "sex" + LOCALE_SABBREVDAYNAME6 "sáb" + LOCALE_SABBREVDAYNAME7 "dom" + LOCALE_SABBREVLANGNAME "PTG" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Fev" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Abr" + LOCALE_SABBREVMONTHNAME5 "Mai" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Ago" + LOCALE_SABBREVMONTHNAME9 "Set" + LOCALE_SABBREVMONTHNAME10 "Out" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dez" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Portugal" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "segunda-feira" + LOCALE_SDAYNAME2 "terça-feira" + LOCALE_SDAYNAME3 "quarta-feira" + LOCALE_SDAYNAME4 "quinta-feira" + LOCALE_SDAYNAME5 "sexta-feira" + LOCALE_SDAYNAME6 "sábado" + LOCALE_SDAYNAME7 "domingo" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Portugal" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Portuguese" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "PT" + LOCALE_SISO639LANGNAME "pt" + LOCALE_SLANGUAGE "Portuguese (Portugal)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dddd, d' de 'MMMM' de 'yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Janeiro" + LOCALE_SMONTHNAME2 "Fevereiro" + LOCALE_SMONTHNAME3 "Março" + LOCALE_SMONTHNAME4 "Abril" + LOCALE_SMONTHNAME5 "Maio" + LOCALE_SMONTHNAME6 "Junho" + LOCALE_SMONTHNAME7 "Julho" + LOCALE_SMONTHNAME8 "Agosto" + LOCALE_SMONTHNAME9 "Setembro" + LOCALE_SMONTHNAME10 "Outubro" + LOCALE_SMONTHNAME11 "Novembro" + LOCALE_SMONTHNAME12 "Dezembro" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Portugal" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "português" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd-MM-yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM' de 'yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Europa Ocidental e Estados Unidos" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Europa Central" + LGRPID_BALTIC+LGRPID_RES_BASE "Báltico" + LGRPID_GREEK+LGRPID_RES_BASE "Grego" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cirílico" + LGRPID_TURKISH+LGRPID_RES_BASE "Turco" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japonês" + LGRPID_KOREAN+LGRPID_RES_BASE "Coreano" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Chinês Tradicional" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Chinês Simplificado" + LGRPID_THAI+LGRPID_RES_BASE "Tailandês" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebraico" + LGRPID_ARABIC+LGRPID_RES_BASE "Árabe" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamita" + LGRPID_INDIC+LGRPID_RES_BASE "Indiano" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgiano" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armênio" +} diff --git a/reactos/lib/kernel32/nls/rom.nls b/reactos/lib/kernel32/nls/rom.nls new file mode 100644 index 00000000000..aa355831bb4 --- /dev/null +++ b/reactos/lib/kernel32/nls/rom.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Romanian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_ROMANIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "40" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "40" + LOCALE_IDEFAULTEBCDICCODEPAGE "20880" + LOCALE_IDEFAULTLANGUAGE "0418" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0418" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "ROM" + LOCALE_SABBREVDAYNAME1 "L" + LOCALE_SABBREVDAYNAME2 "Ma" + LOCALE_SABBREVDAYNAME3 "Mi" + LOCALE_SABBREVDAYNAME4 "J" + LOCALE_SABBREVDAYNAME5 "V" + LOCALE_SABBREVDAYNAME6 "S" + LOCALE_SABBREVDAYNAME7 "D" + LOCALE_SABBREVLANGNAME "ROM" + LOCALE_SABBREVMONTHNAME1 "ian." + LOCALE_SABBREVMONTHNAME2 "feb." + LOCALE_SABBREVMONTHNAME3 "mar." + LOCALE_SABBREVMONTHNAME4 "apr." + LOCALE_SABBREVMONTHNAME5 "mai." + LOCALE_SABBREVMONTHNAME6 "iun." + LOCALE_SABBREVMONTHNAME7 "iul." + LOCALE_SABBREVMONTHNAME8 "aug." + LOCALE_SABBREVMONTHNAME9 "sep." + LOCALE_SABBREVMONTHNAME10 "oct." + LOCALE_SABBREVMONTHNAME11 "nov." + LOCALE_SABBREVMONTHNAME12 "dec." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Romania" + LOCALE_SCURRENCY "lei" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "luni" + LOCALE_SDAYNAME2 "marþi" + LOCALE_SDAYNAME3 "miercuri" + LOCALE_SDAYNAME4 "joi" + LOCALE_SDAYNAME5 "vineri" + LOCALE_SDAYNAME6 "sâmbãtã" + LOCALE_SDAYNAME7 "duminicã" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Romania" + LOCALE_SENGCURRNAME "Romanian Leu" + LOCALE_SENGLANGUAGE "Romanian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ROL" + LOCALE_SISO3166CTRYNAME "RO" + LOCALE_SISO639LANGNAME "ro" + LOCALE_SLANGUAGE "Romanian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "ianuarie" + LOCALE_SMONTHNAME2 "februarie" + LOCALE_SMONTHNAME3 "martie" + LOCALE_SMONTHNAME4 "aprilie" + LOCALE_SMONTHNAME5 "mai" + LOCALE_SMONTHNAME6 "iunie" + LOCALE_SMONTHNAME7 "iulie" + LOCALE_SMONTHNAME8 "august" + LOCALE_SMONTHNAME9 "septembrie" + LOCALE_SMONTHNAME10 "octombrie" + LOCALE_SMONTHNAME11 "noiembrie" + LOCALE_SMONTHNAME12 "decembrie" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "România" + LOCALE_SNATIVECURRNAME "Leu" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "românã" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/rus.nls b/reactos/lib/kernel32/nls/rus.nls new file mode 100644 index 00000000000..ff154e72afe --- /dev/null +++ b/reactos/lib/kernel32/nls/rus.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Russian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1251) + +STRINGTABLE LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "7" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "1" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1251" + LOCALE_IDEFAULTCODEPAGE "866" + LOCALE_IDEFAULTCOUNTRY "7" + LOCALE_IDEFAULTEBCDICCODEPAGE "20880" + LOCALE_IDEFAULTLANGUAGE "0419" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10007" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "20866" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0419" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "5" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "RUS" + LOCALE_SABBREVDAYNAME1 "Ïí" + LOCALE_SABBREVDAYNAME2 "Âò" + LOCALE_SABBREVDAYNAME3 "Ñð" + LOCALE_SABBREVDAYNAME4 "×ò" + LOCALE_SABBREVDAYNAME5 "Ïò" + LOCALE_SABBREVDAYNAME6 "Ñá" + LOCALE_SABBREVDAYNAME7 "Âñ" + LOCALE_SABBREVLANGNAME "RUS" + LOCALE_SABBREVMONTHNAME1 "ÿíâ" + LOCALE_SABBREVMONTHNAME2 "ôåâ" + LOCALE_SABBREVMONTHNAME3 "ìàð" + LOCALE_SABBREVMONTHNAME4 "àïð" + LOCALE_SABBREVMONTHNAME5 "ìàé" + LOCALE_SABBREVMONTHNAME6 "èþí" + LOCALE_SABBREVMONTHNAME7 "èþë" + LOCALE_SABBREVMONTHNAME8 "àâã" + LOCALE_SABBREVMONTHNAME9 "ñåí" + LOCALE_SABBREVMONTHNAME10 "îêò" + LOCALE_SABBREVMONTHNAME11 "íîÿ" + LOCALE_SABBREVMONTHNAME12 "äåê" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Russia" + LOCALE_SCURRENCY "ð." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ïîíåäåëüíèê" + LOCALE_SDAYNAME2 "âòîðíèê" + LOCALE_SDAYNAME3 "ñðåäà" + LOCALE_SDAYNAME4 "÷åòâåðã" + LOCALE_SDAYNAME5 "ïÿòíèöà" + LOCALE_SDAYNAME6 "ñóááîòà" + LOCALE_SDAYNAME7 "âîñêðåñåíüå" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Russia" + LOCALE_SENGCURRNAME "Russian Ruble" + LOCALE_SENGLANGUAGE "Russian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "RUR" + LOCALE_SISO3166CTRYNAME "RU" + LOCALE_SISO639LANGNAME "ru" + LOCALE_SLANGUAGE "Russian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d MMMM yyyy 'ã.'" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "ßíâàðü" + LOCALE_SMONTHNAME2 "Ôåâðàëü" + LOCALE_SMONTHNAME3 "Ìàðò" + LOCALE_SMONTHNAME4 "Àïðåëü" + LOCALE_SMONTHNAME5 "Ìàé" + LOCALE_SMONTHNAME6 "Èþíü" + LOCALE_SMONTHNAME7 "Èþëü" + LOCALE_SMONTHNAME8 "Àâãóñò" + LOCALE_SMONTHNAME9 "Ñåíòÿáðü" + LOCALE_SMONTHNAME10 "Îêòÿáðü" + LOCALE_SMONTHNAME11 "Íîÿáðü" + LOCALE_SMONTHNAME12 "Äåêàáðü" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Ðîññèÿ" + LOCALE_SNATIVECURRNAME "ðóáëü" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "ðóññêèé" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy 'ã.'" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Çàïàäíûé" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Öåíòðàëüíîåâðîïåéñêèé" + LGRPID_BALTIC+LGRPID_RES_BASE "Áàëòèéñêèé" + LGRPID_GREEK+LGRPID_RES_BASE "Ãðå÷åñêèé" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Êèðèëëè÷åñêèé" + LGRPID_TURKISH+LGRPID_RES_BASE "Òóðåöêèé" + LGRPID_JAPANESE+LGRPID_RES_BASE "ßïîíñêèé" + LGRPID_KOREAN+LGRPID_RES_BASE "Êîðåéñêèé" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Êèòàéñêèé òðàäèöèîííûé" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Êèòàéñêèé óïðîù¸ííûé" + LGRPID_THAI+LGRPID_RES_BASE "Òàéñêèé" + LGRPID_HEBREW+LGRPID_RES_BASE "Èâðèò" + LGRPID_ARABIC+LGRPID_RES_BASE "Àðàáñêèé" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Âüåòíàìñêèé" + LGRPID_INDIC+LGRPID_RES_BASE "Èíäèéñêèé" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Ãðóçèíñêèé" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Àðìÿíñêèé" +} diff --git a/reactos/lib/kernel32/nls/sky.nls b/reactos/lib/kernel32/nls/sky.nls new file mode 100644 index 00000000000..44110e9dd7d --- /dev/null +++ b/reactos/lib/kernel32/nls/sky.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Slovak + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "421" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "421" + LOCALE_IDEFAULTEBCDICCODEPAGE "20880" + LOCALE_IDEFAULTLANGUAGE "041b" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "041b" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "SVK" + LOCALE_SABBREVDAYNAME1 "po" + LOCALE_SABBREVDAYNAME2 "ut" + LOCALE_SABBREVDAYNAME3 "st" + LOCALE_SABBREVDAYNAME4 "št" + LOCALE_SABBREVDAYNAME5 "pi" + LOCALE_SABBREVDAYNAME6 "so" + LOCALE_SABBREVDAYNAME7 "ne" + LOCALE_SABBREVLANGNAME "SKY" + LOCALE_SABBREVMONTHNAME1 "I" + LOCALE_SABBREVMONTHNAME2 "II" + LOCALE_SABBREVMONTHNAME3 "III" + LOCALE_SABBREVMONTHNAME4 "IV" + LOCALE_SABBREVMONTHNAME5 "V" + LOCALE_SABBREVMONTHNAME6 "VI" + LOCALE_SABBREVMONTHNAME7 "VII" + LOCALE_SABBREVMONTHNAME8 "VIII" + LOCALE_SABBREVMONTHNAME9 "IX" + LOCALE_SABBREVMONTHNAME10 "X" + LOCALE_SABBREVMONTHNAME11 "XI" + LOCALE_SABBREVMONTHNAME12 "XII" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Slovakia" + LOCALE_SCURRENCY "Sk" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "pondelok" + LOCALE_SDAYNAME2 "utorok" + LOCALE_SDAYNAME3 "streda" + LOCALE_SDAYNAME4 "štvrtok" + LOCALE_SDAYNAME5 "piatok" + LOCALE_SDAYNAME6 "sobota" + LOCALE_SDAYNAME7 "nede¾a" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Slovakia" + LOCALE_SENGCURRNAME "Slovak Koruna" + LOCALE_SENGLANGUAGE "Slovak" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "SKK" + LOCALE_SISO3166CTRYNAME "SK" + LOCALE_SISO639LANGNAME "sk" + LOCALE_SLANGUAGE "Slovak" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "január" + LOCALE_SMONTHNAME2 "február" + LOCALE_SMONTHNAME3 "marec" + LOCALE_SMONTHNAME4 "apríl" + LOCALE_SMONTHNAME5 "máj" + LOCALE_SMONTHNAME6 "jún" + LOCALE_SMONTHNAME7 "júl" + LOCALE_SMONTHNAME8 "august" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "október" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Slovenská republika" + LOCALE_SNATIVECURRNAME "Slovenská koruna" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "slovenèina" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d. M. yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/slv.nls b/reactos/lib/kernel32/nls/slv.nls new file mode 100644 index 00000000000..37d37e4c8a3 --- /dev/null +++ b/reactos/lib/kernel32/nls/slv.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Slovenian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "386" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "386" + LOCALE_IDEFAULTEBCDICCODEPAGE "20880" + LOCALE_IDEFAULTLANGUAGE "0424" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0424" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "SVN" + LOCALE_SABBREVDAYNAME1 "pon" + LOCALE_SABBREVDAYNAME2 "tor" + LOCALE_SABBREVDAYNAME3 "sre" + LOCALE_SABBREVDAYNAME4 "èet" + LOCALE_SABBREVDAYNAME5 "pet" + LOCALE_SABBREVDAYNAME6 "sob" + LOCALE_SABBREVDAYNAME7 "ned" + LOCALE_SABBREVLANGNAME "SLV" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "maj" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "avg" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Slovenia" + LOCALE_SCURRENCY "SIT" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ponedeljek" + LOCALE_SDAYNAME2 "torek" + LOCALE_SDAYNAME3 "sreda" + LOCALE_SDAYNAME4 "èetrtek" + LOCALE_SDAYNAME5 "petek" + LOCALE_SDAYNAME6 "sobota" + LOCALE_SDAYNAME7 "nedelja" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Slovenia" + LOCALE_SENGCURRNAME "Slovenian Tolar" + LOCALE_SENGLANGUAGE "Slovenian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "SIT" + LOCALE_SISO3166CTRYNAME "SI" + LOCALE_SISO639LANGNAME "sl" + LOCALE_SLANGUAGE "Slovenian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januar" + LOCALE_SMONTHNAME2 "februar" + LOCALE_SMONTHNAME3 "marec" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "maj" + LOCALE_SMONTHNAME6 "junij" + LOCALE_SMONTHNAME7 "julij" + LOCALE_SMONTHNAME8 "avgust" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Slovenija" + LOCALE_SNATIVECURRNAME "slovenski tolar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "slovenski" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/sqi.nls b/reactos/lib/kernel32/nls/sqi.nls new file mode 100644 index 00000000000..fe241809f11 --- /dev/null +++ b/reactos/lib/kernel32/nls/sqi.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Albanian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_ALBANIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "355" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "1" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "355" + LOCALE_IDEFAULTEBCDICCODEPAGE "20880" + LOCALE_IDEFAULTLANGUAGE "041c" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "041c" + LOCALE_ILDATE "2" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "5" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "PD" + LOCALE_S2359 "MD" + LOCALE_SABBREVCTRYNAME "ALB" + LOCALE_SABBREVDAYNAME1 "Hën" + LOCALE_SABBREVDAYNAME2 "Mar" + LOCALE_SABBREVDAYNAME3 "Mër" + LOCALE_SABBREVDAYNAME4 "Enj" + LOCALE_SABBREVDAYNAME5 "Pre" + LOCALE_SABBREVDAYNAME6 "Sht" + LOCALE_SABBREVDAYNAME7 "Die" + LOCALE_SABBREVLANGNAME "SQI" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Shk" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Pri" + LOCALE_SABBREVMONTHNAME5 "Maj" + LOCALE_SABBREVMONTHNAME6 "Qer" + LOCALE_SABBREVMONTHNAME7 "Kor" + LOCALE_SABBREVMONTHNAME8 "Gsh" + LOCALE_SABBREVMONTHNAME9 "Sht" + LOCALE_SABBREVMONTHNAME10 "Tet" + LOCALE_SABBREVMONTHNAME11 "Nën" + LOCALE_SABBREVMONTHNAME12 "Dhj" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Albania" + LOCALE_SCURRENCY "Lek" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "e hënë" + LOCALE_SDAYNAME2 "e martë" + LOCALE_SDAYNAME3 "e mërkurë" + LOCALE_SDAYNAME4 "e enjte" + LOCALE_SDAYNAME5 "e premte" + LOCALE_SDAYNAME6 "e shtunë" + LOCALE_SDAYNAME7 "e diel" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Albania" + LOCALE_SENGCURRNAME "Albanian Lek" + LOCALE_SENGLANGUAGE "Albanian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "ALL" + LOCALE_SISO3166CTRYNAME "AL" + LOCALE_SISO639LANGNAME "sq" + LOCALE_SLANGUAGE "Albanian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "yyyy-MM-dd" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "janar" + LOCALE_SMONTHNAME2 "shkurt" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "prill" + LOCALE_SMONTHNAME5 "maj" + LOCALE_SMONTHNAME6 "qershor" + LOCALE_SMONTHNAME7 "korrik" + LOCALE_SMONTHNAME8 "gusht" + LOCALE_SMONTHNAME9 "shtator" + LOCALE_SMONTHNAME10 "tetor" + LOCALE_SMONTHNAME11 "nëntor" + LOCALE_SMONTHNAME12 "dhjetor" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Shqipëria" + LOCALE_SNATIVECURRNAME "Lek" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "shqipe" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy-MM-dd" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss.tt" + LOCALE_SYEARMONTH "yyyy-MM" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/srb.nls b/reactos/lib/kernel32/nls/srb.nls new file mode 100644 index 00000000000..c6ef2c87fd2 --- /dev/null +++ b/reactos/lib/kernel32/nls/srb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Serbian (Cyrillic) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1251) + +STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "381" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1251" + LOCALE_IDEFAULTCODEPAGE "855" + LOCALE_IDEFAULTCOUNTRY "381" + LOCALE_IDEFAULTEBCDICCODEPAGE "21025" + LOCALE_IDEFAULTLANGUAGE "0c1a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10007" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28595" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0c1a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "SPB" + LOCALE_SABBREVDAYNAME1 "ïîí" + LOCALE_SABBREVDAYNAME2 "óòî" + LOCALE_SABBREVDAYNAME3 "ñðå" + LOCALE_SABBREVDAYNAME4 "÷åò" + LOCALE_SABBREVDAYNAME5 "ïåò" + LOCALE_SABBREVDAYNAME6 "ñóá" + LOCALE_SABBREVDAYNAME7 "íåä" + LOCALE_SABBREVLANGNAME "SRB" + LOCALE_SABBREVMONTHNAME1 "¼àí" + LOCALE_SABBREVMONTHNAME2 "ôåá" + LOCALE_SABBREVMONTHNAME3 "ìàð" + LOCALE_SABBREVMONTHNAME4 "àïð" + LOCALE_SABBREVMONTHNAME5 "ìà¼" + LOCALE_SABBREVMONTHNAME6 "¼óí" + LOCALE_SABBREVMONTHNAME7 "¼óë" + LOCALE_SABBREVMONTHNAME8 "àâã" + LOCALE_SABBREVMONTHNAME9 "ñåï" + LOCALE_SABBREVMONTHNAME10 "îêò" + LOCALE_SABBREVMONTHNAME11 "íîâ" + LOCALE_SABBREVMONTHNAME12 "äåö" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Serbia" + LOCALE_SCURRENCY "Äèí." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ïîíåäåšàê" + LOCALE_SDAYNAME2 "óòîðàê" + LOCALE_SDAYNAME3 "ñðåäà" + LOCALE_SDAYNAME4 "÷åòâðòàê" + LOCALE_SDAYNAME5 "ïåòàê" + LOCALE_SDAYNAME6 "ñóáîòà" + LOCALE_SDAYNAME7 "íåäåšà" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Serbia" + LOCALE_SENGCURRNAME "Yugoslavian Dinar" + LOCALE_SENGLANGUAGE "Serbian (Cyrillic)" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "YUN" + LOCALE_SISO3166CTRYNAME "SP" + LOCALE_SISO639LANGNAME "sr" + LOCALE_SLANGUAGE "Serbian (Cyrillic)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "¼àíóàð" + LOCALE_SMONTHNAME2 "ôåáðóàð" + LOCALE_SMONTHNAME3 "ìàðò" + LOCALE_SMONTHNAME4 "àïðèë" + LOCALE_SMONTHNAME5 "ìà¼" + LOCALE_SMONTHNAME6 "¼óí" + LOCALE_SMONTHNAME7 "¼óë" + LOCALE_SMONTHNAME8 "àâãóñò" + LOCALE_SMONTHNAME9 "ñåïòåìáàð" + LOCALE_SMONTHNAME10 "îêòîáàð" + LOCALE_SMONTHNAME11 "íîâåìáàð" + LOCALE_SMONTHNAME12 "äåöåìáàð" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "£óãîñëàâè¼à" + LOCALE_SNATIVECURRNAME "äèíàð" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "ñðïñêè" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/srl.nls b/reactos/lib/kernel32/nls/srl.nls new file mode 100644 index 00000000000..fab71553754 --- /dev/null +++ b/reactos/lib/kernel32/nls/srl.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Serbian (Latin) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1250) + +STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "381" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1250" + LOCALE_IDEFAULTCODEPAGE "852" + LOCALE_IDEFAULTCOUNTRY "381" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "081a" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10029" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28592" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "081a" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "SPB" + LOCALE_SABBREVDAYNAME1 "pon" + LOCALE_SABBREVDAYNAME2 "uto" + LOCALE_SABBREVDAYNAME3 "sre" + LOCALE_SABBREVDAYNAME4 "èet" + LOCALE_SABBREVDAYNAME5 "pet" + LOCALE_SABBREVDAYNAME6 "sub" + LOCALE_SABBREVDAYNAME7 "ned" + LOCALE_SABBREVLANGNAME "SRL" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "maj" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "avg" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Serbia" + LOCALE_SCURRENCY "Din." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ponedeljak" + LOCALE_SDAYNAME2 "utorak" + LOCALE_SDAYNAME3 "sreda" + LOCALE_SDAYNAME4 "èetvrtak" + LOCALE_SDAYNAME5 "petak" + LOCALE_SDAYNAME6 "subota" + LOCALE_SDAYNAME7 "nedelja" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Serbia" + LOCALE_SENGCURRNAME "Yugoslavian Dinar" + LOCALE_SENGLANGUAGE "Serbian (Latin)" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "YUN" + LOCALE_SISO3166CTRYNAME "SP" + LOCALE_SISO639LANGNAME "sr" + LOCALE_SLANGUAGE "Serbian (Latin)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d. MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januar" + LOCALE_SMONTHNAME2 "februar" + LOCALE_SMONTHNAME3 "mart" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "maj" + LOCALE_SMONTHNAME6 "jun" + LOCALE_SMONTHNAME7 "jul" + LOCALE_SMONTHNAME8 "avgust" + LOCALE_SMONTHNAME9 "septembar" + LOCALE_SMONTHNAME10 "oktobar" + LOCALE_SMONTHNAME11 "novembar" + LOCALE_SMONTHNAME12 "decembar" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Srbija" + LOCALE_SNATIVECURRNAME "dinar" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "srpski" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/sve.nls b/reactos/lib/kernel32/nls/sve.nls new file mode 100644 index 00000000000..776a4a87592 --- /dev/null +++ b/reactos/lib/kernel32/nls/sve.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Swedish + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "46" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "2" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "46" + LOCALE_IDEFAULTEBCDICCODEPAGE "20278" + LOCALE_IDEFAULTLANGUAGE "041d" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "041d" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "SWE" + LOCALE_SABBREVDAYNAME1 "må" + LOCALE_SABBREVDAYNAME2 "ti" + LOCALE_SABBREVDAYNAME3 "on" + LOCALE_SABBREVDAYNAME4 "to" + LOCALE_SABBREVDAYNAME5 "fr" + LOCALE_SABBREVDAYNAME6 "lö" + LOCALE_SABBREVDAYNAME7 "sö" + LOCALE_SABBREVLANGNAME "SVE" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "maj" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Sweden" + LOCALE_SCURRENCY "kr" + LOCALE_SDATE "-" + LOCALE_SDAYNAME1 "måndag" + LOCALE_SDAYNAME2 "tisdag" + LOCALE_SDAYNAME3 "onsdag" + LOCALE_SDAYNAME4 "torsdag" + LOCALE_SDAYNAME5 "fredag" + LOCALE_SDAYNAME6 "lördag" + LOCALE_SDAYNAME7 "söndag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Sweden" + LOCALE_SENGCURRNAME "Swedish Krona" + LOCALE_SENGLANGUAGE "Swedish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "SEK" + LOCALE_SISO3166CTRYNAME "SE" + LOCALE_SISO639LANGNAME "sv" + LOCALE_SLANGUAGE "Swedish" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "'den 'd MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januari" + LOCALE_SMONTHNAME2 "februari" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "maj" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "augusti" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Sverige" + LOCALE_SNATIVECURRNAME "Svensk krona" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "svenska" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "yyyy-MM-dd" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/svf.nls b/reactos/lib/kernel32/nls/svf.nls new file mode 100644 index 00000000000..5e57c65d2c7 --- /dev/null +++ b/reactos/lib/kernel32/nls/svf.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Swedish (Finland) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH_FINLAND +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "358" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "850" + LOCALE_IDEFAULTCOUNTRY "358" + LOCALE_IDEFAULTEBCDICCODEPAGE "20278" + LOCALE_IDEFAULTLANGUAGE "081d" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28605" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "2" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "081d" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "FIN" + LOCALE_SABBREVDAYNAME1 "må" + LOCALE_SABBREVDAYNAME2 "ti" + LOCALE_SABBREVDAYNAME3 "on" + LOCALE_SABBREVDAYNAME4 "to" + LOCALE_SABBREVDAYNAME5 "fr" + LOCALE_SABBREVDAYNAME6 "lö" + LOCALE_SABBREVDAYNAME7 "sö" + LOCALE_SABBREVLANGNAME "SVF" + LOCALE_SABBREVMONTHNAME1 "jan" + LOCALE_SABBREVMONTHNAME2 "feb" + LOCALE_SABBREVMONTHNAME3 "mar" + LOCALE_SABBREVMONTHNAME4 "apr" + LOCALE_SABBREVMONTHNAME5 "maj" + LOCALE_SABBREVMONTHNAME6 "jun" + LOCALE_SABBREVMONTHNAME7 "jul" + LOCALE_SABBREVMONTHNAME8 "aug" + LOCALE_SABBREVMONTHNAME9 "sep" + LOCALE_SABBREVMONTHNAME10 "okt" + LOCALE_SABBREVMONTHNAME11 "nov" + LOCALE_SABBREVMONTHNAME12 "dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Finland" + LOCALE_SCURRENCY "€" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "måndag" + LOCALE_SDAYNAME2 "tisdag" + LOCALE_SDAYNAME3 "onsdag" + LOCALE_SDAYNAME4 "torsdag" + LOCALE_SDAYNAME5 "fredag" + LOCALE_SDAYNAME6 "lördag" + LOCALE_SDAYNAME7 "söndag" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Finland" + LOCALE_SENGCURRNAME "Euro" + LOCALE_SENGLANGUAGE "Swedish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "EUR" + LOCALE_SISO3166CTRYNAME "FI" + LOCALE_SISO639LANGNAME "sv" + LOCALE_SLANGUAGE "Swedish (Finland)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "'den 'd MMMM yyyy" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "januari" + LOCALE_SMONTHNAME2 "februari" + LOCALE_SMONTHNAME3 "mars" + LOCALE_SMONTHNAME4 "april" + LOCALE_SMONTHNAME5 "maj" + LOCALE_SMONTHNAME6 "juni" + LOCALE_SMONTHNAME7 "juli" + LOCALE_SMONTHNAME8 "augusti" + LOCALE_SMONTHNAME9 "september" + LOCALE_SMONTHNAME10 "oktober" + LOCALE_SMONTHNAME11 "november" + LOCALE_SMONTHNAME12 "december" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Finland" + LOCALE_SNATIVECURRNAME "euro" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "svenska" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d.M.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/swk.nls b/reactos/lib/kernel32/nls/swk.nls new file mode 100644 index 00000000000..c06c767b1fe --- /dev/null +++ b/reactos/lib/kernel32/nls/swk.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Swahili + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1252) + +STRINGTABLE LANGUAGE LANG_SWAHILI, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x00af\x8000\x38cb\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x8000\x00ff\x003f\x0000\xffff" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "254" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "0" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "1252" + LOCALE_IDEFAULTCODEPAGE "437" + LOCALE_IDEFAULTCOUNTRY "254" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0441" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10000" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28591" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0441" + LOCALE_ILDATE "0" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "1" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "KEN" + LOCALE_SABBREVDAYNAME1 "Mon" + LOCALE_SABBREVDAYNAME2 "Tue" + LOCALE_SABBREVDAYNAME3 "Wed" + LOCALE_SABBREVDAYNAME4 "Thu" + LOCALE_SABBREVDAYNAME5 "Fri" + LOCALE_SABBREVDAYNAME6 "Sat" + LOCALE_SABBREVDAYNAME7 "Sun" + LOCALE_SABBREVLANGNAME "SWK" + LOCALE_SABBREVMONTHNAME1 "Jan" + LOCALE_SABBREVMONTHNAME2 "Feb" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Apr" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Jun" + LOCALE_SABBREVMONTHNAME7 "Jul" + LOCALE_SABBREVMONTHNAME8 "Aug" + LOCALE_SABBREVMONTHNAME9 "Sep" + LOCALE_SABBREVMONTHNAME10 "Oct" + LOCALE_SABBREVMONTHNAME11 "Nov" + LOCALE_SABBREVMONTHNAME12 "Dec" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Kenya" + LOCALE_SCURRENCY "S" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "Monday" + LOCALE_SDAYNAME2 "Tuesday" + LOCALE_SDAYNAME3 "Wednesday" + LOCALE_SDAYNAME4 "Thursday" + LOCALE_SDAYNAME5 "Friday" + LOCALE_SDAYNAME6 "Saturday" + LOCALE_SDAYNAME7 "Sunday" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Kenya" + LOCALE_SENGCURRNAME "Kenyan Shilling" + LOCALE_SENGLANGUAGE "Swahili" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "KES" + LOCALE_SISO3166CTRYNAME "KE" + LOCALE_SISO639LANGNAME "sw" + LOCALE_SLANGUAGE "Swahili" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, MMMM dd, yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "January" + LOCALE_SMONTHNAME2 "February" + LOCALE_SMONTHNAME3 "March" + LOCALE_SMONTHNAME4 "April" + LOCALE_SMONTHNAME5 "May" + LOCALE_SMONTHNAME6 "June" + LOCALE_SMONTHNAME7 "July" + LOCALE_SMONTHNAME8 "August" + LOCALE_SMONTHNAME9 "September" + LOCALE_SMONTHNAME10 "October" + LOCALE_SMONTHNAME11 "November" + LOCALE_SMONTHNAME12 "December" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "Kenya" + LOCALE_SNATIVECURRNAME "Shilingi" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Kiswahili" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "M/d/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "h:mm:ss tt" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/tam.nls b/reactos/lib/kernel32/nls/tam.nls new file mode 100644 index 00000000000..f92907acc98 --- /dev/null +++ b/reactos/lib/kernel32/nls/tam.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Tamil + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(0) /* Unicode only */ + +STRINGTABLE LANGUAGE LANG_TAMIL, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8010\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0003\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE L"1" + LOCALE_ICENTURY L"1" + LOCALE_ICOUNTRY L"91" + LOCALE_ICURRDIGITS L"2" + LOCALE_ICURRENCY L"2" + LOCALE_IDATE L"1" + LOCALE_IDAYLZERO L"1" + LOCALE_IDEFAULTANSICODEPAGE L"0" + LOCALE_IDEFAULTCODEPAGE L"1" + LOCALE_IDEFAULTCOUNTRY L"91" + LOCALE_IDEFAULTEBCDICCODEPAGE L"500" + LOCALE_IDEFAULTLANGUAGE L"0449" +//FIXME LOCALE_IDEFAULTMACCODEPAGE L"2" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE L"65001" + LOCALE_IDIGITS L"2" + LOCALE_IDIGITSUBSTITUTION L"1" + LOCALE_IFIRSTDAYOFWEEK L"0" + LOCALE_IFIRSTWEEKOFYEAR L"0" + LOCALE_IINTLCURRDIGITS L"2" + LOCALE_ILANGUAGE L"0449" + LOCALE_ILDATE L"1" + LOCALE_ILZERO L"1" + LOCALE_IMEASURE L"0" + LOCALE_IMONLZERO L"1" + LOCALE_INEGCURR L"12" + LOCALE_INEGNUMBER L"1" + LOCALE_INEGSEPBYSPACE L"1" + LOCALE_INEGSIGNPOSN L"4" + LOCALE_INEGSYMPRECEDES L"1" + LOCALE_IOPTIONALCALENDAR L"0" + LOCALE_IPAPERSIZE L"9" + LOCALE_IPOSSEPBYSPACE L"1" + LOCALE_IPOSSIGNPOSN L"4" + LOCALE_IPOSSYMPRECEDES L"1" + LOCALE_ITIME L"1" + LOCALE_ITIMEMARKPOSN L"1" + LOCALE_ITLZERO L"1" + LOCALE_S1159 L"\x0b95\x0bbe\x0bb2\x0bc8" + LOCALE_S2359 L"\x0bae\x0bbe\x0bb2\x0bc8" + LOCALE_SABBREVCTRYNAME L"IND" + LOCALE_SABBREVDAYNAME1 L"\x0ba4\x0bbf" + LOCALE_SABBREVDAYNAME2 L"\x0b9a\x0bc6" + LOCALE_SABBREVDAYNAME3 L"\x0baa\x0bc1" + LOCALE_SABBREVDAYNAME4 L"\x0bb5\x0bbf" + LOCALE_SABBREVDAYNAME5 L"\x0bb5\x0bc6" + LOCALE_SABBREVDAYNAME6 L"\x0b9a" + LOCALE_SABBREVDAYNAME7 L"\x0b9e\x0bbe" + LOCALE_SABBREVLANGNAME L"TAM" + LOCALE_SABBREVMONTHNAME1 L"\x0b9c\x0ba9." + LOCALE_SABBREVMONTHNAME2 L"\x0baa\x0bc6\x0baa\x0bcd." + LOCALE_SABBREVMONTHNAME3 L"\x0bae\x0bbe\x0bb0\x0bcd." + LOCALE_SABBREVMONTHNAME4 L"\x0b8f\x0baa\x0bcd." + LOCALE_SABBREVMONTHNAME5 L"\x0bae\x0bc7" + LOCALE_SABBREVMONTHNAME6 L"\x0b9c\x0bc2\x0ba9\x0bcd" + LOCALE_SABBREVMONTHNAME7 L"\x0b9c\x0bc2\x0bb2\x0bc8" + LOCALE_SABBREVMONTHNAME8 L"\x0b86\x0b95." + LOCALE_SABBREVMONTHNAME9 L"\x0b9a\x0bc6\x0baa\x0bcd." + LOCALE_SABBREVMONTHNAME10 L"\x0b85\x0b95\x0bcd." + LOCALE_SABBREVMONTHNAME11 L"\x0ba8\x0bb5." + LOCALE_SABBREVMONTHNAME12 L"\x0b9f\x0bbf\x0b9a." + LOCALE_SABBREVMONTHNAME13 L"" + LOCALE_SCOUNTRY L"India" + LOCALE_SCURRENCY L"\x0bb0\x0bc2" + LOCALE_SDATE L"-" + LOCALE_SDAYNAME1 L"\x0ba4\x0bbf\x0b99\x0bcd\x0b95\x0bb3\x0bcd" + LOCALE_SDAYNAME2 L"\x0b9a\x0bc6\x0bb5\x0bcd\x0bb5\x0bbe\x0baf\x0bcd" + LOCALE_SDAYNAME3 L"\x0baa\x0bc1\x0ba4\x0ba9\x0bcd" + LOCALE_SDAYNAME4 L"\x0bb5\x0bbf\x0baf\x0bbe\x0bb4\x0ba9\x0bcd" + LOCALE_SDAYNAME5 L"\x0bb5\x0bc6\x0bb3\x0bcd\x0bb3\x0bbf" + LOCALE_SDAYNAME6 L"\x0b9a\x0ba9\x0bbf" + LOCALE_SDAYNAME7 L"\x0b9e\x0bbe\x0baf\x0bbf\x0bb1\x0bc1" + LOCALE_SDECIMAL L"." + LOCALE_SENGCOUNTRY L"India" + LOCALE_SENGCURRNAME L"Indian Rupee" + LOCALE_SENGLANGUAGE L"Tamil" + LOCALE_SGROUPING L"3;2;0" + LOCALE_SINTLSYMBOL L"INR" + LOCALE_SISO3166CTRYNAME L"IN" + LOCALE_SISO639LANGNAME L"ta" + LOCALE_SLANGUAGE L"Tamil" + LOCALE_SLIST L"," + LOCALE_SLONGDATE L"dd MMMM yyyy" + LOCALE_SMONDECIMALSEP L"." + LOCALE_SMONGROUPING L"3;2;0" + LOCALE_SMONTHNAME1 L"\x0b9c\x0ba9\x0bb5\x0bb0\x0bbf" + LOCALE_SMONTHNAME2 L"\x0baa\x0bc6\x0baa\x0bcd\x0bb0\x0bb5\x0bb0\x0bbf" + LOCALE_SMONTHNAME3 L"\x0bae\x0bbe\x0bb0\x0bcd\x0b9a\x0bcd" + LOCALE_SMONTHNAME4 L"\x0b8f\x0baa\x0bcd\x0bb0\x0bb2\x0bcd" + LOCALE_SMONTHNAME5 L"\x0bae\x0bc7" + LOCALE_SMONTHNAME6 L"\x0b9c\x0bc2\x0ba9\x0bcd" + LOCALE_SMONTHNAME7 L"\x0b9c\x0bc2\x0bb2\x0bc8" + LOCALE_SMONTHNAME8 L"\x0b86\x0b95\x0bb8\x0bcd\x0b9f\x0bcd" + LOCALE_SMONTHNAME9 L"\x0b9a\x0bc6\x0baa\x0bcd\x0b9f\x0bae\x0bcd\x0baa\x0bb0\x0bcd" + LOCALE_SMONTHNAME10 L"\x0b85\x0b95\x0bcd\x0b9f\x0bcb\x0baa\x0bb0\x0bcd" + LOCALE_SMONTHNAME11 L"\x0ba8\x0bb5\x0bae\x0bcd\x0baa\x0bb0\x0bcd" + LOCALE_SMONTHNAME12 L"\x0b9f\x0bbf\x0b9a\x0bae\x0bcd\x0baa\x0bb0\x0bcd" + LOCALE_SMONTHNAME13 L"" + LOCALE_SMONTHOUSANDSEP L"," + LOCALE_SNATIVECTRYNAME L"\x0b87\x0ba8\x0bcd\x0ba4\x0bbf\x0baf\x0bbe" + LOCALE_SNATIVECURRNAME L"\x0bb0\x0bc2\x0baa\x0bbe\x0baf\x0bcd" + LOCALE_SNATIVEDIGITS L"0123456789" + LOCALE_SNATIVELANGNAME L"\x0ba4\x0bae\x0bbf\x0bb4\x0bcd" + LOCALE_SNEGATIVESIGN L"-" + LOCALE_SPOSITIVESIGN L"" + LOCALE_SSHORTDATE L"dd-MM-yyyy" + LOCALE_SSORTNAME L"Default" + LOCALE_STHOUSAND L"," + LOCALE_STIME L":" + LOCALE_STIMEFORMAT L"HH:mm:ss" + LOCALE_SYEARMONTH L"MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE L"Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE L"Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE L"Baltic" + LGRPID_GREEK+LGRPID_RES_BASE L"Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE L"Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE L"Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE L"Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE L"Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE L"Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE L"Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE L"Thai" + LGRPID_HEBREW+LGRPID_RES_BASE L"Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE L"Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE L"Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE L"Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE L"Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE L"Armenian" +} diff --git a/reactos/lib/kernel32/nls/tha.nls b/reactos/lib/kernel32/nls/tha.nls new file mode 100644 index 00000000000..ff4cf029126 --- /dev/null +++ b/reactos/lib/kernel32/nls/tha.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Thai + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(874) + +STRINGTABLE LANGUAGE LANG_THAI, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0003\x8100\x0000\x1000\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x0000\x0001\x0000\x0000" + LOCALE_ICALENDARTYPE "7" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "66" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "874" + LOCALE_IDEFAULTCODEPAGE "874" + LOCALE_IDEFAULTCOUNTRY "66" + LOCALE_IDEFAULTEBCDICCODEPAGE "20838" + LOCALE_IDEFAULTLANGUAGE "041e" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10021" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "874" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "041e" + LOCALE_ILDATE "1" + LOCALE_ILZERO "0" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "1" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "3" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "7" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "THA" + LOCALE_SABBREVDAYNAME1 "¨." + LOCALE_SABBREVDAYNAME2 "Í." + LOCALE_SABBREVDAYNAME3 "¾." + LOCALE_SABBREVDAYNAME4 "¾Ä." + LOCALE_SABBREVDAYNAME5 "È." + LOCALE_SABBREVDAYNAME6 "Ê." + LOCALE_SABBREVDAYNAME7 "ÍÒ." + LOCALE_SABBREVLANGNAME "THA" + LOCALE_SABBREVMONTHNAME1 "Á.¤." + LOCALE_SABBREVMONTHNAME2 "¡.¾." + LOCALE_SABBREVMONTHNAME3 "ÁÕ.¤." + LOCALE_SABBREVMONTHNAME4 "àÁ.Â." + LOCALE_SABBREVMONTHNAME5 "¾.¤." + LOCALE_SABBREVMONTHNAME6 "ÁÔ.Â." + LOCALE_SABBREVMONTHNAME7 "¡.¤." + LOCALE_SABBREVMONTHNAME8 "Ê.¤." + LOCALE_SABBREVMONTHNAME9 "¡.Â." + LOCALE_SABBREVMONTHNAME10 "µ.¤." + LOCALE_SABBREVMONTHNAME11 "¾.Â." + LOCALE_SABBREVMONTHNAME12 "¸.¤." + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Thailand" + LOCALE_SCURRENCY "ß" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "¨Ñ¹·Ãì" + LOCALE_SDAYNAME2 "Íѧ¤ÒÃ" + LOCALE_SDAYNAME3 "¾Ø¸" + LOCALE_SDAYNAME4 "¾ÄËÑʺ´Õ" + LOCALE_SDAYNAME5 "ÈØ¡Ãì" + LOCALE_SDAYNAME6 "àÊÒÃì" + LOCALE_SDAYNAME7 "ÍÒ·ÔµÂì" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Thailand" + LOCALE_SENGCURRNAME "Thai Baht" + LOCALE_SENGLANGUAGE "Thai" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "THB" + LOCALE_SISO3166CTRYNAME "TH" + LOCALE_SISO639LANGNAME "th" + LOCALE_SLANGUAGE "Thai" + LOCALE_SLIST "," + LOCALE_SLONGDATE "d MMMM yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Á¡ÃÒ¤Á" + LOCALE_SMONTHNAME2 "¡ØÁÀҾѹ¸ì" + LOCALE_SMONTHNAME3 "ÁÕ¹Ò¤Á" + LOCALE_SMONTHNAME4 "àÁÉÒ¹" + LOCALE_SMONTHNAME5 "¾ÄÉÀÒ¤Á" + LOCALE_SMONTHNAME6 "ÁԶعÒ¹" + LOCALE_SMONTHNAME7 "¡Ã¡®Ò¤Á" + LOCALE_SMONTHNAME8 "ÊÔ§ËÒ¤Á" + LOCALE_SMONTHNAME9 "¡Ñ¹ÂÒ¹" + LOCALE_SMONTHNAME10 "µØÅÒ¤Á" + LOCALE_SMONTHNAME11 "¾ÄȨԡÒ¹" + LOCALE_SMONTHNAME12 "¸Ñ¹ÇÒ¤Á" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "ä·Â" + LOCALE_SNATIVECURRNAME "ºÒ·" + LOCALE_SNATIVEDIGITS "ðñòóôõö÷øù" + LOCALE_SNATIVELANGNAME "ä·Â" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/M/yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/trk.nls b/reactos/lib/kernel32/nls/trk.nls new file mode 100644 index 00000000000..263d6932e2c --- /dev/null +++ b/reactos/lib/kernel32/nls/trk.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Turkish + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1254) + +STRINGTABLE LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x002f\x8000\x3808\x1000\x0000\x0000\x0000\x0000\x0010\x0000\x0000\x0100\x0012\x0000\x0000\xc5d4" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "90" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1254" + LOCALE_IDEFAULTCODEPAGE "857" + LOCALE_IDEFAULTCOUNTRY "90" + LOCALE_IDEFAULTEBCDICCODEPAGE "20905" + LOCALE_IDEFAULTLANGUAGE "041f" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10081" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28599" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "041f" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "TUR" + LOCALE_SABBREVDAYNAME1 "Pzt" + LOCALE_SABBREVDAYNAME2 "Sal" + LOCALE_SABBREVDAYNAME3 "Çar" + LOCALE_SABBREVDAYNAME4 "Per" + LOCALE_SABBREVDAYNAME5 "Cum" + LOCALE_SABBREVDAYNAME6 "Cmt" + LOCALE_SABBREVDAYNAME7 "Paz" + LOCALE_SABBREVLANGNAME "TRK" + LOCALE_SABBREVMONTHNAME1 "Oca" + LOCALE_SABBREVMONTHNAME2 "Þub" + LOCALE_SABBREVMONTHNAME3 "Mar" + LOCALE_SABBREVMONTHNAME4 "Nis" + LOCALE_SABBREVMONTHNAME5 "May" + LOCALE_SABBREVMONTHNAME6 "Haz" + LOCALE_SABBREVMONTHNAME7 "Tem" + LOCALE_SABBREVMONTHNAME8 "Aðu" + LOCALE_SABBREVMONTHNAME9 "Eyl" + LOCALE_SABBREVMONTHNAME10 "Eki" + LOCALE_SABBREVMONTHNAME11 "Kas" + LOCALE_SABBREVMONTHNAME12 "Ara" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Turkey" + LOCALE_SCURRENCY "TL" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "Pazartesi" + LOCALE_SDAYNAME2 "Salý" + LOCALE_SDAYNAME3 "Çarþamba" + LOCALE_SDAYNAME4 "Perþembe" + LOCALE_SDAYNAME5 "Cuma" + LOCALE_SDAYNAME6 "Cumartesi" + LOCALE_SDAYNAME7 "Pazar" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Turkey" + LOCALE_SENGCURRNAME "Turkish Lira" + LOCALE_SENGLANGUAGE "Turkish" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "TRL" + LOCALE_SISO3166CTRYNAME "TR" + LOCALE_SISO639LANGNAME "tr" + LOCALE_SLANGUAGE "Turkish" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "dd MMMM yyyy dddd" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Ocak" + LOCALE_SMONTHNAME2 "Þubat" + LOCALE_SMONTHNAME3 "Mart" + LOCALE_SMONTHNAME4 "Nisan" + LOCALE_SMONTHNAME5 "Mayýs" + LOCALE_SMONTHNAME6 "Haziran" + LOCALE_SMONTHNAME7 "Temmuz" + LOCALE_SMONTHNAME8 "Aðustos" + LOCALE_SMONTHNAME9 "Eylül" + LOCALE_SMONTHNAME10 "Ekim" + LOCALE_SMONTHNAME11 "Kasým" + LOCALE_SMONTHNAME12 "Aralýk" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "." + LOCALE_SNATIVECTRYNAME "Türkiye" + LOCALE_SNATIVECURRNAME "Türk Lirasý" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "Türkçe" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND "." + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/ukr.nls b/reactos/lib/kernel32/nls/ukr.nls new file mode 100644 index 00000000000..8814e911b88 --- /dev/null +++ b/reactos/lib/kernel32/nls/ukr.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Ukrainian + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1251) + +STRINGTABLE LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "380" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1251" + LOCALE_IDEFAULTCODEPAGE "866" + LOCALE_IDEFAULTCOUNTRY "380" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "0422" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10017" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "21866" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0422" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "0" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "UKR" + LOCALE_SABBREVDAYNAME1 "Ïí" + LOCALE_SABBREVDAYNAME2 "Ââ" + LOCALE_SABBREVDAYNAME3 "Ñð" + LOCALE_SABBREVDAYNAME4 "×ò" + LOCALE_SABBREVDAYNAME5 "Ïò" + LOCALE_SABBREVDAYNAME6 "Ñá" + LOCALE_SABBREVDAYNAME7 "Íä" + LOCALE_SABBREVLANGNAME "UKR" + LOCALE_SABBREVMONTHNAME1 "ѳ÷" + LOCALE_SABBREVMONTHNAME2 "Ëþò" + LOCALE_SABBREVMONTHNAME3 "Áåð" + LOCALE_SABBREVMONTHNAME4 "Êâ³" + LOCALE_SABBREVMONTHNAME5 "Òðà" + LOCALE_SABBREVMONTHNAME6 "×åð" + LOCALE_SABBREVMONTHNAME7 "Ëèï" + LOCALE_SABBREVMONTHNAME8 "Ñåð" + LOCALE_SABBREVMONTHNAME9 "Âåð" + LOCALE_SABBREVMONTHNAME10 "Æîâ" + LOCALE_SABBREVMONTHNAME11 "Ëèñ" + LOCALE_SABBREVMONTHNAME12 "Ãðã" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Ukraine" + LOCALE_SCURRENCY "ãðí." + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "ïîíåä³ëîê" + LOCALE_SDAYNAME2 "â³âòîðîê" + LOCALE_SDAYNAME3 "ñåðåäà" + LOCALE_SDAYNAME4 "÷åòâåð" + LOCALE_SDAYNAME5 "ï'ÿòíèöÿ" + LOCALE_SDAYNAME6 "ñóáîòà" + LOCALE_SDAYNAME7 "íåä³ëÿ" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Ukraine" + LOCALE_SENGCURRNAME "Ukrainian Grivna" + LOCALE_SENGLANGUAGE "Ukrainian" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "UAH" + LOCALE_SISO3166CTRYNAME "UA" + LOCALE_SISO639LANGNAME "uk" + LOCALE_SLANGUAGE "Ukrainian" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "d MMMM yyyy' ð.'" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "ѳ÷åíü" + LOCALE_SMONTHNAME2 "Ëþòèé" + LOCALE_SMONTHNAME3 "Áåðåçåíü" + LOCALE_SMONTHNAME4 "Êâ³òåíü" + LOCALE_SMONTHNAME5 "Òðàâåíü" + LOCALE_SMONTHNAME6 "×åðâåíü" + LOCALE_SMONTHNAME7 "Ëèïåíü" + LOCALE_SMONTHNAME8 "Ñåðïåíü" + LOCALE_SMONTHNAME9 "Âåðåñåíü" + LOCALE_SMONTHNAME10 "Æîâòåíü" + LOCALE_SMONTHNAME11 "Ëèñòîïàä" + LOCALE_SMONTHNAME12 "Ãðóäåíü" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "Óêðà¿íà" + LOCALE_SNATIVECURRNAME "ãðèâíÿ" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "óêðà¿íüñêà" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "H:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy' ð.'" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/uzb.nls b/reactos/lib/kernel32/nls/uzb.nls new file mode 100644 index 00000000000..c5b6ecf43d7 --- /dev/null +++ b/reactos/lib/kernel32/nls/uzb.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Uzbek (Cyrillic) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(1251) + +STRINGTABLE LANGUAGE LANG_UZBEK, SUBLANG_UZBEK_CYRILLIC +{ +//FIXME LOCALE_FONTSIGNATURE L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "7" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "3" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "1" + LOCALE_IDEFAULTANSICODEPAGE "1251" + LOCALE_IDEFAULTCODEPAGE "866" + LOCALE_IDEFAULTCOUNTRY "7" + LOCALE_IDEFAULTEBCDICCODEPAGE "20880" + LOCALE_IDEFAULTLANGUAGE "0843" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10007" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "28595" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "0" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "0843" + LOCALE_ILDATE "1" + LOCALE_ILZERO "0" + LOCALE_IMEASURE "0" + LOCALE_IMONLZERO "1" + LOCALE_INEGCURR "8" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "1" + LOCALE_INEGSIGNPOSN "1" + LOCALE_INEGSYMPRECEDES "0" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "1" + LOCALE_IPOSSIGNPOSN "1" + LOCALE_IPOSSYMPRECEDES "0" + LOCALE_ITIME "1" + LOCALE_ITIMEMARKPOSN "0" + LOCALE_ITLZERO "1" + LOCALE_S1159 "" + LOCALE_S2359 "" + LOCALE_SABBREVCTRYNAME "UZB" + LOCALE_SABBREVDAYNAME1 "äø" + LOCALE_SABBREVDAYNAME2 "ñø" + LOCALE_SABBREVDAYNAME3 "÷ø" + LOCALE_SABBREVDAYNAME4 "ïø" + LOCALE_SABBREVDAYNAME5 "æ" + LOCALE_SABBREVDAYNAME6 "ø" + LOCALE_SABBREVDAYNAME7 "ÿêø" + LOCALE_SABBREVLANGNAME "UZB" + LOCALE_SABBREVMONTHNAME1 "ßíâ" + LOCALE_SABBREVMONTHNAME2 "Ôåâ" + LOCALE_SABBREVMONTHNAME3 "Ìàð" + LOCALE_SABBREVMONTHNAME4 "Àïð" + LOCALE_SABBREVMONTHNAME5 "Ìàé" + LOCALE_SABBREVMONTHNAME6 "Èþí" + LOCALE_SABBREVMONTHNAME7 "Èþë" + LOCALE_SABBREVMONTHNAME8 "Àâã" + LOCALE_SABBREVMONTHNAME9 "Ñåí" + LOCALE_SABBREVMONTHNAME10 "Îêò" + LOCALE_SABBREVMONTHNAME11 "Íîÿ" + LOCALE_SABBREVMONTHNAME12 "Äåê" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Uzbekistan" + LOCALE_SCURRENCY "ñ¢ì" + LOCALE_SDATE "." + LOCALE_SDAYNAME1 "äóøàíáà" + LOCALE_SDAYNAME2 "ñåøàíáà" + LOCALE_SDAYNAME3 "÷îðøàíáà" + LOCALE_SDAYNAME4 "ïàéøàíáà" + LOCALE_SDAYNAME5 "æóìà" + LOCALE_SDAYNAME6 "øàíáà" + LOCALE_SDAYNAME7 "ÿêøàíáà" + LOCALE_SDECIMAL "," + LOCALE_SENGCOUNTRY "Uzbekistan" + LOCALE_SENGCURRNAME "Uzbekistan Sum" + LOCALE_SENGLANGUAGE "Uzbek (Cyrillic)" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "UZS" + LOCALE_SISO3166CTRYNAME "UZ" + LOCALE_SISO639LANGNAME "uz" + LOCALE_SLANGUAGE "Uzbek (Cyrillic)" + LOCALE_SLIST ";" + LOCALE_SLONGDATE "yyyy 'éèë' d-MMMM" + LOCALE_SMONDECIMALSEP "," + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "ßíâàð" + LOCALE_SMONTHNAME2 "Ôåâðàë" + LOCALE_SMONTHNAME3 "Ìàðò" + LOCALE_SMONTHNAME4 "Àïðåë" + LOCALE_SMONTHNAME5 "Ìàé" + LOCALE_SMONTHNAME6 "Èþí" + LOCALE_SMONTHNAME7 "Èþë" + LOCALE_SMONTHNAME8 "Àâãóñò" + LOCALE_SMONTHNAME9 "Ñåíòÿáð" + LOCALE_SMONTHNAME10 "Îêòÿáð" + LOCALE_SMONTHNAME11 "Íîÿáð" + LOCALE_SMONTHNAME12 "Äåêàáð" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP " " + LOCALE_SNATIVECTRYNAME "¡çáåêèñòîí" + LOCALE_SNATIVECURRNAME "ðóáëü" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "¡çáåê" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "dd.MM.yyyy" + LOCALE_SSORTNAME "Default" + LOCALE_STHOUSAND " " + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "HH:mm:ss" + LOCALE_SYEARMONTH "MMMM yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/nls/zhi.nls b/reactos/lib/kernel32/nls/zhi.nls new file mode 100644 index 00000000000..22faf5cd2fb --- /dev/null +++ b/reactos/lib/kernel32/nls/zhi.nls @@ -0,0 +1,154 @@ +/* + * Locale definitions for Chinese (Singapore) + * + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma code_page(936) + +STRINGTABLE LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE +{ +//FIXME LOCALE_FONTSIGNATURE L"\x02af\x8000\x6cf8\x184f\x0010\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0000\x0004\x0000\x0000" + LOCALE_ICALENDARTYPE "1" + LOCALE_ICENTURY "1" + LOCALE_ICOUNTRY "65" + LOCALE_ICURRDIGITS "2" + LOCALE_ICURRENCY "0" + LOCALE_IDATE "1" + LOCALE_IDAYLZERO "0" + LOCALE_IDEFAULTANSICODEPAGE "936" + LOCALE_IDEFAULTCODEPAGE "936" + LOCALE_IDEFAULTCOUNTRY "65" + LOCALE_IDEFAULTEBCDICCODEPAGE "500" + LOCALE_IDEFAULTLANGUAGE "1004" +//FIXME LOCALE_IDEFAULTMACCODEPAGE "10008" +//FIXME LOCALE_IDEFAULTUNIXCODEPAGE "936" + LOCALE_IDIGITS "2" + LOCALE_IDIGITSUBSTITUTION "1" + LOCALE_IFIRSTDAYOFWEEK "6" + LOCALE_IFIRSTWEEKOFYEAR "0" + LOCALE_IINTLCURRDIGITS "2" + LOCALE_ILANGUAGE "1004" + LOCALE_ILDATE "1" + LOCALE_ILZERO "1" + LOCALE_IMEASURE "1" + LOCALE_IMONLZERO "0" + LOCALE_INEGCURR "0" + LOCALE_INEGNUMBER "1" + LOCALE_INEGSEPBYSPACE "0" + LOCALE_INEGSIGNPOSN "0" + LOCALE_INEGSYMPRECEDES "1" + LOCALE_IOPTIONALCALENDAR "0" + LOCALE_IPAPERSIZE "9" + LOCALE_IPOSSEPBYSPACE "0" + LOCALE_IPOSSIGNPOSN "3" + LOCALE_IPOSSYMPRECEDES "1" + LOCALE_ITIME "0" + LOCALE_ITIMEMARKPOSN "1" + LOCALE_ITLZERO "0" + LOCALE_S1159 "AM" + LOCALE_S2359 "PM" + LOCALE_SABBREVCTRYNAME "SGP" + LOCALE_SABBREVDAYNAME1 "ÐÇÆÚÒ»" + LOCALE_SABBREVDAYNAME2 "ÐÇÆÚ¶þ" + LOCALE_SABBREVDAYNAME3 "ÐÇÆÚÈý" + LOCALE_SABBREVDAYNAME4 "ÐÇÆÚËÄ" + LOCALE_SABBREVDAYNAME5 "ÐÇÆÚÎå" + LOCALE_SABBREVDAYNAME6 "ÐÇÆÚÁù" + LOCALE_SABBREVDAYNAME7 "ÐÇÆÚÈÕ" + LOCALE_SABBREVLANGNAME "ZHI" + LOCALE_SABBREVMONTHNAME1 "Ò»ÔÂ" + LOCALE_SABBREVMONTHNAME2 "¶þÔÂ" + LOCALE_SABBREVMONTHNAME3 "ÈýÔÂ" + LOCALE_SABBREVMONTHNAME4 "ËÄÔÂ" + LOCALE_SABBREVMONTHNAME5 "ÎåÔÂ" + LOCALE_SABBREVMONTHNAME6 "ÁùÔÂ" + LOCALE_SABBREVMONTHNAME7 "ÆßÔÂ" + LOCALE_SABBREVMONTHNAME8 "°ËÔÂ" + LOCALE_SABBREVMONTHNAME9 "¾ÅÔÂ" + LOCALE_SABBREVMONTHNAME10 "Ê®ÔÂ" + LOCALE_SABBREVMONTHNAME11 "ʮһÔÂ" + LOCALE_SABBREVMONTHNAME12 "Ê®¶þÔÂ" + LOCALE_SABBREVMONTHNAME13 "" + LOCALE_SCOUNTRY "Singapore" + LOCALE_SCURRENCY "$" + LOCALE_SDATE "/" + LOCALE_SDAYNAME1 "ÐÇÆÚÒ»" + LOCALE_SDAYNAME2 "ÐÇÆÚ¶þ" + LOCALE_SDAYNAME3 "ÐÇÆÚÈý" + LOCALE_SDAYNAME4 "ÐÇÆÚËÄ" + LOCALE_SDAYNAME5 "ÐÇÆÚÎå" + LOCALE_SDAYNAME6 "ÐÇÆÚÁù" + LOCALE_SDAYNAME7 "ÐÇÆÚÈÕ" + LOCALE_SDECIMAL "." + LOCALE_SENGCOUNTRY "Singapore" + LOCALE_SENGCURRNAME "Singapore Dollar" + LOCALE_SENGLANGUAGE "Chinese" + LOCALE_SGROUPING "3;0" + LOCALE_SINTLSYMBOL "SGD" + LOCALE_SISO3166CTRYNAME "SG" + LOCALE_SISO639LANGNAME "zh" + LOCALE_SLANGUAGE "Chinese (Singapore)" + LOCALE_SLIST "," + LOCALE_SLONGDATE "dddd, d MMMM, yyyy" + LOCALE_SMONDECIMALSEP "." + LOCALE_SMONGROUPING "3;0" + LOCALE_SMONTHNAME1 "Ò»ÔÂ" + LOCALE_SMONTHNAME2 "¶þÔÂ" + LOCALE_SMONTHNAME3 "ÈýÔÂ" + LOCALE_SMONTHNAME4 "ËÄÔÂ" + LOCALE_SMONTHNAME5 "ÎåÔÂ" + LOCALE_SMONTHNAME6 "ÁùÔÂ" + LOCALE_SMONTHNAME7 "ÆßÔÂ" + LOCALE_SMONTHNAME8 "°ËÔÂ" + LOCALE_SMONTHNAME9 "¾ÅÔÂ" + LOCALE_SMONTHNAME10 "Ê®ÔÂ" + LOCALE_SMONTHNAME11 "ʮһÔÂ" + LOCALE_SMONTHNAME12 "Ê®¶þÔÂ" + LOCALE_SMONTHNAME13 "" + LOCALE_SMONTHOUSANDSEP "," + LOCALE_SNATIVECTRYNAME "ÐÂ¼ÓÆÂ" + LOCALE_SNATIVECURRNAME "бÒ" + LOCALE_SNATIVEDIGITS "0123456789" + LOCALE_SNATIVELANGNAME "ÖÐÎÄ(¼òÌå)" + LOCALE_SNEGATIVESIGN "-" + LOCALE_SPOSITIVESIGN "" + LOCALE_SSHORTDATE "d/M/yyyy" + LOCALE_SSORTNAME "Pronunciation" + LOCALE_STHOUSAND "," + LOCALE_STIME ":" + LOCALE_STIMEFORMAT "tt h:mm:ss" + LOCALE_SYEARMONTH "MMMM, yyyy" + + LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States" + LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe" + LGRPID_BALTIC+LGRPID_RES_BASE "Baltic" + LGRPID_GREEK+LGRPID_RES_BASE "Greek" + LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic" + LGRPID_TURKISH+LGRPID_RES_BASE "Turkic" + LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese" + LGRPID_KOREAN+LGRPID_RES_BASE "Korean" + LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese" + LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese" + LGRPID_THAI+LGRPID_RES_BASE "Thai" + LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew" + LGRPID_ARABIC+LGRPID_RES_BASE "Arabic" + LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese" + LGRPID_INDIC+LGRPID_RES_BASE "Indic" + LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian" + LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian" +} diff --git a/reactos/lib/kernel32/process/create.c b/reactos/lib/kernel32/process/create.c index 596d14cfd57..29121b4b4b3 100644 --- a/reactos/lib/kernel32/process/create.c +++ b/reactos/lib/kernel32/process/create.c @@ -1398,7 +1398,7 @@ CreateProcessW(LPCWSTR lpApplicationName, (PVOID)((ULONG_PTR)ImageBaseAddress + Sii.EntryPoint), dwCreationFlags, &lpProcessInformation->dwThreadId); - if (hThread == INVALID_HANDLE_VALUE) + if (hThread == NULL) { return FALSE; } diff --git a/reactos/lib/kernel32/process/proc.c b/reactos/lib/kernel32/process/proc.c index 27c867dce34..3994255954e 100644 --- a/reactos/lib/kernel32/process/proc.c +++ b/reactos/lib/kernel32/process/proc.c @@ -342,18 +342,13 @@ OpenProcess(DWORD dwDesiredAccess, CLIENT_ID ClientId; ClientId.UniqueProcess = (HANDLE)dwProcessId; - ClientId.UniqueThread = INVALID_HANDLE_VALUE; + ClientId.UniqueThread = 0; - ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); - ObjectAttributes.RootDirectory = (HANDLE)NULL; - ObjectAttributes.SecurityDescriptor = NULL; - ObjectAttributes.SecurityQualityOfService = NULL; - ObjectAttributes.ObjectName = NULL; - - if (bInheritHandle == TRUE) - ObjectAttributes.Attributes = OBJ_INHERIT; - else - ObjectAttributes.Attributes = 0; + InitializeObjectAttributes(&ObjectAttributes, + NULL, + (bInheritHandle ? OBJ_INHERIT : 0), + NULL, + NULL); errCode = NtOpenProcess(&ProcessHandle, dwDesiredAccess, diff --git a/reactos/lib/mpr/mpr.rc b/reactos/lib/mpr/mpr.rc index 550e5e5d140..aed47a53e24 100644 --- a/reactos/lib/mpr/mpr.rc +++ b/reactos/lib/mpr/mpr.rc @@ -33,3 +33,4 @@ #include "mpr_Ja.rc" #include "mpr_Nl.rc" #include "mpr_Pt.rc" +#include "mpr_Sv.rc" diff --git a/reactos/lib/mpr/mpr_Es.rc b/reactos/lib/mpr/mpr_Es.rc index 1d7e32e0e6d..520b12229f4 100644 --- a/reactos/lib/mpr/mpr_Es.rc +++ b/reactos/lib/mpr/mpr_Es.rc @@ -1,7 +1,7 @@ /* * MPR dll Spanish resources * - * Copyright (C) 2004 José Manuel Ferrer Ortiz + * Copyright (C) 2004, 2005 José Manuel Ferrer Ortiz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,3 +24,23 @@ STRINGTABLE DISCARDABLE { IDS_ENTIRENETWORK "Toda la red" } + +IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Introduzca contraseña de red" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Por favor, introduzca su nombre de usuario y contraseña:", IDC_EXPLAIN, 40, 6, 150, 15 + LTEXT "Proxy", -1, 40, 26, 50, 10 +/* LTEXT "Realm", -1, 40, 46, 50, 10 */ + LTEXT "Usuario", -1, 40, 66, 50, 10 + LTEXT "Contraseña", -1, 40, 86, 50, 10 + LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Guardar esta contraseña (Inseguro)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Aceptar", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} diff --git a/reactos/lib/mpr/mpr_Sv.rc b/reactos/lib/mpr/mpr_Sv.rc new file mode 100644 index 00000000000..eeaa71a5c90 --- /dev/null +++ b/reactos/lib/mpr/mpr_Sv.rc @@ -0,0 +1,46 @@ +/* + * MPR dll Swedish resources + * + * Copyright (C) 2005 Andreas Bjerkeholt + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +{ + IDS_ENTIRENETWORK "Hela nätverket" +} + +IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ange nätverkslösenord" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Ange ditt användarnamn och lösenord:", IDC_EXPLAIN, 40, 6, 150, 15 + LTEXT "Proxy", -1, 40, 26, 50, 10 +/* LTEXT "Realm", -1, 40, 46, 50, 10 */ + LTEXT "Användare", -1, 40, 66, 50, 10 + LTEXT "Lösenord", -1, 40, 86, 50, 10 + LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Spara detta lösenord (Osäkert)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} diff --git a/reactos/lib/mpr/wnet.c b/reactos/lib/mpr/wnet.c index 19caab35da1..a5ee8473828 100644 --- a/reactos/lib/mpr/wnet.c +++ b/reactos/lib/mpr/wnet.c @@ -138,7 +138,7 @@ static void _tryLoadProvider(PCWSTR provider) RegQueryValueExW(hKey, szProviderName, NULL, NULL, NULL, &size); if (size) { - name = (PWSTR)HeapAlloc(GetProcessHeap(), 0, size); + name = HeapAlloc(GetProcessHeap(), 0, size); if (RegQueryValueExW(hKey, szProviderName, NULL, &type, (LPBYTE)name, &size) != ERROR_SUCCESS || type != REG_SZ) { @@ -243,7 +243,7 @@ void wnetInit(HINSTANCE hInstDll) RegQueryValueExW(hKey, providerOrder, NULL, NULL, NULL, &size); if (size) { - PWSTR providers = (PWSTR)HeapAlloc(GetProcessHeap(), 0, size); + PWSTR providers = HeapAlloc(GetProcessHeap(), 0, size); if (providers) { @@ -264,7 +264,7 @@ void wnetInit(HINSTANCE hInstDll) if (ptr) numToAllocate++; } - providerTable = (PWNetProviderTable) + providerTable = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetProviderTable) + (numToAllocate - 1) * sizeof(WNetProvider)); @@ -275,7 +275,7 @@ void wnetInit(HINSTANCE hInstDll) entireNetworkLen = LoadStringW(hInstDll, IDS_ENTIRENETWORK, NULL, 0); - providerTable->entireNetwork = (LPWSTR)HeapAlloc( + providerTable->entireNetwork = HeapAlloc( GetProcessHeap(), 0, (entireNetworkLen + 1) * sizeof(WCHAR)); if (providerTable->entireNetwork) @@ -343,8 +343,7 @@ static LPNETRESOURCEW _copyNetResourceForEnumW(LPNETRESOURCEW lpNet) if (lpNet) { - ret = (LPNETRESOURCEW)HeapAlloc(GetProcessHeap(), 0, - sizeof(NETRESOURCEW)); + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(NETRESOURCEW)); if (ret) { size_t len; @@ -354,8 +353,7 @@ static LPNETRESOURCEW _copyNetResourceForEnumW(LPNETRESOURCEW lpNet) if (lpNet->lpRemoteName) { len = strlenW(lpNet->lpRemoteName) + 1; - ret->lpRemoteName = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - len * sizeof(WCHAR)); + ret->lpRemoteName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (ret->lpRemoteName) strcpyW(ret->lpRemoteName, lpNet->lpRemoteName); } @@ -377,7 +375,7 @@ static void _freeEnumNetResource(LPNETRESOURCEW lpNet) static PWNetEnumerator _createNullEnumerator(void) { - PWNetEnumerator ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), + PWNetEnumerator ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) @@ -388,7 +386,7 @@ static PWNetEnumerator _createNullEnumerator(void) static PWNetEnumerator _createGlobalEnumeratorW(DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEW lpNet) { - PWNetEnumerator ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), + PWNetEnumerator ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) @@ -411,8 +409,7 @@ static PWNetEnumerator _createProviderEnumerator(DWORD dwScope, DWORD dwType, ret = NULL; else { - ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) { ret->enumType = WNET_ENUMERATOR_TYPE_PROVIDER; @@ -429,7 +426,7 @@ static PWNetEnumerator _createProviderEnumerator(DWORD dwScope, DWORD dwType, static PWNetEnumerator _createContextEnumerator(DWORD dwScope, DWORD dwType, DWORD dwUsage) { - PWNetEnumerator ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), + PWNetEnumerator ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) @@ -641,7 +638,7 @@ DWORD WINAPI WNetOpenEnumA( DWORD dwScope, DWORD dwType, DWORD dwUsage, ret = _thunkNetResourceArrayAToW(lpNet, &count, buf, &size); if (ret == WN_MORE_DATA) { - lpNetWide = (LPNETRESOURCEW)HeapAlloc(GetProcessHeap(), 0, + lpNetWide = HeapAlloc(GetProcessHeap(), 0, size); if (lpNetWide) { @@ -1538,7 +1535,7 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName, if (len) { - PWSTR wideLocalName = (PWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + PWSTR wideLocalName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (wideLocalName) { @@ -1569,7 +1566,7 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName, } else if (ret == WN_MORE_DATA) { - PWSTR wideRemote = (PWSTR)HeapAlloc(GetProcessHeap(), 0, + PWSTR wideRemote = HeapAlloc(GetProcessHeap(), 0, wideRemoteSize * sizeof(WCHAR)); if (wideRemote) @@ -1863,8 +1860,7 @@ DWORD WINAPI WNetGetNetworkInformationA( LPCSTR lpProvider, len = MultiByteToWideChar(CP_ACP, 0, lpProvider, -1, NULL, 0); if (len) { - LPWSTR wideProvider = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - len * sizeof(WCHAR)); + LPWSTR wideProvider = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (wideProvider) { diff --git a/reactos/lib/msi/Makefile.in b/reactos/lib/msi/Makefile.in index 14ad0ed4a12..85c1eee55e3 100644 --- a/reactos/lib/msi/Makefile.in +++ b/reactos/lib/msi/Makefile.in @@ -11,6 +11,7 @@ C_SRCS = \ appsearch.c \ create.c \ custom.c \ + database.c \ delete.c \ dialog.c \ distinct.c \ diff --git a/reactos/lib/msi/action.c b/reactos/lib/msi/action.c index aef211a0cb6..ae48e3bcf75 100644 --- a/reactos/lib/msi/action.c +++ b/reactos/lib/msi/action.c @@ -61,7 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); */ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran); static UINT ACTION_ProcessUISequence(MSIPACKAGE *package); -static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq); +static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI); static UINT build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name, LPWSTR *FilePath); @@ -508,8 +508,8 @@ int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path) memset(&package->files[index],0,sizeof(MSIFILE)); - package->files[index].File = dupstrW(name); - package->files[index].TargetPath = dupstrW(path); + package->files[index].File = strdupW(name); + package->files[index].TargetPath = strdupW(path); package->files[index].Temporary = TRUE; TRACE("Tracking tempfile (%s)\n",debugstr_w(package->files[index].File)); @@ -677,7 +677,7 @@ static void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * recor package->ActionFormat = load_dynamic_stringW(row,3); HeapFree(GetProcessHeap(),0,package->LastAction); - package->LastAction = dupstrW(action); + package->LastAction = strdupW(action); msiobj_release(&row->hdr); MSI_ViewClose(view); @@ -864,6 +864,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath, DWORD sz; WCHAR buffer[10]; UINT rc; + BOOL ui = FALSE; static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0}; static const WCHAR szAction[] = {'A','C','T','I','O','N',0}; static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0}; @@ -875,8 +876,8 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath, { LPWSTR p, check, path; - package->PackagePath = dupstrW(szPackagePath); - path = dupstrW(szPackagePath); + package->PackagePath = strdupW(szPackagePath); + path = strdupW(szPackagePath); p = strrchrW(path,'\\'); if (p) { @@ -921,7 +922,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath, while (*ptr == ' ') ptr++; len = ptr2-ptr; prop = HeapAlloc(GetProcessHeap(),0,(len+1)*sizeof(WCHAR)); - strncpyW(prop,ptr,len); + memcpy(prop,ptr,len*sizeof(WCHAR)); prop[len]=0; ptr2++; @@ -941,7 +942,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath, len -= 2; } val = HeapAlloc(GetProcessHeap(),0,(len+1)*sizeof(WCHAR)); - strncpyW(val,ptr2,len); + memcpy(val,ptr2,len*sizeof(WCHAR)); val[len] = 0; if (strlenW(prop) > 0) @@ -963,6 +964,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath, if (atoiW(buffer) >= INSTALLUILEVEL_REDUCED) { rc = ACTION_ProcessUISequence(package); + ui = TRUE; if (rc == ERROR_SUCCESS) rc = ACTION_ProcessExecSequence(package,TRUE); } @@ -980,13 +982,13 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath, /* process the ending type action */ if (rc == ERROR_SUCCESS) - ACTION_PerformActionSequence(package,-1); + ACTION_PerformActionSequence(package,-1,ui); else if (rc == ERROR_INSTALL_USEREXIT) - ACTION_PerformActionSequence(package,-2); + ACTION_PerformActionSequence(package,-2,ui); else if (rc == ERROR_FUNCTION_FAILED) - ACTION_PerformActionSequence(package,-3); + ACTION_PerformActionSequence(package,-3,ui); else if (rc == ERROR_INSTALL_SUSPEND) - ACTION_PerformActionSequence(package,-4); + ACTION_PerformActionSequence(package,-4,ui); /* finish up running custom actions */ ACTION_FinishCustomActions(package); @@ -994,7 +996,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath, return rc; } -static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) +static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI) { MSIQUERY * view; UINT rc; @@ -1007,7 +1009,16 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) 'S','e','q','u','e','n','c','e',' ', 'W','H','E','R','E',' ', 'S','e','q','u','e','n','c','e',' ', '=',' ','%','i',0}; - rc = MSI_OpenQuery(package->db, &view, ExecSeqQuery, seq); + static const WCHAR UISeqQuery[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', + 'I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e', + ' ', 'W','H','E','R','E',' ', 'S','e','q','u','e','n','c','e', + ' ', '=',' ','%','i',0}; + + if (UI) + rc = MSI_OpenQuery(package->db, &view, UISeqQuery, seq); + else + rc = MSI_OpenQuery(package->db, &view, ExecSeqQuery, seq); if (rc == ERROR_SUCCESS) { @@ -1058,7 +1069,10 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) goto end; } - rc = ACTION_PerformAction(package,buffer); + if (UI) + rc = ACTION_PerformUIAction(package,buffer); + else + rc = ACTION_PerformAction(package,buffer); msiobj_release(&row->hdr); end: MSI_ViewClose(view); @@ -1921,7 +1935,7 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir) memset(&package->folders[index],0,sizeof(MSIFOLDER)); - package->folders[index].Directory = dupstrW(dir); + package->folders[index].Directory = strdupW(dir); rc = MSI_OpenQuery(package->db, &view, Query, dir); if (rc != ERROR_SUCCESS) @@ -1980,13 +1994,13 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir) { TRACE(" TargetDefault = %s\n",debugstr_w(targetdir)); HeapFree(GetProcessHeap(),0, package->folders[index].TargetDefault); - package->folders[index].TargetDefault = dupstrW(targetdir); + package->folders[index].TargetDefault = strdupW(targetdir); } if (srcdir) - package->folders[index].SourceDefault = dupstrW(srcdir); + package->folders[index].SourceDefault = strdupW(srcdir); else if (targetdir) - package->folders[index].SourceDefault = dupstrW(targetdir); + package->folders[index].SourceDefault = strdupW(targetdir); HeapFree(GetProcessHeap(), 0, ptargetdir); parent = load_dynamic_stringW(row,2); @@ -2084,13 +2098,13 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, if (!source && package->folders[i].ResolvedTarget) { - path = dupstrW(package->folders[i].ResolvedTarget); + path = strdupW(package->folders[i].ResolvedTarget); TRACE(" already resolved to %s\n",debugstr_w(path)); return path; } else if (source && package->folders[i].ResolvedSource) { - path = dupstrW(package->folders[i].ResolvedSource); + path = strdupW(package->folders[i].ResolvedSource); return path; } else if (!source && package->folders[i].Property) @@ -2114,7 +2128,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, { TRACE(" TargetDefault = %s\n",debugstr_w(package->folders[i].TargetDefault)); path = build_directory_name(3, p, package->folders[i].TargetDefault, NULL); - package->folders[i].ResolvedTarget = dupstrW(path); + package->folders[i].ResolvedTarget = strdupW(path); TRACE(" resolved into %s\n",debugstr_w(path)); if (set_prop) MSI_SetPropertyW(package,name,path); @@ -2122,7 +2136,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, else { path = build_directory_name(3, p, package->folders[i].SourceDefault, NULL); - package->folders[i].ResolvedSource = dupstrW(path); + package->folders[i].ResolvedSource = strdupW(path); } HeapFree(GetProcessHeap(),0,p); } @@ -3119,7 +3133,7 @@ inline static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key, { if (package->files[index].State >= 2) { - *file_source = dupstrW(package->files[index].TargetPath); + *file_source = strdupW(package->files[index].TargetPath); return ERROR_SUCCESS; } else @@ -3231,7 +3245,7 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package) if (MSI_RecordIsNull(row,5)) { LPWSTR p; - dest_path = dupstrW(file_source); + dest_path = strdupW(file_source); p = strrchrW(dest_path,'\\'); if (p) *p=0; @@ -3523,7 +3537,8 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package) value_data = parse_value(package, value, &type, &size); else { - value_data = NULL; + static const WCHAR szEmpty[] = {0}; + value_data = (LPSTR)strdupW(szEmpty); size = 0; type = REG_SZ; } @@ -3759,7 +3774,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, INT if (j>=0) { - LPWSTR p = dupstrW(package->files[j].TargetPath); + LPWSTR p = strdupW(package->files[j].TargetPath); return p; } } @@ -4005,6 +4020,61 @@ end: return rc; } +typedef struct { + CLSID clsid; + LPWSTR source; + + LPWSTR path; + ITypeLib *ptLib; +} typelib_struct; + +BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, + LPWSTR lpszName, LONG_PTR lParam) +{ + TLIBATTR *attr; + typelib_struct *tl_struct = (typelib_struct*) lParam; + static const WCHAR fmt[] = {'%','s','\\','%','i',0}; + int sz; + HRESULT res; + + if (!IS_INTRESOURCE(lpszName)) + { + ERR("Not Int Resource Name %s\n",debugstr_w(lpszName)); + return TRUE; + } + + sz = strlenW(tl_struct->source)+4; + sz *= sizeof(WCHAR); + + tl_struct->path = HeapAlloc(GetProcessHeap(),0,sz); + sprintfW(tl_struct->path,fmt,tl_struct->source, lpszName); + + TRACE("trying %s\n", debugstr_w(tl_struct->path)); + res = LoadTypeLib(tl_struct->path,&tl_struct->ptLib); + if (!SUCCEEDED(res)) + { + HeapFree(GetProcessHeap(),0,tl_struct->path); + tl_struct->path = NULL; + + return TRUE; + } + + ITypeLib_GetLibAttr(tl_struct->ptLib, &attr); + if (IsEqualGUID(&(tl_struct->clsid),&(attr->guid))) + { + ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr); + return FALSE; + } + + HeapFree(GetProcessHeap(),0,tl_struct->path); + tl_struct->path = NULL; + + ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr); + ITypeLib_Release(tl_struct->ptLib); + + return TRUE; +} + static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package) { /* @@ -4019,8 +4089,6 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package) static const WCHAR Query[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', 'T','y','p','e','L','i','b',0}; - ITypeLib *ptLib; - HRESULT res; if (!package) return ERROR_INVALID_HANDLE; @@ -4042,6 +4110,10 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package) WCHAR component[0x100]; DWORD sz; INT index; + LPWSTR guid; + typelib_struct tl_struct; + HMODULE module; + static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0}; rc = MSI_ViewFetch(view,&row); if (rc != ERROR_SUCCESS) @@ -4082,46 +4154,59 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package) continue; } - res = LoadTypeLib(package->files[index].TargetPath,&ptLib); - if (SUCCEEDED(res)) + guid = load_dynamic_stringW(row,1); + module = LoadLibraryExW(package->files[index].TargetPath, NULL, + LOAD_LIBRARY_AS_DATAFILE); + if (module != NULL) { - LPWSTR help; - WCHAR helpid[0x100]; + CLSIDFromString(guid, &tl_struct.clsid); + tl_struct.source = strdupW(package->files[index].TargetPath); + tl_struct.path = NULL; - sz = 0x100; - MSI_RecordGetStringW(row,6,helpid,&sz); + EnumResourceNamesW(module, szTYPELIB, Typelib_EnumResNameProc, + (LONG_PTR)&tl_struct); - help = resolve_folder(package,helpid,FALSE,FALSE,NULL); - res = RegisterTypeLib(ptLib,package->files[index].TargetPath,help); - HeapFree(GetProcessHeap(),0,help); - - if (!SUCCEEDED(res)) - ERR("Failed to register type library %s\n", - debugstr_w(package->files[index].TargetPath)); - else + if (tl_struct.path != NULL) { - /* Yes the row has more fields than I need, but #1 is - correct and the only one I need. Why make a new row? */ + LPWSTR help; + WCHAR helpid[0x100]; + HRESULT res; - ui_actiondata(package,szRegisterTypeLibraries,row); + sz = 0x100; + MSI_RecordGetStringW(row,6,helpid,&sz); + + help = resolve_folder(package,helpid,FALSE,FALSE,NULL); + res = RegisterTypeLib(tl_struct.ptLib,tl_struct.path,help); + HeapFree(GetProcessHeap(),0,help); + + if (!SUCCEEDED(res)) + ERR("Failed to register type library %s\n", + debugstr_w(tl_struct.path)); + else + { + ui_actiondata(package,szRegisterTypeLibraries,row); - TRACE("Registered %s\n", - debugstr_w(package->files[index].TargetPath)); - } + TRACE("Registered %s\n", debugstr_w(tl_struct.path)); + } - if (ptLib) - ITypeLib_Release(ptLib); + ITypeLib_Release(tl_struct.ptLib); + HeapFree(GetProcessHeap(),0,tl_struct.path); + } + else + ERR("Failed to load type library %s\n", + debugstr_w(tl_struct.source)); + + FreeLibrary(module); + HeapFree(GetProcessHeap(),0,tl_struct.source); } else - ERR("Failed to load type library %s\n", - debugstr_w(package->files[index].TargetPath)); - + ERR("Could not load file! %s\n", + debugstr_w(package->files[index].TargetPath)); msiobj_release(&row->hdr); } MSI_ViewClose(view); msiobj_release(&view->hdr); return rc; - } static UINT register_appid(MSIPACKAGE *package, LPCWSTR clsid, LPCWSTR app ) @@ -4362,7 +4447,7 @@ static UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) HeapFree(GetProcessHeap(),0,argument); size += (strlenW(package->files[index].TargetPath))*sizeof(WCHAR); - argument = (LPWSTR)HeapAlloc(GetProcessHeap(),0,size+sizeof(WCHAR)); + argument = HeapAlloc(GetProcessHeap(),0,size+sizeof(WCHAR)); strcpyW(argument,package->files[index].TargetPath); if (deformated) { @@ -4882,7 +4967,7 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package) { LPWSTR keypath; FIXME("poorly handled shortcut format, advertised shortcut\n"); - keypath = dupstrW(package->components[index].FullKeypath); + keypath = strdupW(package->components[index].FullKeypath); IShellLinkW_SetPath(sl,keypath); HeapFree(GetProcessHeap(),0,keypath); } diff --git a/reactos/lib/msi/action.h b/reactos/lib/msi/action.h index 1ac1430c32e..af718bee464 100644 --- a/reactos/lib/msi/action.h +++ b/reactos/lib/msi/action.h @@ -116,39 +116,3 @@ int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component ); int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature ); int get_loaded_file(MSIPACKAGE* package, LPCWSTR file); int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path); - - - -inline static char *strdupWtoA( const WCHAR *str ) -{ - char *ret = NULL; - if (str) - { - DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL -); - if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) - WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); - } - return ret; -} - -inline static WCHAR *strdupAtoW( const char *str ) -{ - WCHAR *ret = NULL; - if (str) - { - DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) - MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); - } - return ret; -} - -inline static LPWSTR dupstrW(LPCWSTR src) -{ - LPWSTR dest; - if (!src) return NULL; - dest = HeapAlloc(GetProcessHeap(), 0, (strlenW(src)+1)*sizeof(WCHAR)); - strcpyW(dest, src); - return dest; -} diff --git a/reactos/lib/msi/appsearch.c b/reactos/lib/msi/appsearch.c index 8918d7f4588..ca9fc65a305 100644 --- a/reactos/lib/msi/appsearch.c +++ b/reactos/lib/msi/appsearch.c @@ -406,7 +406,7 @@ static void ACTION_ExpandAnyPath(MSIPACKAGE *package, WCHAR *src, WCHAR *dst, /* Sets *matches to whether the file (whose path is filePath) matches the * versions set in sig. * Return ERROR_SUCCESS in case of success (whether or not the file matches), - * something else if a install-halting error occurs. + * something else if an install-halting error occurs. */ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath, BOOL *matches) @@ -481,7 +481,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath, * fullFilePath is assumed to be the full path of the file specified in * findData, which may be necessary to compare the version. * Return ERROR_SUCCESS in case of success (whether or not the file matches), - * something else if a install-halting error occurs. + * something else if an install-halting error occurs. */ static UINT ACTION_FileMatchesSig(MSISIGNATURE *sig, LPWIN32_FIND_DATAW findData, LPCWSTR fullFilePath, BOOL *matches) @@ -672,8 +672,8 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig, pathWithDrive[0] = 'A' + i; if (GetDriveTypeW(pathWithDrive) == DRIVE_FIXED) { - strncpyW(pathWithDrive + 3, expanded, - sizeof(pathWithDrive) / sizeof(pathWithDrive[0]) - 3); + lstrcpynW(pathWithDrive + 3, expanded, + sizeof(pathWithDrive) / sizeof(pathWithDrive[0]) - 3); if (sig->File) rc = ACTION_RecurseSearchDirectory(package, &found, sig, pathWithDrive, depth); diff --git a/reactos/lib/msi/cond.tab.c b/reactos/lib/msi/cond.tab.c index 31fa5f736a6..56af92f32e5 100644 --- a/reactos/lib/msi/cond.tab.c +++ b/reactos/lib/msi/cond.tab.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 1.875b. */ +/* A Bison parser, made by GNU Bison 1.875c. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -253,18 +253,25 @@ typedef union YYSTYPE { #if ! defined (yyoverflow) || YYERROR_VERBOSE +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + /* The parser invokes alloca or malloc; define the necessary symbols. */ -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# endif # else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif @@ -277,15 +284,15 @@ typedef union YYSTYPE { # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ - || (YYSTYPE_IS_TRIVIAL))) + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -306,7 +313,7 @@ union yyalloc /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if 1 < __GNUC__ +# if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -454,14 +461,14 @@ static const unsigned short yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR", - "COND_AND", "COND_NOT", "COND_LT", "COND_GT", "COND_EQ", "COND_LPAR", - "COND_RPAR", "COND_TILDA", "COND_PERCENT", "COND_DOLLARS", - "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT", - "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition", - "expression", "boolean_term", "boolean_factor", "term", "comp_op_i", - "comp_op_s", "comp_op_m1", "comp_op_m2", "value_i", "value_s", - "literal", "symbol_i", "symbol_s", "identifier", "integer", 0 + "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR", + "COND_AND", "COND_NOT", "COND_LT", "COND_GT", "COND_EQ", "COND_LPAR", + "COND_RPAR", "COND_TILDA", "COND_PERCENT", "COND_DOLLARS", + "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT", + "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition", + "expression", "boolean_term", "boolean_factor", "term", "comp_op_i", + "comp_op_s", "comp_op_m1", "comp_op_m2", "value_i", "value_s", "literal", + "symbol_i", "symbol_s", "identifier", "integer", 0 }; #endif @@ -624,7 +631,7 @@ static const unsigned char yystos[] = #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 +#define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily @@ -659,11 +666,11 @@ while (0) are run). */ #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.first_line = Rhs[1].first_line; \ - Current.first_column = Rhs[1].first_column; \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + ((Current).first_line = (Rhs)[1].first_line, \ + (Current).first_column = (Rhs)[1].first_column, \ + (Current).last_line = (Rhs)[N].last_line, \ + (Current).last_column = (Rhs)[N].last_column) #endif /* YYLEX -- calling `yylex' with the right arguments. */ @@ -707,7 +714,7 @@ do { \ /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (cinluded). | +| TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) @@ -786,7 +793,7 @@ int yydebug; SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 +#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif @@ -1714,8 +1721,8 @@ yyreduce: } -/* Line 999 of yacc.c. */ -#line 1719 "cond.tab.c" +/* Line 1000 of yacc.c. */ +#line 1726 "cond.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -1818,25 +1825,27 @@ yyerrlab: /* If just tried and failed to reuse lookahead token after an error, discard it. */ - /* Return failure if at end of input. */ - if (yychar == YYEOF) + if (yychar <= YYEOF) { - /* Pop the error token. */ - YYPOPSTACK; - /* Pop the rest of the stack. */ - while (yyss < yyssp) - { - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - YYPOPSTACK; - } - YYABORT; + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + } } + else + { + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); - yychar = YYEMPTY; - + } } /* Else will try to reuse lookahead token after shifting the error @@ -1844,9 +1853,27 @@ yyerrlab: goto yyerrlab1; -/*----------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action. | -`----------------------------------------------------*/ +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + + yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ @@ -1870,9 +1897,8 @@ yyerrlab1: YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[yystate], yyvsp); - yyvsp--; - yystate = *--yyssp; - + YYPOPSTACK; + yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -2123,7 +2149,7 @@ static LPWSTR COND_GetString( struct cond_str *str ) ret = HeapAlloc( GetProcessHeap(), 0, (str->len+1) * sizeof (WCHAR) ); if( ret ) { - strncpyW( ret, str->data, str->len ); + memcpy( ret, str->data, str->len * sizeof(WCHAR)); ret[str->len]=0; } TRACE("Got identifier %s\n",debugstr_w(ret)); diff --git a/reactos/lib/msi/cond.tab.h b/reactos/lib/msi/cond.tab.h index 4870215530d..f37273b3993 100644 --- a/reactos/lib/msi/cond.tab.h +++ b/reactos/lib/msi/cond.tab.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 1.875b. */ +/* A Bison parser, made by GNU Bison 1.875c. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -86,7 +86,7 @@ typedef union YYSTYPE { comp_m1 fn_comp_m1; comp_m2 fn_comp_m2; } YYSTYPE; -/* Line 1252 of yacc.c. */ +/* Line 1275 of yacc.c. */ #line 91 "cond.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 diff --git a/reactos/lib/msi/cond.y b/reactos/lib/msi/cond.y index 2221fb156ba..8be1d2e6c04 100644 --- a/reactos/lib/msi/cond.y +++ b/reactos/lib/msi/cond.y @@ -701,7 +701,7 @@ static LPWSTR COND_GetString( struct cond_str *str ) ret = HeapAlloc( GetProcessHeap(), 0, (str->len+1) * sizeof (WCHAR) ); if( ret ) { - strncpyW( ret, str->data, str->len ); + memcpy( ret, str->data, str->len * sizeof(WCHAR)); ret[str->len]=0; } TRACE("Got identifier %s\n",debugstr_w(ret)); diff --git a/reactos/lib/msi/custom.c b/reactos/lib/msi/custom.c index 3f5686a7ea2..b9e70cf9d6e 100644 --- a/reactos/lib/msi/custom.c +++ b/reactos/lib/msi/custom.c @@ -145,7 +145,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) else newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR)); - newbuf[count] = dupstrW(action); + newbuf[count] = strdupW(action); package->CommitAction = newbuf; } else @@ -160,7 +160,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) else newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR)); - newbuf[count] = dupstrW(action); + newbuf[count] = strdupW(action); package->DeferredAction = newbuf; } @@ -326,7 +326,7 @@ static void file_running_action(MSIPACKAGE* package, HANDLE Handle, newbuf[count].handle = Handle; newbuf[count].process = process; - newbuf[count].name = dupstrW(name); + newbuf[count].name = strdupW(name); package->RunningAction = newbuf; } @@ -508,8 +508,8 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source, info = HeapAlloc( GetProcessHeap(), 0, sizeof(*info) ); msiobj_addref( &package->hdr ); info->package = package; - info->target = dupstrW(target); - info->source = dupstrW(tmp_file); + info->target = strdupW(target); + info->source = strdupW(tmp_file); ThreadHandle = CreateThread(NULL,0,DllThread,(LPVOID)info,0,&ThreadId); @@ -542,7 +542,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source, if (deformated) len += strlenW(deformated); - cmd = (WCHAR*)HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len); + cmd = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len); strcpyW(cmd,tmp_file); if (deformated) @@ -595,7 +595,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source, len += strlenW(deformated); len += 2; - cmd = (WCHAR*)HeapAlloc(GetProcessHeap(),0,len * sizeof(WCHAR)); + cmd = HeapAlloc(GetProcessHeap(),0,len * sizeof(WCHAR)); strcpyW(cmd, package->files[index].TargetPath); if (deformated) @@ -692,7 +692,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source, if (deformated) len += strlenW(deformated); - cmd = (WCHAR*)HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len); + cmd = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len); strcpyW(cmd,prop); if (deformated) diff --git a/reactos/lib/msi/database.c b/reactos/lib/msi/database.c new file mode 100644 index 00000000000..6d7bd1b9e5b --- /dev/null +++ b/reactos/lib/msi/database.c @@ -0,0 +1,345 @@ +/* + * Implementation of the Microsoft Installer (msi.dll) + * + * Copyright 2002,2003,2004,2005 Mike McCormack for CodeWeavers + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#define COBJMACROS +#define NONAMELESSUNION + +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winnls.h" +#include "wine/debug.h" +#include "msi.h" +#include "msiquery.h" +#include "msipriv.h" +#include "objidl.h" +#include "objbase.h" + +#include "initguid.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msi); + +/* + * The MSVC headers define the MSIDBOPEN_* macros cast to LPCTSTR, + * which is a problem because LPCTSTR isn't defined when compiling wine. + * To work around this problem, we need to define LPCTSTR as LPCWSTR here, + * and make sure to only use it in W functions. + */ +#define LPCTSTR LPCWSTR + +DEFINE_GUID( CLSID_MsiDatabase, 0x000c1084, 0x0000, 0x0000, + 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); + +/* + * .MSI file format + * + * An .msi file is a structured storage file. + * It contains a number of streams. + * A stream for each table in the database. + * Two streams for the string table in the database. + * Any binary data in a table is a reference to a stream. + */ + +VOID MSI_CloseDatabase( MSIOBJECTHDR *arg ) +{ + MSIDATABASE *db = (MSIDATABASE *) arg; + DWORD r; + + free_cached_tables( db ); + r = IStorage_Release( db->storage ); + if( r ) + ERR("database reference count was not zero (%ld)\n", r); +} + +UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) +{ + IStorage *stg = NULL; + HRESULT r; + MSIDATABASE *db = NULL; + UINT ret = ERROR_FUNCTION_FAILED; + LPWSTR szMode; + STATSTG stat; + + TRACE("%s %s\n",debugstr_w(szDBPath),debugstr_w(szPersist) ); + + if( !pdb ) + return ERROR_INVALID_PARAMETER; + + szMode = (LPWSTR) szPersist; + if( HIWORD( szPersist ) ) + { + /* UINT len = lstrlenW( szPerist ) + 1; */ + FIXME("don't support persist files yet\b"); + return ERROR_INVALID_PARAMETER; + /* szMode = HeapAlloc( GetProcessHeap(), 0, len * sizeof (DWORD) ); */ + } + else if( szPersist == MSIDBOPEN_READONLY ) + { + r = StgOpenStorage( szDBPath, NULL, + STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg); + } + else if( szPersist == MSIDBOPEN_CREATE ) + { + r = StgCreateDocfile( szDBPath, + STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg); + if( r == ERROR_SUCCESS ) + { + IStorage_SetClass( stg, &CLSID_MsiDatabase ); + r = init_string_table( stg ); + } + } + else if( szPersist == MSIDBOPEN_TRANSACT ) + { + r = StgOpenStorage( szDBPath, NULL, + STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg); + } + else + { + ERR("unknown flag %p\n",szPersist); + return ERROR_INVALID_PARAMETER; + } + + if( FAILED( r ) ) + { + FIXME("open failed r = %08lx!\n",r); + return ERROR_FUNCTION_FAILED; + } + + r = IStorage_Stat( stg, &stat, STATFLAG_NONAME ); + if( FAILED( r ) ) + { + FIXME("Failed to stat storage\n"); + goto end; + } + + if( memcmp( &stat.clsid, &CLSID_MsiDatabase, sizeof (GUID) ) ) + { + ERR("storage GUID is not a MSI database GUID %s\n", + debugstr_guid(&stat.clsid) ); + goto end; + } + + + db = alloc_msiobject( MSIHANDLETYPE_DATABASE, sizeof (MSIDATABASE), + MSI_CloseDatabase ); + if( !db ) + { + FIXME("Failed to allocate a handle\n"); + goto end; + } + + if( TRACE_ON( msi ) ) + enum_stream_names( stg ); + + db->storage = stg; + db->mode = szMode; + + ret = load_string_table( db ); + if( ret != ERROR_SUCCESS ) + goto end; + + msiobj_addref( &db->hdr ); + IStorage_AddRef( stg ); + *pdb = db; + +end: + if( db ) + msiobj_release( &db->hdr ); + if( stg ) + IStorage_Release( stg ); + + return ret; +} + +UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB) +{ + MSIDATABASE *db; + UINT ret; + + TRACE("%s %s %p\n",debugstr_w(szDBPath),debugstr_w(szPersist), phDB); + + ret = MSI_OpenDatabaseW( szDBPath, szPersist, &db ); + if( ret == ERROR_SUCCESS ) + { + *phDB = alloc_msihandle( &db->hdr ); + msiobj_release( &db->hdr ); + } + + return ret; +} + +UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB) +{ + HRESULT r = ERROR_FUNCTION_FAILED; + LPWSTR szwDBPath = NULL, szwPersist = NULL; + + TRACE("%s %s %p\n", debugstr_a(szDBPath), debugstr_a(szPersist), phDB); + + if( szDBPath ) + { + szwDBPath = strdupAtoW( szDBPath ); + if( !szwDBPath ) + goto end; + } + + if( HIWORD(szPersist) ) + { + szwPersist = strdupAtoW( szPersist ); + if( !szwPersist ) + goto end; + } + else + szwPersist = (LPWSTR) szPersist; + + r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB ); + +end: + HeapFree( GetProcessHeap(), 0, szwPersist ); + HeapFree( GetProcessHeap(), 0, szwDBPath ); + + return r; +} + +UINT MSI_DatabaseImport( MSIDATABASE *db, LPCWSTR folder, LPCWSTR file ) +{ + FIXME("%p %s %s\n", db, debugstr_w(folder), debugstr_w(file) ); + + if( folder == NULL || file == NULL ) + return ERROR_INVALID_PARAMETER; + + return ERROR_CALL_NOT_IMPLEMENTED; +} + +UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolder, LPCWSTR szFilename) +{ + MSIDATABASE *db; + UINT r; + + TRACE("%lx %s %s\n",handle,debugstr_w(szFolder), debugstr_w(szFilename)); + + db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); + if( !db ) + return ERROR_INVALID_HANDLE; + r = MSI_DatabaseImport( db, szFolder, szFilename ); + msiobj_release( &db->hdr ); + return r; +} + +UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle, + LPCSTR szFolder, LPCSTR szFilename ) +{ + LPWSTR path = NULL, file = NULL; + UINT r = ERROR_OUTOFMEMORY; + + TRACE("%lx %s %s\n", handle, debugstr_a(szFolder), debugstr_a(szFilename)); + + if( szFolder ) + { + path = strdupAtoW( szFolder ); + if( !path ) + goto end; + } + + if( szFilename ) + { + file = strdupAtoW( szFilename ); + if( !file ) + goto end; + } + + r = MsiDatabaseImportW( handle, path, file ); + +end: + HeapFree( GetProcessHeap(), 0, path ); + HeapFree( GetProcessHeap(), 0, file ); + + return r; +} + +UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, + LPCWSTR folder, LPCWSTR file ) +{ + FIXME("%p %s %s %s\n", db, debugstr_w(table), + debugstr_w(folder), debugstr_w(file) ); + + if( folder == NULL || file == NULL ) + return ERROR_INVALID_PARAMETER; + + return ERROR_CALL_NOT_IMPLEMENTED; +} + +UINT WINAPI MsiDatabaseExportW( MSIHANDLE handle, LPCWSTR szTable, + LPCWSTR szFolder, LPCWSTR szFilename ) +{ + MSIDATABASE *db; + UINT r; + + TRACE("%lx %s %s %s\n", handle, debugstr_w(szTable), + debugstr_w(szFolder), debugstr_w(szFilename)); + + db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); + if( !db ) + return ERROR_INVALID_HANDLE; + r = MSI_DatabaseExport( db, szTable, szFolder, szFilename ); + msiobj_release( &db->hdr ); + return r; +} + +UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, LPCSTR szTable, + LPCSTR szFolder, LPCSTR szFilename ) +{ + LPWSTR path = NULL, file = NULL, table = NULL; + UINT r = ERROR_OUTOFMEMORY; + + TRACE("%lx %s %s %s\n", handle, debugstr_a(szTable), + debugstr_a(szFolder), debugstr_a(szFilename)); + + if( szTable ) + { + table = strdupAtoW( szTable ); + if( !table ) + goto end; + } + + if( szFolder ) + { + path = strdupAtoW( szFolder ); + if( !path ) + goto end; + } + + if( szFilename ) + { + file = strdupAtoW( szFilename ); + if( !file ) + goto end; + } + + r = MsiDatabaseImportW( handle, path, file ); + +end: + HeapFree( GetProcessHeap(), 0, table ); + HeapFree( GetProcessHeap(), 0, path ); + HeapFree( GetProcessHeap(), 0, file ); + + return r; +} diff --git a/reactos/lib/msi/dialog.c b/reactos/lib/msi/dialog.c index ccd01a43c1c..19ab2d5d402 100644 --- a/reactos/lib/msi/dialog.c +++ b/reactos/lib/msi/dialog.c @@ -18,6 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define COBJMACROS + #include #include "windef.h" @@ -28,6 +30,8 @@ #include "msi.h" #include "msipriv.h" #include "msidefs.h" +#include "ocidl.h" +#include "olectl.h" #include "wine/debug.h" #include "wine/unicode.h" @@ -55,6 +59,7 @@ struct msi_control_tag HWND hwnd; msi_handler handler; LPWSTR property; + IPicture *pic; WCHAR name[1]; }; @@ -131,7 +136,7 @@ static LPWSTR msi_dialog_get_style( LPCWSTR *text ) ret = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); if( !ret ) return ret; - strncpyW( ret, p, len ); + memcpy( ret, p, len*sizeof(WCHAR) ); ret[len-1] = 0; return ret; } @@ -226,17 +231,16 @@ static UINT msi_dialog_build_font_list( msi_dialog *dialog ) return r; } -static msi_control *msi_dialog_add_control( msi_dialog *dialog, - MSIRECORD *rec, LPCWSTR szCls, DWORD style ) +static msi_control *msi_dialog_create_window( msi_dialog *dialog, + MSIRECORD *rec, LPCWSTR szCls, LPCWSTR name, LPCWSTR text, + DWORD style, HWND parent ) { - DWORD x, y, width, height, attributes; - LPCWSTR text, name; + DWORD x, y, width, height; LPWSTR font = NULL, title = NULL; - msi_control *control = NULL; + msi_control *control; style |= WS_CHILD | WS_GROUP; - name = MSI_RecordGetString( rec, 2 ); control = HeapAlloc( GetProcessHeap(), 0, sizeof *control + strlenW(name)*sizeof(WCHAR) ); strcpyW( control->name, name ); @@ -244,39 +248,57 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog, dialog->control_list = control; control->handler = NULL; control->property = NULL; + control->pic = NULL; x = MSI_RecordGetInteger( rec, 4 ); y = MSI_RecordGetInteger( rec, 5 ); width = MSI_RecordGetInteger( rec, 6 ); height = MSI_RecordGetInteger( rec, 7 ); - attributes = MSI_RecordGetInteger( rec, 8 ); - text = MSI_RecordGetString( rec, 10 ); - - TRACE("Dialog %s control %s\n", debugstr_w(dialog->name), debugstr_w(text)); x = msi_dialog_scale_unit( dialog, x ); y = msi_dialog_scale_unit( dialog, y ); width = msi_dialog_scale_unit( dialog, width ); height = msi_dialog_scale_unit( dialog, height ); - if( attributes & 1 ) - style |= WS_VISIBLE; - if( ~attributes & 2 ) - style |= WS_DISABLED; if( text ) { font = msi_dialog_get_style( &text ); deformat_string( dialog->package, text, &title ); } + control->hwnd = CreateWindowW( szCls, title, style, - x, y, width, height, dialog->hwnd, NULL, NULL, NULL ); + x, y, width, height, parent, NULL, NULL, NULL ); + + TRACE("Dialog %s control %s hwnd %p\n", + debugstr_w(dialog->name), debugstr_w(text), control->hwnd ); + msi_dialog_set_font( dialog, control->hwnd, font ? font : dialog->default_font ); + HeapFree( GetProcessHeap(), 0, font ); HeapFree( GetProcessHeap(), 0, title ); + return control; } +/* everything except radio buttons */ +static msi_control *msi_dialog_add_control( msi_dialog *dialog, + MSIRECORD *rec, LPCWSTR szCls, DWORD style ) +{ + DWORD attributes; + LPCWSTR text, name; + + name = MSI_RecordGetString( rec, 2 ); + attributes = MSI_RecordGetInteger( rec, 8 ); + text = MSI_RecordGetString( rec, 10 ); + if( attributes & 1 ) + style |= WS_VISIBLE; + if( ~attributes & 2 ) + style |= WS_DISABLED; + return msi_dialog_create_window( dialog, rec, szCls, name, text, + style, dialog->hwnd ); +} + static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) { TRACE("%p %p\n", dialog, rec); @@ -309,7 +331,7 @@ static UINT msi_dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec ) control->handler = msi_dialog_checkbox_handler; prop = MSI_RecordGetString( rec, 9 ); if( prop ) - control->property = dupstrW( prop ); + control->property = strdupW( prop ); msi_dialog_checkbox_sync_state( dialog, control ); return ERROR_SUCCESS; @@ -327,7 +349,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) { const static WCHAR szEdit[] = { 'E','D','I','T',0 }; - TRACE("%p %p\n", dialog, rec); + FIXME("%p %p\n", dialog, rec); msi_dialog_add_control( dialog, rec, szEdit, WS_BORDER | ES_MULTILINE | WS_VSCROLL | ES_READONLY | ES_AUTOVSCROLL ); @@ -335,12 +357,64 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) return ERROR_SUCCESS; } +static UINT msi_load_bitmap( MSIDATABASE *db, LPCWSTR name, IPicture **pic ) +{ + const static WCHAR query[] = { + 's','e','l','e','c','t',' ','*',' ', + 'f','r','o','m',' ','B','i','n','a','r','y',' ', + 'w','h','e','r','e',' ', + '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0 + }; + MSIQUERY *view = NULL; + MSIRECORD *rec = NULL; + IStream *stm = NULL; + UINT r; + + r = MSI_OpenQuery( db, &view, query, name ); + if( r != ERROR_SUCCESS ) + return r; + + MSI_ViewExecute( view, NULL ); + MSI_ViewFetch( view, &rec ); + MSI_ViewClose( view ); + msiobj_release( &view->hdr ); + + if( !rec ) + return ERROR_FUNCTION_FAILED; + + r = MSI_RecordGetIStream( rec, 2, &stm ); + msiobj_release( &rec->hdr ); + if( r != ERROR_SUCCESS ) + return r; + + r = OleLoadPicture( stm, 0, TRUE, &IID_IPicture, (LPVOID*) pic ); + IStream_Release( stm ); + if( FAILED( r ) ) + return ERROR_FUNCTION_FAILED; + + return ERROR_SUCCESS; +} + static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) { - TRACE("%p %p\n", dialog, rec); + IPicture *pic = NULL; + msi_control *control; + OLE_HANDLE hBitmap = 0; + LPCWSTR text; + UINT r; - msi_dialog_add_control( dialog, rec, szStatic, + control = msi_dialog_add_control( dialog, rec, szStatic, SS_BITMAP | SS_LEFT | SS_CENTERIMAGE ); + text = MSI_RecordGetString( rec, 10 ); + r = msi_load_bitmap( dialog->package->db, text, &pic ); + if( r == ERROR_SUCCESS ) + { + r = IPicture_get_Handle( pic, &hBitmap ); + if( SUCCEEDED( r ) ) + SendMessageW( control->hwnd, STM_SETIMAGE, IMAGE_BITMAP, hBitmap ); + control->pic = pic; + } + return ERROR_SUCCESS; } @@ -364,7 +438,7 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) control->handler = msi_dialog_edit_handler; prop = MSI_RecordGetString( rec, 9 ); if( prop ) - control->property = dupstrW( prop ); + control->property = strdupW( prop ); val = load_dynamic_property( dialog->package, control->property, NULL ); SetWindowTextW( control->hwnd, val ); HeapFree( GetProcessHeap(), 0, val ); @@ -377,63 +451,31 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) return msi_dialog_edit_control( dialog, rec ); } +/* radio buttons are a bit different from normal controls */ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) { radio_button_group_descr *group = (radio_button_group_descr *)param; msi_dialog *dialog = group->dialog; msi_control *control; - LPCWSTR prop; - DWORD x, y, width, height, style; + LPCWSTR prop, text, name; + DWORD style; DWORD attributes = group->attributes; - LPCWSTR text, name; - LPWSTR font = NULL, title = NULL; style = WS_CHILD | BS_AUTORADIOBUTTON | BS_MULTILINE; name = MSI_RecordGetString( rec, 3 ); - control = HeapAlloc( GetProcessHeap(), 0, - sizeof *control + strlenW(name)*sizeof(WCHAR) ); - strcpyW( control->name, name ); - control->next = dialog->control_list; - dialog->control_list = control; - - x = MSI_RecordGetInteger( rec, 4 ); - y = MSI_RecordGetInteger( rec, 5 ); - width = MSI_RecordGetInteger( rec, 6 ); - height = MSI_RecordGetInteger( rec, 7 ); text = MSI_RecordGetString( rec, 8 ); - - x = msi_dialog_scale_unit( dialog, x ); - y = msi_dialog_scale_unit( dialog, y ); - width = msi_dialog_scale_unit( dialog, width ); - height = msi_dialog_scale_unit( dialog, height ); - if( attributes & 1 ) style |= WS_VISIBLE; if( ~attributes & 2 ) style |= WS_DISABLED; - if( text ) - { - font = msi_dialog_get_style( &text ); - deformat_string( dialog->package, text, &title ); - } - - control->hwnd = CreateWindowW( szButton, title, style, x, y, width, height, - group->parent->hwnd, NULL, NULL, NULL ); - - TRACE("Dialog %s control %s hwnd %p\n", debugstr_w(dialog->name), debugstr_w(text), control->hwnd); - - msi_dialog_set_font( dialog, control->hwnd, - font ? font : dialog->default_font ); - - HeapFree( GetProcessHeap(), 0, font ); - HeapFree( GetProcessHeap(), 0, title ); - + control = msi_dialog_create_window( dialog, rec, szButton, name, text, + style, group->parent->hwnd ); control->handler = msi_dialog_radiogroup_handler; prop = MSI_RecordGetString( rec, 1 ); if( prop ) - control->property = dupstrW( prop ); + control->property = strdupW( prop ); return ERROR_SUCCESS; } @@ -467,7 +509,7 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) } if( prop ) - control->property = dupstrW( prop ); + control->property = strdupW( prop ); /* query the Radio Button table for all control in this group */ r = MSI_OpenQuery( package->db, &view, query, prop ); @@ -1078,6 +1120,8 @@ void msi_dialog_destroy( msi_dialog *dialog ) dialog->control_list = t->next; /* leave dialog->hwnd - destroying parent destroys child windows */ HeapFree( GetProcessHeap(), 0, t->property ); + if( t->pic ) + IPicture_Release( t->pic ); HeapFree( GetProcessHeap(), 0, t ); } diff --git a/reactos/lib/msi/format.c b/reactos/lib/msi/format.c index 7e5b6dc2574..d85fd27c58b 100644 --- a/reactos/lib/msi/format.c +++ b/reactos/lib/msi/format.c @@ -114,7 +114,7 @@ static LPWSTR deformat_file(MSIPACKAGE* package, LPCWSTR key, DWORD* sz) index = get_loaded_file(package,key); if (index >=0) { - value = dupstrW(package->files[index].TargetPath); + value = strdupW(package->files[index].TargetPath); *sz = (strlenW(value)) * sizeof(WCHAR); } @@ -137,7 +137,7 @@ static LPWSTR deformat_environment(MSIPACKAGE* package, LPCWSTR key, } else { - ERR("Unknown environment variable\n"); + ERR("Unknown environment variable %s\n", debugstr_w(key)); *chunk = 0; value = NULL; } @@ -252,7 +252,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining, *key = HeapAlloc(GetProcessHeap(),0,i*sizeof(WCHAR)); /* do not have the [] in the key */ i -= 1; - strncpyW(*key,&(*mark)[1],i); + memcpy(*key,&(*mark)[1],i*sizeof(WCHAR)); (*key)[i] = 0; TRACE("Found Key %s\n",debugstr_w(*key)); @@ -358,11 +358,12 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, value = deformat_index(record,key,&chunk); else { - chunk = (strlenW(key) + 2)*sizeof(WCHAR); + DWORD keylen = strlenW(key); + chunk = (keylen + 2)*sizeof(WCHAR); value = HeapAlloc(GetProcessHeap(),0,chunk); value[0] = '['; - memcpy(&value[1],key,strlenW(key)*sizeof(WCHAR)); - value[strlenW(key)+1] = ']'; + memcpy(&value[1],key,keylen*sizeof(WCHAR)); + value[1+keylen] = ']'; } } else diff --git a/reactos/lib/msi/msi.c b/reactos/lib/msi/msi.c index 7534f04f6d2..aabcd522e77 100644 --- a/reactos/lib/msi/msi.c +++ b/reactos/lib/msi/msi.c @@ -32,15 +32,10 @@ #include "msi.h" #include "msiquery.h" #include "msipriv.h" -#include "objidl.h" #include "wincrypt.h" -#include "wine/unicode.h" -#include "objbase.h" #include "winver.h" #include "winuser.h" -#include "initguid.h" - UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, DWORD* pcchVersionBuf, LPWSTR lpLangBuf, DWORD* pcchLangBuf); @@ -54,9 +49,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); */ #define LPCTSTR LPCWSTR -DEFINE_GUID( CLSID_MsiDatabase, 0x000c1084, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); - /* the UI level */ INSTALLUILEVEL gUILevel = INSTALLUILEVEL_BASIC; HWND gUIhwnd = 0; @@ -67,198 +59,25 @@ LPVOID gUIContext = NULL; WCHAR gszLogFile[MAX_PATH]; HINSTANCE msi_hInstance; -/* - * .MSI file format - * - * A .msi file is a structured storage file. - * It should contain a number of streams. - */ - -VOID MSI_CloseDatabase( MSIOBJECTHDR *arg ) -{ - MSIDATABASE *db = (MSIDATABASE *) arg; - DWORD r; - - free_cached_tables( db ); - r = IStorage_Release( db->storage ); - if( r ) - ERR("database reference count was not zero (%ld)\n", r); -} - -UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) -{ - IStorage *stg = NULL; - HRESULT r; - MSIDATABASE *db = NULL; - UINT ret = ERROR_FUNCTION_FAILED; - LPWSTR szMode; - STATSTG stat; - - TRACE("%s %s\n",debugstr_w(szDBPath),debugstr_w(szPersist) ); - - if( !pdb ) - return ERROR_INVALID_PARAMETER; - - szMode = (LPWSTR) szPersist; - if( HIWORD( szPersist ) ) - { - /* UINT len = lstrlenW( szPerist ) + 1; */ - FIXME("don't support persist files yet\b"); - return ERROR_INVALID_PARAMETER; - /* szMode = HeapAlloc( GetProcessHeap(), 0, len * sizeof (DWORD) ); */ - } - else if( szPersist == MSIDBOPEN_READONLY ) - { - r = StgOpenStorage( szDBPath, NULL, - STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg); - } - else if( szPersist == MSIDBOPEN_CREATE ) - { - r = StgCreateDocfile( szDBPath, - STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg); - if( r == ERROR_SUCCESS ) - { - IStorage_SetClass( stg, &CLSID_MsiDatabase ); - r = init_string_table( stg ); - } - } - else if( szPersist == MSIDBOPEN_TRANSACT ) - { - r = StgOpenStorage( szDBPath, NULL, - STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg); - } - else - { - ERR("unknown flag %p\n",szPersist); - return ERROR_INVALID_PARAMETER; - } - - if( FAILED( r ) ) - { - FIXME("open failed r = %08lx!\n",r); - return ERROR_FUNCTION_FAILED; - } - - r = IStorage_Stat( stg, &stat, STATFLAG_NONAME ); - if( FAILED( r ) ) - { - FIXME("Failed to stat storage\n"); - goto end; - } - - if( memcmp( &stat.clsid, &CLSID_MsiDatabase, sizeof (GUID) ) ) - { - ERR("storage GUID is not a MSI database GUID %s\n", - debugstr_guid(&stat.clsid) ); - goto end; - } - - - db = alloc_msiobject( MSIHANDLETYPE_DATABASE, sizeof (MSIDATABASE), - MSI_CloseDatabase ); - if( !db ) - { - FIXME("Failed to allocate a handle\n"); - goto end; - } - - if( TRACE_ON( msi ) ) - enum_stream_names( stg ); - - db->storage = stg; - db->mode = szMode; - - ret = load_string_table( db ); - if( ret != ERROR_SUCCESS ) - goto end; - - msiobj_addref( &db->hdr ); - IStorage_AddRef( stg ); - *pdb = db; - -end: - if( db ) - msiobj_release( &db->hdr ); - if( stg ) - IStorage_Release( stg ); - - return ret; -} - -UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB) -{ - MSIDATABASE *db; - UINT ret; - - TRACE("%s %s %p\n",debugstr_w(szDBPath),debugstr_w(szPersist), phDB); - - ret = MSI_OpenDatabaseW( szDBPath, szPersist, &db ); - if( ret == ERROR_SUCCESS ) - { - *phDB = alloc_msihandle( &db->hdr ); - msiobj_release( &db->hdr ); - } - - return ret; -} - -UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB) -{ - HRESULT r = ERROR_FUNCTION_FAILED; - LPWSTR szwDBPath = NULL, szwPersist = NULL; - UINT len; - - TRACE("%s %s %p\n", debugstr_a(szDBPath), debugstr_a(szPersist), phDB); - - if( szDBPath ) - { - len = MultiByteToWideChar( CP_ACP, 0, szDBPath, -1, NULL, 0 ); - szwDBPath = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - if( !szwDBPath ) - goto end; - MultiByteToWideChar( CP_ACP, 0, szDBPath, -1, szwDBPath, len ); - } - - if( HIWORD(szPersist) ) - { - len = MultiByteToWideChar( CP_ACP, 0, szPersist, -1, NULL, 0 ); - szwPersist = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - if( !szwPersist ) - goto end; - MultiByteToWideChar( CP_ACP, 0, szPersist, -1, szwPersist, len ); - } - else - szwPersist = (LPWSTR) szPersist; - - r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB ); - -end: - HeapFree( GetProcessHeap(), 0, szwPersist ); - HeapFree( GetProcessHeap(), 0, szwDBPath ); - - return r; -} - UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct) { - UINT len, ret; + UINT r; LPWSTR szwProd = NULL; TRACE("%s %p\n",debugstr_a(szProduct), phProduct); if( szProduct ) { - len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProd = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); - if( szwProd ) - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProd, len ); + szwProd = strdupAtoW( szProduct ); + if( !szwProd ) + return ERROR_OUTOFMEMORY; } - ret = MsiOpenProductW( szwProd, phProduct ); + r = MsiOpenProductW( szwProd, phProduct ); HeapFree( GetProcessHeap(), 0, szwProd ); - return ret; + return r; } UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct) @@ -350,28 +169,24 @@ UINT WINAPI MsiAdvertiseProductExW( LPCWSTR szPackagePath, LPCWSTR szScriptfileP UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine) { LPWSTR szwPath = NULL, szwCommand = NULL; - UINT r = ERROR_FUNCTION_FAILED; /* FIXME: check return code */ + UINT r = ERROR_OUTOFMEMORY; TRACE("%s %s\n",debugstr_a(szPackagePath), debugstr_a(szCommandLine)); if( szPackagePath ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szPackagePath, -1, NULL, 0 ); - szwPath = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwPath = strdupAtoW( szPackagePath ); if( !szwPath ) goto end; - MultiByteToWideChar( CP_ACP, 0, szPackagePath, -1, szwPath, len ); } if( szCommandLine ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, NULL, 0 ); - szwCommand = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwCommand = strdupAtoW( szCommandLine ); if( !szwCommand ) goto end; - MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, szwCommand, len ); } - + r = MsiInstallProductW( szwPath, szwCommand ); end: @@ -384,26 +199,26 @@ end: UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine) { MSIPACKAGE *package = NULL; - UINT rc = ERROR_SUCCESS; + UINT r; MSIHANDLE handle; FIXME("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine)); - rc = MsiVerifyPackageW(szPackagePath); - if (rc != ERROR_SUCCESS) - return rc; + r = MsiVerifyPackageW(szPackagePath); + if (r != ERROR_SUCCESS) + return r; - rc = MSI_OpenPackageW(szPackagePath,&package); - if (rc != ERROR_SUCCESS) - return rc; + r = MSI_OpenPackageW(szPackagePath,&package); + if (r != ERROR_SUCCESS) + return r; handle = alloc_msihandle( &package->hdr ); - rc = ACTION_DoTopLevelINSTALL(package, szPackagePath, szCommandLine); + r = ACTION_DoTopLevelINSTALL(package, szPackagePath, szCommandLine); MsiCloseHandle(handle); msiobj_release( &package->hdr ); - return rc; + return r; } UINT WINAPI MsiReinstallProductA(LPCSTR szProduct, DWORD dwReinstallMode) @@ -437,7 +252,7 @@ UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage, UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState, LPCWSTR szCommandLine) { - MSIHANDLE handle; + MSIHANDLE handle; MSIPACKAGE* package; UINT rc; HKEY hkey=0,hkey1=0; @@ -454,7 +269,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, FIXME("%s %d %d %s\n",debugstr_w(szProduct), iInstallLevel, eInstallState, debugstr_w(szCommandLine)); - if (eInstallState != INSTALLSTATE_LOCAL && + if (eInstallState != INSTALLSTATE_LOCAL && eInstallState != INSTALLSTATE_DEFAULT) { FIXME("Not implemented for anything other than local installs\n"); @@ -479,7 +294,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, * ok 1, we need to find the msi file for this product. * 2, find the source dir for the files * 3, do the configure/install. - * 4, cleanupany runonce entry. + * 4, cleanupany runonce entry. */ rc = MsiOpenProductW(szProduct,&handle); @@ -492,21 +307,21 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, rc = ERROR_INVALID_HANDLE; goto end; } - - sz = strlenW(szInstalled); + + sz = lstrlenW(szInstalled); if (szCommandLine) - sz += strlenW(szCommandLine); + sz += lstrlenW(szCommandLine); commandline = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR)); - if (szCommandLine) - strcpyW(commandline,szCommandLine); + if (szCommandLine) + lstrcpyW(commandline,szCommandLine); else commandline[0] = 0; if (MsiQueryProductStateW(szProduct) != INSTALLSTATE_UNKNOWN) - strcatW(commandline,szInstalled); + lstrcatW(commandline,szInstalled); rc = ACTION_DoTopLevelINSTALL(package, sourcepath, commandline); @@ -524,102 +339,89 @@ UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel, { LPWSTR szwProduct = NULL; LPWSTR szwCommandLine = NULL; - UINT hr = ERROR_FUNCTION_FAILED; + UINT r = ERROR_OUTOFMEMORY; if( szProduct ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwProduct = strdupAtoW( szProduct ); if( !szwProduct ) goto end; - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); } if( szCommandLine) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, NULL, 0 ); - szwCommandLine= HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwCommandLine = strdupAtoW( szCommandLine ); if( !szwCommandLine) goto end; - MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, szwCommandLine, len ); } - hr = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState, + r = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState, szwCommandLine ); end: HeapFree( GetProcessHeap(), 0, szwProduct ); HeapFree( GetProcessHeap(), 0, szwCommandLine); - return hr; + return r; } -UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel, +UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState) { LPWSTR szwProduct = NULL; - UINT hr = ERROR_SUCCESS; + UINT r; - FIXME("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState); + TRACE("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState); if( szProduct ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwProduct = strdupAtoW( szProduct ); if( !szwProduct ) - goto end; - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); + return ERROR_OUTOFMEMORY; } - hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState ); - -end: + r = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState ); HeapFree( GetProcessHeap(), 0, szwProduct ); - return hr; + return r; } -UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel, +UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState) { FIXME("%s %d %d\n", debugstr_w(szProduct), iInstallLevel, eInstallState); - return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState, - NULL); + return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState, NULL); } UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer) { LPWSTR szwComponent = NULL; - UINT hr = ERROR_INSTALL_FAILURE; + UINT r; WCHAR szwBuffer[GUID_SIZE]; - FIXME("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer)); + TRACE("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer)); if( szComponent ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); - szwComponent = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwComponent = strdupAtoW( szComponent ); if( !szwComponent ) - goto end; - MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len ); + return ERROR_OUTOFMEMORY; } - else - return ERROR_INVALID_PARAMETER; - hr = MsiGetProductCodeW( szwComponent, szwBuffer ); + r = MsiGetProductCodeW( szwComponent, szwBuffer ); - if( ERROR_SUCCESS == hr ) + if( ERROR_SUCCESS == r ) WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL); -end: HeapFree( GetProcessHeap(), 0, szwComponent ); - return hr; + return r; } UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer) { - FIXME("%s %s\n",debugstr_w(szComponent), debugstr_w(szBuffer)); + FIXME("%s %p\n",debugstr_w(szComponent), szBuffer); + if (NULL == szComponent) return ERROR_INVALID_PARAMETER; return ERROR_CALL_NOT_IMPLEMENTED; @@ -629,36 +431,23 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute, LPSTR szBuffer, DWORD *pcchValueBuf) { LPWSTR szwProduct = NULL, szwAttribute = NULL, szwBuffer = NULL; - UINT hr = ERROR_INSTALL_FAILURE; + UINT r = ERROR_OUTOFMEMORY; - FIXME("%s %s %p %p\n",debugstr_a(szProduct), debugstr_a(szAttribute), + TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szAttribute), szBuffer, pcchValueBuf); - if( NULL != szBuffer && NULL == pcchValueBuf ) - return ERROR_INVALID_PARAMETER; if( szProduct ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwProduct = strdupAtoW( szProduct ); if( !szwProduct ) goto end; - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); } - else - return ERROR_INVALID_PARAMETER; if( szAttribute ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, NULL, 0 ); - szwAttribute = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwAttribute = strdupAtoW( szAttribute ); if( !szwAttribute ) goto end; - MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, szwAttribute, len ); - } - else - { - hr = ERROR_INVALID_PARAMETER; - goto end; } if( szBuffer ) @@ -668,9 +457,9 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute, goto end; } - hr = MsiGetProductInfoW( szwProduct, szwAttribute, szwBuffer, pcchValueBuf ); + r = MsiGetProductInfoW( szwProduct, szwAttribute, szwBuffer, pcchValueBuf ); - if( ERROR_SUCCESS == hr ) + if( ERROR_SUCCESS == r ) WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, *pcchValueBuf, NULL, NULL); end: @@ -678,15 +467,15 @@ end: HeapFree( GetProcessHeap(), 0, szwAttribute ); HeapFree( GetProcessHeap(), 0, szwBuffer ); - return hr; + return r; } UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute, LPWSTR szBuffer, DWORD *pcchValueBuf) { MSIHANDLE hProduct; - UINT hr; - + UINT r; + FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szAttribute), szBuffer, pcchValueBuf); @@ -695,51 +484,31 @@ UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute, if (NULL == szProduct || NULL == szAttribute) return ERROR_INVALID_PARAMETER; - hr = MsiOpenProductW(szProduct, &hProduct); - if (ERROR_SUCCESS != hr) - return hr; + r = MsiOpenProductW(szProduct, &hProduct); + if (ERROR_SUCCESS != r) + return r; - hr = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf); + r = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf); MsiCloseHandle(hProduct); - return hr; -} - -UINT WINAPI MsiDatabaseImportA(LPCSTR szFolderPath, LPCSTR szFilename) -{ - FIXME("%s %s\n",debugstr_a(szFolderPath), debugstr_a(szFilename)); - return ERROR_CALL_NOT_IMPLEMENTED; -} - -UINT WINAPI MsiDatabaseImportW(LPCWSTR szFolderPath, LPCWSTR szFilename) -{ - FIXME("%s %s\n",debugstr_w(szFolderPath), debugstr_w(szFilename)); - return ERROR_CALL_NOT_IMPLEMENTED; + return r; } UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes) { LPWSTR szwLogFile = NULL; - UINT hr = ERROR_INSTALL_FAILURE; + UINT r; - FIXME("%08lx %s %08lx\n", dwLogMode, debugstr_a(szLogFile), attributes); + TRACE("%08lx %s %08lx\n", dwLogMode, debugstr_a(szLogFile), attributes); if( szLogFile ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, NULL, 0 ); - szwLogFile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szwLogFile = strdupAtoW( szLogFile ); if( !szwLogFile ) - goto end; - MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, szwLogFile, len ); + return ERROR_OUTOFMEMORY; } - else - return ERROR_INVALID_PARAMETER; - - hr = MsiEnableLogW( dwLogMode, szwLogFile, attributes ); - -end: + r = MsiEnableLogW( dwLogMode, szwLogFile, attributes ); HeapFree( GetProcessHeap(), 0, szwLogFile ); - - return hr; + return r; } UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes) @@ -748,7 +517,7 @@ UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes) TRACE("%08lx %s %08lx\n", dwLogMode, debugstr_w(szLogFile), attributes); - strcpyW(gszLogFile,szLogFile); + lstrcpyW(gszLogFile,szLogFile); if (!(attributes & INSTALLLOGATTRIBUTES_APPEND)) DeleteFileW(szLogFile); file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, @@ -763,23 +532,25 @@ UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes) INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct) { - LPWSTR szwProduct; - UINT len; - INSTALLSTATE rc; + LPWSTR szwProduct = NULL; + INSTALLSTATE r; - len = MultiByteToWideChar(CP_ACP,0,szProduct,-1,NULL,0); - szwProduct = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP,0,szProduct,-1,szwProduct,len); - rc = MsiQueryProductStateW(szwProduct); - HeapFree(GetProcessHeap(),0,szwProduct); - return rc; + if( szProduct ) + { + szwProduct = strdupAtoW( szProduct ); + if( !szwProduct ) + return ERROR_OUTOFMEMORY; + } + r = MsiQueryProductStateW( szwProduct ); + HeapFree( GetProcessHeap(), 0, szwProduct ); + return r; } INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct) { UINT rc; INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN; - HKEY hkey=0; + HKEY hkey = 0; static const WCHAR szWindowsInstaller[] = { 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 }; DWORD sz; @@ -833,7 +604,7 @@ INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd) return old; } -INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler, +INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler, DWORD dwMessageFilter, LPVOID pvContext) { INSTALLUI_HANDLERA prev = gUIHandlerA; @@ -980,7 +751,7 @@ UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uT UINT WINAPI MsiProvideAssemblyA( LPCSTR szAssemblyName, LPCSTR szAppContext, DWORD dwInstallMode, DWORD dwAssemblyInfo, LPSTR lpPathBuf, - DWORD* pcchPathBuf ) + DWORD* pcchPathBuf ) { FIXME("%s %s %08lx %08lx %p %p\n", debugstr_a(szAssemblyName), debugstr_a(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf, @@ -992,7 +763,7 @@ UINT WINAPI MsiProvideAssemblyW( LPCWSTR szAssemblyName, LPCWSTR szAppContext, DWORD dwInstallMode, DWORD dwAssemblyInfo, LPWSTR lpPathBuf, DWORD* pcchPathBuf ) { - FIXME("%s %s %08lx %08lx %p %p\n", debugstr_w(szAssemblyName), + FIXME("%s %s %08lx %08lx %p %p\n", debugstr_w(szAssemblyName), debugstr_w(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf, pcchPathBuf); return ERROR_CALL_NOT_IMPLEMENTED; @@ -1046,18 +817,16 @@ UINT WINAPI MsiGetProductPropertyW( MSIHANDLE hProduct, LPCWSTR szProperty, UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage ) { - UINT r, len; + UINT r; LPWSTR szPack = NULL; TRACE("%s\n", debugstr_a(szPackage) ); if( szPackage ) { - len = MultiByteToWideChar( CP_ACP, 0, szPackage, -1, NULL, 0 ); - szPack = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + szPack = strdupAtoW( szPackage ); if( !szPack ) return ERROR_OUTOFMEMORY; - MultiByteToWideChar( CP_ACP, 0, szPackage, -1, szPack, len ); } r = MsiVerifyPackageW( szPack ); @@ -1085,27 +854,23 @@ INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent, { LPWSTR szwProduct = NULL, szwComponent = NULL, lpwPathBuf= NULL; INSTALLSTATE rc; - UINT len, incoming_len; + UINT incoming_len; if( szProduct ) { - len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + szwProduct = strdupAtoW( szProduct ); if( !szwProduct) return ERROR_OUTOFMEMORY; - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); } if( szComponent ) { - len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); - szwComponent= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + szwComponent = strdupAtoW( szComponent ); if( !szwComponent ) { HeapFree( GetProcessHeap(), 0, szwProduct); return ERROR_OUTOFMEMORY; } - MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len ); } if( pcchBuf && *pcchBuf > 0 ) @@ -1180,7 +945,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent, if (path[0]=='0') { FIXME("Registry entry.. check entry\n"); - rrc = INSTALLSTATE_LOCAL; + rrc = INSTALLSTATE_LOCAL; } else { @@ -1195,7 +960,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent, { sz = sz / sizeof(WCHAR); if( *pcchBuf >= sz ) - strcpyW( lpPathBuf, path ); + lstrcpyW( lpPathBuf, path ); *pcchBuf = sz; } @@ -1208,29 +973,24 @@ end: INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature) { INSTALLSTATE rc; - UINT len; LPWSTR szwProduct= NULL; LPWSTR szwFeature= NULL; if( szProduct ) { - len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + szwProduct = strdupAtoW( szProduct ); if( !szwProduct) return ERROR_OUTOFMEMORY; - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); } if( szFeature ) { - len = MultiByteToWideChar( CP_ACP, 0, szFeature, -1, NULL, 0 ); - szwFeature= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + szwFeature = strdupAtoW( szFeature ); if( !szwFeature) { HeapFree( GetProcessHeap(), 0, szwProduct); return ERROR_OUTOFMEMORY; } - MultiByteToWideChar( CP_ACP, 0, szFeature, -1, szwFeature, len ); } rc = MsiQueryFeatureStateW(szwProduct, szwFeature); @@ -1254,17 +1014,15 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf, DWORD* pcchVersionBuf, LPSTR lpLangBuf, DWORD* pcchLangBuf) { LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL; - UINT len, ret = ERROR_OUTOFMEMORY; - + UINT ret = ERROR_OUTOFMEMORY; + if( szFilePath ) { - len = MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, NULL, 0 ); - szwFilePath = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + szwFilePath = strdupAtoW( szFilePath ); if( !szwFilePath ) goto end; - MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, szwFilePath, len ); } - + if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf ) { lpwVersionBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf*sizeof(WCHAR)); @@ -1278,22 +1036,22 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf, if( !lpwLangBuff ) goto end; } - + ret = MsiGetFileVersionW(szwFilePath, lpwVersionBuff, pcchVersionBuf, lpwLangBuff, pcchLangBuf); - + if( lpwVersionBuff ) WideCharToMultiByte(CP_ACP, 0, lpwVersionBuff, -1, lpVersionBuf, *pcchVersionBuf, NULL, NULL); if( lpwLangBuff ) WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1, lpLangBuf, *pcchLangBuf, NULL, NULL); - + end: HeapFree(GetProcessHeap(), 0, szwFilePath); HeapFree(GetProcessHeap(), 0, lpwVersionBuff); HeapFree(GetProcessHeap(), 0, lpwLangBuff); - + return ret; } @@ -1340,7 +1098,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS)); lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf); - *pcchVersionBuf = strlenW(lpVersionBuf); + *pcchVersionBuf = lstrlenW(lpVersionBuf); } else { @@ -1356,7 +1114,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, FIXME("Retrieve language from file\n"); wsprintfW(tmp, szLangFormat, lang); lstrcpynW(lpLangBuf, tmp, *pcchLangBuf); - *pcchLangBuf = strlenW(lpLangBuf); + *pcchLangBuf = lstrlenW(lpLangBuf); } end: @@ -1461,15 +1219,15 @@ HRESULT WINAPI MSI_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) HRESULT WINAPI MSI_DllGetVersion(DLLVERSIONINFO *pdvi) { TRACE("%p\n",pdvi); - + if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) return E_INVALIDARG; - + pdvi->dwMajorVersion = MSI_MAJORVERSION; pdvi->dwMinorVersion = MSI_MINORVERSION; pdvi->dwBuildNumber = MSI_BUILDNUMBER; pdvi->dwPlatformID = 1; - + return S_OK; } @@ -1497,7 +1255,7 @@ UINT WINAPI MsiGetFeatureUsageA(LPCSTR szProduct, LPCSTR szFeature, return ERROR_CALL_NOT_IMPLEMENTED; } -INSTALLSTATE WINAPI MsiUseFeatureExW(LPCWSTR szProduct, LPCWSTR szFeature, +INSTALLSTATE WINAPI MsiUseFeatureExW(LPCWSTR szProduct, LPCWSTR szFeature, DWORD dwInstallMode, DWORD dwReserved) { FIXME("%s %s %li %li\n", debugstr_w(szProduct), debugstr_w(szFeature), @@ -1509,37 +1267,37 @@ INSTALLSTATE WINAPI MsiUseFeatureExW(LPCWSTR szProduct, LPCWSTR szFeature, * Software\\Microsoft\\Windows\\CurrentVersion\\ * Installer\\Products\\\\ * "Usage"=dword:........ - */ - - return INSTALLSTATE_LOCAL; + */ + + return INSTALLSTATE_LOCAL; } -INSTALLSTATE WINAPI MsiUseFeatureExA(LPCSTR szProduct, LPCSTR szFeature, +INSTALLSTATE WINAPI MsiUseFeatureExA(LPCSTR szProduct, LPCSTR szFeature, DWORD dwInstallMode, DWORD dwReserved) { FIXME("%s %s %li %li\n", debugstr_a(szProduct), debugstr_a(szFeature), dwInstallMode, dwReserved); - - return INSTALLSTATE_LOCAL; + + return INSTALLSTATE_LOCAL; } INSTALLSTATE WINAPI MsiUseFeatureW(LPCWSTR szProduct, LPCWSTR szFeature) { FIXME("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature)); - - return INSTALLSTATE_LOCAL; + + return INSTALLSTATE_LOCAL; } INSTALLSTATE WINAPI MsiUseFeatureA(LPCSTR szProduct, LPCSTR szFeature) { FIXME("%s %s\n", debugstr_a(szProduct), debugstr_a(szFeature)); - - return INSTALLSTATE_LOCAL; + + return INSTALLSTATE_LOCAL; } -UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent, +UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent, LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR szProduct, - DWORD Unused1, DWORD Unused2, LPWSTR lpPathBuf, + DWORD Unused1, DWORD Unused2, LPWSTR lpPathBuf, DWORD* pcchPathBuf) { FIXME("%s %s %li %s %li %li %p %p\n", debugstr_w(szComponent), @@ -1549,26 +1307,26 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent, return ERROR_INDEX_ABSENT; } -USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct, LPWSTR lpUserNameBuf, - DWORD* pcchUserNameBuf, LPWSTR lpOrgNameBuf, +USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct, LPWSTR lpUserNameBuf, + DWORD* pcchUserNameBuf, LPWSTR lpOrgNameBuf, DWORD* pcchOrgNameBuf, LPWSTR lpSerialBuf, DWORD* pcchSerialBuf) { FIXME("%s %p %p %p %p %p %p\n",debugstr_w(szProduct), lpUserNameBuf, pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf, pcchSerialBuf); - - return USERINFOSTATE_UNKNOWN; + + return USERINFOSTATE_UNKNOWN; } -USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct, LPSTR lpUserNameBuf, - DWORD* pcchUserNameBuf, LPSTR lpOrgNameBuf, +USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct, LPSTR lpUserNameBuf, + DWORD* pcchUserNameBuf, LPSTR lpOrgNameBuf, DWORD* pcchOrgNameBuf, LPSTR lpSerialBuf, DWORD* pcchSerialBuf) { FIXME("%s %p %p %p %p %p %p\n",debugstr_a(szProduct), lpUserNameBuf, pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf, pcchSerialBuf); - - return USERINFOSTATE_UNKNOWN; + + return USERINFOSTATE_UNKNOWN; } UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct) @@ -1583,9 +1341,9 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct) return ERROR_CALL_NOT_IMPLEMENTED; } -UINT WINAPI MsiCreateAndVerifyInstallerDirectory(void) +UINT WINAPI MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved) { - FIXME("\n"); + FIXME("%ld\n", dwReserved); return ERROR_CALL_NOT_IMPLEMENTED; } @@ -1605,7 +1363,7 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget, return ERROR_CALL_NOT_IMPLEMENTED; } -UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, +UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dwReinstallMode ) { FIXME("%s %s %li\n", debugstr_w(szProduct), debugstr_w(szFeature), @@ -1613,7 +1371,7 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, return ERROR_SUCCESS; } -UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature, +UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature, DWORD dwReinstallMode ) { FIXME("%s %s %li\n", debugstr_a(szProduct), debugstr_a(szFeature), diff --git a/reactos/lib/msi/msi.rc b/reactos/lib/msi/msi.rc index af6906c8883..ce777aa13ef 100644 --- a/reactos/lib/msi/msi.rc +++ b/reactos/lib/msi/msi.rc @@ -31,4 +31,5 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "msi_En.rc" #include "msi_Es.rc" #include "msi_Fr.rc" +#include "msi_Nl.rc" #include "msi_Pt.rc" diff --git a/reactos/lib/msi/msi.spec b/reactos/lib/msi/msi.spec index a5a7d44068b..4bf2712ecb1 100644 --- a/reactos/lib/msi/msi.spec +++ b/reactos/lib/msi/msi.spec @@ -24,8 +24,8 @@ 24 stdcall MsiDatabaseGenerateTransformW(long long wstr long long) 25 stdcall MsiDatabaseGetPrimaryKeysA(long str ptr) 26 stdcall MsiDatabaseGetPrimaryKeysW(long wstr ptr) -27 stdcall MsiDatabaseImportA(str str) -28 stdcall MsiDatabaseImportW(wstr wstr) +27 stdcall MsiDatabaseImportA(str str long) +28 stdcall MsiDatabaseImportW(wstr wstr long) 29 stub MsiDatabaseMergeA 30 stub MsiDatabaseMergeW 31 stdcall MsiDatabaseOpenViewA(long str ptr) @@ -219,7 +219,7 @@ 219 stub MsiGetFileHashW 220 stub MsiEnumComponentCostsA 221 stub MsiEnumComponentCostsW -222 stdcall MsiCreateAndVerifyInstallerDirectory() +222 stdcall MsiCreateAndVerifyInstallerDirectory(long) 223 stdcall MsiGetFileSignatureInformationA(str long ptr ptr ptr) 224 stdcall MsiGetFileSignatureInformationW(wstr long ptr ptr ptr) 225 stdcall MsiProvideAssemblyA(str str long long str ptr) diff --git a/reactos/lib/msi/msi.xml b/reactos/lib/msi/msi.xml index 1514fca835d..221c50fa42a 100644 --- a/reactos/lib/msi/msi.xml +++ b/reactos/lib/msi/msi.xml @@ -25,6 +25,7 @@ cond.tab.c create.c custom.c + database.c delete.c dialog.c distinct.c diff --git a/reactos/lib/msi/msi_Es.rc b/reactos/lib/msi/msi_Es.rc index 3270f479eea..3d36ff7cde8 100644 --- a/reactos/lib/msi/msi_Es.rc +++ b/reactos/lib/msi/msi_Es.rc @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -LANGUAGE LANG_SPANISH, SUBLANG_DEFAULT +LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE { diff --git a/reactos/lib/msi/msi_Nl.rc b/reactos/lib/msi/msi_Nl.rc new file mode 100644 index 00000000000..aff08e7bf90 --- /dev/null +++ b/reactos/lib/msi/msi_Nl.rc @@ -0,0 +1,33 @@ +/* + * Durch resources for MSI + * + * Copyright 2005 Hans Leidekker + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_DUTCH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +{ + 5 "Pad %s niet gevonden" + 9 "Plaats disk %s" + 10 "Ongeldige parameters" + 11 "Voer de map in die %s bevat" + 12 "De installatiebron van het feature ontbreekt" + 13 "De netwerkschijf met het feature ontbreekt" + 14 "Feature van:" + 15 "Kies de map die %s bevat" +} diff --git a/reactos/lib/msi/msipriv.h b/reactos/lib/msi/msipriv.h index eed3e545517..290de68e075 100644 --- a/reactos/lib/msi/msipriv.h +++ b/reactos/lib/msi/msipriv.h @@ -29,6 +29,7 @@ #include "msiquery.h" #include "objbase.h" #include "objidl.h" +#include "wine/unicode.h" #define MSI_DATASIZEMASK 0x00ff #define MSITYPE_VALID 0x0100 @@ -170,12 +171,6 @@ typedef struct tagMSIVIEWOPS } MSIVIEWOPS; -typedef struct tagMSISUMMARYINFO -{ - MSIOBJECTHDR hdr; - IPropertyStorage *propstg; -} MSISUMMARYINFO; - struct tagMSIVIEW { MSIOBJECTHDR hdr; @@ -307,6 +302,7 @@ extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR); /* record internals */ extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *); +extern UINT MSI_RecordGetIStream( MSIRECORD *, unsigned int, IStream **); extern const WCHAR *MSI_RecordGetString( MSIRECORD *, unsigned int ); extern MSIRECORD *MSI_CreateRecord( unsigned int ); extern UINT MSI_RecordSetInteger( MSIRECORD *, unsigned int, int ); @@ -386,4 +382,38 @@ extern DWORD gUIFilter; extern LPVOID gUIContext; extern WCHAR gszLogFile[MAX_PATH]; +inline static char *strdupWtoA( LPCWSTR str ) +{ + LPSTR ret = NULL; + if (str) + { + DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL +); + if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) + WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); + } + return ret; +} + +inline static LPWSTR strdupAtoW( LPCSTR str ) +{ + LPWSTR ret = NULL; + if (str) + { + DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); + if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) + MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); + } + return ret; +} + +inline static LPWSTR strdupW( LPCWSTR src ) +{ + LPWSTR dest; + if (!src) return NULL; + dest = HeapAlloc(GetProcessHeap(), 0, (strlenW(src)+1)*sizeof(WCHAR)); + strcpyW(dest, src); + return dest; +} + #endif /* __WINE_MSI_PRIVATE__ */ diff --git a/reactos/lib/msi/msiquery.c b/reactos/lib/msi/msiquery.c index cfe1ecfab64..eb50d0991cc 100644 --- a/reactos/lib/msi/msiquery.c +++ b/reactos/lib/msi/msiquery.c @@ -86,11 +86,9 @@ UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, if( szQuery ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szQuery, -1, NULL, 0 ); - szwQuery = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + szwQuery = strdupAtoW( szQuery ); if( !szwQuery ) return ERROR_FUNCTION_FAILED; - MultiByteToWideChar( CP_ACP, 0, szQuery, -1, szwQuery, len ); } else szwQuery = NULL; @@ -672,16 +670,15 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb, LPCSTR table, MSIHANDLE* phRec) { LPWSTR szwTable = NULL; - DWORD len; UINT r; TRACE("%ld %s %p\n", hdb, debugstr_a(table), phRec); if( table ) { - len = MultiByteToWideChar( CP_ACP, 0, table, -1, NULL, 0 ); - szwTable = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, table, -1, szwTable, len ); + szwTable = strdupAtoW( table ); + if( !szwTable ) + return ERROR_OUTOFMEMORY; } r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec ); HeapFree( GetProcessHeap(), 0, szwTable ); diff --git a/reactos/lib/msi/package.c b/reactos/lib/msi/package.c index 60f939e6472..938de885d70 100644 --- a/reactos/lib/msi/package.c +++ b/reactos/lib/msi/package.c @@ -469,14 +469,13 @@ UINT WINAPI MsiOpenPackageW(LPCWSTR szPackage, MSIHANDLE *phPackage) UINT WINAPI MsiOpenPackageExA(LPCSTR szPackage, DWORD dwOptions, MSIHANDLE *phPackage) { LPWSTR szwPack = NULL; - UINT len, ret; + UINT ret; if( szPackage ) { - len = MultiByteToWideChar( CP_ACP, 0, szPackage, -1, NULL, 0 ); - szwPack = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); - if( szwPack ) - MultiByteToWideChar( CP_ACP, 0, szPackage, -1, szwPack, len ); + szwPack = strdupAtoW( szPackage ); + if( !szwPack ) + return ERROR_OUTOFMEMORY; } ret = MsiOpenPackageExW( szwPack, dwOptions, phPackage ); @@ -638,29 +637,20 @@ UINT WINAPI MsiSetPropertyA( MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue) { LPWSTR szwName = NULL, szwValue = NULL; UINT hr = ERROR_INSTALL_FAILURE; - UINT len; - if (0 == hInstall) { - return ERROR_INVALID_HANDLE; - } - if (NULL == szName) { - return ERROR_INVALID_PARAMETER; - } - if (NULL == szValue) { - return ERROR_INVALID_PARAMETER; + if( szName ) + { + szwName = strdupAtoW( szName ); + if( !szwName ) + goto end; } - len = MultiByteToWideChar( CP_ACP, 0, szName, -1, NULL, 0 ); - szwName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - if( !szwName ) - goto end; - MultiByteToWideChar( CP_ACP, 0, szName, -1, szwName, len ); - - len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 ); - szwValue = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - if( !szwValue) - goto end; - MultiByteToWideChar( CP_ACP, 0, szValue , -1, szwValue, len ); + if( szValue ) + { + szwValue = strdupAtoW( szValue ); + if( !szwValue) + goto end; + } hr = MsiSetPropertyW( hInstall, szwName, szwValue); @@ -703,7 +693,7 @@ UINT MSI_SetPropertyW( MSIPACKAGE *package, LPCWSTR szName, LPCWSTR szValue) } else { - strcpyW(Query,Insert); + strcpyW(Query,Insert); row = MSI_CreateRecord(2); MSI_RecordSetStringW(row,1,szName); @@ -732,8 +722,13 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue MSIPACKAGE *package; UINT ret; + if (NULL == szName) + return ERROR_INVALID_PARAMETER; + if (NULL == szValue) + return ERROR_INVALID_PARAMETER; + package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); - if( !package) + if( !package ) return ERROR_INVALID_HANDLE; ret = MSI_SetPropertyW( package, szName, szValue); msiobj_release( &package->hdr ); @@ -808,17 +803,18 @@ UINT MSI_GetPropertyA(MSIPACKAGE *package, LPCSTR szName, LPSTR szValueBuf, DWORD* pchValueBuf) { MSIRECORD *row; - UINT rc, len; - LPWSTR szwName; + UINT rc; + LPWSTR szwName = NULL; if (*pchValueBuf > 0) szValueBuf[0] = 0; - len = MultiByteToWideChar( CP_ACP, 0, szName, -1, NULL, 0 ); - szwName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - if (!szwName) - return ERROR_NOT_ENOUGH_MEMORY; - MultiByteToWideChar( CP_ACP, 0, szName, -1, szwName, len ); + if( szName ) + { + szwName = strdupAtoW( szName ); + if (!szwName) + return ERROR_NOT_ENOUGH_MEMORY; + } rc = MSI_GetPropertyRow(package, szwName, &row); if (rc == ERROR_SUCCESS) diff --git a/reactos/lib/msi/preview.c b/reactos/lib/msi/preview.c index 5df8ef0e796..540d65174b6 100644 --- a/reactos/lib/msi/preview.c +++ b/reactos/lib/msi/preview.c @@ -132,16 +132,16 @@ UINT WINAPI MsiPreviewDialogW( MSIHANDLE hPreview, LPCWSTR szDialogName ) UINT WINAPI MsiPreviewDialogA( MSIHANDLE hPreview, LPCSTR szDialogName ) { - UINT r, len; + UINT r; LPWSTR strW = NULL; TRACE("%ld %s\n", hPreview, debugstr_a(szDialogName)); if( szDialogName ) { - len = MultiByteToWideChar( CP_ACP, 0, szDialogName, -1, NULL, 0 ); - strW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, szDialogName, -1, strW, len ); + strW = strdupAtoW( szDialogName ); + if( !strW ) + return ERROR_OUTOFMEMORY; } r = MsiPreviewDialogW( hPreview, strW ); HeapFree( GetProcessHeap(), 0, strW ); diff --git a/reactos/lib/msi/record.c b/reactos/lib/msi/record.c index 99722e347c1..a06b0a58658 100644 --- a/reactos/lib/msi/record.c +++ b/reactos/lib/msi/record.c @@ -448,7 +448,6 @@ UINT WINAPI MsiRecordDataSize(MSIHANDLE handle, unsigned int iField) UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue ) { LPWSTR str; - UINT len; TRACE("%p %d %s\n", rec, iField, debugstr_a(szValue)); @@ -458,9 +457,7 @@ UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue ) MSI_FreeField( &rec->fields[iField] ); if( szValue && szValue[0] ) { - len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 ); - str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, szValue, -1, str, len ); + str = strdupAtoW( szValue ); rec->fields[iField].type = MSIFIELD_WSTR; rec->fields[iField].u.szwVal = str; } @@ -493,7 +490,6 @@ UINT WINAPI MsiRecordSetStringA( MSIHANDLE handle, unsigned int iField, LPCSTR s UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue ) { LPWSTR str; - UINT len; TRACE("%p %d %s\n", rec, iField, debugstr_w(szValue)); @@ -504,10 +500,7 @@ UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue if( szValue && szValue[0] ) { - len = lstrlenW(szValue) + 1; - str = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR)); - lstrcpyW( str, szValue ); - + str = strdupW( szValue ); rec->fields[iField].type = MSIFIELD_WSTR; rec->fields[iField].u.szwVal = str; } @@ -633,15 +626,15 @@ UINT MSI_RecordSetStreamW(MSIRECORD *rec, unsigned int iField, LPCWSTR szFilenam UINT WINAPI MsiRecordSetStreamA(MSIHANDLE hRecord, unsigned int iField, LPCSTR szFilename) { LPWSTR wstr = NULL; - UINT ret, len; + UINT ret; TRACE("%ld %d %s\n", hRecord, iField, debugstr_a(szFilename)); if( szFilename ) { - len = MultiByteToWideChar(CP_ACP,0,szFilename,-1,NULL,0); - wstr = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP,0,szFilename,-1,wstr,len); + wstr = strdupAtoW( szFilename ); + if( !wstr ) + return ERROR_OUTOFMEMORY; } ret = MsiRecordSetStreamW(hRecord, iField, wstr); HeapFree(GetProcessHeap(),0,wstr); @@ -751,3 +744,19 @@ UINT MSI_RecordSetIStream( MSIRECORD *rec, unsigned int iField, IStream *stm ) return ERROR_SUCCESS; } + +UINT MSI_RecordGetIStream( MSIRECORD *rec, unsigned int iField, IStream **pstm) +{ + TRACE("%p %d %p\n", rec, iField, pstm); + + if( iField > rec->count ) + return ERROR_INVALID_FIELD; + + if( rec->fields[iField].type != MSIFIELD_STREAM ) + return ERROR_INVALID_FIELD; + + *pstm = rec->fields[iField].u.stream; + IStream_AddRef( *pstm ); + + return ERROR_SUCCESS; +} diff --git a/reactos/lib/msi/registry.c b/reactos/lib/msi/registry.c index ad3fa1c7985..c6de5692a96 100644 --- a/reactos/lib/msi/registry.c +++ b/reactos/lib/msi/registry.c @@ -134,6 +134,8 @@ static const WCHAR szInstaller_UpgradeCodes_fmt[] = { 'U','p','g','r','a','d','e','C','o','d','e','s','\\', '%','s',0}; +#define SQUISH_GUID_SIZE 33 + BOOL unsquash_guid(LPCWSTR in, LPWSTR out) { DWORD i,n=0; @@ -496,16 +498,16 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct, WCHAR feature[MAX_FEATURE_CHARS+1]; WCHAR component[MAX_FEATURE_CHARS+1]; LPWSTR str = NULL; - UINT r, len; + UINT r; TRACE("%s %p %p %p %p\n", debugstr_a(szDescriptor), szProduct, szFeature, szComponent, pUsed); if( szDescriptor ) { - len = MultiByteToWideChar( CP_ACP, 0, szDescriptor, -1, NULL, 0 ); - str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, szDescriptor, -1, str, len ); + str = strdupAtoW( szDescriptor ); + if( !str ) + return ERROR_OUTOFMEMORY; } r = MsiDecomposeDescriptorW( str, product, feature, component, pUsed ); @@ -542,7 +544,7 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid) { HKEY hkeyFeatures = 0; DWORD r; - WCHAR szKeyName[33]; + WCHAR szKeyName[SQUISH_GUID_SIZE]; TRACE("%ld %p\n",index,lpguid); @@ -551,16 +553,12 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid) r = MSIREG_OpenFeatures(&hkeyFeatures); if( r != ERROR_SUCCESS ) - goto end; + return ERROR_NO_MORE_ITEMS; - r = RegEnumKeyW(hkeyFeatures, index, szKeyName, GUID_SIZE); - - unsquash_guid(szKeyName, lpguid); - -end: - - if( hkeyFeatures ) - RegCloseKey(hkeyFeatures); + r = RegEnumKeyW(hkeyFeatures, index, szKeyName, SQUISH_GUID_SIZE); + if( r == ERROR_SUCCESS ) + unsquash_guid(szKeyName, lpguid); + RegCloseKey(hkeyFeatures); return r; } @@ -576,12 +574,9 @@ UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index, if( szProduct ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); - if( szwProduct ) - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); - else - return ERROR_FUNCTION_FAILED; + szwProduct = strdupAtoW( szProduct ); + if( !szwProduct ) + return ERROR_OUTOFMEMORY; } r = MsiEnumFeaturesW(szwProduct, index, szwFeature, szwParent); @@ -608,14 +603,11 @@ UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index, r = MSIREG_OpenFeaturesKey(szProduct,&hkeyProduct,FALSE); if( r != ERROR_SUCCESS ) - goto end; + return ERROR_NO_MORE_ITEMS; sz = GUID_SIZE; r = RegEnumValueW(hkeyProduct, index, szFeature, &sz, NULL, NULL, NULL, NULL); - -end: - if( hkeyProduct ) - RegCloseKey(hkeyProduct); + RegCloseKey(hkeyProduct); return r; } @@ -638,22 +630,18 @@ UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid) { HKEY hkeyComponents = 0; DWORD r; - WCHAR szKeyName[33]; + WCHAR szKeyName[SQUISH_GUID_SIZE]; TRACE("%ld %p\n",index,lpguid); r = MSIREG_OpenComponents(&hkeyComponents); if( r != ERROR_SUCCESS ) - goto end; + return ERROR_NO_MORE_ITEMS; - r = RegEnumKeyW(hkeyComponents, index, szKeyName, GUID_SIZE); - - unsquash_guid(szKeyName, lpguid); - -end: - - if( hkeyComponents ) - RegCloseKey(hkeyComponents); + r = RegEnumKeyW(hkeyComponents, index, szKeyName, SQUISH_GUID_SIZE); + if( r == ERROR_SUCCESS ) + unsquash_guid(szKeyName, lpguid); + RegCloseKey(hkeyComponents); return r; } @@ -668,12 +656,9 @@ UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct) if( szComponent ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); - szwComponent = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); - if( szwComponent ) - MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len ); - else - return ERROR_FUNCTION_FAILED; + szwComponent = strdupAtoW( szComponent ); + if( !szwComponent ) + return ERROR_OUTOFMEMORY; } r = MsiEnumClientsW(szComponent?szwComponent:NULL, index, szwProduct); @@ -692,24 +677,20 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct) { HKEY hkeyComp = 0; DWORD r, sz; - WCHAR szValName[GUID_SIZE]; + WCHAR szValName[SQUISH_GUID_SIZE]; TRACE("%s %ld %p\n",debugstr_w(szComponent),index,szProduct); r = MSIREG_OpenComponentsKey(szComponent,&hkeyComp,FALSE); if( r != ERROR_SUCCESS ) - goto end; + return ERROR_NO_MORE_ITEMS; - sz = GUID_SIZE; + sz = SQUISH_GUID_SIZE; r = RegEnumValueW(hkeyComp, index, szValName, &sz, NULL, NULL, NULL, NULL); - if( r != ERROR_SUCCESS ) - goto end; + if( r == ERROR_SUCCESS ) + unsquash_guid(szValName, szProduct); - unsquash_guid(szValName, szProduct); - -end: - if( hkeyComp ) - RegCloseKey(hkeyComp); + RegCloseKey(hkeyComp); return r; } @@ -737,9 +718,9 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex, UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved, DWORD iProductIndex, LPWSTR lpProductBuf) { - UINT rc; + UINT r; HKEY hkey; - WCHAR szKeyName[33]; + WCHAR szKeyName[SQUISH_GUID_SIZE]; TRACE("%s %lu %lu %p\n", debugstr_w(szUpgradeCode), dwReserved, iProductIndex, lpProductBuf); @@ -748,54 +729,43 @@ UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved, return ERROR_INVALID_PARAMETER; if (NULL == lpProductBuf) return ERROR_INVALID_PARAMETER; - rc = MSIREG_OpenUpgradeCodesKey(szUpgradeCode, &hkey, FALSE); - if (rc != ERROR_SUCCESS) - { - rc = ERROR_NO_MORE_ITEMS; - goto end; - } - rc = RegEnumKeyW(hkey, iProductIndex, szKeyName, - sizeof(szKeyName) / sizeof(szKeyName[0])); + r = MSIREG_OpenUpgradeCodesKey(szUpgradeCode, &hkey, FALSE); + if (r != ERROR_SUCCESS) + return ERROR_NO_MORE_ITEMS; - unsquash_guid(szKeyName, lpProductBuf); + r = RegEnumKeyW(hkey, iProductIndex, szKeyName, SQUISH_GUID_SIZE); + if( r == ERROR_SUCCESS ) + unsquash_guid(szKeyName, lpProductBuf); RegCloseKey(hkey); -end: - return rc; + return r; } UINT WINAPI MsiEnumRelatedProductsA(LPCSTR szUpgradeCode, DWORD dwReserved, DWORD iProductIndex, LPSTR lpProductBuf) { - UINT rc; - int len; - LPWSTR szUpgradeCodeW = NULL; + LPWSTR szwUpgradeCode = NULL; + WCHAR productW[GUID_SIZE]; + UINT r; TRACE("%s %lu %lu %p\n", debugstr_a(szUpgradeCode), dwReserved, iProductIndex, lpProductBuf); - if (!szUpgradeCode) - return ERROR_INVALID_PARAMETER; - len = MultiByteToWideChar(CP_ACP, 0, szUpgradeCode, -1, NULL, 0); - szUpgradeCodeW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - len * sizeof(WCHAR)); - if (szUpgradeCodeW) + + if (szUpgradeCode) { - WCHAR productW[39]; - - MultiByteToWideChar(CP_ACP, 0, szUpgradeCode, -1, szUpgradeCodeW, len); - rc = MsiEnumRelatedProductsW(szUpgradeCodeW, dwReserved, - iProductIndex, productW); - if (rc == ERROR_SUCCESS) - { - LPWSTR ptr; - - for (ptr = productW; *ptr; ) - *lpProductBuf++ = *ptr++; - } - HeapFree(GetProcessHeap(), 0, szUpgradeCodeW); + szwUpgradeCode = strdupAtoW( szUpgradeCode ); + if( !szwUpgradeCode ) + return ERROR_OUTOFMEMORY; } - else - rc = ERROR_OUTOFMEMORY; - return rc; + + r = MsiEnumRelatedProductsW( szwUpgradeCode, dwReserved, + iProductIndex, productW ); + if (r == ERROR_SUCCESS) + { + WideCharToMultiByte( CP_ACP, 0, productW, GUID_SIZE, + lpProductBuf, GUID_SIZE, NULL, NULL ); + } + HeapFree(GetProcessHeap(), 0, szwUpgradeCode); + return r; } diff --git a/reactos/lib/msi/suminfo.c b/reactos/lib/msi/suminfo.c index 16e4516b9ae..74f00dc64ad 100644 --- a/reactos/lib/msi/suminfo.c +++ b/reactos/lib/msi/suminfo.c @@ -1,7 +1,7 @@ /* * Implementation of the Microsoft Installer (msi.dll) * - * Copyright 2002 Mike McCormack for CodeWeavers + * Copyright 2002, 2005 Mike McCormack for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,61 +33,406 @@ #include "wine/debug.h" #include "msi.h" #include "msiquery.h" +#include "msidefs.h" #include "msipriv.h" #include "objidl.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); +#define MSI_MAX_PROPS 19 + +#include "pshpack1.h" + +typedef struct { + WORD wByteOrder; + WORD wFormat; + DWORD dwOSVer; + CLSID clsID; + DWORD reserved; +} PROPERTYSETHEADER; + +typedef struct { + FMTID fmtid; + DWORD dwOffset; +} FORMATIDOFFSET; + +typedef struct { + DWORD cbSection; + DWORD cProperties; +} PROPERTYSECTIONHEADER; + +typedef struct { + DWORD propid; + DWORD dwOffset; +} PROPERTYIDOFFSET; + +typedef struct { + DWORD type; + union { + INT i4; + SHORT i2; + FILETIME ft; + struct { + DWORD len; + BYTE str[1]; + } str; + } u; +} PROPERTY_DATA; + +#include "poppack.h" + +typedef struct { + BOOL unicode; + union { + LPSTR a; + LPWSTR w; + } str; +} awstring; + +typedef struct tagMSISUMMARYINFO +{ + MSIOBJECTHDR hdr; + MSIDATABASE *db; + DWORD update_count; + PROPVARIANT property[MSI_MAX_PROPS]; +} MSISUMMARYINFO; + static const WCHAR szSumInfo[] = { 5 ,'S','u','m','m','a','r','y', 'I','n','f','o','r','m','a','t','i','o','n',0 }; -static void MSI_CloseSummaryInfo( MSIOBJECTHDR *arg ) +static void free_prop( PROPVARIANT *prop ) { - MSISUMMARYINFO *suminfo = (MSISUMMARYINFO *) arg; - IPropertyStorage_Release( suminfo->propstg ); + if (prop->vt == VT_LPSTR ) + HeapFree( GetProcessHeap(), 0, prop->u.pszVal ); + prop->vt = VT_EMPTY; } -UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, - LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *phSummaryInfo) +static void MSI_CloseSummaryInfo( MSIOBJECTHDR *arg ) { - LPWSTR szwDatabase = NULL; - UINT ret; + MSISUMMARYINFO *si = (MSISUMMARYINFO *) arg; + DWORD i; - TRACE("%ld %s %d %p\n", hDatabase, debugstr_a(szDatabase), - uiUpdateCount, phSummaryInfo); + for( i = 0; i < MSI_MAX_PROPS; i++ ) + free_prop( &si->property[i] ); + msiobj_release( &si->db->hdr ); +} - if( szDatabase ) +static UINT get_type( UINT uiProperty ) +{ + switch( uiProperty ) { - UINT len = MultiByteToWideChar( CP_ACP, 0, szDatabase, -1, NULL, 0 ); - szwDatabase = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); - if( !szwDatabase ) - return ERROR_FUNCTION_FAILED; - MultiByteToWideChar( CP_ACP, 0, szDatabase, -1, szwDatabase, len ); + case PID_CODEPAGE: + return VT_I2; + + case PID_SUBJECT: + case PID_AUTHOR: + case PID_KEYWORDS: + case PID_COMMENTS: + case PID_TEMPLATE: + case PID_LASTAUTHOR: + case PID_REVNUMBER: + case PID_APPNAME: + case PID_TITLE: + return VT_LPSTR; + + case PID_LASTPRINTED: + case PID_CREATE_DTM: + case PID_LASTSAVE_DTM: + return VT_FILETIME; + + case PID_WORDCOUNT: + case PID_CHARCOUNT: + case PID_SECURITY: + case PID_PAGECOUNT: + return VT_I4; + } + return VT_EMPTY; +} + +static UINT get_property_count( PROPVARIANT *property ) +{ + UINT i, n = 0; + + if( !property ) + return n; + for( i = 0; i < MSI_MAX_PROPS; i++ ) + if( property[i].vt != VT_EMPTY ) + n++; + return n; +} + +/* FIXME: doesn't deal with endian conversion */ +static void read_properties_from_data( PROPVARIANT *prop, + PROPERTYIDOFFSET *idofs, DWORD count, LPBYTE data, DWORD sz ) +{ + UINT type; + DWORD i; + int size; + PROPERTY_DATA *propdata; + PROPVARIANT *property; + + /* now set all the properties */ + for( i = 0; i < count; i++ ) + { + type = get_type( idofs[i].propid ); + if( type == VT_EMPTY ) + { + ERR("propid %ld has unknown type\n", idofs[i].propid); + break; + } + + propdata = (PROPERTY_DATA*) &data[idofs[i].dwOffset]; + + /* check the type is the same as we expect */ + if( type != propdata->type ) + { + ERR("wrong type\n"); + break; + } + + /* check we don't run off the end of the data */ + size = sz - idofs[i].dwOffset - sizeof(DWORD); + if( sizeof(DWORD) > size || + ( type == VT_FILETIME && sizeof(FILETIME) > size ) || + ( type == VT_LPSTR && (propdata->u.str.len + sizeof(DWORD)) > size ) ) + { + ERR("not enough data\n"); + break; + } + + property = &prop[ idofs[i].propid ]; + property->vt = type; + + if( type == VT_LPSTR ) + { + LPSTR str = HeapAlloc( GetProcessHeap(), 0, propdata->u.str.len ); + memcpy( str, propdata->u.str.str, propdata->u.str.len ); + str[ propdata->u.str.len - 1 ] = 0; + property->u.pszVal = str; + } + else if( type == VT_FILETIME ) + property->u.filetime = propdata->u.ft; + else if( type == VT_I2 ) + property->u.iVal = propdata->u.i2; + else if( type == VT_I4 ) + property->u.lVal = propdata->u.i4; + } +} + +static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm ) +{ + UINT ret = ERROR_FUNCTION_FAILED; + PROPERTYSETHEADER set_hdr; + FORMATIDOFFSET format_hdr; + PROPERTYSECTIONHEADER section_hdr; + PROPERTYIDOFFSET idofs[MSI_MAX_PROPS]; + LPBYTE data = NULL; + LARGE_INTEGER ofs; + ULONG count, sz; + HRESULT r; + + TRACE("%p %p\n", si, stm); + + /* read the header */ + sz = sizeof set_hdr; + r = IStream_Read( stm, &set_hdr, sz, &count ); + if( FAILED(r) || count != sz ) + return ret; + + if( set_hdr.wByteOrder != 0xfffe ) + { + ERR("property set not big-endian %04X\n", set_hdr.wByteOrder); + return ret; } - ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, phSummaryInfo); + sz = sizeof format_hdr; + r = IStream_Read( stm, &format_hdr, sz, &count ); + if( FAILED(r) || count != sz ) + return ret; - HeapFree( GetProcessHeap(), 0, szwDatabase ); + /* check the format id is correct */ + if( !IsEqualGUID( &FMTID_SummaryInformation, &format_hdr.fmtid ) ) + return ret; + /* seek to the location of the section */ + ofs.QuadPart = format_hdr.dwOffset; + r = IStream_Seek( stm, ofs, STREAM_SEEK_SET, NULL ); + if( FAILED(r) ) + return ret; + + /* read the section itself */ + sz = sizeof section_hdr; + r = IStream_Read( stm, §ion_hdr, sz, &count ); + if( FAILED(r) || count != sz ) + return ret; + + if( section_hdr.cProperties > MSI_MAX_PROPS ) + { + ERR("too many properties %ld\n", section_hdr.cProperties); + return ret; + } + + /* read the offsets */ + sz = sizeof idofs[0] * section_hdr.cProperties; + r = IStream_Read( stm, idofs, sz, &count ); + if( FAILED(r) || count != sz ) + return ret; + + /* read all the data in one go */ + sz = section_hdr.cbSection; + data = HeapAlloc( GetProcessHeap(), 0, sz ); + if( !data ) + return ret; + r = IStream_Read( stm, data, sz, &count ); + if( SUCCEEDED(r) && count == sz ) + { + read_properties_from_data( si->property, idofs, + section_hdr.cProperties, data, sz ); + } + + HeapFree( GetProcessHeap(), 0, data ); return ret; } -UINT WINAPI MsiGetSummaryInformationW(MSIHANDLE hDatabase, - LPCWSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *phSummaryInfo) +static DWORD write_dword( LPBYTE data, DWORD ofs, DWORD val ) { + if( data ) + { + data[ofs++] = val&0xff; + data[ofs++] = (val>>8)&0xff; + data[ofs++] = (val>>16)&0xff; + data[ofs++] = (val>>24)&0xff; + } + return 4; +} + +static DWORD write_filetime( LPBYTE data, DWORD ofs, LPFILETIME ft ) +{ + write_dword( data, ofs, ft->dwLowDateTime ); + write_dword( data, ofs + 4, ft->dwHighDateTime ); + return 8; +} + +static DWORD write_string( LPBYTE data, DWORD ofs, LPCSTR str ) +{ + DWORD len = lstrlenA( str ) + 1; + write_dword( data, ofs, len ); + if( data ) + lstrcpyA( &data[ofs + 4], str ); + return (7 + len) & ~3; +} + +static UINT write_property_to_data( PROPVARIANT *prop, LPBYTE data ) +{ + DWORD sz = 0; + + if( prop->vt == VT_EMPTY ) + return sz; + + /* add the type */ + sz += write_dword( data, sz, prop->vt ); + switch( prop->vt ) + { + case VT_I2: + sz += write_dword( data, sz, prop->u.iVal ); + break; + case VT_I4: + sz += write_dword( data, sz, prop->u.lVal ); + break; + case VT_FILETIME: + sz += write_filetime( data, sz, &prop->u.filetime ); + break; + case VT_LPSTR: + sz += write_string( data, sz, prop->u.pszVal ); + break; + } + return sz; +} + +static UINT save_summary_info( MSISUMMARYINFO * si, IStream *stm ) +{ + UINT ret = ERROR_FUNCTION_FAILED; + PROPERTYSETHEADER set_hdr; + FORMATIDOFFSET format_hdr; + PROPERTYSECTIONHEADER section_hdr; + PROPERTYIDOFFSET idofs[MSI_MAX_PROPS]; + LPBYTE data = NULL; + ULONG count, sz; HRESULT r; - MSIHANDLE handle; - MSISUMMARYINFO *suminfo; - MSIDATABASE *db; + int i, n; + + /* write the header */ + sz = sizeof set_hdr; + memset( &set_hdr, 0, sz ); + set_hdr.wByteOrder = 0xfffe; + set_hdr.wFormat = 0; + set_hdr.dwOSVer = 0x00020005; /* build 5, platform id 2 */ + /* set_hdr.clsID is {00000000-0000-0000-0000-000000000000} */ + set_hdr.reserved = 1; + r = IStream_Write( stm, &set_hdr, sz, &count ); + if( FAILED(r) || count != sz ) + return ret; + + /* write the format header */ + sz = sizeof format_hdr; + memcpy( &format_hdr.fmtid, &FMTID_SummaryInformation, sizeof (FMTID) ); + format_hdr.dwOffset = sizeof format_hdr + sizeof set_hdr; + r = IStream_Write( stm, &format_hdr, sz, &count ); + if( FAILED(r) || count != sz ) + return ret; + + /* add up how much space the data will take and calculate the offsets */ + section_hdr.cbSection = sizeof section_hdr; + section_hdr.cbSection += (get_property_count( si->property ) * sizeof idofs[0]); + section_hdr.cProperties = 0; + n = 0; + for( i = 0; i < MSI_MAX_PROPS; i++ ) + { + sz = write_property_to_data( &si->property[i], NULL ); + if( !sz ) + continue; + idofs[ section_hdr.cProperties ].propid = i; + idofs[ section_hdr.cProperties ].dwOffset = section_hdr.cbSection; + section_hdr.cProperties++; + section_hdr.cbSection += sz; + } + + data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, section_hdr.cbSection ); + + sz = 0; + memcpy( &data[sz], §ion_hdr, sizeof section_hdr ); + sz += sizeof section_hdr; + + memcpy( &data[sz], idofs, section_hdr.cProperties * sizeof idofs[0] ); + sz += section_hdr.cProperties * sizeof idofs[0]; + + /* write out the data */ + for( i = 0; i < MSI_MAX_PROPS; i++ ) + sz += write_property_to_data( &si->property[i], &data[sz] ); + + r = IStream_Write( stm, data, sz, &count ); + HeapFree( GetProcessHeap(), 0, data ); + if( FAILED(r) || count != sz ) + return ret; + + return ERROR_SUCCESS; +} + +UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase, + LPCWSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle ) +{ UINT ret = ERROR_SUCCESS; - IPropertySetStorage *psstg = NULL; - IPropertyStorage *ps = NULL; + IStream *stm = NULL; + MSISUMMARYINFO *si; + MSIHANDLE handle; + MSIDATABASE *db; DWORD grfMode; + HRESULT r; TRACE("%ld %s %d %p\n", hDatabase, debugstr_w(szDatabase), - uiUpdateCount, phSummaryInfo); + uiUpdateCount, pHandle); - if( !phSummaryInfo ) + if( !pHandle ) return ERROR_INVALID_PARAMETER; if( szDatabase ) @@ -105,207 +450,302 @@ UINT WINAPI MsiGetSummaryInformationW(MSIHANDLE hDatabase, return ERROR_INVALID_PARAMETER; } - r = IStorage_QueryInterface( db->storage, - &IID_IPropertySetStorage, (LPVOID)&psstg); - if( FAILED( r ) ) - { - ERR("IStorage -> IPropertySetStorage failed\n"); - ret = ERROR_FUNCTION_FAILED; - goto end; - } - - grfMode = STGM_READ | STGM_SHARE_EXCLUSIVE; - r = IPropertySetStorage_Open( psstg, &FMTID_SummaryInformation, grfMode, &ps ); - if( FAILED( r ) ) - { - ERR("failed to get IPropertyStorage r=%08lx\n",r); - ret = ERROR_FUNCTION_FAILED; - goto end; - } - - suminfo = alloc_msiobject( MSIHANDLETYPE_SUMMARYINFO, + si = alloc_msiobject( MSIHANDLETYPE_SUMMARYINFO, sizeof (MSISUMMARYINFO), MSI_CloseSummaryInfo ); - if( !suminfo ) + if( !si ) { ret = ERROR_FUNCTION_FAILED; goto end; } - IPropertyStorage_AddRef(ps); - suminfo->propstg = ps; - handle = alloc_msihandle( &suminfo->hdr ); + msiobj_addref( &db->hdr ); + si->db = db; + memset( &si->property, 0, sizeof si->property ); + si->update_count = uiUpdateCount; + + /* read the stream... if we fail, we'll start with an empty property set */ + grfMode = STGM_READ | STGM_SHARE_EXCLUSIVE; + r = IStorage_OpenStream( si->db->storage, szSumInfo, 0, grfMode, 0, &stm ); + if( SUCCEEDED(r) ) + { + load_summary_info( si, stm ); + IStream_Release( stm ); + } + + handle = alloc_msihandle( &si->hdr ); if( handle ) - *phSummaryInfo = handle; + *pHandle = handle; else ret = ERROR_FUNCTION_FAILED; - msiobj_release( &suminfo->hdr ); + msiobj_release( &si->hdr ); end: - if( ps ) - IPropertyStorage_Release(ps); - if( psstg ) - IPropertySetStorage_Release(psstg); if( db ) msiobj_release(&db->hdr); return ret; } +UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, + LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle) +{ + LPWSTR szwDatabase = NULL; + UINT ret; + + TRACE("%ld %s %d %p\n", hDatabase, debugstr_a(szDatabase), + uiUpdateCount, pHandle); + + if( szDatabase ) + { + szwDatabase = strdupAtoW( szDatabase ); + if( !szwDatabase ) + return ERROR_FUNCTION_FAILED; + } + + ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, pHandle); + + HeapFree( GetProcessHeap(), 0, szwDatabase ); + + return ret; +} + UINT WINAPI MsiSummaryInfoGetPropertyCount(MSIHANDLE hSummaryInfo, UINT *pCount) { - MSISUMMARYINFO *suminfo; + MSISUMMARYINFO *si; - FIXME("%ld %p\n",hSummaryInfo, pCount); + TRACE("%ld %p\n",hSummaryInfo, pCount); - suminfo = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO ); - if( !suminfo ) + si = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO ); + if( !si ) return ERROR_INVALID_HANDLE; - msiobj_release( &suminfo->hdr ); - return ERROR_CALL_NOT_IMPLEMENTED; + if( pCount ) + *pCount = get_property_count( si->property ); + msiobj_release( &si->hdr ); + + return ERROR_SUCCESS; +} + +static UINT get_prop( MSIHANDLE handle, UINT uiProperty, UINT *puiDataType, + INT *piValue, FILETIME *pftValue, awstring *str, DWORD *pcchValueBuf) +{ + MSISUMMARYINFO *si; + PROPVARIANT *prop; + UINT type; + + TRACE("%ld %d %p %p %p %p %p\n", handle, uiProperty, puiDataType, + piValue, pftValue, str, pcchValueBuf); + + type = get_type( uiProperty ); + if( puiDataType ) + *puiDataType = type; + + si = msihandle2msiinfo( handle, MSIHANDLETYPE_SUMMARYINFO ); + if( !si ) + return ERROR_INVALID_HANDLE; + + prop = &si->property[uiProperty]; + if( prop->vt != type ) + goto end; + + switch( type ) + { + case VT_I2: + if( piValue ) + *piValue = prop->u.iVal; + break; + case VT_I4: + if( piValue ) + *piValue = prop->u.lVal; + break; + case VT_LPSTR: + if( pcchValueBuf ) + { + DWORD len = 0; + + if( str->unicode ) + { + len = MultiByteToWideChar( CP_ACP, 0, prop->u.pszVal, -1, + str->str.w, *pcchValueBuf ); + } + else + { + len = lstrlenA( prop->u.pszVal ); + if( str->str.a ) + lstrcpynA(str->str.a, prop->u.pszVal, *pcchValueBuf ); + } + *pcchValueBuf = len; + } + break; + case VT_FILETIME: + if( pftValue ) + memcpy(pftValue, &prop->u.filetime, sizeof (FILETIME) ); + break; + case VT_EMPTY: + break; + default: + FIXME("Unknown property variant type\n"); + break; + } +end: + msiobj_release( &si->hdr ); + return ERROR_SUCCESS; } UINT WINAPI MsiSummaryInfoGetPropertyA( - MSIHANDLE hSummaryInfo, UINT uiProperty, UINT *puiDataType, INT *piValue, + MSIHANDLE handle, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, LPSTR szValueBuf, DWORD *pcchValueBuf) { - MSISUMMARYINFO *suminfo; - HRESULT r; - PROPSPEC spec; - PROPVARIANT var; - UINT rc = ERROR_SUCCESS; + awstring str; - TRACE("%ld %d %p %p %p %p %p\n", - hSummaryInfo, uiProperty, puiDataType, piValue, - pftValue, szValueBuf, pcchValueBuf); + TRACE("%ld %d %p %p %p %p %p\n", handle, uiProperty, puiDataType, + piValue, pftValue, szValueBuf, pcchValueBuf ); - suminfo = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO ); - if( !suminfo ) - return ERROR_INVALID_HANDLE; + str.unicode = FALSE; + str.str.a = szValueBuf; - spec.ulKind = PRSPEC_PROPID; - spec.u.propid = uiProperty; - - r = IPropertyStorage_ReadMultiple( suminfo->propstg, 1, &spec, &var); - if( FAILED(r) ) - { - rc = ERROR_FUNCTION_FAILED; - goto end; - } - - if( puiDataType ) - *puiDataType = var.vt; - - switch( var.vt ) - { - case VT_I4: - if( piValue ) - *piValue = var.u.lVal; - break; - case VT_LPSTR: - if( pcchValueBuf && szValueBuf ) - { - lstrcpynA(szValueBuf, var.u.pszVal, *pcchValueBuf ); - *pcchValueBuf = lstrlenA( var.u.pszVal ); - } - break; - case VT_FILETIME: - if( pftValue ) - memcpy(pftValue, &var.u.filetime, sizeof (FILETIME) ); - break; - case VT_EMPTY: - break; - default: - FIXME("Unknown property variant type\n"); - break; - } - -end: - msiobj_release( &suminfo->hdr ); - return rc; + return get_prop( handle, uiProperty, puiDataType, piValue, + pftValue, &str, pcchValueBuf ); } UINT WINAPI MsiSummaryInfoGetPropertyW( - MSIHANDLE hSummaryInfo, UINT uiProperty, UINT *puiDataType, INT *piValue, + MSIHANDLE handle, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, LPWSTR szValueBuf, DWORD *pcchValueBuf) { - MSISUMMARYINFO *suminfo; - HRESULT r; - PROPSPEC spec; - PROPVARIANT var; - UINT rc = ERROR_SUCCESS; + awstring str; - TRACE("%ld %d %p %p %p %p %p\n", - hSummaryInfo, uiProperty, puiDataType, piValue, - pftValue, szValueBuf, pcchValueBuf); + TRACE("%ld %d %p %p %p %p %p\n", handle, uiProperty, puiDataType, + piValue, pftValue, szValueBuf, pcchValueBuf ); - suminfo = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO ); - if( !suminfo ) + str.unicode = TRUE; + str.str.w = szValueBuf; + + return get_prop( handle, uiProperty, puiDataType, piValue, + pftValue, &str, pcchValueBuf ); +} + +static UINT set_prop( MSIHANDLE handle, UINT uiProperty, UINT uiDataType, + INT iValue, FILETIME* pftValue, awstring *str ) +{ + MSISUMMARYINFO *si; + PROPVARIANT *prop; + UINT type, len, ret = ERROR_SUCCESS; + + TRACE("%ld %u %u %i %p %p\n", handle, uiProperty, uiDataType, + iValue, pftValue, str ); + + type = get_type( uiProperty ); + if( type == VT_EMPTY || type != uiDataType ) + return ERROR_DATATYPE_MISMATCH; + + if( uiDataType == VT_LPSTR && !str->str.w ) + return ERROR_INVALID_PARAMETER; + + if( uiDataType == VT_FILETIME && !pftValue ) + return ERROR_INVALID_PARAMETER; + + si = msihandle2msiinfo( handle, MSIHANDLETYPE_SUMMARYINFO ); + if( !si ) return ERROR_INVALID_HANDLE; - spec.ulKind = PRSPEC_PROPID; - spec.u.propid = uiProperty; + prop = &si->property[uiProperty]; - r = IPropertyStorage_ReadMultiple( suminfo->propstg, 1, &spec, &var); - if( FAILED(r) ) + if( prop->vt == VT_EMPTY ) { - rc = ERROR_FUNCTION_FAILED; - goto end; + if( !si->update_count ) + { + ret = ERROR_FUNCTION_FAILED; + goto end; + } + si->update_count--; } + else if( prop->vt != type ) + goto end; - if( puiDataType ) - *puiDataType = var.vt; - - switch( var.vt ) + free_prop( prop ); + prop->vt = type; + switch( type ) { case VT_I4: - if( piValue ) - *piValue = var.u.lVal; + prop->u.lVal = iValue; break; - case VT_LPSTR: - if( pcchValueBuf && szValueBuf ) - { - MultiByteToWideChar(CP_ACP, 0, var.u.pszVal, -1, szValueBuf, - *pcchValueBuf ); - *pcchValueBuf = lstrlenA( var.u.pszVal ); - } + case VT_I2: + prop->u.iVal = iValue; break; case VT_FILETIME: - if( pftValue ) - memcpy(pftValue, &var.u.filetime, sizeof (FILETIME) ); + memcpy( &prop->u.filetime, pftValue, sizeof prop->u.filetime ); break; - case VT_EMPTY: - break; - default: - FIXME("Unknown property variant type\n"); + case VT_LPSTR: + if( str->unicode ) + { + len = WideCharToMultiByte( CP_ACP, 0, str->str.w, -1, + NULL, 0, NULL, NULL ); + prop->u.pszVal = HeapAlloc( GetProcessHeap(), 0, len ); + WideCharToMultiByte( CP_ACP, 0, str->str.w, -1, + prop->u.pszVal, len, NULL, NULL ); + } + else + { + len = lstrlenA( str->str.a ) + 1; + prop->u.pszVal = HeapAlloc( GetProcessHeap(), 0, len ); + lstrcpyA( prop->u.pszVal, str->str.a ); + } break; } end: - msiobj_release( &suminfo->hdr ); - return rc; + msiobj_release( &si->hdr ); + return ret; } -UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE hSummaryInfo, UINT uiProperty, - UINT uiDataType, INT iValue, - FILETIME* pftValue, LPSTR szValue ) +UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE handle, UINT uiProperty, + UINT uiDataType, INT iValue, FILETIME* pftValue, LPWSTR szValue ) { - FIXME("%ld %u %u %i %p %s\n", hSummaryInfo, uiProperty, - uiDataType, iValue, pftValue, debugstr_a(szValue) ); - return ERROR_CALL_NOT_IMPLEMENTED; + awstring str; + + TRACE("%ld %u %u %i %p %s\n", handle, uiProperty, uiDataType, + iValue, pftValue, debugstr_w(szValue) ); + + str.unicode = TRUE; + str.str.w = szValue; + return set_prop( handle, uiProperty, uiDataType, iValue, pftValue, &str ); } -UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE hSummaryInfo, UINT uiProperty, - UINT uiDataType, INT iValue, - FILETIME* pftValue, LPWSTR szValue ) +UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE handle, UINT uiProperty, + UINT uiDataType, INT iValue, FILETIME* pftValue, LPSTR szValue ) { - FIXME("%ld %u %u %i %p %s\n", hSummaryInfo, uiProperty, - uiDataType, iValue, pftValue, debugstr_w(szValue) ); - return ERROR_CALL_NOT_IMPLEMENTED; + awstring str; + + TRACE("%ld %u %u %i %p %s\n", handle, uiProperty, uiDataType, + iValue, pftValue, debugstr_a(szValue) ); + + str.unicode = FALSE; + str.str.a = szValue; + return set_prop( handle, uiProperty, uiDataType, iValue, pftValue, &str ); } -UINT WINAPI MsiSummaryInfoPersist( MSIHANDLE hSummaryInfo ) +UINT WINAPI MsiSummaryInfoPersist( MSIHANDLE handle ) { - FIXME("%ld\n", hSummaryInfo ); - return ERROR_CALL_NOT_IMPLEMENTED; + IStream *stm = NULL; + MSISUMMARYINFO *si; + DWORD grfMode; + HRESULT r; + UINT ret = ERROR_FUNCTION_FAILED; + + TRACE("%ld\n", handle ); + + si = msihandle2msiinfo( handle, MSIHANDLETYPE_SUMMARYINFO ); + if( !si ) + return ERROR_INVALID_HANDLE; + + grfMode = STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE; + r = IStorage_CreateStream( si->db->storage, szSumInfo, grfMode, 0, 0, &stm ); + if( SUCCEEDED(r) ) + { + ret = save_summary_info( si, stm ); + IStream_Release( stm ); + } + msiobj_release( &si->hdr ); + + return ret; } diff --git a/reactos/lib/msi/table.c b/reactos/lib/msi/table.c index 63ee0db24ac..cf0718b19c7 100644 --- a/reactos/lib/msi/table.c +++ b/reactos/lib/msi/table.c @@ -834,15 +834,6 @@ err: return ret; } -static LPWSTR strdupW( LPCWSTR str ) -{ - UINT len = lstrlenW( str ) + 1; - LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); - if( ret ) - lstrcpyW( ret, str ); - return ret; -} - /* information for default tables */ static const WCHAR szTables[] = { '_','T','a','b','l','e','s',0 }; static const WCHAR szTable[] = { 'T','a','b','l','e',0 }; diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index fd153307bf8..ccabed238e2 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -215,6 +215,7 @@ NtRequestPort@8 NtRequestWaitReplyPort@12 NtResetEvent@8 NtRestoreKey@12 +NtResumeProcess@4 NtResumeThread@8 NtSaveKey@8 NtSetContextThread@8 @@ -251,6 +252,7 @@ NtShutdownSystem@4 NtSignalAndWaitForSingleObject@16 NtStartProfile@4 NtStopProfile@4 +NtSuspendProcess@4 NtSuspendThread@8 NtSystemDebugControl@24 NtTerminateJobObject@8 @@ -843,6 +845,7 @@ ZwRequestPort@8 ZwRequestWaitReplyPort@12 ZwResetEvent@8 ZwRestoreKey@12 +ZwResumeProcess@4 ZwResumeThread@8 ZwSaveKey@8 ZwSetContextThread@8 @@ -878,6 +881,7 @@ ZwShutdownSystem@4 ZwSignalAndWaitForSingleObject@16 ZwStartProfile@4 ZwStopProfile@4 +ZwSuspendProcess@4 ZwSuspendThread@8 ZwSystemDebugControl@24 ZwTerminateProcess@8 diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index 559c5224afd..73032aa2af6 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -51,19 +51,9 @@ LDR_OBJECTS = \ ldr/utils.o RTL_I386_OBJECTS = \ - rtl/i386/alldiv.o \ - rtl/i386/allmul.o \ - rtl/i386/allrem.o \ - rtl/i386/allshl.o \ - rtl/i386/allshr.o \ - rtl/i386/aulldiv.o \ - rtl/i386/aullrem.o \ - rtl/i386/aullshr.o \ - rtl/i386/float.o \ rtl/i386/ftol.o RTL_OBJECTS = \ - rtl/access.o \ rtl/apc.o \ rtl/atom.o \ rtl/callback.o \ diff --git a/reactos/lib/ntdll/ntdll.xml b/reactos/lib/ntdll/ntdll.xml index fcb08f18cd4..96ac96c6f39 100644 --- a/reactos/lib/ntdll/ntdll.xml +++ b/reactos/lib/ntdll/ntdll.xml @@ -29,19 +29,8 @@ - alldiv.s - allmul.s - allrem.s - allshl.s - allshr.s - aulldiv.s - aullrem.s - aullshr.s - exception.c - float.c ftol.c - access.c apc.c atom.c callback.c diff --git a/reactos/lib/ntdll/rtl/access.c b/reactos/lib/ntdll/rtl/access.c deleted file mode 100644 index 684ae52e2ee..00000000000 --- a/reactos/lib/ntdll/rtl/access.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Access rights handling functions - * FILE: lib/ntdll/rtl/access.c - * PROGRAMER: Eric Kohl - * REVISION HISTORY: - * 06/04/2000: Created - */ - -/* INCLUDES *****************************************************************/ - -#include - -#include - -/* FUNCTIONS ***************************************************************/ - -BOOLEAN -STDCALL -RtlAreAllAccessesGranted ( - ACCESS_MASK GrantedAccess, - ACCESS_MASK DesiredAccess - ) -{ - return ((GrantedAccess & DesiredAccess) == DesiredAccess); -} - - -/* - * @implemented - */ -BOOLEAN -STDCALL -RtlAreAnyAccessesGranted ( - ACCESS_MASK GrantedAccess, - ACCESS_MASK DesiredAccess - ) -{ - return ((GrantedAccess & DesiredAccess) != 0); -} - - -/* - * @implemented - */ -VOID -STDCALL -RtlMapGenericMask ( - PACCESS_MASK AccessMask, - PGENERIC_MAPPING GenericMapping - ) -{ - if (*AccessMask & GENERIC_READ) - *AccessMask |= GenericMapping->GenericRead; - - if (*AccessMask & GENERIC_WRITE) - *AccessMask |= GenericMapping->GenericWrite; - - if (*AccessMask & GENERIC_EXECUTE) - *AccessMask |= GenericMapping->GenericExecute; - - if (*AccessMask & GENERIC_ALL) - *AccessMask |= GenericMapping->GenericAll; - - *AccessMask &= 0x0FFFFFFF; -} - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/apc.c b/reactos/lib/ntdll/rtl/apc.c index f548df12ca5..f61b5ae2477 100644 --- a/reactos/lib/ntdll/rtl/apc.c +++ b/reactos/lib/ntdll/rtl/apc.c @@ -28,6 +28,7 @@ #include #include +#include /* FUNCTIONS ***************************************************************/ @@ -41,12 +42,14 @@ KiUserApcDispatcher(PIO_APC_ROUTINE ApcRoutine, /* * Call the APC */ + //DPRINT1("ITS ME\n"); ApcRoutine(ApcContext, Iosb, Reserved); /* * Switch back to the interrupted context */ + //DPRINT1("switch back\n"); NtContinue(Context, 1); } diff --git a/reactos/lib/ntdll/rtl/dbgbuffer.c b/reactos/lib/ntdll/rtl/dbgbuffer.c index 707635d40c8..98b73f02363 100644 --- a/reactos/lib/ntdll/rtl/dbgbuffer.c +++ b/reactos/lib/ntdll/rtl/dbgbuffer.c @@ -349,14 +349,13 @@ else Buf->Unknown[0] = (ULONG)NtCurrentProcess(); - ClientId.UniqueThread = INVALID_HANDLE_VALUE; + ClientId.UniqueThread = 0; ClientId.UniqueProcess = (HANDLE)ProcessId; - ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); - ObjectAttributes.RootDirectory = (HANDLE)NULL; - ObjectAttributes.SecurityDescriptor = NULL; - ObjectAttributes.SecurityQualityOfService = NULL; - ObjectAttributes.ObjectName = NULL; - ObjectAttributes.Attributes = 0; + InitializeObjectAttributes(&ObjectAttributes, + NULL, + 0, + NULL, + NULL); Status = NtOpenProcess( &hProcess, (PROCESS_ALL_ACCESS), diff --git a/reactos/lib/ntdll/rtl/i386/alldiv.s b/reactos/lib/ntdll/rtl/i386/alldiv.s deleted file mode 100644 index 3ee5d7facf1..00000000000 --- a/reactos/lib/ntdll/rtl/i386/alldiv.s +++ /dev/null @@ -1,50 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/alldiv.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -/* - * long long - * __alldiv(long long Dividend, long long Divisor); - * - * Parameters: - * [ESP+04h] - long long Dividend - * [ESP+0Ch] - long long Divisor - * Registers: - * Unknown - * Returns: - * EDX:EAX - long long quotient (Dividend/Divisor) - * Notes: - * Routine removes the arguments from the stack. - */ -.globl __alldiv -__alldiv: - call ___divdi3 - ret $0x10 - -/* -__alldiv: - pushl %ebp - movl %esp, %ebp - pushl %eax - pushl %eax - movl 20(%ebp), %eax - pushl %eax - movl 16(%ebp), %eax - pushl %eax - movl 12(%ebp), %eax - pushl %eax - movl 8(%ebp), %eax - pushl %eax - call ___divdi3 - addl $16, %esp - movl %ebp, %esp - popl %ebp - ret -*/ - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/allmul.s b/reactos/lib/ntdll/rtl/i386/allmul.s deleted file mode 100644 index 21f561e0463..00000000000 --- a/reactos/lib/ntdll/rtl/i386/allmul.s +++ /dev/null @@ -1,54 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/allmul.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -/* - * long long - * __allmul(long long Multiplier, long long Multiplicand); - * - * Parameters: - * [ESP+04h] - long long Multiplier - * [ESP+0Ch] - long long Multiplicand - * Registers: - * Unknown - * Returns: - * EDX:EAX - long long product (Multiplier*Multiplicand) - * Notes: - * Routine removes the arguments from the stack. - */ -.globl __allmul -__allmul: - pushl %ebp - movl %esp, %ebp - pushl %edi - pushl %esi - pushl %ebx - subl $12, %esp - movl 16(%ebp), %ebx - movl 8(%ebp), %eax - mull %ebx - movl 20(%ebp), %ecx - movl %eax, -24(%ebp) - movl 8(%ebp), %eax - movl %edx, %esi - imull %ecx, %eax - addl %eax, %esi - movl 12(%ebp), %eax - imull %eax, %ebx - leal (%ebx,%esi), %eax - movl %eax, -20(%ebp) - movl -24(%ebp), %eax - movl -20(%ebp), %edx - addl $12, %esp - popl %ebx - popl %esi - popl %edi - popl %ebp - ret $0x10 - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/allrem.s b/reactos/lib/ntdll/rtl/i386/allrem.s deleted file mode 100644 index 133b7d57969..00000000000 --- a/reactos/lib/ntdll/rtl/i386/allrem.s +++ /dev/null @@ -1,31 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/math.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - * NOTES: This file is shared with ntoskrnl/rtl/i386/math.s. - * Please keep the files synchronized! - */ - -/* - * long long - * __allrem(long long Dividend, long long Divisor); - * - * Parameters: - * [ESP+04h] - long long Dividend - * [ESP+0Ch] - long long Divisor - * Registers: - * Unknown - * Returns: - * EDX:EAX - long long remainder (Dividend/Divisor) - * Notes: - * Routine removes the arguments from the stack. - */ -.globl __allrem -__allrem: - call ___moddi3 - ret $16 - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/allshl.s b/reactos/lib/ntdll/rtl/i386/allshl.s deleted file mode 100644 index a988299b4e2..00000000000 --- a/reactos/lib/ntdll/rtl/i386/allshl.s +++ /dev/null @@ -1,33 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/allshl.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -/* - * long long - * __allshl(long long Value, unsigned char Shift); - * - * Parameters: - * EDX:EAX - signed long long value to be shifted left - * CL - number of bits to shift by - * Registers: - * Destroys CL - * Returns: - * EDX:EAX - shifted value - */ -.globl __allshl -__allshl: - shldl %cl, %eax, %edx - sall %cl, %eax - andl $32, %ecx - je L1 - movl %eax, %edx - xorl %eax, %eax -L1: - ret - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/allshr.s b/reactos/lib/ntdll/rtl/i386/allshr.s deleted file mode 100644 index 3b4f2e99b99..00000000000 --- a/reactos/lib/ntdll/rtl/i386/allshr.s +++ /dev/null @@ -1,33 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/allshr.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -/* - * long long - * __allshr(long long Value, unsigned char Shift); - * - * Parameters: - * EDX:EAX - signed long long value to be shifted right - * CL - number of bits to shift by - * Registers: - * Destroys CL - * Returns: - * EDX:EAX - shifted value - */ -.globl __allshr -__allshr: - shrdl %cl, %edx, %eax - sarl %cl, %edx - andl $32, %ecx - je L1 - movl %edx, %eax - sarl $31, %edx -L1: - ret - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/aulldiv.s b/reactos/lib/ntdll/rtl/i386/aulldiv.s deleted file mode 100644 index 144201cd2f4..00000000000 --- a/reactos/lib/ntdll/rtl/i386/aulldiv.s +++ /dev/null @@ -1,29 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/aulldiv.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -/* - * unsigned long long - * __aulldiv(unsigned long long Dividend, unsigned long long Divisor); - * - * Parameters: - * [ESP+04h] - unsigned long long Dividend - * [ESP+0Ch] - unsigned long long Divisor - * Registers: - * Unknown - * Returns: - * EDX:EAX - unsigned long long quotient (Dividend/Divisor) - * Notes: - * Routine removes the arguments from the stack. - */ -.globl __aulldiv -__aulldiv: - call ___udivdi3 - ret $16 - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/aullrem.s b/reactos/lib/ntdll/rtl/i386/aullrem.s deleted file mode 100644 index 16fd9c3dfa2..00000000000 --- a/reactos/lib/ntdll/rtl/i386/aullrem.s +++ /dev/null @@ -1,29 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/aullrem.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -/* - * unsigned long long - * __aullrem(unsigned long long Dividend, unsigned long long Divisor); - * - * Parameters: - * [ESP+04h] - unsigned long long Dividend - * [ESP+0Ch] - unsigned long long Divisor - * Registers: - * Unknown - * Returns: - * EDX:EAX - unsigned long long remainder (Dividend%Divisor) - * Notes: - * Routine removes the arguments from the stack. - */ -.globl __aullrem -__aullrem: - call ___umoddi3 - ret $16 - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/aullshr.s b/reactos/lib/ntdll/rtl/i386/aullshr.s deleted file mode 100644 index a97793a61f8..00000000000 --- a/reactos/lib/ntdll/rtl/i386/aullshr.s +++ /dev/null @@ -1,32 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Math support for IA-32 - * FILE: lib/ntdll/rtl/i386/aullshr.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -/* - * unsigned long long - * __aullshr(unsigned long long Value, unsigned char Shift); - * - * Parameters: - * EDX:EAX - unsigned long long value to be shifted right - * CL - number of bits to shift by - * Registers: - * Destroys CL - * Returns: - * EDX:EAX - shifted value - */ -.globl __aullshr -__aullshr: - shrdl %cl, %edx, %eax - shrl %cl, %edx - andl $32, %ecx - je L1 - movl %edx, %eax -L1: - ret - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/exception.c b/reactos/lib/ntdll/rtl/i386/exception.c deleted file mode 100755 index dbc2d596885..00000000000 --- a/reactos/lib/ntdll/rtl/i386/exception.c +++ /dev/null @@ -1,429 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: User-mode exception support for IA-32 - * FILE: lib/ntdll/rtl/i386/exception.c - * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net) - */ - -/* INCLUDES *****************************************************************/ - -#include -#include -#include - -#define NDEBUG -#include - -/* FUNCTIONS ***************************************************************/ - -/* Implemented in except.s */ - -VOID -RtlpCaptureContext(PCONTEXT pContext); - -/* Macros that will help streamline the SEH implementations for - kernel mode and user mode */ - -#define SehpGetStackLimits(StackBase, StackLimit) \ -{ \ - (*(StackBase)) = NtCurrentTeb()->Tib->StackBase; \ - (*(StackLimit)) = NtCurrentTeb()->Tib->StackLimit; \ -} - -#define SehpGetExceptionList() \ - (PEXCEPTION_REGISTRATION)(NtCurrentTeb()->Tib.ExceptionList) - -#define SehpSetExceptionList(NewExceptionList) \ - NtCurrentTeb()->Tib.ExceptionList = (PVOID)(NewExceptionList) - -#define SehpCaptureContext(Context) \ -{ \ - RtlpCaptureContext(Context); \ -} - -#define SehpContinue(Context, TestAlert) \ - NtContinue(Context, TestAlert) - -/*** Code below this line is shared with ntoskrnl/rtl/i386/exception.c - please keep in sync ***/ - -VOID STDCALL -AsmDebug(ULONG Value) -{ - DbgPrint("Value 0x%.08x\n", Value); -} - - -/* Declare a few prototypes for the functions in except.s */ - -EXCEPTION_DISPOSITION -RtlpExecuteHandlerForException( - PEXCEPTION_RECORD ExceptionRecord, - PEXCEPTION_REGISTRATION RegistrationFrame, - PCONTEXT Context, - PVOID DispatcherContext, - PEXCEPTION_HANDLER ExceptionHandler); - -EXCEPTION_DISPOSITION -RtlpExecuteHandlerForUnwind( - PEXCEPTION_RECORD ExceptionRecord, - PEXCEPTION_REGISTRATION RegistrationFrame, - PCONTEXT Context, - PVOID DispatcherContext, - PEXCEPTION_HANDLER ExceptionHandler); - - -#ifndef NDEBUG - -VOID RtlpDumpExceptionRegistrations(VOID) -{ - PEXCEPTION_REGISTRATION Current; - - DbgPrint("Dumping exception registrations:\n"); - - Current = SehpGetExceptionList(); - - if ((ULONG_PTR)Current != -1) - { - while ((ULONG_PTR)Current != -1) - { - DbgPrint(" (0x%08X) HANDLER (0x%08X)\n", Current, Current->handler); - Current = Current->prev; - } - DbgPrint(" End-Of-List\n"); - } else { - DbgPrint(" No exception registrations exists.\n"); - } -} - -#endif /* NDEBUG */ - -ULONG -RtlpDispatchException(IN PEXCEPTION_RECORD ExceptionRecord, - IN PCONTEXT Context) -{ - PEXCEPTION_REGISTRATION RegistrationFrame; - DWORD DispatcherContext; - DWORD ReturnValue; - - DPRINT("RtlpDispatchException()\n"); - -#ifndef NDEBUG - RtlpDumpExceptionRegistrations(); -#endif /* NDEBUG */ - - RegistrationFrame = SehpGetExceptionList(); - - DPRINT("RegistrationFrame is 0x%X\n", RegistrationFrame); - - while ((ULONG_PTR)RegistrationFrame != -1) - { - EXCEPTION_RECORD ExceptionRecord2; - DWORD Temp = 0; - //PVOID RegistrationFrameEnd = (PVOID)RegistrationFrame + 8; - - // Make sure the registration frame is located within the stack - - DPRINT("Error checking\n"); -#if 0 - if (Teb->Tib.StackBase > RegistrationFrameEnd) - { - DPRINT("Teb->Tib.StackBase (0x%.08x) > RegistrationFrameEnd (0x%.08x)\n", - Teb->Tib.StackBase, RegistrationFrameEnd); - ExceptionRecord->ExceptionFlags |= EXCEPTION_STACK_INVALID; - return ExceptionContinueExecution; - } - // FIXME: Stack top, correct? - if (Teb->Tib.StackLimit < RegistrationFrameEnd) - { - DPRINT("Teb->Tib.StackLimit (0x%.08x) > RegistrationFrameEnd (0x%.08x)\n", - Teb->Tib.StackLimit, RegistrationFrameEnd); - ExceptionRecord->ExceptionFlags |= EXCEPTION_STACK_INVALID; - return ExceptionContinueExecution; - } - - // Make sure stack is DWORD aligned - if ((ULONG_PTR)RegistrationFrame & 3) - { - DPRINT("RegistrationFrameEnd (0x%.08x) is not DWORD aligned.\n", - RegistrationFrameEnd); - ExceptionRecord->ExceptionFlags |= EXCEPTION_STACK_INVALID; - return ExceptionContinueExecution; - } -#endif - -#if 0 - /* FIXME: */ - if (someFlag) - RtlpLogLastExceptionDisposition( hLog, retValue ); -#endif - - DPRINT("Calling handler at 0x%X\n", RegistrationFrame->handler); - DPRINT("ExceptionRecord 0x%X\n", ExceptionRecord); - DPRINT("RegistrationFrame 0x%X\n", RegistrationFrame); - DPRINT("Context 0x%X\n", Context); - DPRINT("&DispatcherContext 0x%X\n", &DispatcherContext); - - ReturnValue = RtlpExecuteHandlerForException( - ExceptionRecord, - RegistrationFrame, - Context, - &DispatcherContext, - RegistrationFrame->handler); -#ifdef DEBUG - DPRINT("Exception handler said 0x%X\n", ReturnValue); - DPRINT("RegistrationFrame == 0x%.08x\n", RegistrationFrame); - { - PULONG sp = (PULONG)((PVOID)RegistrationFrame - 0x08); - DPRINT("StandardESP == 0x%.08x\n", sp[0]); - DPRINT("Exception Pointers == 0x%.08x\n", sp[1]); - DPRINT("PrevFrame == 0x%.08x\n", sp[2]); - DPRINT("Handler == 0x%.08x\n", sp[3]); - DPRINT("ScopeTable == 0x%.08x\n", sp[4]); - DPRINT("TryLevel == 0x%.08x\n", sp[5]); - DPRINT("EBP == 0x%.08x\n", sp[6]); - } -#endif - if (RegistrationFrame == NULL) - { - ExceptionRecord->ExceptionFlags &= ~EXCEPTION_NESTED_CALL; // Turn off flag - } - - if (ReturnValue == ExceptionContinueExecution) - { - DPRINT("ReturnValue == ExceptionContinueExecution\n"); - if (ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) - { - DPRINT("(ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) == TRUE\n"); - - ExceptionRecord2.ExceptionRecord = ExceptionRecord; - ExceptionRecord2.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION; - ExceptionRecord2.ExceptionFlags = EXCEPTION_NONCONTINUABLE; - ExceptionRecord2.NumberParameters = 0; - RtlRaiseException(&ExceptionRecord2); - } - else - { - /* Copy the (possibly changed) context back to the trap frame and return */ - SehpContinue(Context, FALSE); - return ExceptionContinueExecution; - } - } - else if (ReturnValue == ExceptionContinueSearch) - { - DPRINT("ReturnValue == ExceptionContinueSearch\n"); - - /* Nothing to do here */ - } - else if (ReturnValue == ExceptionNestedException) - { - DPRINT("ReturnValue == ExceptionNestedException\n"); - - ExceptionRecord->ExceptionFlags |= EXCEPTION_EXIT_UNWIND; - if (DispatcherContext > Temp) - { - Temp = DispatcherContext; - } - } - else /* if (ReturnValue == ExceptionCollidedUnwind) */ - { - DPRINT("ReturnValue == ExceptionCollidedUnwind or unknown\n"); - - ExceptionRecord2.ExceptionRecord = ExceptionRecord; - ExceptionRecord2.ExceptionCode = STATUS_INVALID_DISPOSITION; - ExceptionRecord2.ExceptionFlags = EXCEPTION_NONCONTINUABLE; - ExceptionRecord2.NumberParameters = 0; - RtlRaiseException(&ExceptionRecord2); - } - - RegistrationFrame = RegistrationFrame->prev; // Go to previous frame - } - - /* No exception handler will handle this exception */ - - DPRINT("RtlpDispatchException(): Return ExceptionContinueExecution\n"); - - return ExceptionContinueExecution; -} - -/* - * @implemented - */ -VOID STDCALL -RtlUnwind(PEXCEPTION_REGISTRATION RegistrationFrame, - PVOID ReturnAddress, - PEXCEPTION_RECORD ExceptionRecord, - DWORD EaxValue) -{ - PEXCEPTION_REGISTRATION ERHead; - PEXCEPTION_RECORD pExceptRec; - EXCEPTION_RECORD TempER; - CONTEXT Context; - - DPRINT("RtlUnwind(). RegistrationFrame 0x%X\n", RegistrationFrame); - -#ifndef NDEBUG - RtlpDumpExceptionRegistrations(); -#endif /* NDEBUG */ - - ERHead = SehpGetExceptionList(); - - DPRINT("ERHead is 0x%X\n", ERHead); - - if (ExceptionRecord == NULL) // The normal case - { - DPRINT("ExceptionRecord == NULL (normal)\n"); - - pExceptRec = &TempER; - pExceptRec->ExceptionFlags = 0; - pExceptRec->ExceptionCode = STATUS_UNWIND; - pExceptRec->ExceptionRecord = NULL; - pExceptRec->ExceptionAddress = ReturnAddress; - pExceptRec->ExceptionInformation[0] = 0; - } - else - { - pExceptRec = ExceptionRecord; - } - - if (RegistrationFrame) - pExceptRec->ExceptionFlags |= EXCEPTION_UNWINDING; - else - pExceptRec->ExceptionFlags |= (EXCEPTION_UNWINDING|EXCEPTION_EXIT_UNWIND); - -#ifndef NDEBUG - DPRINT("ExceptionFlags == 0x%x:\n", pExceptRec->ExceptionFlags); - if (pExceptRec->ExceptionFlags & EXCEPTION_UNWINDING) - { - DPRINT(" * EXCEPTION_UNWINDING (0x%x)\n", EXCEPTION_UNWINDING); - } - if (pExceptRec->ExceptionFlags & EXCEPTION_EXIT_UNWIND) - { - DPRINT(" * EXCEPTION_EXIT_UNWIND (0x%x)\n", EXCEPTION_EXIT_UNWIND); - } -#endif /* NDEBUG */ - - Context.ContextFlags = - (CONTEXT_i386 | CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS); - - SehpCaptureContext(&Context); - - DPRINT("Context.Eip = 0x%.08x\n", Context.Eip); - DPRINT("Context.Ebp = 0x%.08x\n", Context.Ebp); - DPRINT("Context.Esp = 0x%.08x\n", Context.Esp); - - Context.Esp += 0x10; - Context.Eax = EaxValue; - - // Begin traversing the list of EXCEPTION_REGISTRATION - while ((ULONG_PTR)ERHead != -1) - { - EXCEPTION_RECORD er2; - - DPRINT("ERHead 0x%X\n", ERHead); - - if (ERHead == RegistrationFrame) - { - DPRINT("Continueing execution\n"); - SehpContinue(&Context, FALSE); - return; - } - else - { - // If there's an exception frame, but it's lower on the stack - // than the head of the exception list, something's wrong! - if (RegistrationFrame && (RegistrationFrame <= ERHead)) - { - DPRINT("The exception frame is bad\n"); - - // Generate an exception to bail out - er2.ExceptionRecord = pExceptRec; - er2.NumberParameters = 0; - er2.ExceptionCode = STATUS_INVALID_UNWIND_TARGET; - er2.ExceptionFlags = EXCEPTION_NONCONTINUABLE; - - RtlRaiseException(&er2); - } - } - -#if 0 - Stack = ERHead + sizeof(EXCEPTION_REGISTRATION); - if ( (Teb->Tib.StackBase <= (PVOID)ERHead ) // Make sure that ERHead - && (Teb->Tib.->StackLimit >= (PVOID)Stack ) // is in range, and a multiple - && (0 == ((ULONG_PTR)ERHead & 3)) ) // of 4 (i.e., sane) - { -#else - if (1) { -#endif - PEXCEPTION_REGISTRATION NewERHead; - PEXCEPTION_REGISTRATION pCurrExceptReg; - EXCEPTION_DISPOSITION ReturnValue; - - DPRINT("Executing handler at 0x%X for unwind\n", ERHead->handler); - - ReturnValue = RtlpExecuteHandlerForUnwind( - pExceptRec, - ERHead, - &Context, - &NewERHead, - ERHead->handler); - - DPRINT("Handler at 0x%X returned 0x%X\n", ERHead->handler, ReturnValue); - - if (ReturnValue != ExceptionContinueSearch) - { - if (ReturnValue != ExceptionCollidedUnwind) - { - DPRINT("Bad return value\n"); - - er2.ExceptionRecord = pExceptRec; - er2.NumberParameters = 0; - er2.ExceptionCode = STATUS_INVALID_DISPOSITION; - er2.ExceptionFlags = EXCEPTION_NONCONTINUABLE; - - RtlRaiseException(&er2); - } - else - { - ERHead = NewERHead; - } - } - - pCurrExceptReg = ERHead; - ERHead = ERHead->prev; - - DPRINT("New ERHead is 0x%X\n", ERHead); - - DPRINT("Setting exception registration at 0x%X as current\n", - RegistrationFrame->prev); - - // Unlink the exception handler - SehpSetExceptionList(RegistrationFrame->prev); - } - else // The stack looks goofy! Raise an exception to bail out - { - DPRINT("Bad stack\n"); - - er2.ExceptionRecord = pExceptRec; - er2.NumberParameters = 0; - er2.ExceptionCode = STATUS_BAD_STACK; - er2.ExceptionFlags = EXCEPTION_NONCONTINUABLE; - - RtlRaiseException(&er2); - } - } - - // If we get here, we reached the end of the EXCEPTION_REGISTRATION list. - // This shouldn't happen normally. - - DPRINT("Ran out of exception registrations. RegistrationFrame is (0x%X)\n", - RegistrationFrame); - - if ((ULONG_PTR)RegistrationFrame == -1) - SehpContinue(&Context, FALSE); - else - NtRaiseException(pExceptRec, &Context, 0); -} - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/float.c b/reactos/lib/ntdll/rtl/i386/float.c deleted file mode 100644 index 8032dd5ef95..00000000000 --- a/reactos/lib/ntdll/rtl/i386/float.c +++ /dev/null @@ -1,12 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Floating point initializer - * FILE: lib/ntdll/rtl/i386/float.c - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) - */ - -int _fltused = 0x9875; - -/* EOF */ diff --git a/reactos/lib/ntdll/rtl/i386/ftol.c b/reactos/lib/ntdll/rtl/i386/ftol.c index 08324865269..a1aa485457a 100644 --- a/reactos/lib/ntdll/rtl/i386/ftol.c +++ b/reactos/lib/ntdll/rtl/i386/ftol.c @@ -8,6 +8,7 @@ * REVISION HISTORY: 2003/04/24 Created */ +int _fltused = 0x9875; /* * This routine is called by MSVC-generated code to convert from floating point * to integer representation. The floating point number to be converted is diff --git a/reactos/lib/psapi/psapi.c b/reactos/lib/psapi/psapi.c index ff2464c6db0..c6cb1275588 100644 --- a/reactos/lib/psapi/psapi.c +++ b/reactos/lib/psapi/psapi.c @@ -71,7 +71,7 @@ typedef struct _ENUM_PROCESSES_CONTEXT } ENUM_PROCESSES_CONTEXT, *PENUM_PROCESSES_CONTEXT; NTSTATUS STDCALL -EnumProcessesCallback(IN PSYSTEM_PROCESSES CurrentProcess, +EnumProcessesCallback(IN PSYSTEM_PROCESS_INFORMATION CurrentProcess, IN OUT PVOID CallbackContext) { PENUM_PROCESSES_CONTEXT Context = (PENUM_PROCESSES_CONTEXT)CallbackContext; @@ -83,7 +83,7 @@ EnumProcessesCallback(IN PSYSTEM_PROCESSES CurrentProcess, } /* return current process */ - *Context->lpidProcess = (DWORD)CurrentProcess->ProcessId; + *Context->lpidProcess = (DWORD)CurrentProcess->UniqueProcessId; /* go to next array slot */ Context->lpidProcess++; diff --git a/reactos/lib/rosky/libskygi/libskygi.c b/reactos/lib/rosky/libskygi/libskygi.c index 5f7c433b62d..b0f50cce19d 100644 --- a/reactos/lib/rosky/libskygi/libskygi.c +++ b/reactos/lib/rosky/libskygi/libskygi.c @@ -404,7 +404,7 @@ GI_create_app(app_para *p) Style = IntMapWindowStyle(p->ulStyle, &ExStyle); /* convert the window caption to unicode */ - MultiByteToWideChar(CP_UTF8, 0, p->cpName, -1, WindowName, + MultiByteToWideChar(CP_UTF8, 0, (char*)p->cpName, -1, WindowName, sizeof(WindowName) / sizeof(WindowName[0])); skw->Window.win_func = p->win_func; @@ -1076,7 +1076,7 @@ GI_create_menu_item(unsigned char *Text, DBG("GI_create_menu_item(0x%x, 0x%x, 0x%x, 0x%x)\n", Text, Id, Flags, Enabled); - TextLength = MultiByteToWideChar(CP_UTF8, 0, Text, -1, NULL, 0); + TextLength = MultiByteToWideChar(CP_UTF8, 0, (char*)Text, -1, NULL, 0); MenuItem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SKY_MENUITEM) + TextLength * sizeof(WCHAR)); if (MenuItem == NULL) @@ -1084,7 +1084,7 @@ GI_create_menu_item(unsigned char *Text, return NULL; } - lstrcpyA(MenuItem->MenuItem.text, Text); + lstrcpyA((char*)MenuItem->MenuItem.text, (char*)Text); MenuItem->MenuItem.ID = Id; MenuItem->MenuItem.flags = Flags; MenuItem->MenuItem.enabled = Enabled; @@ -1099,7 +1099,7 @@ GI_create_menu_item(unsigned char *Text, MenuItem->MenuItemInfo.wID = Id; MenuItem->MenuItemInfo.dwTypeData = (LPWSTR)(MenuItem + 1); MenuItem->MenuItemInfo.cch = TextLength; - MultiByteToWideChar(CP_UTF8, 0, Text, TextLength, (LPWSTR)(MenuItem + 1), + MultiByteToWideChar(CP_UTF8, 0, (char*)Text, TextLength, (LPWSTR)(MenuItem + 1), TextLength); return (widget_menu_item *)MenuItem; diff --git a/reactos/lib/rpcrt4/ndr_marshall.c b/reactos/lib/rpcrt4/ndr_marshall.c index 314f7ee7c48..36bd4c3034c 100644 --- a/reactos/lib/rpcrt4/ndr_marshall.c +++ b/reactos/lib/rpcrt4/ndr_marshall.c @@ -1161,7 +1161,15 @@ unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (pFormat[0] != RPC_FC_STRUCT) EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat+4); + /* + * This test does not work when NdrSimpleStructMarshall is called + * by an rpc-server to marshall data to return to the client because + * BufferStart and BufferEnd are bogus. MIDL does not update them + * when a new buffer is allocated in order to return data to the caller. + */ +#if 0 STD_OVERFLOW_CHECK(pStubMsg); +#endif return NULL; } @@ -1201,20 +1209,22 @@ unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, /*********************************************************************** - * NdrSimpleStructUnmarshall [RPCRT4.@] + * NdrSimpleTypeUnmarshall [RPCRT4.@] */ -void WINAPI NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, - unsigned char FormatChar ) +void WINAPI NdrSimpleTypeMarshall(PMIDL_STUB_MESSAGE pStubMsg, + unsigned char *pMemory, + unsigned char FormatChar) { FIXME("stub\n"); } /*********************************************************************** - * NdrSimpleStructUnmarshall [RPCRT4.@] + * NdrSimpleTypeUnmarshall [RPCRT4.@] */ -void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, - unsigned char FormatChar ) +void WINAPI NdrSimpleTypeUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, + unsigned char *pMemory, + unsigned char FormatChar) { FIXME("stub\n"); } diff --git a/reactos/lib/rpcrt4/rpcrt4_main.c b/reactos/lib/rpcrt4/rpcrt4_main.c index cdf54512aec..3f7da12d0c6 100644 --- a/reactos/lib/rpcrt4/rpcrt4_main.c +++ b/reactos/lib/rpcrt4/rpcrt4_main.c @@ -152,8 +152,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hinstDLL); master_mutex = CreateMutexA( NULL, FALSE, RPCSS_MASTER_MUTEX_NAME); - if (!master_mutex) - ERR("Failed to create master mutex\n"); break; case DLL_PROCESS_DETACH: diff --git a/reactos/lib/rtl/access.c b/reactos/lib/rtl/access.c new file mode 100644 index 00000000000..f12870468bf --- /dev/null +++ b/reactos/lib/rtl/access.c @@ -0,0 +1,68 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: lib/rtl/access.c + * PURPOSE: Access rights handling functions + * + * PROGRAMMERS: Eric Kohl + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +#define NDEBUG +#include + +/* FUNCTIONS ***************************************************************/ + +/* + * @implemented + */ +BOOLEAN STDCALL +RtlAreAllAccessesGranted(ACCESS_MASK GrantedAccess, + ACCESS_MASK DesiredAccess) +{ + PAGED_CODE_RTL(); + return ((GrantedAccess & DesiredAccess) == DesiredAccess); +} + + +/* + * @implemented + */ +BOOLEAN STDCALL +RtlAreAnyAccessesGranted(ACCESS_MASK GrantedAccess, + ACCESS_MASK DesiredAccess) +{ + PAGED_CODE_RTL(); + return ((GrantedAccess & DesiredAccess) != 0); +} + + +/* + * @implemented + */ +VOID STDCALL +RtlMapGenericMask(PACCESS_MASK AccessMask, + PGENERIC_MAPPING GenericMapping) +{ + PAGED_CODE_RTL(); + + if (*AccessMask & GENERIC_READ) + *AccessMask |= GenericMapping->GenericRead; + + if (*AccessMask & GENERIC_WRITE) + *AccessMask |= GenericMapping->GenericWrite; + + if (*AccessMask & GENERIC_EXECUTE) + *AccessMask |= GenericMapping->GenericExecute; + + if (*AccessMask & GENERIC_ALL) + *AccessMask |= GenericMapping->GenericAll; + + *AccessMask &= ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); +} + +/* EOF */ diff --git a/reactos/ntoskrnl/rtl/i386/alldiv.s b/reactos/lib/rtl/i386/alldiv.s similarity index 94% rename from reactos/ntoskrnl/rtl/i386/alldiv.s rename to reactos/lib/rtl/i386/alldiv.s index ae6fe9acbe1..ba235b80966 100644 --- a/reactos/ntoskrnl/rtl/i386/alldiv.s +++ b/reactos/lib/rtl/i386/alldiv.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: alldiv.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/ntoskrnl/rtl/i386/allmul.s b/reactos/lib/rtl/i386/allmul.s similarity index 95% rename from reactos/ntoskrnl/rtl/i386/allmul.s rename to reactos/lib/rtl/i386/allmul.s index ab310d06c6c..55e4e498b24 100644 --- a/reactos/ntoskrnl/rtl/i386/allmul.s +++ b/reactos/lib/rtl/i386/allmul.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: allmul.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/ntoskrnl/rtl/i386/allrem.s b/reactos/lib/rtl/i386/allrem.s similarity index 93% rename from reactos/ntoskrnl/rtl/i386/allrem.s rename to reactos/lib/rtl/i386/allrem.s index c4a7dbf7856..fa2bce46f2e 100644 --- a/reactos/ntoskrnl/rtl/i386/allrem.s +++ b/reactos/lib/rtl/i386/allrem.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: allrem.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/ntoskrnl/rtl/i386/allshl.s b/reactos/lib/rtl/i386/allshl.s similarity index 93% rename from reactos/ntoskrnl/rtl/i386/allshl.s rename to reactos/lib/rtl/i386/allshl.s index d816439786d..4d3c5bf6f14 100644 --- a/reactos/ntoskrnl/rtl/i386/allshl.s +++ b/reactos/lib/rtl/i386/allshl.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: allshl.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/ntoskrnl/rtl/i386/allshr.s b/reactos/lib/rtl/i386/allshr.s similarity index 93% rename from reactos/ntoskrnl/rtl/i386/allshr.s rename to reactos/lib/rtl/i386/allshr.s index 08a9ea8d56a..3423db29d8a 100644 --- a/reactos/ntoskrnl/rtl/i386/allshr.s +++ b/reactos/lib/rtl/i386/allshr.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: allshr.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/ntoskrnl/rtl/i386/aulldiv.s b/reactos/lib/rtl/i386/aulldiv.s similarity index 93% rename from reactos/ntoskrnl/rtl/i386/aulldiv.s rename to reactos/lib/rtl/i386/aulldiv.s index 1446b385fc5..f88cb25c8aa 100644 --- a/reactos/ntoskrnl/rtl/i386/aulldiv.s +++ b/reactos/lib/rtl/i386/aulldiv.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: aulldiv.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/ntoskrnl/rtl/i386/aullrem.s b/reactos/lib/rtl/i386/aullrem.s similarity index 93% rename from reactos/ntoskrnl/rtl/i386/aullrem.s rename to reactos/lib/rtl/i386/aullrem.s index 47891823f72..e9af91d2ce6 100644 --- a/reactos/ntoskrnl/rtl/i386/aullrem.s +++ b/reactos/lib/rtl/i386/aullrem.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: aullrem.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/ntoskrnl/rtl/i386/aullshr.s b/reactos/lib/rtl/i386/aullshr.s similarity index 92% rename from reactos/ntoskrnl/rtl/i386/aullshr.s rename to reactos/lib/rtl/i386/aullshr.s index 0d7bbcda6f1..44df14b05b5 100644 --- a/reactos/ntoskrnl/rtl/i386/aullshr.s +++ b/reactos/lib/rtl/i386/aullshr.s @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: aullshr.s 12852 2005-01-06 13:58:04Z mf $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel diff --git a/reactos/lib/rtl/makefile b/reactos/lib/rtl/makefile index 6987763c93e..005a46926b7 100644 --- a/reactos/lib/rtl/makefile +++ b/reactos/lib/rtl/makefile @@ -17,6 +17,7 @@ TARGET_CFLAGS += -DDBG endif TARGET_OBJECTS = \ + access.o \ acl.o \ ppb.o \ bit.o \ @@ -51,7 +52,15 @@ TARGET_OBJECTS = \ version.o \ i386/chkstk.o \ i386/exception.o \ - i386/except.o + i386/except.o \ + i386/alldiv.o \ + i386/allmul.o \ + i386/allrem.o \ + i386/allshl.o \ + i386/allshr.o \ + i386/aulldiv.o \ + i386/aullrem.o \ + i386/aullshr.o \ # atom # registry diff --git a/reactos/lib/rtl/rtl.xml b/reactos/lib/rtl/rtl.xml index 9a689761b64..189d2881222 100644 --- a/reactos/lib/rtl/rtl.xml +++ b/reactos/lib/rtl/rtl.xml @@ -1,9 +1,18 @@ + allshl.s + aulldiv.s + aullrem.s + allshr.s + allmul.s + aullshr.s + alldiv.s + allrem.s chkstk.s except.s exception.c + access.c acl.c bit.c bitmap.c diff --git a/reactos/lib/shell32/Makefile.ros-template b/reactos/lib/shell32/Makefile.ros-template index 1268c4a1dde..dacc69e69a1 100644 --- a/reactos/lib/shell32/Makefile.ros-template +++ b/reactos/lib/shell32/Makefile.ros-template @@ -19,7 +19,7 @@ TARGET_CLEAN = authors.c default: all authors.c: -ifeq ($(HOST),mingw32-linux) +ifeq ($(HOST_TYPE),unix) echo 'const char * const SHELL_Authors[] = { "Copyright 1993-2005 WINE team", "Copyright 1998-2005 ReactOS team", 0 };' > authors.c else echo const char * const SHELL_Authors[] = { "Copyright 1993-2005 WINE team", "Copyright 1998-2005 ReactOS team", 0 }; > authors.c diff --git a/reactos/lib/smdll/query.c b/reactos/lib/smdll/query.c index 0e8fe38c7fd..078cf4b5207 100644 --- a/reactos/lib/smdll/query.c +++ b/reactos/lib/smdll/query.c @@ -1,39 +1,105 @@ -/* $Id: compses.c 13731 2005-02-23 23:37:06Z ea $ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/smdll/query.c - * PURPOSE: Call SM API SM_API_QUERY (not in NT) + * PURPOSE: Call SM API SM_API_QUERY_INFORMATION (not in NT) */ #define NTOS_MODE_USER #include -#include #include #define NDEBUG #include + /********************************************************************** * NAME EXPORTED - * SmQuery/4 + * SmQueryInformation/5 * * DESCRIPTION + * Ask the SM to collect some data from its internal data + * structures and send it back. * * ARGUMENTS - * + * hSmApiPort: handle returned by SmConnectApiPort; + * SmInformationClass: an SM information class ID: + * SM_BASIC_INFORMATION: the number of registered subsystems + * Data: pointer to storage for the information to request; + * DataLength: length in bytes of the Data buffer; it must be + * set and must match the SmInformationClass info size; + * ReturnedDataLength: optional pointer to storage to receive + * the size of the returnede data. + * * RETURN VALUE + * STATUS_SUCCESS: OK you get what you asked for; + * STATUS_INFO_LENGTH_MISMATCH: you set DataLength to 0 or to a + * value that does not match whet the SmInformationClass + * requires; + * STATUS_INVALID_PARAMETER_2: bad information class; + * A port error. + * */ NTSTATUS STDCALL -SmQuery (IN HANDLE SmApiPort, - IN SM_INFORMATION_CLASS SmInformationClass, - IN OUT PVOID Data, - IN OUT PULONG DataLength) +SmQueryInformation (IN HANDLE hSmApiPort, + IN SM_INFORMATION_CLASS SmInformationClass, + IN OUT PVOID Data, + IN ULONG DataLength, + IN OUT PULONG ReturnedDataLength OPTIONAL) { - /* TODO */ - if(NULL != DataLength) + NTSTATUS Status = STATUS_SUCCESS; + SM_PORT_MESSAGE SmReqMsg; + + + if(0 == DataLength) { - *DataLength = 0; + return STATUS_INFO_LENGTH_MISMATCH; } - return STATUS_SUCCESS; + /* Marshal data in the port message */ + switch (SmInformationClass) + { + case SmBasicInformation: + if(DataLength != sizeof (SM_BASIC_INFORMATION)) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + SmReqMsg.Request.QryInfo.SmInformationClass = SmBasicInformation; + SmReqMsg.Request.QryInfo.DataLength = DataLength; + SmReqMsg.Request.QryInfo.BasicInformation.SubSystemCount = 0; + break; + case SmSubSystemInformation: + if(DataLength != sizeof (SM_SUBSYSTEM_INFORMATION)) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + SmReqMsg.Request.QryInfo.SmInformationClass = SmSubSystemInformation; + SmReqMsg.Request.QryInfo.DataLength = DataLength; + SmReqMsg.Request.QryInfo.SubSystemInformation.SubSystemId = + ((PSM_SUBSYSTEM_INFORMATION)Data)->SubSystemId; + break; + default: + return STATUS_INVALID_PARAMETER_2; + } + /* SM API to invoke */ + SmReqMsg.SmHeader.ApiIndex = SM_API_QUERY_INFORMATION; + + /* Prepare the port request message */ + SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE; + SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.Request); + SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE; + Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg); + if (NT_SUCCESS(Status)) + { + /* Unmarshal data */ + RtlCopyMemory (Data, & SmReqMsg.Reply.QryInfo.BasicInformation, SmReqMsg.Reply.QryInfo.DataLength); + /* Use caller provided storage to store data size */ + if(NULL != ReturnedDataLength) + { + *ReturnedDataLength = SmReqMsg.Reply.QryInfo.DataLength; + } + return SmReqMsg.SmHeader.Status; + } + DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status); + return Status; } /* EOF */ diff --git a/reactos/lib/smdll/smdll.def b/reactos/lib/smdll/smdll.def index 8be3c1fb4ae..df6394e5f0a 100644 --- a/reactos/lib/smdll/smdll.def +++ b/reactos/lib/smdll/smdll.def @@ -3,4 +3,4 @@ EXPORTS SmCompleteSession@12 SmConnectApiPort@16 SmExecuteProgram@8 -SmQuery@16 +SmQueryInformation@20 diff --git a/reactos/lib/smdll/testapi.c b/reactos/lib/smdll/testapi.c deleted file mode 100644 index cfb8b453dfd..00000000000 --- a/reactos/lib/smdll/testapi.c +++ /dev/null @@ -1,20 +0,0 @@ -/* $Id$ */ -#define NTOS_MODE_USER -#include -#include - -VOID STDCALL SmPrintPortMessage (PSM_PORT_MESSAGE SmMessage) -{ - DbgPrint ("SM_PORT_MESSAGE %08lx:\n", (ULONG) SmMessage); - DbgPrint (" Header:\n"); - DbgPrint (" MessageType = %u\n", SmMessage->Header.MessageType); - DbgPrint (" DataSize = %d\n", SmMessage->Header.DataSize); - DbgPrint (" MessageSize = %d\n", SmMessage->Header.MessageSize); - DbgPrint (" ApiIndex = %ld\n", SmMessage->ApiIndex); - DbgPrint (" Status = %08lx\n", SmMessage->Status); - DbgPrint (" ExecPgm:\n"); - DbgPrint (" NameLength = %ld\n", SmMessage->ExecPgm.NameLength); - DbgPrint (" Name = %ls\n", (LPWSTR) & SmMessage->ExecPgm.Name); -} -/* EOF */ - diff --git a/reactos/lib/smlib/compses.c b/reactos/lib/smlib/compses.c index f4b43166e2b..54542380583 100644 --- a/reactos/lib/smlib/compses.c +++ b/reactos/lib/smlib/compses.c @@ -7,7 +7,6 @@ */ #define NTOS_MODE_USER #include -#include #include #define NDEBUG @@ -42,20 +41,20 @@ SmCompleteSession (IN HANDLE hSmApiPort, DPRINT("SMLIB: %s called\n", __FUNCTION__); /* Marshal Ses in the LPC message */ - SmReqMsg.CompSes.hApiPort = hApiPort; - SmReqMsg.CompSes.hSbApiPort = hSbApiPort; + SmReqMsg.Request.CompSes.hApiPort = hApiPort; + SmReqMsg.Request.CompSes.hSbApiPort = hSbApiPort; /* SM API to invoke */ - SmReqMsg.ApiIndex = SM_API_COMPLETE_SESSION; + SmReqMsg.SmHeader.ApiIndex = SM_API_COMPLETE_SESSION; /* Port message */ SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE; - SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.CompSes); + SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.Request); SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE; Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg); if (NT_SUCCESS(Status)) { - return SmReqMsg.Status; + return SmReqMsg.SmHeader.Status; } DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status); return Status; diff --git a/reactos/lib/smlib/connect.c b/reactos/lib/smlib/connect.c index ce6f1353b68..dfd5925cbf6 100644 --- a/reactos/lib/smlib/connect.c +++ b/reactos/lib/smlib/connect.c @@ -7,7 +7,6 @@ */ #define NTOS_MODE_USER #include -#include #include #include @@ -25,26 +24,34 @@ * ARGUMENTS * pSbApiPortName: name of the Sb port the calling subsystem * server already created in the system name space; - * hSbApiPort: LPC port handle (checked, but not used); - * dwSubsystem: a valid IMAGE_SUBSYSTEM_xxx value; + * hSbApiPort: LPC port handle (checked, but not used: the + * subsystem is required to have already created + * the callback port before it connects to the SM); + * wSubsystem: a valid IMAGE_SUBSYSTEM_xxx value; * phSmApiPort: a pointer to a HANDLE, which will be * filled with a valid client-side LPC comm port. + * + * There should be only two ways to call this API: + * a) subsystems willing to register with SM will use it + * with full parameters (the function checks them); + * b) regular SM clients, will set to 0 the 1st, the 2nd, + * and the 3rd parameter. * * RETURN VALUE * If all three optional values are omitted, an LPC status. * STATUS_INVALID_PARAMETER_MIX if PortName is defined and - * both hSbApiPort and dwSubsystem are 0. + * both hSbApiPort and wSubsystem are 0. */ NTSTATUS STDCALL SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL, IN HANDLE hSbApiPort OPTIONAL, - IN DWORD dwSubsystem OPTIONAL, + IN WORD wSubSystemId OPTIONAL, IN OUT PHANDLE phSmApiPort) { UNICODE_STRING SmApiPortName; SECURITY_QUALITY_OF_SERVICE SecurityQos; NTSTATUS Status = STATUS_SUCCESS; - SM_CONNECT_DATA ConnectData = {0,{0}}; + SM_CONNECT_DATA ConnectData = {0,0,{0}}; ULONG ConnectDataLength = 0; DPRINT("SMLIB: %s called\n", __FUNCTION__); @@ -55,12 +62,13 @@ SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL, { return STATUS_INVALID_PARAMETER_1; } - if (NULL == hSbApiPort || IMAGE_SUBSYSTEM_UNKNOWN == dwSubsystem) + if (NULL == hSbApiPort || IMAGE_SUBSYSTEM_UNKNOWN == wSubSystemId) { return STATUS_INVALID_PARAMETER_MIX; } RtlZeroMemory (& ConnectData, sizeof ConnectData); - ConnectData.Subsystem = dwSubsystem; + ConnectData.Unused = 0; + ConnectData.SubSystemId = wSubSystemId; if (pSbApiPortName->Length > 0) { RtlCopyMemory (& ConnectData.SbName, diff --git a/reactos/lib/smlib/execpgm.c b/reactos/lib/smlib/execpgm.c index 75b7aaf58ff..fd29e70ede7 100644 --- a/reactos/lib/smlib/execpgm.c +++ b/reactos/lib/smlib/execpgm.c @@ -7,7 +7,6 @@ */ #define NTOS_MODE_USER #include -#include #include #include @@ -41,7 +40,8 @@ SmExecuteProgram (IN HANDLE hSmApiPort, SM_PORT_MESSAGE SmReqMsg; - DPRINT("SMLIB: %s called\n", __FUNCTION__); + DPRINT("SMLIB: %s(%08lx,'%S') called\n", + __FUNCTION__, hSmApiPort, Pgm->Buffer); /* Check Pgm's length */ if (Pgm->Length > (sizeof (Pgm->Buffer[0]) * SM_EXEXPGM_MAX_LENGTH)) @@ -50,24 +50,35 @@ SmExecuteProgram (IN HANDLE hSmApiPort, } /* Marshal Pgm in the LPC message */ RtlZeroMemory (& SmReqMsg, sizeof SmReqMsg); - SmReqMsg.ExecPgm.NameLength = Pgm->Length; - RtlCopyMemory (SmReqMsg.ExecPgm.Name, + SmReqMsg.Request.ExecPgm.NameLength = Pgm->Length; + RtlCopyMemory (SmReqMsg.Request.ExecPgm.Name, Pgm->Buffer, Pgm->Length); /* SM API to invoke */ - SmReqMsg.ApiIndex = SM_API_EXECUTE_PROGRAMME; + SmReqMsg.SmHeader.ApiIndex = SM_API_EXECUTE_PROGRAMME; /* LPC message */ SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE; - SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.ExecPgm); + SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.Request); SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE; + DPRINT("SMLIB: %s:\n" + " MessageType = %d\n" + " DataSize = %d\n" + " MessageSize = %d\n" + " sizeof(LPC_MESSAGE)==%d\n", + __FUNCTION__, + SmReqMsg.Header.MessageType, + SmReqMsg.Header.DataSize, + SmReqMsg.Header.MessageSize, + sizeof(LPC_MESSAGE)); + /* Call SM and wait for a reply */ Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg); if (NT_SUCCESS(Status)) { - return SmReqMsg.Status; + return SmReqMsg.SmHeader.Status; } DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status); return Status; diff --git a/reactos/lib/user32/windows/defwnd.c b/reactos/lib/user32/windows/defwnd.c index e0f9d0d9edc..19a803ce8d8 100644 --- a/reactos/lib/user32/windows/defwnd.c +++ b/reactos/lib/user32/windows/defwnd.c @@ -315,6 +315,7 @@ DefWndStartSizeMove(HWND hWnd, WPARAM wParam, POINT *capturePoint) } else /* SC_SIZE */ { + pt.x = pt.y = 0; while(!hittest) { if (GetMessageW(&msg, NULL, 0, 0) <= 0) @@ -479,19 +480,15 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam) } } - if (Style & WS_CHILD) - { - hWndParent = GetParent(hwnd); - } - /* Get min/max info */ WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack); GetWindowRect(hwnd, &sizingRect); - unmodRect = sizingRect; if (Style & WS_CHILD) { + hWndParent = GetParent(hwnd); MapWindowPoints( 0, hWndParent, (LPPOINT)&sizingRect, 2 ); + unmodRect = sizingRect; GetClientRect(hWndParent, &mouseRect ); clipRect = mouseRect; MapWindowPoints(hWndParent, HWND_DESKTOP, (LPPOINT)&clipRect, 2); @@ -508,6 +505,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam) SetRect(&mouseRect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); clipRect = mouseRect; } + unmodRect = sizingRect; } ClipCursor(&clipRect); diff --git a/reactos/lib/user32/windows/dialog.c b/reactos/lib/user32/windows/dialog.c index 53775c1a6da..9209b806df2 100644 --- a/reactos/lib/user32/windows/dialog.c +++ b/reactos/lib/user32/windows/dialog.c @@ -632,6 +632,13 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result ) result->faceName = (LPCWSTR)p; p += wcslen( result->faceName ) + 1; } + else + { + result->pointSize = 0; + result->weight = FW_DONTCARE; + result->italic = FALSE; + result->faceName = NULL; + } /* First control is on dword boundary */ return (LPCSTR)((((int)p) + 3) & ~3); diff --git a/reactos/lib/user32/windows/mdi.c b/reactos/lib/user32/windows/mdi.c index 61244e5b01e..4c39803220a 100644 --- a/reactos/lib/user32/windows/mdi.c +++ b/reactos/lib/user32/windows/mdi.c @@ -1066,31 +1066,24 @@ static void MDITile( HWND client, MDICLIENTINFO *ci, WPARAM wParam ) static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild ) { HMENU menu = GetMenu( frame ); -#ifndef __REACTOS__ - WND* child = WIN_FindWndPtr(hChild); -#endif HMENU hSysPopup = 0; HBITMAP hSysMenuBitmap = 0; + INT nItems; + UINT iId; + HICON hIcon; TRACE("frame %p,child %p\n",frame,hChild); -#ifndef __REACTOS__ - if( !menu || !child->hSysMenu ) - { - WIN_ReleaseWndPtr(child); + if( !menu ) return 0; + + /* if the system buttons already exist do not add them again */ + nItems = GetMenuItemCount(menu) - 1; + iId = GetMenuItemID(menu,nItems) ; + if (iId == SC_RESTORE || iId == SC_CLOSE) return 0; - } - WIN_ReleaseWndPtr(child); -#else - if( !menu || !GetSystemMenu(hChild, FALSE) ) - { - return 0; - } -#endif /* create a copy of sysmenu popup and insert it into frame menu bar */ - - if (!(hSysPopup = LoadMenuA(GetModuleHandleA("USER32"), "SYSMENU"))) + if (!(hSysPopup = GetSystemMenu(hChild, FALSE))) return 0; AppendMenuA(menu,MF_HELP | MF_BITMAP, @@ -1098,14 +1091,15 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild ) AppendMenuA(menu,MF_HELP | MF_BITMAP, SC_RESTORE, (LPSTR)(DWORD)HBMMENU_MBAR_RESTORE ); - /* In Win 95 look, the system menu is replaced by the child icon */ -#ifndef __REACTOS__ - if(TWEAK_WineLook > WIN31_LOOK) -#endif - { - HICON hIcon = (HICON)GetClassLongA(hChild, GCL_HICONSM); + AppendMenuA(menu,MF_HELP | MF_BITMAP, + SC_CLOSE, (LPSTR)(DWORD)HBMMENU_MBAR_CLOSE ); + + /* The system menu is replaced by the child icon */ + hIcon = (HICON)GetClassLongW(hChild, GCL_HICONSM); if (!hIcon) - hIcon = (HICON)GetClassLongA(hChild, GCL_HICON); + hIcon = (HICON)GetClassLongW(hChild, GCL_HICON); + if (!hIcon) + hIcon = LoadIconW(NULL, IDI_APPLICATION); if (hIcon) { HDC hMemDC; @@ -1131,14 +1125,8 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild ) hSysMenuBitmap = hBitmap; } } - } -#ifndef __REACTOS__ - else - hSysMenuBitmap = hBmpClose; -#endif - if( hSysMenuBitmap != NULL && - !InsertMenuA(menu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, + if( !InsertMenuA(menu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, (UINT_PTR)hSysPopup, (LPSTR)hSysMenuBitmap)) { TRACE("not inserted\n"); @@ -1146,15 +1134,6 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild ) return 0; } - /* The close button is only present in Win 95 look */ -#ifndef __REACTOS__ - if(TWEAK_WineLook > WIN31_LOOK) -#endif - { - AppendMenuA(menu,MF_HELP | MF_BITMAP, - SC_CLOSE, (LPSTR)(DWORD)HBMMENU_MBAR_CLOSE ); - } - EnableMenuItem(hSysPopup, SC_SIZE, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(hSysPopup, SC_MOVE, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(hSysPopup, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED); @@ -1187,7 +1166,7 @@ static BOOL MDI_RestoreFrameMenu( HWND frame, HWND hChild ) */ memset(&menuInfo, 0, sizeof(menuInfo)); menuInfo.cbSize = sizeof(menuInfo); - menuInfo.fMask = MIIM_DATA | MIIM_TYPE; + menuInfo.fMask = MIIM_DATA | MIIM_TYPE | MIIM_BITMAP; GetMenuItemInfoW(menu, 0, @@ -1196,28 +1175,11 @@ static BOOL MDI_RestoreFrameMenu( HWND frame, HWND hChild ) RemoveMenu(menu,0,MF_BYPOSITION); -#ifndef __REACTOS__ - if ( (menuInfo.fType & MFT_BITMAP) && - (LOWORD(menuInfo.dwTypeData)!=0) && - (LOWORD(menuInfo.dwTypeData)!=HBITMAP_16(hBmpClose)) ) - { - DeleteObject(HBITMAP_32(LOWORD(menuInfo.dwTypeData))); - } -#else - if ( (menuInfo.fType & MFT_BITMAP) && - (LOWORD(menuInfo.dwTypeData)!=0)) - { - DeleteObject((HBITMAP)(LOWORD(menuInfo.dwTypeData) & 0x50000)); - } -#endif + if ( menuInfo.hbmpItem != 0 ) + DeleteObject(menuInfo.hbmpItem); -#ifndef __REACTOS__ - if(TWEAK_WineLook > WIN31_LOOK) -#endif - { - /* close */ - DeleteMenu(menu,GetMenuItemCount(menu) - 1,MF_BYPOSITION); - } + /* close */ + DeleteMenu(menu,GetMenuItemCount(menu) - 1,MF_BYPOSITION); /* restore */ DeleteMenu(menu,GetMenuItemCount(menu) - 1,MF_BYPOSITION); /* minimize */ @@ -2072,8 +2034,16 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll ) #ifndef __REACTOS__ HWND *list; #else + WINDOWINFO WindowInfo; HWND hWndCurrent; #endif + /* The rectangle returned by GetClientRect always has 0,0 as top left + * because it is in client coordinates. The rectangles returned by + * GetWindowRect are in screen coordinates to make this complicated. + * + * Apparently (in ReactOS at least) the rcClient returned by GetWindowInfo + * is in screen coordinates too. + */ GetClientRect( hwnd, &clientRect ); SetRectEmpty( &childRect ); @@ -2101,6 +2071,13 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll ) HeapFree( GetProcessHeap(), 0, list ); } #else + WindowInfo.cbSize = sizeof(WindowInfo); + if (!GetWindowInfo(hwnd, &WindowInfo)) + { + ERR("Can't get window info\n"); + return; + } + hWndCurrent = GetWindow(hwnd, GW_CHILD); while (hWndCurrent != NULL) { @@ -2115,6 +2092,9 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll ) RECT WindowRect; GetWindowRect( hWndCurrent, &WindowRect ); + OffsetRect(&WindowRect, + -WindowInfo.rcClient.left, + -WindowInfo.rcClient.top); UnionRect( &childRect, &WindowRect, &childRect ); } hWndCurrent = GetWindow(hWndCurrent, GW_HWNDNEXT); @@ -2124,23 +2104,30 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll ) /* set common info values */ info.cbSize = sizeof(info); - info.fMask = SIF_POS | SIF_RANGE; + info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE; - /* set the specific */ + /* set the specific scrollbars*/ + /* Note how we set nPos to 0 because we scroll the clients instead of + * the window, and we set nPage to 1 bigger than the clientRect because + * otherwise the scrollbar never disables. This causes a somewhat ugly + * effect though while scrolling. + */ switch( scroll ) { case SB_BOTH: case SB_HORZ: info.nMin = childRect.left; - info.nMax = childRect.right - clientRect.right; - info.nPos = clientRect.left - childRect.left; + info.nMax = childRect.right; + info.nPos = 0; + info.nPage = 1 + clientRect.right - clientRect.left; SetScrollInfo(hwnd, SB_HORZ, &info, TRUE); if (scroll == SB_HORZ) break; /* fall through */ case SB_VERT: info.nMin = childRect.top; - info.nMax = childRect.bottom - clientRect.bottom; - info.nPos = clientRect.top - childRect.top; + info.nMax = childRect.bottom; + info.nPos = 0; + info.nPage = 1 + clientRect.bottom - clientRect.top; SetScrollInfo(hwnd, SB_VERT, &info, TRUE); break; } diff --git a/reactos/lib/userenv/Sv.rc b/reactos/lib/userenv/Sv.rc new file mode 100644 index 00000000000..b54f13ef975 --- /dev/null +++ b/reactos/lib/userenv/Sv.rc @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2005 David Nordenberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_PROFILEPATH "%SystemDrive%\\Documents and Settings" + IDS_APPDATA "Application Data" + IDS_DESKTOP "Skrivbord" + IDS_FAVORITES "Favoriter" + IDS_STARTMENU "Start-meny" + IDS_PROGRAMS "Start-meny\\Program" + IDS_ADMINTOOLS "Start-meny\\Program\\Administrativa verktyg" + IDS_STARTUP "Start-meny\\Program\\Autostart" + IDS_MYDOCUMENTS "Mina dokument" + IDS_MYPICTURES "Mina dokument\\Mina bilder" + IDS_MYMUSIC "Mina dokument\\Min musik" + IDS_MYVIDEOS "Mina dokument\\Mina videoklipp" + IDS_TEMPLATES "Mallar" + IDS_RECENT "Tidigare" + IDS_SENDTO "SendTo" + IDS_PRINTHOOD "Skrivare" + IDS_NETHOOD "Nätverket" + IDS_LOCALSETTINGS "Lokala inställningar" + IDS_LOCALAPPDATA "Lokala inställningar\\Application Data" + IDS_TEMP "Lokala inställningar\\Temp" + IDS_CACHE "Lokala inställningar\\Temporary Internet Files" + IDS_HISTORY "Lokala inställningar\\Tidigare" + IDS_COOKIES "Cookies" + IDS_PROGRAMFILES "%SystemDrive%\\Program files" +END diff --git a/reactos/lib/userenv/userenv.rc b/reactos/lib/userenv/userenv.rc index f89ddc50761..6f1aff6cd17 100644 --- a/reactos/lib/userenv/userenv.rc +++ b/reactos/lib/userenv/userenv.rc @@ -38,3 +38,4 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "En.rc" #include "De.rc" +#include "Sv.rc" diff --git a/reactos/lib/wininet/wininet.xml b/reactos/lib/wininet/wininet.xml new file mode 100644 index 00000000000..cf0a497b46c --- /dev/null +++ b/reactos/lib/wininet/wininet.xml @@ -0,0 +1,34 @@ + + + . + include/wine + + + + + 0x600 + 0x501 + 0x501 + wine + ntdll + kernel32 + user32 + advapi32 + shell32 + shlwapi + mpr + ws2_32 + cookie.c + dialogs.c + ftp.c + gopher.c + http.c + internet.c + netconnection.c + urlcache.c + utility.c + wininet_main.c + rsrc.rc + version.rc + wininet.spec + diff --git a/reactos/lib/ws2_32/include/ws2_32.h b/reactos/lib/ws2_32/include/ws2_32.h index 001970b348e..ad9b9491793 100644 --- a/reactos/lib/ws2_32/include/ws2_32.h +++ b/reactos/lib/ws2_32/include/ws2_32.h @@ -27,7 +27,7 @@ unsigned long strtoul(const char *nptr, char **endptr, int base); #define EXPORT STDCALL extern HANDLE GlobalHeap; -extern BOOL Initialized; /* TRUE if WSAStartup() has been successfully called */ +extern BOOL WsaInitialized; /* TRUE if WSAStartup() has been successfully called */ extern WSPUPCALLTABLE UpcallTable; #define WS2_INTERNAL_MAX_ALIAS 16 @@ -59,9 +59,9 @@ typedef struct _WINSOCK_THREAD_BLOCK { /* Macros */ -#define WSAINITIALIZED (Initialized) +#define WSAINITIALIZED (WsaInitialized) -#define WSASETINITIALIZED (Initialized = TRUE) +#define WSASETINITIALIZED (WsaInitialized = TRUE) /* ws2_32 internal Functions */ void check_hostent(struct hostent **he); diff --git a/reactos/lib/ws2_32/misc/dllmain.c b/reactos/lib/ws2_32/misc/dllmain.c index e8fced768ee..e51d0cbc187 100644 --- a/reactos/lib/ws2_32/misc/dllmain.c +++ b/reactos/lib/ws2_32/misc/dllmain.c @@ -28,7 +28,7 @@ VOID STDCALL KeBugCheck (ULONG BugCheckCode) {} HANDLE GlobalHeap; -BOOL Initialized = FALSE; /* TRUE if WSAStartup() has been successfully called */ +BOOL WsaInitialized = FALSE; /* TRUE if WSAStartup() has been successfully called */ WSPUPCALLTABLE UpcallTable; diff --git a/reactos/lib/ws2_32/misc/ns.c b/reactos/lib/ws2_32/misc/ns.c index 977f953ba7f..2d6e3aed7a1 100644 --- a/reactos/lib/ws2_32/misc/ns.c +++ b/reactos/lib/ws2_32/misc/ns.c @@ -320,14 +320,39 @@ WSAStringToAddressA( OUT LPSOCKADDR lpAddress, IN OUT LPINT lpAddressLength) { - UNIMPLEMENTED + INT ret, len; + LPWSTR szTemp; + LPWSAPROTOCOL_INFOW lpProtoInfoW = NULL; - return 0; + len = MultiByteToWideChar( CP_ACP, 0, AddressString, -1, NULL, 0 ); + szTemp = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, AddressString, -1, szTemp, len ); + + if (lpProtocolInfo) + { + len = WSAPROTOCOL_LEN+1; + lpProtoInfoW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + + memcpy( lpProtoInfoW, lpProtocolInfo, sizeof(LPWSAPROTOCOL_INFOA)); + + MultiByteToWideChar( CP_ACP, 0, lpProtocolInfo->szProtocol, -1, lpProtoInfoW->szProtocol, len ); + } + + ret = WSAStringToAddressW(szTemp, AddressFamily, lpProtoInfoW, lpAddress, lpAddressLength); + + HeapFree( GetProcessHeap(), 0, szTemp ); + + if (lpProtocolInfo) + HeapFree( GetProcessHeap(), 0, lpProtoInfoW ); + + WSASetLastError(ret); + return ret; } + /* - * @unimplemented + * @implement */ INT EXPORT @@ -338,9 +363,76 @@ WSAStringToAddressW( OUT LPSOCKADDR lpAddress, IN OUT LPINT lpAddressLength) { - UNIMPLEMENTED + int pos=0; + int res=0; + LONG inetaddr = 0; + LPWSTR *bp=NULL; - return 0; + SOCKADDR_IN *sockaddr = (SOCKADDR_IN *) lpAddress; + + if (!lpAddressLength || !lpAddress) + return SOCKET_ERROR; + + if (AddressString==NULL) + return WSAEINVAL; + + /* Set right adress family */ + if (lpProtocolInfo!=NULL) + sockaddr->sin_family = lpProtocolInfo->iAddressFamily; + + else sockaddr->sin_family = AddressFamily; + + /* Report size */ + if (AddressFamily == AF_INET) + { + if (*lpAddressLength < sizeof(SOCKADDR_IN)) + { + *lpAddressLength = sizeof(SOCKADDR_IN); + res = WSAEFAULT; + } + else + { + if (!lpAddress) + res = WSAEINVAL; + else + { + // translate now ip string to ip + + /* rest sockaddr.sin_addr.s_addr + for we need to be sure it is zero when we come to while */ + memset(lpAddress,0,sizeof(SOCKADDR_IN)); + + /* Set right adress family */ + sockaddr->sin_family = AF_INET; + + /* Get port number */ + pos = wcscspn(AddressString,L":") + 1; + if (pos < wcslen(AddressString)) + sockaddr->sin_port = wcstol(&AddressString[pos],bp,10); + + else + sockaddr->sin_port = 0; + + /* Get ip number */ + pos=0; + inetaddr=0; + + while (pos < wcslen(AddressString)) + { + inetaddr = (inetaddr<<8) + ((UCHAR)wcstol(&AddressString[pos],bp,10)); + pos += wcscspn( &AddressString[pos],L".") +1 ; + } + + res = 0; + sockaddr->sin_addr.s_addr = inetaddr; + } + + } + } + + WSASetLastError(res); + if (!res) return 0; + return SOCKET_ERROR; } void check_hostent(struct hostent **he) { @@ -1215,3 +1307,4 @@ WSAAsyncGetServByPort( } /* EOF */ + diff --git a/reactos/ntoskrnl/cc/copy.c b/reactos/ntoskrnl/cc/copy.c index 60c4893e1cb..5a6ac44a295 100644 --- a/reactos/ntoskrnl/cc/copy.c +++ b/reactos/ntoskrnl/cc/copy.c @@ -263,7 +263,7 @@ WriteCacheSegment(PCACHE_SEGMENT CacheSeg) MmBuildMdlForNonPagedPool(Mdl); Mdl->MdlFlags |= MDL_IO_PAGE_READ; KeInitializeEvent(&Event, NotificationEvent, FALSE); - Status = IoPageWrite(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, &Event, &IoStatus); + Status = IoSynchronousPageWrite(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, &Event, &IoStatus); if (Status == STATUS_PENDING) { KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); @@ -643,7 +643,7 @@ CcZeroData (IN PFILE_OBJECT FileObject, ((PPFN_TYPE)(Mdl + 1))[i] = CcZeroPage; } KeInitializeEvent(&Event, NotificationEvent, FALSE); - Status = IoPageWrite(FileObject, Mdl, &WriteOffset, &Event, &Iosb); + Status = IoSynchronousPageWrite(FileObject, Mdl, &WriteOffset, &Event, &Iosb); if (Status == STATUS_PENDING) { KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); diff --git a/reactos/ntoskrnl/cm/ntfunc.c b/reactos/ntoskrnl/cm/ntfunc.c index 9b1f635992b..53388c6602f 100644 --- a/reactos/ntoskrnl/cm/ntfunc.c +++ b/reactos/ntoskrnl/cm/ntfunc.c @@ -1115,6 +1115,10 @@ NtOpenKey(OUT PHANDLE KeyHandle, ObjectAttributes, ObjectAttributes ? ObjectAttributes->ObjectName : NULL); + /* Check place for result handle, if it's null - return immediately */ + if (KeyHandle == NULL) + return(STATUS_INVALID_PARAMETER); + PreviousMode = ExGetPreviousMode(); if(PreviousMode != KernelMode) @@ -1137,6 +1141,10 @@ NtOpenKey(OUT PHANDLE KeyHandle, } } + /* WINE checks for the length also */ + /*if (ObjectAttributes->ObjectName->Length > MAX_NAME_LENGTH) + return(STATUS_BUFFER_OVERFLOW);*/ + RemainingPath.Buffer = NULL; Status = ObFindObject(ObjectAttributes, &Object, @@ -1144,7 +1152,10 @@ NtOpenKey(OUT PHANDLE KeyHandle, CmiKeyType); if (!NT_SUCCESS(Status)) { - return(Status); + DPRINT("ObFindObject() returned 0x%08lx\n", Status); + Status = STATUS_INVALID_HANDLE; /* Because ObFindObject returns STATUS_UNSUCCESSFUL */ + hKey = *KeyHandle; /* Preserve hkResult value */ + goto openkey_cleanup; } VERIFY_KEY_OBJECT((PKEY_OBJECT) Object); @@ -1155,7 +1166,9 @@ NtOpenKey(OUT PHANDLE KeyHandle, { ObDereferenceObject(Object); RtlFreeUnicodeString(&RemainingPath); - return STATUS_OBJECT_NAME_NOT_FOUND; + Status = STATUS_OBJECT_NAME_NOT_FOUND; + hKey = NULL; + goto openkey_cleanup; } RtlFreeUnicodeString(&RemainingPath); @@ -1164,7 +1177,9 @@ NtOpenKey(OUT PHANDLE KeyHandle, if (((PKEY_OBJECT)Object)->Flags & KO_MARKED_FOR_DELETE) { ObDereferenceObject(Object); - return(STATUS_UNSUCCESSFUL); + Status = STATUS_UNSUCCESSFUL; + hKey = NULL; + goto openkey_cleanup; } Status = ObCreateHandle(PsGetCurrentProcess(), @@ -1175,10 +1190,9 @@ NtOpenKey(OUT PHANDLE KeyHandle, ObDereferenceObject(Object); if (!NT_SUCCESS(Status)) - { - return(Status); - } + hKey = NULL; +openkey_cleanup: _SEH_TRY { *KeyHandle = hKey; diff --git a/reactos/ntoskrnl/dbg/dbgctrl.c b/reactos/ntoskrnl/dbg/dbgctrl.c deleted file mode 100644 index 705fa3378a4..00000000000 --- a/reactos/ntoskrnl/dbg/dbgctrl.c +++ /dev/null @@ -1,58 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/dbgctrl.c - * PURPOSE: System debug control - * - * PROGRAMMERS: No programmer listed. - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -DbgLoadImageSymbols( - IN PUNICODE_STRING Name, - IN ULONG Base, - IN ULONG Unknown3 - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - - -NTSTATUS STDCALL -NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode, - PVOID InputBuffer, - ULONG InputBufferLength, - PVOID OutputBuffer, - ULONG OutputBufferLength, - PULONG ReturnLength) -{ - switch (ControlCode) { - case DebugGetTraceInformation: - case DebugSetInternalBreakpoint: - case DebugSetSpecialCall: - case DebugClearSpecialCalls: - case DebugQuerySpecialCalls: - case DebugDbgBreakPoint: - break; - case DebugDbgLoadSymbols: - KDB_LOADUSERMODULE_HOOK((PLDR_MODULE) InputBuffer); - break; - default: - break; - } - return STATUS_SUCCESS; -} diff --git a/reactos/ntoskrnl/dbg/errinfo.c b/reactos/ntoskrnl/dbg/errinfo.c deleted file mode 100644 index 765e5d8b762..00000000000 --- a/reactos/ntoskrnl/dbg/errinfo.c +++ /dev/null @@ -1,268 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/errinfo.c - * PURPOSE: Print information descriptions of error messages - * - * PROGRAMMERS: No programmer listed. - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -/* GLOBALS *******************************************************************/ - -static PCHAR SeverityCodes[] = {"SUC", "INF", "ERR", "WRN"}; - -static struct _FACLIST -{ - ULONG Code; - PCHAR Name; -} FacList[] = -{ - {0, "KERNEL"}, - {0, NULL} -}; - -static struct _ERRLIST -{ - NTSTATUS Code; - PCHAR Name; - PCHAR Text; -} ErrList[] = -{ - {STATUS_SUCCESS, "SUCCESS", NULL}, - {STATUS_INSUFFICIENT_RESOURCES, "INSUFFICIENT_RESOURCES", NULL}, - {STATUS_OBJECT_NAME_EXISTS, "OBJECT_NAME_EXISTS", NULL}, - {STATUS_OBJECT_NAME_COLLISION, "OBJECT_NAME_COLLISION", NULL}, - {STATUS_CTL_FILE_NOT_SUPPORTED, "CTL_FILE_NOT_SUPPORTED", NULL}, - {STATUS_PORT_ALREADY_SET, "PORT_ALREADY_SET", NULL}, - {STATUS_SECTION_NOT_IMAGE, "SECTION_NOT_IMAGE", NULL}, - {STATUS_BAD_WORKING_SET_LIMIT, "BAD_WORKING_SET_LIMIT", NULL}, - {STATUS_INCOMPATIBLE_FILE_MAP, "INCOMPATIBLE_FILE_MAP", NULL}, - {STATUS_HANDLE_NOT_WAITABLE, "HANDLE_NOT_WAITABLE", NULL}, - {STATUS_PORT_DISCONNECTED, "PORT_DISCONNECTED", NULL}, - {STATUS_NOT_LOCKED, "NOT_LOCKED", NULL}, - {STATUS_NOT_MAPPED_VIEW, "NOT_MAPPED_VIEW", NULL}, - {STATUS_UNABLE_TO_FREE_VM, "UNABLE_TO_FREE_VM", NULL}, - {STATUS_UNABLE_TO_DELETE_SECTION, "UNABLE_TO_DELETE_SECTION", NULL}, - {STATUS_MORE_PROCESSING_REQUIRED, "MORE_PROCESSING_REQUIRED", NULL}, - {STATUS_INVALID_CID, "INVALID_CID", NULL}, - {STATUS_BAD_INITIAL_STACK, "BAD_INITIAL_STACK", NULL}, - {STATUS_INVALID_VOLUME_LABEL, "INVALID_VOLUME_LABEL", NULL}, - {STATUS_SECTION_NOT_EXTENDED, "SECTION_NOT_EXTENDED", NULL}, - {STATUS_NOT_MAPPED_DATA, "NOT_MAPPED_DATA", NULL}, - {STATUS_INFO_LENGTH_MISMATCH, "INFO_LENGTH_MISMATCH", NULL}, - {STATUS_INVALID_INFO_CLASS, "INVALID_INFO_CLASS", NULL}, - {STATUS_SUSPEND_COUNT_EXCEEDED, "SUSPEND_COUNT_EXCEEDED", NULL}, - {STATUS_NOTIFY_ENUM_DIR, "NOTIFY_ENUM_DIR", NULL}, - {STATUS_REGISTRY_RECOVERED, "REGISTRY_RECOVERED", NULL}, - {STATUS_REGISTRY_IO_FAILED, "REGISTRY_IO_FAILED", NULL}, - {STATUS_KEY_DELETED, "KEY_DELETED", NULL}, - {STATUS_NO_LOG_SPACE, "NO_LOG_SPACE", NULL}, - {STATUS_KEY_HAS_CHILDREN, "KEY_HAS_CHILDREN", NULL}, - {STATUS_CHILD_MUST_BE_VOLATILE, "CHILD_MUST_BE_VOLATILE", NULL}, - {STATUS_REGISTRY_CORRUPT, "REGISTRY_CORRUPT", NULL}, - {STATUS_DLL_NOT_FOUND, "DLL_NOT_FOUND", NULL}, - {STATUS_DLL_INIT_FAILED, "DLL_INIT_FAILED", NULL}, - {STATUS_ORDINAL_NOT_FOUND, "ORDINAL_NOT_FOUND", NULL}, - {STATUS_ENTRYPOINT_NOT_FOUND, "ENTRYPOINT_NOT_FOUND", NULL}, - {STATUS_MORE_ENTRIES, "MORE_ENTRIES", NULL}, - {STATUS_BUFFER_OVERFLOW, "BUFFER_OVERFLOW", NULL}, - {STATUS_NO_MORE_FILES, "NO_MORE_FILES", NULL}, - {STATUS_NO_INHERITANCE, "NO_INHERITANCE", NULL}, - {STATUS_NO_MORE_EAS, "NO_MORE_EAS", NULL}, - {STATUS_NO_MORE_ENTRIES, "NO_MORE_ENTRIES", NULL}, - {STATUS_GUIDS_EXHAUSTED, "GUIDS_EXHAUSTED", NULL}, - {STATUS_AGENTS_EXHAUSTED, "AGENTS_EXHAUSTED", NULL}, - {STATUS_UNSUCCESSFUL, "UNSUCCESSFUL", NULL}, - {STATUS_NOT_IMPLEMENTED, "NOT_IMPLEMENTED", NULL}, - {STATUS_ILLEGAL_FUNCTION, "ILLEGAL_FUNCTION", NULL}, - {STATUS_PAGEFILE_QUOTA, "PAGEFILE_QUOTA", NULL}, - {STATUS_COMMITMENT_LIMIT, "COMMITMENT_LIMIT", NULL}, - {STATUS_SECTION_TOO_BIG, "SECTION_TOO_BIG", NULL}, - {RPC_NT_SS_IN_NULL_CONTEXT, "RPC_NT_SS_IN_NULL_CONTEXT", NULL}, - {RPC_NT_INVALID_BINDING, "RPC_NT_INVALID_BINDING", NULL}, - {STATUS_OBJECT_FILE_MISMATCH, "OBJECT_FILE_MISMATCH", NULL}, - {STATUS_FILE_CLOSED, "FILE_CLOSED", NULL}, - {STATUS_INVALID_PORT_HANDLE, "INVALID_PORT_HANDLE", NULL}, - {STATUS_NOT_COMMITTED, "NOT_COMMITTED", NULL}, - {STATUS_INVALID_PARAMETER, "INVALID_PARAMETER", NULL}, - {STATUS_INVALID_PARAMETER_1, "INVALID_PARAMETER_1", NULL}, - {STATUS_INVALID_PARAMETER_2, "INVALID_PARAMETER_2", NULL}, - {STATUS_INVALID_PARAMETER_3, "INVALID_PARAMETER_3", NULL}, - {STATUS_INVALID_PARAMETER_4, "INVALID_PARAMETER_4", NULL}, - {STATUS_INVALID_PARAMETER_5, "INVALID_PARAMETER_5", NULL}, - {STATUS_INVALID_PARAMETER_6, "INVALID_PARAMETER_6", NULL}, - {STATUS_INVALID_PARAMETER_7, "INVALID_PARAMETER_7", NULL}, - {STATUS_INVALID_PARAMETER_8, "INVALID_PARAMETER_8", NULL}, - {STATUS_INVALID_PARAMETER_9, "INVALID_PARAMETER_9", NULL}, - {STATUS_INVALID_PARAMETER_10, "INVALID_PARAMETER_10", NULL}, - {STATUS_INVALID_PARAMETER_11, "INVALID_PARAMETER_11", NULL}, - {STATUS_INVALID_PARAMETER_12, "INVALID_PARAMETER_12", NULL}, - {STATUS_INVALID_PARAMETER_MAX, "INVALID_PARAMETER_MAX", NULL}, - {STATUS_INVALID_PAGE_PROTECTION, "INVALID_PAGE_PROTECTION", NULL}, - {STATUS_RESOURCE_DATA_NOT_FOUND, "RESOURCE_DATA_NOT_FOUND", NULL}, - {STATUS_RESOURCE_TYPE_NOT_FOUND, "RESOURCE_TYPE_NOT_FOUND", NULL}, - {STATUS_RESOURCE_NAME_NOT_FOUND, "RESOURCE_NAME_NOT_FOUND", NULL}, - {STATUS_RESOURCE_LANG_NOT_FOUND, "RESOURCE_LANG_NOT_FOUND", NULL}, - {STATUS_NO_SUCH_DEVICE, "NO_SUCH_DEVICE", NULL}, - {STATUS_NO_SUCH_FILE, "NO_SUCH_FILE", NULL}, - {STATUS_INVALID_DEVICE_REQUEST, "INVALID_DEVICE_REQUEST", NULL}, - {STATUS_END_OF_FILE, "END_OF_FILE", NULL}, - {STATUS_FILE_FORCED_CLOSED, "FILE_FORCED_CLOSED", NULL}, - {STATUS_WRONG_VOLUME, "WRONG_VOLUME", NULL}, - {STATUS_NO_MEDIA, "NO_MEDIA", NULL}, - {STATUS_NO_MEDIA_IN_DEVICE, "NO_MEDIA_IN_DEVICE", NULL}, - {STATUS_NONEXISTENT_SECTOR, "NONEXISTENT_SECTOR", NULL}, - {STATUS_WORKING_SET_QUOTA, "WORKING_SET_QUOTA", NULL}, - {STATUS_CONFLICTING_ADDRESS, "CONFLICTING_ADDRESS", NULL}, - {STATUS_INVALID_SYSTEM_SERVICE, "INVALID_SYSTEM_SERVICE", NULL}, - {STATUS_THREAD_IS_TERMINATING, "THREAD_IS_TERMINATING", NULL}, - {STATUS_PROCESS_IS_TERMINATING, "PROCESS_IS_TERMINATING", NULL}, - {STATUS_INVALID_LOCK_SEQUENCE, "INVALID_LOCK_SEQUENCE", NULL}, - {STATUS_INVALID_VIEW_SIZE, "INVALID_VIEW_SIZE", NULL}, - {STATUS_ALREADY_COMMITTED, "ALREADY_COMMITTED", NULL}, - {STATUS_ACCESS_DENIED, "ACCESS_DENIED", NULL}, - {STATUS_FILE_IS_A_DIRECTORY, "FILE_IS_A_DIRECTORY", NULL}, - {STATUS_CANNOT_DELETE, "CANNOT_DELETE", NULL}, - {STATUS_INVALID_COMPUTER_NAME, "INVALID_COMPUTER_NAME", NULL}, - {STATUS_FILE_DELETED, "FILE_DELETED", NULL}, - {STATUS_DELETE_PENDING, "DELETE_PENDING", NULL}, - {STATUS_PORT_CONNECTION_REFUSED, "PORT_CONNECTION_REFUSED", NULL}, - {STATUS_NO_SUCH_PRIVILEGE, "NO_SUCH_PRIVILEGE", NULL}, - {STATUS_PRIVILEGE_NOT_HELD, "PRIVILEGE_NOT_HELD", NULL}, - {STATUS_CANNOT_IMPERSONATE, "CANNOT_IMPERSONATE", NULL}, - {STATUS_LOGON_FAILURE, "LOGON_FAILURE", NULL}, - {STATUS_ACCOUNT_RESTRICTION, "ACCOUNT_RESTRICTION", NULL}, - {STATUS_INVALID_LOGON_HOURS, "INVALID_LOGON_HOURS", NULL}, - {STATUS_INVALID_WORKSTATION, "INVALID_WORKSTATION", NULL}, - {STATUS_BUFFER_TOO_SMALL, "BUFFER_TOO_SMALL", NULL}, - {STATUS_UNABLE_TO_DECOMMIT_VM, "UNABLE_TO_DECOMMIT_VM", NULL}, - {STATUS_DISK_CORRUPT_ERROR, "DISK_CORRUPT_ERROR", NULL}, - {STATUS_OBJECT_NAME_INVALID, "OBJECT_NAME_INVALID", NULL}, - {STATUS_OBJECT_NAME_NOT_FOUND, "OBJECT_NAME_NOT_FOUND", NULL}, - {STATUS_OBJECT_PATH_INVALID, "OBJECT_PATH_INVALID", NULL}, - {STATUS_OBJECT_PATH_NOT_FOUND, "OBJECT_PATH_NOT_FOUND", NULL}, - {STATUS_DFS_EXIT_PATH_FOUND, "DFS_EXIT_PATH_FOUND", NULL}, - {STATUS_OBJECT_PATH_SYNTAX_BAD, "OBJECT_PATH_SYNTAX_BAD", NULL}, - {STATUS_DATA_OVERRUN, "DATA_OVERRUN", NULL}, - {STATUS_DATA_LATE_ERROR, "DATA_LATE_ERROR", NULL}, - {STATUS_DATA_ERROR, "DATA_ERROR", NULL}, - {STATUS_CRC_ERROR, "CRC_ERROR", NULL}, - {STATUS_SHARING_VIOLATION, "SHARING_VIOLATION", NULL}, - {STATUS_QUOTA_EXCEEDED, "QUOTA_EXCEEDED", NULL}, - {STATUS_MUTANT_NOT_OWNED, "MUTANT_NOT_OWNED", NULL}, - {STATUS_SEMAPHORE_LIMIT_EXCEEDED, "SEMAPHORE_LIMIT_EXCEEDED", NULL}, - {STATUS_DISK_FULL, "DISK_FULL", NULL}, - {STATUS_LOCK_NOT_GRANTED, "LOCK_NOT_GRANTED", NULL}, - {STATUS_DEVICE_NOT_READY, "DEVICE_NOT_READY", NULL}, - {STATUS_IO_TIMEOUT, "IO_TIMEOUT", NULL}, - {STATUS_MEDIA_WRITE_PROTECTED, "MEDIA_WRITE_PROTECTED", NULL}, - {STATUS_NO_MEDIA_IN_DRIVE, "NO_MEDIA_IN_DRIVE", NULL}, - {STATUS_VERIFY_REQUIRED, "VERIFY_REQUIRED", NULL}, - {STATUS_UNRECOGNIZED_MEDIA, "UNRECOGNIZED_MEDIA", NULL}, - {STATUS_UNRECOGNIZED_VOLUME, "UNRECOGNIZED_VOLUME", NULL}, - {STATUS_FS_DRIVER_REQUIRED, "FS_DRIVER_REQUIRED", NULL}, - {STATUS_NOT_SUPPORTED, "NOT_SUPPORTED", NULL}, - {STATUS_DISK_OPERATION_FAILED, "DISK_OPERATION_FAILED", NULL}, - {STATUS_FS_QUERY_REQUIRED, "FS_QUERY_REQUIRED", NULL}, - {0, NULL, NULL} -}; - -/* FUNCTIONS *****************************************************************/ - -VOID -DbgGetErrorText(NTSTATUS ErrorCode, PUNICODE_STRING ErrorText, ULONG Flags) -{ - int i; - char TempBuf[255], NumBuf[32]; - ANSI_STRING AnsiString; - - TempBuf[0] = '\0'; - if (Flags & DBG_GET_SHOW_FACILITY) - { - if (NT_CUSTOMER(ErrorCode)) - { - _snprintf(TempBuf, sizeof(TempBuf)-1, - "%%CUST-%s-", - SeverityCodes[NT_SEVERITY(ErrorCode)]); - TempBuf[sizeof(TempBuf)-1] = '\0'; - } - else - { - for (i = 0; FacList[i].Name != NULL; i++) - { - if (FacList[i].Code == (ULONG) NT_FACILITY(ErrorCode)) - { - break; - } - } - if (FacList[i].Name != NULL) - { - _snprintf(TempBuf, sizeof(TempBuf)-1, "%%%s-%s-", - FacList[i].Name, - SeverityCodes[NT_SEVERITY(ErrorCode)]); - TempBuf[sizeof(TempBuf)-1] = '\0'; - } - else - { - _snprintf(TempBuf, sizeof(TempBuf)-1, "%%UNKNOWN-%s-", - SeverityCodes[NT_SEVERITY(ErrorCode)]); - TempBuf[sizeof(TempBuf)-1] = '\0'; - } - } - } - for (i = 0; ErrList[i].Name != NULL; i++) - { - if (ErrorCode == ErrList[i].Code) - { - break; - } - } - if (ErrList[i].Name != NULL) - { - if (Flags & DBG_GET_SHOW_FACILITY) - { - strcat(TempBuf, ErrList[i].Name); - strcat(TempBuf, " "); - } - if (ErrList[i].Text != NULL) - { - strcat(TempBuf, ErrList[i].Text); - } - else - { - strcat(TempBuf, ErrList[i].Name); - } - } - else - { - if (Flags & DBG_GET_SHOW_FACILITY) - { - _snprintf(NumBuf, sizeof(NumBuf)-1, "%08lx", ErrorCode); - NumBuf[sizeof(NumBuf)-1] = '\0'; - strcat(TempBuf, NumBuf); - strcat(TempBuf, " "); - } - sprintf(NumBuf, "Unknown Message #%08lx", ErrorCode); - strcat(TempBuf, NumBuf); - } - RtlInitAnsiString(&AnsiString, TempBuf); - RtlAnsiStringToUnicodeString(ErrorText, &AnsiString, TRUE); -} - -VOID -DbgPrintErrorMessage(NTSTATUS ErrorCode) -{ - UNICODE_STRING ErrorText; - - DbgGetErrorText(ErrorCode, &ErrorText, 0xf); - DbgPrint("%wZ\n", &ErrorText); - RtlFreeUnicodeString(&ErrorText); -} - - diff --git a/reactos/ntoskrnl/dbg/rdebug.c b/reactos/ntoskrnl/dbg/rdebug.c deleted file mode 100644 index f9aefe69717..00000000000 --- a/reactos/ntoskrnl/dbg/rdebug.c +++ /dev/null @@ -1,134 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/rdebug.c - * PURPOSE: Runtime debugging support - * - * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* GLOBALS ******************************************************************/ - -typedef struct _RDEBUG_ENTRY { - LIST_ENTRY ListEntry; - CHAR Filename[MAX_PATH]; -} RDEBUG_ENTRY, *PRDEBUG_ENTRY; - -LIST_ENTRY RDebugListHead; -BOOLEAN RDebugInitialized = FALSE; - -/* FUNCTIONS ****************************************************************/ - -PRDEBUG_ENTRY -DbgpFind(PCH Filename) -{ - PLIST_ENTRY Current; - PRDEBUG_ENTRY Entry; - - Current = RDebugListHead.Flink; - while (Current != &RDebugListHead) - { - Entry = CONTAINING_RECORD(Current, RDEBUG_ENTRY, ListEntry); - - if (strcmp(Filename, Entry->Filename) == 0) - { - return Entry; - } - Current = Current->Flink; - } - - return(NULL); -} - -VOID INIT_FUNCTION -DbgRDebugInit(VOID) -{ - if (RDebugInitialized) - return; - - InitializeListHead(&RDebugListHead); - RDebugInitialized = TRUE; -} - -VOID -DbgShowFiles(VOID) -{ - PLIST_ENTRY Current; - PRDEBUG_ENTRY Entry; - ULONG Count; - - if (!RDebugInitialized) - return; - - Count = 0; - Current = RDebugListHead.Flink; - while (Current != &RDebugListHead) - { - Entry = CONTAINING_RECORD(Current, RDEBUG_ENTRY, ListEntry); - - DbgPrint(" %s\n", Entry->Filename); - Count++; - - Current = Current->Flink; - } - - if (Count == 1) - { - DbgPrint(" 1 file listed\n"); - } - else - { - DbgPrint(" %d files listed\n", Count); - } -} - -VOID -DbgEnableFile(PCH Filename) -{ - PRDEBUG_ENTRY Entry; - - if (!RDebugInitialized) - return; - - if (!DbgpFind(Filename)) - { - Entry = ExAllocatePool(NonPagedPool, sizeof(RDEBUG_ENTRY)); - ASSERT(Entry); - RtlMoveMemory(Entry->Filename, Filename, strlen(Filename) + 1); - InsertTailList(&RDebugListHead, &Entry->ListEntry); - } -} - -VOID -DbgDisableFile(PCH Filename) -{ - PRDEBUG_ENTRY Entry; - - if (!RDebugInitialized) - return; - - Entry = DbgpFind(Filename); - - if (Entry) - { - RemoveEntryList(&Entry->ListEntry); - } -} - -BOOLEAN -DbgShouldPrint(PCH Filename) -{ - if (!RDebugInitialized) - return FALSE; - - return(DbgpFind(Filename) != NULL); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/dbg/user.c b/reactos/ntoskrnl/dbgk/dbgkutil.c similarity index 50% rename from reactos/ntoskrnl/dbg/user.c rename to reactos/ntoskrnl/dbgk/dbgkutil.c index c4882b12fab..0d3fc793996 100644 --- a/reactos/ntoskrnl/dbg/user.c +++ b/reactos/ntoskrnl/dbgk/dbgkutil.c @@ -1,23 +1,25 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/user.c - * PURPOSE: User mode debugging - * - * PROGRAMMERS: David Welch (welch@cwcom.net) + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/dbgk/dbgkutil.c + * PURPOSE: User-Mode Debugging Support, Internal Debug Functions. + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) */ -/* INCLUDES ******************************************************************/ +/* INCLUDES *****************************************************************/ #include +#define NDEBUG #include /* FUNCTIONS *****************************************************************/ VOID +STDCALL DbgkCreateThread(PVOID StartAddress) { +#if 0 LPC_DBG_MESSAGE Message; LPC_DBG_MESSAGE Reply; NTSTATUS Status; @@ -49,42 +51,7 @@ DbgkCreateThread(PVOID StartAddress) /* FIXME: Examine reply */ return; -} - -ULONG -DbgkForwardException(EXCEPTION_RECORD Er, ULONG FirstChance) -{ - LPC_DBG_MESSAGE Message; - LPC_DBG_MESSAGE Reply; - NTSTATUS Status; - - if (PsGetCurrentThread()->ThreadsProcess->DebugPort == NULL) - { - return(0); - } - - Message.Header.MessageSize = sizeof(LPC_DBG_MESSAGE); - Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) - - sizeof(LPC_MESSAGE); - Message.Type = DBG_EVENT_EXCEPTION; - Message.Status = STATUS_SUCCESS; - Message.Data.Exception.ExceptionRecord = Er; - Message.Data.Exception.FirstChance = FirstChance; - - /* FIXME: Freeze all threads in process */ - - /* Send the message to the process's debug port and wait for a reply */ - Status = - LpcSendDebugMessagePort(PsGetCurrentThread()->ThreadsProcess->DebugPort, - &Message, - &Reply); - if (!NT_SUCCESS(Status)) - { - return(0); - } - - /* FIXME: Examine reply */ - return(0); +#endif } /* EOF */ diff --git a/reactos/ntoskrnl/dbgk/debug.c b/reactos/ntoskrnl/dbgk/debug.c new file mode 100644 index 00000000000..3a53a9665b0 --- /dev/null +++ b/reactos/ntoskrnl/dbgk/debug.c @@ -0,0 +1,164 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/dbgk/debug.c + * PURPOSE: User-Mode Debugging Support, Debug Object Management. + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *****************************************************************/ + +#include +#define NDEBUG +#include + +POBJECT_TYPE DbgkDebugObjectType; +/* FUNCTIONS *****************************************************************/ + +NTSTATUS +STDCALL +NtCreateDebugObject(OUT PHANDLE DebugHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN BOOLEAN KillProcessOnExit) +{ + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + PDBGK_DEBUG_OBJECT DebugObject; + HANDLE hDebug; + NTSTATUS Status = STATUS_SUCCESS; + + PAGED_CODE(); + DPRINT("NtCreateDebugObject(0x%x, 0x%x, 0x%x)\n", DebugHandle, DesiredAccess, ObjectAttributes); + + /* Check Output Safety */ + if(PreviousMode != KernelMode) { + + _SEH_TRY { + + ProbeForWrite(DebugHandle, + sizeof(HANDLE), + sizeof(ULONG)); + } _SEH_HANDLE { + + Status = _SEH_GetExceptionCode(); + + } _SEH_END; + + if(!NT_SUCCESS(Status)) return Status; + } + + /* Create the Object */ + Status = ObCreateObject(PreviousMode, + DbgkDebugObjectType, + ObjectAttributes, + PreviousMode, + NULL, + sizeof(PDBGK_DEBUG_OBJECT), + 0, + 0, + (PVOID*)&DebugObject); + + /* Check for Success */ + if(NT_SUCCESS(Status)) { + + /* Initialize the Debug Object's Fast Mutex */ + ExInitializeFastMutex(&DebugObject->Mutex); + + /* Initialize the State Event List */ + InitializeListHead(&DebugObject->StateEventListEntry); + + /* Initialize the Debug Object's Wait Event */ + KeInitializeEvent(&DebugObject->Event, NotificationEvent, 0); + + /* Set the Flags */ + DebugObject->KillProcessOnExit = KillProcessOnExit; + + /* Insert it */ + Status = ObInsertObject((PVOID)DebugObject, + NULL, + DesiredAccess, + 0, + NULL, + &hDebug); + ObDereferenceObject(DebugObject); + + /* Check for success and return handle */ + if(NT_SUCCESS(Status)) { + + _SEH_TRY { + + *DebugHandle = hDebug; + + } _SEH_HANDLE { + + Status = _SEH_GetExceptionCode(); + + } _SEH_END; + } + } + + /* Return Status */ + return Status; +} + +NTSTATUS +STDCALL +NtWaitForDebugEvent(IN HANDLE DebugObject, // Debug object handle must grant DEBUG_OBJECT_WAIT_STATE_CHANGE access. + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Timeout OPTIONAL, + OUT PDBGUI_WAIT_STATE_CHANGE StateChange) +{ + + UNIMPLEMENTED; + + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +STDCALL +NtDebugContinue(IN HANDLE DebugObject, // Debug object handle must grant DEBUG_OBJECT_WAIT_STATE_CHANGE access. + IN PCLIENT_ID AppClientId, + IN NTSTATUS ContinueStatus) +{ + + UNIMPLEMENTED; + + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +STDCALL +NtDebugActiveProcess(IN HANDLE Process, // Process handle must grant PROCESS_SUSPEND_RESUME access. + IN HANDLE DebugObject) // Debug object handle must grant DEBUG_OBJECT_ADD_REMOVE_PROCESS access. +{ + + UNIMPLEMENTED; + + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +STDCALL +NtRemoveProcessDebug(IN HANDLE Process, // Process handle must grant PROCESS_SUSPEND_RESUME access. + IN HANDLE DebugObject) // Debug object handle must grant DEBUG_OBJECT_ADD_REMOVE_PROCESS access. +{ + + UNIMPLEMENTED; + + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +STDCALL +NtSetInformationDebugObject(IN HANDLE DebugObject, // Debug object handle need not grant any particular access right. + IN DEBUGOBJECTINFOCLASS DebugObjectInformationClass, + IN PVOID DebugInformation, + IN ULONG DebugInformationLength, + OUT PULONG ReturnLength OPTIONAL) +{ + UNIMPLEMENTED; + + return STATUS_NOT_IMPLEMENTED; +} +/* EOF */ diff --git a/reactos/ntoskrnl/ex/dbgctrl.c b/reactos/ntoskrnl/ex/dbgctrl.c new file mode 100644 index 00000000000..84865b3a800 --- /dev/null +++ b/reactos/ntoskrnl/ex/dbgctrl.c @@ -0,0 +1,46 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ex/dbgctrl.c + * PURPOSE: System debug control + * + * PROGRAMMERS: No programmer listed. + */ + +/* INCLUDES *****************************************************************/ + +#include +#define NDEBUG +#include + +/* FUNCTIONS *****************************************************************/ + +NTSTATUS +STDCALL +NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength, + PULONG ReturnLength) +{ + switch (ControlCode) + { + case DebugGetTraceInformation: + case DebugSetInternalBreakpoint: + case DebugSetSpecialCall: + case DebugClearSpecialCalls: + case DebugQuerySpecialCalls: + case DebugDbgBreakPoint: + break; + + case DebugDbgLoadSymbols: + KDB_LOADUSERMODULE_HOOK((PLDR_MODULE) InputBuffer); + break; + + default: + break; + } + + return STATUS_SUCCESS; +} diff --git a/reactos/ntoskrnl/ex/i386/interlck.c b/reactos/ntoskrnl/ex/i386/interlck.c index 12a3c2d9887..adf4ed90eba 100644 --- a/reactos/ntoskrnl/ex/i386/interlck.c +++ b/reactos/ntoskrnl/ex/i386/interlck.c @@ -396,6 +396,44 @@ InterlockedExchangeAdd(PLONG Addend, #error Unknown compiler for inline assembler #endif +/********************************************************************** + * FASTCALL: @InterlockedClearBit@8 + * STDCALL: _InterlockedClearBit@8 + */ +#if defined(__GNUC__) +/* + * @implemented + */ +UCHAR +FASTCALL +InterlockedClearBit(PLONG Destination, + LONG Bit); + +__asm__("\n\t.global @InterlockedClearBit@8\n\t" + "@InterlockedClearBit@8:\n\t" + LOCK + "btr %edx,(%ecx)\n\t" + "setc %al\n\t" + "ret $8\n\t"); + +#elif defined(_MSC_VER) +/* + * @implemented + */ +__declspec(naked) +UCHAR +FASTCALL +InterlockedClearBit(PUCHAR Destination, + UCHAR Bit) +{ + __asm LOCK btr [ecx], edx + __asm setc al + __asm ret +} + +#else +#error Unknown compiler for inline assembler +#endif /********************************************************************** * FASTCALL: @InterlockedCompareExchange@12 diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index a5982fed154..23609eff1d3 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -11,7 +11,6 @@ #include #include -#include "../dbg/kdb.h" #define NDEBUG #include @@ -416,8 +415,8 @@ ExpInitializeExecutive(VOID) /* Parse the Loaded Modules (by FreeLoader) and cache the ones we'll need */ ParseAndCacheLoadedModules(&SetupBoot); - /* Initialize the kernel debugger */ - KdInitSystem (1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); + /* Initialize the kernel debugger parameters */ + KdInitSystem(0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); /* Initialize the Dispatcher, Clock and Bug Check Mechanisms. */ KeInit2(); @@ -461,7 +460,7 @@ ExpInitializeExecutive(VOID) /* Set up the Kernel and Process Manager for this CPU */ KePrepareForApplicationProcessorInit(KeNumberProcessors); - PsPrepareForApplicationProcessorInit(KeNumberProcessors); + KeCreateApplicationProcessorIdleThread(KeNumberProcessors); /* Allocate a stack for use when booting the processor */ ProcessorStack = Ki386InitialStackArray[((int)KeNumberProcessors)] + MM_STACK_SIZE; @@ -489,12 +488,12 @@ ExpInitializeExecutive(VOID) /* initialize callbacks */ ExpInitializeCallbacks(); - /* Initialize the GDB Stub and break */ - KdInit1(); + /* Call KD Providers at Phase 1 */ + KdInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); /* Initialize I/O Objects, Filesystems, Error Logging and Shutdown */ IoInit(); - + /* TBD */ PoInit((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock, ForceAcpiDisable); @@ -506,9 +505,6 @@ ExpInitializeExecutive(VOID) /* Initialize Cache Views */ CcInit(); - - /* Hook System Interrupt for the Debugger */ - KdInit2(); /* Initialize File Locking */ FsRtlpInitFileLockingImplementation(); @@ -537,8 +533,8 @@ ExpInitializeExecutive(VOID) (KeLoaderBlock.MemHigher + 1088)/ 1024); HalDisplayString(str); - /* Print which Debugger is being used */ - KdInit3(); + /* Call KD Providers at Phase 2 */ + KdInitSystem(2, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); /* Import and create NLS Data and Sections */ RtlpInitNls(); @@ -549,10 +545,8 @@ ExpInitializeExecutive(VOID) /* Initialize the time zone information from the registry */ ExpInitTimeZoneInfo(); - /* Enter the kernel debugger before starting up the boot drivers */ -#ifdef KDBG + /* Enter the kernel debugger before starting up the boot drivers */ KdbEnter(); -#endif /* KDBG */ /* Setup Drivers and Root Device Node */ IoInit2(BootLog); @@ -562,6 +556,9 @@ ExpInitializeExecutive(VOID) /* Create ARC Names, SystemRoot SymLink, Load Drivers and Assign Letters */ IoInit3(); + + /* Load the System DLL and its Entrypoints */ + LdrpInitializeSystemDll(); /* Initialize the Default Locale */ PiInitDefaultLocale(); diff --git a/reactos/ntoskrnl/ex/list.c b/reactos/ntoskrnl/ex/list.c index 59095978ebd..24746a0794f 100644 --- a/reactos/ntoskrnl/ex/list.c +++ b/reactos/ntoskrnl/ex/list.c @@ -459,9 +459,9 @@ InterlockedPopEntrySList(IN PSLIST_HEADER ListHead) newslh.Sequence = oldslh.Sequence + 1; newslh.Depth = oldslh.Depth - 1; newslh.Next.Next = MmSafeReadPtr(&le->Next); - } while(ExfInterlockedCompareExchange64(&ListHead->Alignment, - &newslh.Alignment, - &oldslh.Alignment) != oldslh.Alignment); + } while(ExfInterlockedCompareExchange64((PLONGLONG)&ListHead->Alignment, + (PLONGLONG)&newslh.Alignment, + (PLONGLONG)&oldslh.Alignment) != oldslh.Alignment); return le; } @@ -485,9 +485,9 @@ InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, newslh.Depth = oldslh.Depth + 1; newslh.Sequence = oldslh.Sequence + 1; ListEntry->Next = oldslh.Next.Next; - } while(ExfInterlockedCompareExchange64(&ListHead->Alignment, - &newslh.Alignment, - &oldslh.Alignment) != oldslh.Alignment); + } while(ExfInterlockedCompareExchange64((PLONGLONG)&ListHead->Alignment, + (PLONGLONG)&newslh.Alignment, + (PLONGLONG)&oldslh.Alignment) != oldslh.Alignment); return oldslh.Next.Next; } diff --git a/reactos/ntoskrnl/ex/sysinfo.c b/reactos/ntoskrnl/ex/sysinfo.c index 3165f1ec7b5..9351c3c1c01 100644 --- a/reactos/ntoskrnl/ex/sysinfo.c +++ b/reactos/ntoskrnl/ex/sysinfo.c @@ -562,12 +562,12 @@ QSI_DEF(SystemProcessInformation) /* scan the process list */ - PSYSTEM_PROCESSES Spi - = (PSYSTEM_PROCESSES) Buffer; + PSYSTEM_PROCESS_INFORMATION Spi + = (PSYSTEM_PROCESS_INFORMATION) Buffer; - *ReqSize = sizeof(SYSTEM_PROCESSES); + *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION); - if (Size < sizeof(SYSTEM_PROCESSES)) + if (Size < sizeof(SYSTEM_PROCESS_INFORMATION)) { return (STATUS_INFO_LENGTH_MISMATCH); // in case buffer size is too small } @@ -578,19 +578,25 @@ QSI_DEF(SystemProcessInformation) do { - PSYSTEM_PROCESSES SpiCur; + PSYSTEM_PROCESS_INFORMATION SpiCur; int curSize, i = 0; ANSI_STRING imgName; int inLen=32; // image name len in bytes PLIST_ENTRY current_entry; PETHREAD current; - SpiCur = (PSYSTEM_PROCESSES)pCur; + SpiCur = (PSYSTEM_PROCESS_INFORMATION)pCur; + + nThreads = 0; + current_entry = pr->ThreadListHead.Flink; + while (current_entry != &pr->ThreadListHead) + { + nThreads++; + current_entry = current_entry->Flink; + } - nThreads = PsEnumThreadsByProcess(pr); - // size of the structure for every process - curSize = sizeof(SYSTEM_PROCESSES)-sizeof(SYSTEM_THREADS)+sizeof(SYSTEM_THREADS)*nThreads; + curSize = sizeof(SYSTEM_PROCESS_INFORMATION)-sizeof(SYSTEM_THREAD_INFORMATION)+sizeof(SYSTEM_THREAD_INFORMATION)*nThreads; ovlSize += curSize+inLen; if (ovlSize > Size) @@ -602,45 +608,45 @@ QSI_DEF(SystemProcessInformation) } // fill system information - SpiCur->NextEntryDelta = curSize+inLen; // relative offset to the beginnnig of the next structure - SpiCur->ThreadCount = nThreads; + SpiCur->NextEntryOffset = curSize+inLen; // relative offset to the beginnnig of the next structure + SpiCur->NumberOfThreads = nThreads; SpiCur->CreateTime = pr->CreateTime; SpiCur->UserTime.QuadPart = pr->Pcb.UserTime * 100000LL; SpiCur->KernelTime.QuadPart = pr->Pcb.KernelTime * 100000LL; - SpiCur->ProcessName.Length = strlen(pr->ImageFileName) * sizeof(WCHAR); - SpiCur->ProcessName.MaximumLength = inLen; - SpiCur->ProcessName.Buffer = (void*)(pCur+curSize); + SpiCur->ImageName.Length = strlen(pr->ImageFileName) * sizeof(WCHAR); + SpiCur->ImageName.MaximumLength = inLen; + SpiCur->ImageName.Buffer = (void*)(pCur+curSize); // copy name to the end of the struct if(pr != PsIdleProcess) { RtlInitAnsiString(&imgName, pr->ImageFileName); - RtlAnsiStringToUnicodeString(&SpiCur->ProcessName, &imgName, FALSE); + RtlAnsiStringToUnicodeString(&SpiCur->ImageName, &imgName, FALSE); } else { - RtlInitUnicodeString(&SpiCur->ProcessName, NULL); + RtlInitUnicodeString(&SpiCur->ImageName, NULL); } SpiCur->BasePriority = pr->Pcb.BasePriority; - SpiCur->ProcessId = pr->UniqueProcessId; - SpiCur->InheritedFromProcessId = pr->InheritedFromUniqueProcessId; + SpiCur->UniqueProcessId = pr->UniqueProcessId; + SpiCur->InheritedFromUniqueProcessId = pr->InheritedFromUniqueProcessId; SpiCur->HandleCount = (pr->ObjectTable ? ObpGetHandleCountByHandleTable(pr->ObjectTable) : 0); - SpiCur->VmCounters.PeakVirtualSize = pr->PeakVirtualSize; - SpiCur->VmCounters.VirtualSize = pr->VirtualSize.QuadPart; - SpiCur->VmCounters.PageFaultCount = pr->LastFaultCount; - SpiCur->VmCounters.PeakWorkingSetSize = pr->Vm.PeakWorkingSetSize; // Is this right using ->Vm. here ? - SpiCur->VmCounters.WorkingSetSize = pr->Vm.WorkingSetSize; // Is this right using ->Vm. here ? - SpiCur->VmCounters.QuotaPeakPagedPoolUsage = + SpiCur->PeakVirtualSize = pr->PeakVirtualSize; + SpiCur->VirtualSize = pr->VirtualSize.QuadPart; + SpiCur->PageFaultCount = pr->LastFaultCount; + SpiCur->PeakWorkingSetSize = pr->Vm.PeakWorkingSetSize; // Is this right using ->Vm. here ? + SpiCur->WorkingSetSize = pr->Vm.WorkingSetSize; // Is this right using ->Vm. here ? + SpiCur->QuotaPeakPagedPoolUsage = pr->QuotaPeakPoolUsage[0]; - SpiCur->VmCounters.QuotaPagedPoolUsage = + SpiCur->QuotaPagedPoolUsage = pr->QuotaPoolUsage[0]; - SpiCur->VmCounters.QuotaPeakNonPagedPoolUsage = + SpiCur->QuotaPeakNonPagedPoolUsage = pr->QuotaPeakPoolUsage[1]; - SpiCur->VmCounters.QuotaNonPagedPoolUsage = + SpiCur->QuotaNonPagedPoolUsage = pr->QuotaPoolUsage[1]; - SpiCur->VmCounters.PagefileUsage = pr->PagefileUsage; // FIXME - SpiCur->VmCounters.PeakPagefileUsage = pr->PeakPagefileUsage; + SpiCur->PagefileUsage = pr->PagefileUsage; // FIXME + SpiCur->PeakPagefileUsage = pr->PeakPagefileUsage; // KJK::Hyperion: I don't know what does this mean. VM_COUNTERS // doesn't seem to contain any equivalent field //SpiCur->TotalPrivateBytes = pr->NumberOfPrivatePages; //FIXME: bytes != pages @@ -651,26 +657,26 @@ QSI_DEF(SystemProcessInformation) current = CONTAINING_RECORD(current_entry, ETHREAD, ThreadListEntry); - SpiCur->Threads[i].KernelTime.QuadPart = current->Tcb.KernelTime * 100000LL; - SpiCur->Threads[i].UserTime.QuadPart = current->Tcb.UserTime * 100000LL; -// SpiCur->Threads[i].CreateTime = current->CreateTime; - SpiCur->Threads[i].WaitTime = current->Tcb.WaitTime; - SpiCur->Threads[i].StartAddress = (PVOID) current->StartAddress; - SpiCur->Threads[i].ClientId = current->Cid; - SpiCur->Threads[i].Priority = current->Tcb.Priority; - SpiCur->Threads[i].BasePriority = current->Tcb.BasePriority; - SpiCur->Threads[i].ContextSwitchCount = current->Tcb.ContextSwitches; - SpiCur->Threads[i].State = current->Tcb.State; - SpiCur->Threads[i].WaitReason = current->Tcb.WaitReason; + SpiCur->TH[i].KernelTime.QuadPart = current->Tcb.KernelTime * 100000LL; + SpiCur->TH[i].UserTime.QuadPart = current->Tcb.UserTime * 100000LL; +// SpiCur->TH[i].CreateTime = current->CreateTime; + SpiCur->TH[i].WaitTime = current->Tcb.WaitTime; + SpiCur->TH[i].StartAddress = (PVOID) current->StartAddress; + SpiCur->TH[i].ClientId = current->Cid; + SpiCur->TH[i].Priority = current->Tcb.Priority; + SpiCur->TH[i].BasePriority = current->Tcb.BasePriority; + SpiCur->TH[i].ContextSwitches = current->Tcb.ContextSwitches; + SpiCur->TH[i].ThreadState = current->Tcb.State; + SpiCur->TH[i].WaitReason = current->Tcb.WaitReason; i++; current_entry = current_entry->Flink; } - + pr = PsGetNextProcess(pr); - + nThreads = 0; if ((pr == syspr) || (pr == NULL)) { - SpiCur->NextEntryDelta = 0; + SpiCur->NextEntryOffset = 0; break; } else @@ -946,6 +952,7 @@ QSI_DEF(SystemPageFileInformation) } UNICODE_STRING FileName; /* FIXME */ + RtlInitUnicodeString(&FileName, NULL); /* FIXME */ /* FIXME */ Spfi->NextEntryOffset = 0; diff --git a/reactos/ntoskrnl/ex/work.c b/reactos/ntoskrnl/ex/work.c index 0a5f82f1588..844c5a34177 100644 --- a/reactos/ntoskrnl/ex/work.c +++ b/reactos/ntoskrnl/ex/work.c @@ -67,7 +67,7 @@ ExpWorkerThreadEntryPoint(IN PVOID Context) ASSERT((NTSTATUS)QueueEntry != STATUS_TIMEOUT); /* Increment Processed Work Items */ - InterlockedIncrement(&WorkQueue->WorkItemsProcessed); + InterlockedIncrement((PLONG)&WorkQueue->WorkItemsProcessed); /* Get the Work Item */ WorkItem = CONTAINING_RECORD(QueueEntry, WORK_QUEUE_ITEM, List); diff --git a/reactos/ntoskrnl/include/internal/arch/ps.h b/reactos/ntoskrnl/include/internal/arch/ps.h index 8d3d0efe9d9..028bb8c2679 100644 --- a/reactos/ntoskrnl/include/internal/arch/ps.h +++ b/reactos/ntoskrnl/include/internal/arch/ps.h @@ -21,8 +21,7 @@ #ifdef i386 #include -#define KiArchContextSwitch Ki386ContextSwitch -#define KiArchInitThread Ke386InitThread +#define KiArchContextSwitch KiSwapContext #define KiArchInitThreadWithContext Ke386InitThreadWithContext #else #error "Unknown processor" diff --git a/reactos/ntoskrnl/include/internal/dbg.h b/reactos/ntoskrnl/include/internal/dbg.h deleted file mode 100644 index 7f06b681036..00000000000 --- a/reactos/ntoskrnl/include/internal/dbg.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __INCLUDE_INTERNAL_DBG_H -#define __INCLUDE_INTERNAL_DBG_H - -#include -#include - -#define KdPrintEx(_x_) DbgPrintEx _x_ - -NTSTATUS STDCALL -LpcSendDebugMessagePort(PEPORT Port, - PLPC_DBG_MESSAGE Message, - PLPC_DBG_MESSAGE Reply); -VOID -DbgkCreateThread(PVOID StartAddress); -ULONG -DbgkForwardException(EXCEPTION_RECORD Er, ULONG FirstChance); -BOOLEAN -DbgShouldPrint(PCH Filename); - -#endif /* __INCLUDE_INTERNAL_DBG_H */ diff --git a/reactos/ntoskrnl/include/internal/dbgk.h b/reactos/ntoskrnl/include/internal/dbgk.h new file mode 100644 index 00000000000..9c419fc3abc --- /dev/null +++ b/reactos/ntoskrnl/include/internal/dbgk.h @@ -0,0 +1,143 @@ +/* + * ReactOS kernel + * Copyright (C) 2000 David Welch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __NTOSKRNL_INCLUDE_INTERNAL_DBGK_H +#define __NTOSKRNL_INCLUDE_INTERNAL_DBGK_H + +// +// DebugObject access rights. +// Note that DEBUG_OBJECT_ALL_ACCESS includes the specific rights 0x0F, but there are only two +// debug object specific access rights that are ever checked by the kernel. This appears to be a bug. +// +#define DEBUG_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x0F) +#define DEBUG_OBJECT_WAIT_STATE_CHANGE 0x0001 /* Required to call NtWaitForDebugEvent & NtContinueDebugEvent */ +#define DEBUG_OBJECT_ADD_REMOVE_PROCESS 0x0002 /* Required to call NtDebugActiveProcess & NtRemoveProcessDebug */ + +typedef enum _DEBUGOBJECTINFOCLASS { + DebugObjectUnusedInformation, + DebugObjectKillProcessOnExitInformation +} DEBUGOBJECTINFOCLASS, * PDEBUGOBJECTINFOCLASS; + +typedef struct _DEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION { + ULONG KillProcessOnExit; // Interpreted as a BOOLEAN, TRUE -> process is terminated on NtRemoveProcessDebug. +} DEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION, * +PDEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION; + +// +// Debug Object +// +typedef struct _DBGK_DEBUG_OBJECT { + KEVENT Event; + FAST_MUTEX Mutex; + LIST_ENTRY StateEventListEntry; + union { + ULONG Flags; + struct { + UCHAR DebuggerInactive :1; + UCHAR KillProcessOnExit :1; + }; + }; +} DBGK_DEBUG_OBJECT, *PDBGK_DEBUG_OBJECT; + +// +// DbgUi types for LPC debug port messages (KM -> UM). +// +// These also apply to Nt*Debug APIs with NT 5.01, 5.02, and later. +// +typedef enum _DBG_STATE { + DbgIdle, + DbgReplyPending, + DbgCreateThreadStateChange, + DbgCreateProcessStateChange, + DbgExitThreadStateChange, + DbgExitProcessStateChange, + DbgExceptionStateChange, + DbgBreakpointStateChange, + DbgSingleStepStateChange, + DbgLoadDllStateChange, + DbgUnloadDllStateChange +} DBG_STATE, *PDBG_STATE; + +typedef struct _DBGKM_EXCEPTION { + EXCEPTION_RECORD ExceptionRecord; + ULONG FirstChance; +} DBGKM_EXCEPTION, *PDBGKM_EXCEPTION; + +typedef struct _DBGKM_CREATE_THREAD { + ULONG SubSystemKey; + PVOID StartAddress; +} DBGKM_CREATE_THREAD, *PDBGKM_CREATE_THREAD; + +typedef struct _DBGKM_CREATE_PROCESS { + ULONG SubSystemKey; + HANDLE FileHandle; + PVOID BaseOfImage; + ULONG DebugInfoFileOffset; + ULONG DebugInfoSize; + DBGKM_CREATE_THREAD InitialThread; +} DBGKM_CREATE_PROCESS, *PDBGKM_CREATE_PROCESS; + +typedef struct _DBGKM_EXIT_THREAD { + NTSTATUS ExitStatus; +} DBGKM_EXIT_THREAD, *PDBGKM_EXIT_THREAD; + +typedef struct _DBGKM_EXIT_PROCESS { + NTSTATUS ExitStatus; +} DBGKM_EXIT_PROCESS, *PDBGKM_EXIT_PROCESS; + +typedef struct _DBGKM_LOAD_DLL { + HANDLE FileHandle; + PVOID BaseOfDll; + ULONG DebugInfoFileOffset; + ULONG DebugInfoSize; +} DBGKM_LOAD_DLL, *PDBGKM_LOAD_DLL; + +typedef struct _DBGKM_UNLOAD_DLL { + PVOID BaseAddress; +} DBGKM_UNLOAD_DLL, *PDBGKM_UNLOAD_DLL; + +typedef struct _DBGUI_WAIT_STATE_CHANGE { + DBG_STATE NewState; + CLIENT_ID AppClientId; + union { + struct { + HANDLE HandleToThread; + DBGKM_CREATE_THREAD NewThread; + } CreateThread; + struct { + HANDLE HandleToProcess; + HANDLE HandleToThread; + DBGKM_CREATE_PROCESS NewProcess; + } CreateProcessInfo; + DBGKM_EXIT_THREAD ExitThread; + DBGKM_EXIT_PROCESS ExitProcess; + DBGKM_EXCEPTION Exception; + DBGKM_LOAD_DLL LoadDll; + DBGKM_UNLOAD_DLL UnloadDll; + } StateInfo; +} DBGUI_WAIT_STATE_CHANGE, * PDBGUI_WAIT_STATE_CHANGE; + + +VOID +STDCALL +DbgkCreateThread(PVOID StartAddress); + +#endif + +/* EOF */ diff --git a/reactos/ntoskrnl/include/internal/debug.h b/reactos/ntoskrnl/include/internal/debug.h index 31324131183..ab41c452fb2 100644 --- a/reactos/ntoskrnl/include/internal/debug.h +++ b/reactos/ntoskrnl/include/internal/debug.h @@ -19,8 +19,6 @@ #define __INTERNAL_DEBUG #include -#include - #if defined(_MSC_VER) && (_MSC_VER < 1300) /* TODO: Verify which version the MS compiler learned the __FUNCTION__ macro */ @@ -93,19 +91,6 @@ #define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0) -#if defined(KDBG) && defined(NDEBUG) && defined(__NTOSKRNL__) - -#define DPRINT(args...) do { \ - if (DbgShouldPrint(__FILE__)) { \ - DbgPrint("(%s:%d) ",__FILE__,__LINE__); \ - DbgPrint(args); \ - } \ -} while(0) - -#define CHECKPOINT - -#else /* KDBG && NDEBUG && __NTOSKRNL__ */ - #ifndef NDEBUG #ifdef __GNUC__ /* using GNU C/C99 macro ellipsis */ #define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0) @@ -122,7 +107,6 @@ #define CHECKPOINT #endif /* NDEBUG */ -#endif /* KDBG && NDEBUG */ /* * FUNCTION: Assert a maximum value for the current irql diff --git a/reactos/ntoskrnl/include/internal/i386/ke.h b/reactos/ntoskrnl/include/internal/i386/ke.h index 5efe824339d..89ad399be49 100644 --- a/reactos/ntoskrnl/include/internal/i386/ke.h +++ b/reactos/ntoskrnl/include/internal/i386/ke.h @@ -27,8 +27,8 @@ #define KTRAP_FRAME_DEBUGEIP (0x4) #define KTRAP_FRAME_DEBUGARGMARK (0x8) #define KTRAP_FRAME_DEBUGPOINTER (0xC) -#define KTRAP_FRAME_TEMPCS (0x10) -#define KTRAP_FRAME_TEMPEIP (0x14) +#define KTRAP_FRAME_TEMPSS (0x10) +#define KTRAP_FRAME_TEMPESP (0x14) #define KTRAP_FRAME_DR0 (0x18) #define KTRAP_FRAME_DR1 (0x1C) #define KTRAP_FRAME_DR2 (0x20) @@ -117,8 +117,8 @@ typedef struct _KTRAP_FRAME PVOID DebugEip; PVOID DebugArgMark; PVOID DebugPointer; - PVOID TempCs; - PVOID TempEip; + PVOID TempSegSs; + PVOID TempEsp; ULONG Dr0; ULONG Dr1; ULONG Dr2; @@ -198,14 +198,40 @@ ULONG KeAllocateGdtSelector(ULONG Desc[2]); VOID KeFreeGdtSelector(ULONG Entry); VOID NtEarlyInitVdm(VOID); +VOID +KeApplicationProcessorInitDispatcher(VOID); +VOID +KeCreateApplicationProcessorIdleThread(ULONG Id); +typedef +VOID +STDCALL +(*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, + PVOID StartContext); + +VOID +STDCALL +Ke386InitThreadWithContext(PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context); + +VOID +STDCALL +KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + BOOLEAN UserThread, + KTRAP_FRAME TrapFrame); + #ifdef CONFIG_SMP #define LOCK "lock ; " #else #define LOCK "" +#define KeGetCurrentIrql(X) (((PKPCR)KPCR_BASE)->Irql) #endif - #if defined(__GNUC__) #define Ke386DisableInterrupts() __asm__("cli\n\t"); #define Ke386EnableInterrupts() __asm__("sti\n\t"); diff --git a/reactos/ntoskrnl/include/internal/i386/ps.h b/reactos/ntoskrnl/include/internal/i386/ps.h index 6eb1c4125fb..9882d69f110 100644 --- a/reactos/ntoskrnl/include/internal/i386/ps.h +++ b/reactos/ntoskrnl/include/internal/i386/ps.h @@ -27,8 +27,12 @@ #define KTHREAD_TEB 0x20 #define KTHREAD_KERNEL_STACK 0x28 #define KTHREAD_NPX_STATE 0x31 +#define KTHREAD_STATE 0x2D +#define KTHREAD_APCSTATE_PROCESS 0x34 + 0x10 #define KTHREAD_PENDING_USER_APC 0x34 + 0x16 -#define KTHREAD_APCSTATE_PROCESS 0x44 +#define KTHREAD_PENDING_KERNEL_APC 0x34 + 0x15 +#define KTHREAD_CONTEXT_SWITCHES 0x4C +#define KTHREAD_WAIT_IRQL 0x54 #define KTHREAD_SERVICE_TABLE 0xDC #define KTHREAD_PREVIOUS_MODE 0x137 #define KTHREAD_TRAP_FRAME 0x128 @@ -44,7 +48,9 @@ #define KPCR_EXCEPTION_LIST 0x0 #define KPCR_INITIAL_STACK 0x4 +#define KPCR_STACK_LIMIT 0x8 #define KPCR_SELF 0x1C +#define KPCR_GDT 0x3C #define KPCR_TSS 0x40 #define KPCR_CURRENT_THREAD 0x124 #define KPCR_NPX_THREAD 0x2A4 @@ -179,7 +185,7 @@ typedef struct _KPRCB { LONG MmMappedPagesWriteCount; LONG MmMappedWriteIoCount; ULONG SpareFields0[1]; - UCHAR VendorString[13]; + CHAR VendorString[13]; UCHAR InitialApicId; UCHAR LogicalProcessorsPerPhysicalProcessor; ULONG MHz; @@ -292,22 +298,12 @@ static inline PKPRCB KeGetCurrentPrcb(VOID) #define KeGetCurrentKPCR(X) ((PKPCR)KPCR_BASE) #define KeGetCurrentPrcb() (((PKPCR)KPCR_BASE)->Prcb) +#define KeGetCurrentThread(X) (((PKPCR)KPCR_BASE)->PrcbData.CurrentThread) #endif #endif /* __USE_W32API */ -VOID -Ki386ContextSwitch(struct _KTHREAD* NewThread, - struct _KTHREAD* OldThread); -NTSTATUS -Ke386InitThread(struct _KTHREAD* Thread, PKSTART_ROUTINE fn, - PVOID StartContext); -NTSTATUS -Ke386InitThreadWithContext(struct _KTHREAD* Thread, PCONTEXT Context); -NTSTATUS -Ki386ValidateUserContext(PCONTEXT Context); - #endif /* __ASM__ */ #endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_PS_H */ diff --git a/reactos/ntoskrnl/include/internal/io.h b/reactos/ntoskrnl/include/internal/io.h index 3d2c432f0c8..b1c26b407ed 100644 --- a/reactos/ntoskrnl/include/internal/io.h +++ b/reactos/ntoskrnl/include/internal/io.h @@ -41,6 +41,7 @@ #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003) +struct _DEVICE_OBJECT_POWER_EXTENSION; typedef struct _IO_COMPLETION_PACKET{ PVOID Key; @@ -53,10 +54,17 @@ typedef struct _DEVOBJ_EXTENSION { CSHORT Type; USHORT Size; PDEVICE_OBJECT DeviceObject; - ULONG Unknown[3]; + ULONG PowerFlags; + struct DEVICE_OBJECT_POWER_EXTENSION *Dope; + ULONG ExtensionFlags; struct _DEVICE_NODE *DeviceNode; + PDEVICE_OBJECT AttachedTo; + LONG StartIoCount; + LONG StartIoKey; + ULONG StartIoFlags; + struct _VPB *Vpb; } DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION; - + typedef struct _PRIVATE_DRIVER_EXTENSIONS { struct _PRIVATE_DRIVER_EXTENSIONS *Link; PVOID ClientIdentificationAddress; @@ -322,6 +330,17 @@ PnpInit(VOID); VOID IopInitDriverImplementation(VOID); +VOID +IopInitPnpNotificationImplementation(VOID); + +VOID +IopNotifyPlugPlayNotification( + IN PDEVICE_OBJECT DeviceObject, + IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, + IN GUID* Event, + IN PVOID EventCategoryData1, + IN PVOID EventCategoryData2); + NTSTATUS IopGetSystemPowerDeviceObject(PDEVICE_OBJECT *DeviceObject); NTSTATUS @@ -362,7 +381,10 @@ IopCreateDevice(PVOID ObjectBody, PVOID Parent, PWSTR RemainingPath, POBJECT_ATTRIBUTES ObjectAttributes); -NTSTATUS IoAttachVpb(PDEVICE_OBJECT DeviceObject); + +NTSTATUS +STDCALL +IopAttachVpb(PDEVICE_OBJECT DeviceObject); PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction, PDEVICE_OBJECT DeviceObject, @@ -478,6 +500,7 @@ NTSTATUS FASTCALL IopCreateDriverObject( PDRIVER_OBJECT *DriverObject, PUNICODE_STRING ServiceName, + ULONG CreateAttributes, BOOLEAN FileSystemDriver, PVOID DriverImageStart, ULONG DriverImageSize); @@ -491,6 +514,7 @@ NTSTATUS FASTCALL IopInitializeDriverModule( IN PDEVICE_NODE DeviceNode, IN PMODULE_OBJECT ModuleObject, + IN PUNICODE_STRING ServiceName, IN BOOLEAN FileSystemDriver, OUT PDRIVER_OBJECT *DriverObject); @@ -505,7 +529,39 @@ IopMarkLastReinitializeDriver(VOID); VOID FASTCALL IopReinitializeDrivers(VOID); +/* file.c */ +NTSTATUS +STDCALL +IopCreateFile(PVOID ObjectBody, + PVOID Parent, + PWSTR RemainingPath, + POBJECT_ATTRIBUTES ObjectAttributes); + +VOID +STDCALL +IopDeleteFile(PVOID ObjectBody); + +NTSTATUS +STDCALL +IopSecurityFile(PVOID ObjectBody, + SECURITY_OPERATION_CODE OperationCode, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR SecurityDescriptor, + PULONG BufferLength); + +NTSTATUS +STDCALL +IopQueryNameFile(PVOID ObjectBody, + POBJECT_NAME_INFORMATION ObjectNameInfo, + ULONG Length, + PULONG ReturnLength); + +VOID +STDCALL +IopCloseFile(PVOID ObjectBody, + ULONG HandleCount); + /* plugplay.c */ NTSTATUS INIT_FUNCTION diff --git a/reactos/ntoskrnl/include/internal/kd.h b/reactos/ntoskrnl/include/internal/kd.h index e74855b8ae1..c5c7f096d64 100644 --- a/reactos/ntoskrnl/include/internal/kd.h +++ b/reactos/ntoskrnl/include/internal/kd.h @@ -10,117 +10,17 @@ #include #include -#define KD_DEBUG_DISABLED 0x00 -#define KD_DEBUG_GDB 0x01 -#define KD_DEBUG_PICE 0x02 -#define KD_DEBUG_SCREEN 0x04 -#define KD_DEBUG_SERIAL 0x08 -#define KD_DEBUG_BOCHS 0x10 -#define KD_DEBUG_FILELOG 0x20 -#define KD_DEBUG_MDA 0x40 -#define KD_DEBUG_KDB 0x80 -#define KD_DEBUG_KDSERIAL 0x100 -#define KD_DEBUG_KDNOECHO 0x200 +struct _KD_DISPATCH_TABLE; +#define KdPrintEx(_x_) DbgPrintEx _x_ -extern ULONG KdDebugState; +#ifdef DBG +#include "kdgdb.h" +#include "kdbochs.h" +#endif -KD_PORT_INFORMATION GdbPortInfo; -KD_PORT_INFORMATION LogPortInfo; +/* SYMBOL ROUTINES **********************************************************/ -typedef enum _KD_CONTINUE_TYPE -{ - kdContinue = 0, - kdDoNotHandleException, - kdHandleException -} KD_CONTINUE_TYPE; - -VOID -KbdDisableMouse(); - -VOID -KbdEnableMouse(); - -ULONG -KdpPrintString (PANSI_STRING String); - -VOID -DebugLogWrite(PCH String); -VOID -DebugLogInit(VOID); -VOID -DebugLogInit2(VOID); - -VOID -STDCALL -KdDisableDebugger( - VOID - ); - -VOID -STDCALL -KdEnableDebugger( - VOID - ); - -NTSTATUS -STDCALL -KdPowerTransition( - ULONG PowerState - ); - -BOOLEAN -STDCALL -KeIsAttachedProcess( - VOID - ); - -VOID -KdInit1(VOID); - -VOID -KdInit2(VOID); - -VOID -KdInit3(VOID); - -VOID -KdPutChar(UCHAR Value); - -UCHAR -KdGetChar(VOID); - -VOID -KdGdbStubInit(ULONG Phase); - -VOID -KdGdbDebugPrint (LPSTR Message); - -VOID -KdDebugPrint (LPSTR Message); - -KD_CONTINUE_TYPE -KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, - PCONTEXT Context, - PKTRAP_FRAME TrapFrame); -VOID KdInitializeMda(VOID); -VOID KdPrintMda(PCH pch); - -#if !defined(KDBG) && !defined(DBG) -# define KDB_LOADUSERMODULE_HOOK(LDRMOD) do { } while (0) -# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) do { } while (0) -# define KDB_UNLOADDRIVER_HOOK(MODULE) do { } while (0) -# define KDB_LOADERINIT_HOOK(NTOS, HAL) do { } while (0) -# define KDB_SYMBOLFILE_HOOK(FILENAME) do { } while (0) -# define KDB_CREATE_THREAD_HOOK(CONTEXT) do { } while (0) -#else -# define KDB_LOADUSERMODULE_HOOK(LDRMOD) KdbSymLoadUserModuleSymbols(LDRMOD) -# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) KdbSymLoadDriverSymbols(FILENAME, MODULE) -# define KDB_UNLOADDRIVER_HOOK(MODULE) KdbSymUnloadDriverSymbols(MODULE) -# define KDB_LOADERINIT_HOOK(NTOS, HAL) KdbSymInit(NTOS, HAL) -# define KDB_SYMBOLFILE_HOOK(FILENAME) KdbSymProcessBootSymbols(FILENAME) -/*#define KDB_CREATE_THREAD_HOOK(CONTEXT) \ - KdbCreateThreadHook(CONTEXT) -*/ +#if defined(KDBG) || defined(DBG) VOID KdbSymLoadUserModuleSymbols(IN PLDR_MODULE LdrModule); @@ -142,28 +42,215 @@ VOID KdbSymInit(IN PMODULE_TEXT_SECTION NtoskrnlTextSection, IN PMODULE_TEXT_SECTION LdrHalTextSection); - BOOLEAN KdbSymPrintAddress(IN PVOID Address); -KD_CONTINUE_TYPE -KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, - KPROCESSOR_MODE PreviousMode, - PCONTEXT Context, - PKTRAP_FRAME TrapFrame, - BOOLEAN FirstChance); - -#endif /* KDBG || DBG */ - -#if !defined(KDBG) -# define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0) -#else -# define KDB_DELETEPROCESS_HOOK(PROCESS) KdbDeleteProcessHook(PROCESS) VOID KdbDeleteProcessHook(IN PEPROCESS Process); -#endif /* KDBG */ + +NTSTATUS +KdbSymGetAddressInformation(IN PROSSYM_INFO RosSymInfo, + IN ULONG_PTR RelativeAddress, + OUT PULONG LineNumber OPTIONAL, + OUT PCH FileName OPTIONAL, + OUT PCH FunctionName OPTIONAL); + +typedef struct _KDB_MODULE_INFO +{ + WCHAR Name[256]; + ULONG_PTR Base; + ULONG Size; + PROSSYM_INFO RosSymInfo; +} KDB_MODULE_INFO, *PKDB_MODULE_INFO; + +/* MACROS FOR NON-KDBG BUILDS ************************************************/ + +# define KDB_LOADUSERMODULE_HOOK(LDRMOD) KdbSymLoadUserModuleSymbols(LDRMOD) +# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) KdbSymLoadDriverSymbols(FILENAME, MODULE) +# define KDB_UNLOADDRIVER_HOOK(MODULE) KdbSymUnloadDriverSymbols(MODULE) +# define KDB_LOADERINIT_HOOK(NTOS, HAL) KdbSymInit(NTOS, HAL) +# define KDB_SYMBOLFILE_HOOK(FILENAME) KdbSymProcessBootSymbols(FILENAME) +#else +# define KDB_LOADUSERMODULE_HOOK(LDRMOD) do { } while (0) +# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) do { } while (0) +# define KDB_UNLOADDRIVER_HOOK(MODULE) do { } while (0) +# define KDB_LOADERINIT_HOOK(NTOS, HAL) do { } while (0) +# define KDB_SYMBOLFILE_HOOK(FILENAME) do { } while (0) +# define KDB_CREATE_THREAD_HOOK(CONTEXT) do { } while (0) +#endif + +#if defined(KDBG) || defined(DBG) +# define KeRosPrintAddress(ADDRESS) KdbSymPrintAddress(ADDRESS) +#else +# define KeRosPrintAddress(ADDRESS) KiRosPrintAddress(ADDRESS) +#endif + +#ifdef KDBG +# define KdbInit() KdbpCliInit() +# define KdbModuleLoaded(FILENAME) KdbpCliModuleLoaded(FILENAME) +# define KDB_DELETEPROCESS_HOOK(PROCESS) KdbDeleteProcessHook(PROCESS) +#else +# define KdbEnterDebuggerException(ER, PM, C, TF, F) kdHandleException +# define KdbInit() do { } while (0) +# define KdbEnter() do { } while (0) +# define KdbModuleLoaded(X) do { } while (0) +# define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0) +#endif + +/* KD ROUTINES ***************************************************************/ + +typedef enum _KD_CONTINUE_TYPE +{ + kdContinue = 0, + kdDoNotHandleException, + kdHandleException +} KD_CONTINUE_TYPE; + +typedef +VOID +STDCALL +(*PKDP_INIT_ROUTINE)(struct _KD_DISPATCH_TABLE *DispatchTable, + ULONG BootPhase); + +typedef +VOID +STDCALL +(*PKDP_PRINT_ROUTINE)(PCH String); + +typedef +VOID +STDCALL +(*PKDP_PROMPT_ROUTINE)(PCH String); + +typedef +KD_CONTINUE_TYPE +STDCALL +(*PKDP_EXCEPTION_ROUTINE)(PEXCEPTION_RECORD ExceptionRecord, + PCONTEXT Context, + PKTRAP_FRAME TrapFrame); + +/* INIT ROUTINES *************************************************************/ VOID -DebugLogDumpMessages(VOID); +STDCALL +KdpScreenInit(struct _KD_DISPATCH_TABLE *DispatchTable, + ULONG BootPhase); + +VOID +STDCALL +KdpSerialInit(struct _KD_DISPATCH_TABLE *DispatchTable, + ULONG BootPhase); + +VOID +STDCALL +KdpInitDebugLog(struct _KD_DISPATCH_TABLE *DispatchTable, + ULONG BootPhase); + +/* KD ROUTINES ***************************************************************/ + +KD_CONTINUE_TYPE +STDCALL +KdpEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, + KPROCESSOR_MODE PreviousMode, + PCONTEXT Context, + PKTRAP_FRAME TrapFrame, + BOOLEAN FirstChance, + BOOLEAN Gdb); + +ULONG +STDCALL +KdpPrintString(PANSI_STRING String); + +BOOLEAN +STDCALL +KdpDetectConflicts(PCM_RESOURCE_LIST DriverList); + +/* KD GLOBALS ***************************************************************/ + +/* serial debug connection */ +#define DEFAULT_DEBUG_PORT 2 /* COM2 */ +#define DEFAULT_DEBUG_COM1_IRQ 4 /* COM1 IRQ */ +#define DEFAULT_DEBUG_COM2_IRQ 3 /* COM2 IRQ */ +#define DEFAULT_DEBUG_BAUD_RATE 115200 /* 115200 Baud */ + +/* KD Native Modes */ +#define KdScreen 0 +#define KdSerial 1 +#define KdFile 2 +#define KdMax 3 + +/* KD Private Debug Modes */ +typedef struct _KDP_DEBUG_MODE +{ + union { + struct { + /* Native Modes */ + UCHAR Screen :1; + UCHAR Serial :1; + UCHAR File :1; + + /* Currently Supported Wrappers */ + UCHAR Pice :1; + UCHAR Gdb :1; + UCHAR Bochs :1; + }; + + /* Generic Value */ + ULONG Value; + }; +} KDP_DEBUG_MODE; + +/* KD Internal Debug Services */ +typedef enum _KDP_DEBUG_SERVICE +{ + DumpNonPagedPool = 0x1e, /* a */ + ManualBugCheck = 0x30, /* b */ + DumpNonPagedPoolStats = 0x2e, /* c */ + DumpNewNonPagedPool = 0x20, /* d */ + DumpNewNonPagedPoolStats = 0x12, /* e */ + DumpAllThreads = 0x21, /* f */ + DumpUserThreads = 0x22, /* g */ + KdSpare1 = 0x23, /* h */ + KdSpare2 = 0x17, /* i */ + KdSpare3 = 0x24, /* j */ + EnterDebugger = 0x25 /* k */ +} KDP_DEBUG_SERVICE; + +/* Dispatch Table for Wrapper Functions */ +typedef struct _KD_DISPATCH_TABLE +{ + LIST_ENTRY KdProvidersList; + PKDP_INIT_ROUTINE KdpInitRoutine; + PKDP_PRINT_ROUTINE KdpPrintRoutine; + PKDP_PROMPT_ROUTINE KdpPromptRoutine; + PKDP_EXCEPTION_ROUTINE KdpExceptionRoutine; +} KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE; + +/* The current Debugging Mode */ +extern KDP_DEBUG_MODE KdpDebugMode; + +/* The current Port IRQ */ +extern ULONG KdpPortIrq; + +/* The current Port */ +extern ULONG KdpPort; + +/* Port Information for the Serial Native Mode */ +extern KD_PORT_INFORMATION SerialPortInfo; + +/* Init Functions for Native Providers */ +extern PKDP_INIT_ROUTINE InitRoutines[KdMax]; + +/* Wrapper Init Function */ +extern PKDP_INIT_ROUTINE WrapperInitRoutine; + +/* Dispatch Tables for Native Providers */ +extern KD_DISPATCH_TABLE DispatchTable[KdMax]; + +/* Dispatch Table for the Wrapper */ +extern KD_DISPATCH_TABLE WrapperTable; + +/* The KD Native Provider List */ +extern LIST_ENTRY KdProviders; #endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */ diff --git a/reactos/ntoskrnl/include/internal/kdb.h b/reactos/ntoskrnl/include/internal/kdb.h new file mode 100644 index 00000000000..f323ece746d --- /dev/null +++ b/reactos/ntoskrnl/include/internal/kdb.h @@ -0,0 +1,276 @@ +#ifndef NTOSKRNL_KDB_H +#define NTOSKRNL_KDB_H + +/* INCLUDES ******************************************************************/ + +#define NTOS_MODE_KERNEL +#include + +#include + +/* DEFINES *******************************************************************/ + +#define TAG_KDBG (('K' << 24) | ('D' << 16) | ('B' << 8) | 'G') + +#ifndef RTL_NUMBER_OF +# define RTL_NUMBER_OF(x) (sizeof(x) / sizeof((x)[0])) +#endif + +/* TYPES *********************************************************************/ + +/* from kdb.c */ +typedef struct _KDB_KTRAP_FRAME +{ + KTRAP_FRAME Tf; + ULONG Cr0; + ULONG Cr1; /* reserved/unused */ + ULONG Cr2; + ULONG Cr3; + ULONG Cr4; +} KDB_KTRAP_FRAME, *PKDB_KTRAP_FRAME; + +typedef enum _KDB_BREAKPOINT_TYPE +{ + KdbBreakPointNone = 0, + KdbBreakPointSoftware, + KdbBreakPointHardware, + KdbBreakPointTemporary +} KDB_BREAKPOINT_TYPE; + +typedef enum _KDB_ACCESS_TYPE +{ + KdbAccessRead, + KdbAccessWrite, + KdbAccessReadWrite, + KdbAccessExec +} KDB_ACCESS_TYPE; + +typedef struct _KDB_BREAKPOINT +{ + KDB_BREAKPOINT_TYPE Type; /* Type of breakpoint */ + BOOLEAN Enabled; /* Whether the bp is enabled */ + ULONG_PTR Address; /* Address of the breakpoint */ + BOOLEAN Global; /* Whether the breakpoint is global or local to a process */ + PEPROCESS Process; /* Owning process */ + PCHAR ConditionExpression; + PVOID Condition; + union { + /* KdbBreakPointSoftware */ + UCHAR SavedInstruction; + /* KdbBreakPointHardware */ + struct { + UCHAR DebugReg : 2; + UCHAR Size : 3; + KDB_ACCESS_TYPE AccessType; + } Hw; + } Data; +} KDB_BREAKPOINT, *PKDB_BREAKPOINT; + +typedef enum _KDB_ENTER_CONDITION +{ + KdbDoNotEnter, + KdbEnterAlways, + KdbEnterFromKmode, + KdbEnterFromUmode +} KDB_ENTER_CONDITION; + +/* These values MUST be nonzero. They're used as bit masks. */ +typedef enum _KDB_OUTPUT_SETTINGS +{ + KD_DEBUG_KDSERIAL = 1, + KD_DEBUG_KDNOECHO = 2 +} KDB_OUTPUT_SETTINGS; + +/* FUNCTIONS *****************************************************************/ + +/* from i386/i386-dis.c */ + +LONG +KdbpDisassemble( + IN ULONG Address, + IN ULONG IntelSyntax); + +LONG +KdbpGetInstLength( + IN ULONG Address); + +/* from i386/kdb_help.S */ + +STDCALL VOID +KdbpStackSwitchAndCall( + IN PVOID NewStack, + IN VOID (*Function)(VOID)); + +/* from kdb_cli.c */ + +extern PCHAR KdbInitFileBuffer; + +VOID +KdbpCliInit(); + +VOID +KdbpCliMainLoop( + IN BOOLEAN EnteredOnSingleStep); + +VOID +KdbpCliModuleLoaded( + IN PUNICODE_STRING Name); + +VOID +KdbpCliInterpretInitFile(); + +VOID +KdbpPrint( + IN PCHAR Format, + IN ... OPTIONAL); + +/* from kdb_expr.c */ + +BOOLEAN +KdbpRpnEvaluateExpression( + IN PCHAR Expression, + IN PKDB_KTRAP_FRAME TrapFrame, + OUT PULONGLONG Result, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL); + +PVOID +KdbpRpnParseExpression( + IN PCHAR Expression, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL); + +BOOLEAN +KdbpRpnEvaluateParsedExpression( + IN PVOID Expression, + IN PKDB_KTRAP_FRAME TrapFrame, + OUT PULONGLONG Result, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL); + +/* from kdb_symbols.c */ + +BOOLEAN +KdbpSymFindModuleByAddress(IN PVOID Address, + OUT PKDB_MODULE_INFO pInfo); + +BOOLEAN +KdbpSymFindModuleByName(IN LPCWSTR Name, + OUT PKDB_MODULE_INFO pInfo); + +BOOLEAN +KdbpSymFindModuleByIndex(IN INT Index, + OUT PKDB_MODULE_INFO pInfo); + +/* from kdb.c */ + +extern PEPROCESS KdbCurrentProcess; +extern PETHREAD KdbCurrentThread; +extern LONG KdbLastBreakPointNr; +extern ULONG KdbNumSingleSteps; +extern BOOLEAN KdbSingleStepOver; +extern PKDB_KTRAP_FRAME KdbCurrentTrapFrame; +extern ULONG KdbDebugState; + +LONG +KdbpGetNextBreakPointNr( + IN ULONG Start OPTIONAL); + +BOOLEAN +KdbpGetBreakPointInfo( + IN ULONG BreakPointNr, + OUT ULONG_PTR *Address OPTIONAL, + OUT KDB_BREAKPOINT_TYPE *Type OPTIONAL, + OUT UCHAR *Size OPTIONAL, + OUT KDB_ACCESS_TYPE *AccessType OPTIONAL, + OUT UCHAR *DebugReg OPTIONAL, + OUT BOOLEAN *Enabled OPTIONAL, + OUT BOOLEAN *Global OPTIONAL, + OUT PEPROCESS *Process OPTIONAL, + OUT PCHAR *ConditionExpression OPTIONAL); + +NTSTATUS +KdbpInsertBreakPoint( + IN ULONG_PTR Address, + IN KDB_BREAKPOINT_TYPE Type, + IN UCHAR Size OPTIONAL, + IN KDB_ACCESS_TYPE AccessType OPTIONAL, + IN PCHAR ConditionExpression OPTIONAL, + IN BOOLEAN Global, + OUT PULONG BreakPointNumber OPTIONAL); + +BOOLEAN +KdbpDeleteBreakPoint( + IN LONG BreakPointNr OPTIONAL, + IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL); + +BOOLEAN +KdbpEnableBreakPoint( + IN LONG BreakPointNr OPTIONAL, + IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL); + +BOOLEAN +KdbpDisableBreakPoint( + IN LONG BreakPointNr OPTIONAL, + IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL); + +BOOLEAN +KdbpGetEnterCondition( + IN LONG ExceptionNr, + IN BOOLEAN FirstChance, + OUT KDB_ENTER_CONDITION *Condition); + +BOOLEAN +KdbpSetEnterCondition( + IN LONG ExceptionNr, + IN BOOLEAN FirstChance, + IN KDB_ENTER_CONDITION Condition); + +BOOLEAN +KdbpAttachToThread( + PVOID ThreadId); + +BOOLEAN +KdbpAttachToProcess( + PVOID ProcessId); + +VOID +STDCALL +KdbpGetCommandLineSettings(PCHAR p1); + +KD_CONTINUE_TYPE +KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, + KPROCESSOR_MODE PreviousMode, + PCONTEXT Context, + PKTRAP_FRAME TrapFrame, + BOOLEAN FirstChance); +/* other functions */ + +#define KdbpSafeReadMemory(dst, src, size) MmSafeCopyFromUser(dst, src, size) +#define KdbpSafeWriteMemory(dst, src, size) MmSafeCopyToUser(dst, src, size) + +#define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0) +CHAR +KdbpTryGetCharKeyboard(PULONG ScanCode, UINT Retry); + +#define KdbpGetCharSerial() KdbpTryGetCharSerial(0) +CHAR +KdbpTryGetCharSerial(UINT Retry); + +VOID +KdbEnter(VOID); +VOID +DbgRDebugInit(VOID); +VOID +DbgShowFiles(VOID); +VOID +DbgEnableFile(PCH Filename); +VOID +DbgDisableFile(PCH Filename); +VOID +KbdDisableMouse(); +VOID +KbdEnableMouse(); + +#endif /* NTOSKRNL_KDB_H */ + diff --git a/reactos/ntoskrnl/include/internal/kdbochs.h b/reactos/ntoskrnl/include/internal/kdbochs.h new file mode 100644 index 00000000000..88748bd30b4 --- /dev/null +++ b/reactos/ntoskrnl/include/internal/kdbochs.h @@ -0,0 +1,18 @@ +/* $Id: kd.h 13948 2005-03-12 01:11:06Z navaraf $ + * + * kernel debugger prototypes + */ + +#ifndef __INCLUDE_INTERNAL_KD_BOCHS_H +#define __INCLUDE_INTERNAL_KD_BOCHS_H + +#include +#include +#include + +VOID +STDCALL +KdpBochsInit(struct _KD_DISPATCH_TABLE *DispatchTable, + ULONG BootPhase); + +#endif /* __INCLUDE_INTERNAL_KD_BOCHS_H */ diff --git a/reactos/ntoskrnl/include/internal/kdgdb.h b/reactos/ntoskrnl/include/internal/kdgdb.h new file mode 100644 index 00000000000..c271cfb8514 --- /dev/null +++ b/reactos/ntoskrnl/include/internal/kdgdb.h @@ -0,0 +1,20 @@ +/* $Id: kd.h 13948 2005-03-12 01:11:06Z navaraf $ + * + * kernel debugger prototypes + */ + +#ifndef __INCLUDE_INTERNAL_KD_GDB_H +#define __INCLUDE_INTERNAL_KD_GDB_H + +#include +#include +#include + +VOID +STDCALL +KdpGdbStubInit(struct _KD_DISPATCH_TABLE *DispatchTable, + ULONG BootPhase); + +extern KD_PORT_INFORMATION GdbPortInfo; + +#endif /* __INCLUDE_INTERNAL_KD_BOCHS_H */ diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index 305d46f4490..86ffe7fec02 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -49,6 +49,39 @@ struct _KEXCEPTION_FRAME; #define IPI_REQUEST_DPC 2 #define IPI_REQUEST_FREEZE 3 +#ifndef __USE_W32API +typedef enum _KTHREAD_STATE { + Initialized, + Ready, + Running, + Standby, + Terminated, + Waiting, + Transition, + DeferredReady, +} THREAD_STATE, *PTHREAD_STATE; +#endif + +/* MACROS *************************************************************************/ + +#define KeEnterCriticalRegion(X) \ +{ \ + PKTHREAD _Thread = KeGetCurrentThread(); \ + if (_Thread) _Thread->KernelApcDisable--; \ +} + +#define KeLeaveCriticalRegion(X) \ +{ \ + PKTHREAD _Thread = KeGetCurrentThread(); \ + if((_Thread) && (++_Thread->KernelApcDisable == 0)) \ + { \ + if (!IsListEmpty(&_Thread->ApcState.ApcListHead[KernelMode])) \ + { \ + KiKernelApcDeliveryCheck(); \ + } \ + } \ +} + /* threadsch.c ********************************************************************/ /* Thread Scheduler Functions */ @@ -77,6 +110,36 @@ STDCALL KiUnblockThread(PKTHREAD Thread, PNTSTATUS WaitStatus, KPRIORITY Increment); + +NTSTATUS +STDCALL +KeSuspendThread(PKTHREAD Thread); + +NTSTATUS +FASTCALL +KiSwapContext(PKTHREAD NewThread); + +/* gmutex.c ********************************************************************/ + +VOID +FASTCALL +KiAcquireGuardedMutexContented(PKGUARDED_MUTEX GuardedMutex); + +/* gate.c **********************************************************************/ + +VOID +FASTCALL +KeInitializeGate(PKGATE Gate); + +VOID +FASTCALL +KeSignalGateBoostPriority(PKGATE Gate); + +VOID +FASTCALL +KeWaitForGate(PKGATE Gate, + KWAIT_REASON WaitReason, + KPROCESSOR_MODE WaitMode); /* ipi.c ********************************************************************/ @@ -168,6 +231,9 @@ KeProfileInterruptWithSource( IN KPROFILE_SOURCE Source ); +BOOLEAN +STDCALL +KiRosPrintAddress(PVOID Address); VOID STDCALL KeUpdateSystemTime(PKTRAP_FRAME TrapFrame, KIRQL Irql); VOID STDCALL KeUpdateRunTime(PKTRAP_FRAME TrapFrame, KIRQL Irql); @@ -179,9 +245,16 @@ VOID inline FASTCALL KeAcquireDispatcherDatabaseLockAtDpcLevel(VOID); VOID inline FASTCALL KeReleaseDispatcherDatabaseLock(KIRQL Irql); VOID inline FASTCALL KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID); -VOID +VOID STDCALL -KeInitializeThread(struct _KPROCESS* Process, PKTHREAD Thread, BOOLEAN First); +KeInitializeThread(struct _KPROCESS* Process, + PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context, + PVOID Teb, + PVOID KernelStack); VOID STDCALL @@ -217,7 +290,14 @@ FASTCALL KiAbortWaitThread(PKTHREAD Thread, NTSTATUS WaitStatus, KPRIORITY Increment); - + +VOID +STDCALL +KeInitializeProcess(struct _KPROCESS *Process, + KPRIORITY Priority, + KAFFINITY Affinity, + LARGE_INTEGER DirectoryTableBase); + ULONG STDCALL KeForceResumeThread(IN PKTHREAD Thread); @@ -233,11 +313,13 @@ VOID inline FASTCALL KiSatisifyMultipleObjectWaits(PKWAIT_BLOCK WaitBlock); VOID FASTCALL KiWaitTest(PDISPATCHER_HEADER Object, KPRIORITY Increment); PULONG KeGetStackTopThread(struct _ETHREAD* Thread); -VOID KeContextToTrapFrame(PCONTEXT Context, PKTRAP_FRAME TrapFrame); +BOOLEAN STDCALL KeContextToTrapFrame(PCONTEXT Context, PKTRAP_FRAME TrapFrame); VOID STDCALL KiDeliverApc(KPROCESSOR_MODE PreviousMode, PVOID Reserved, PKTRAP_FRAME TrapFrame); - +VOID +STDCALL +KiKernelApcDeliveryCheck(VOID); LONG STDCALL KiInsertQueue(IN PKQUEUE Queue, diff --git a/reactos/ntoskrnl/include/internal/ldr.h b/reactos/ntoskrnl/include/internal/ldr.h index a1b6b261359..c9711e889c5 100644 --- a/reactos/ntoskrnl/include/internal/ldr.h +++ b/reactos/ntoskrnl/include/internal/ldr.h @@ -34,10 +34,18 @@ LdrInitModuleManagement ( ); NTSTATUS -LdrpMapSystemDll ( - HANDLE ProcessHandle, - PVOID * LdrStartupAddress - ); +STDCALL +LdrpMapSystemDll(PEPROCESS Process, + PVOID *DllBase); + +NTSTATUS +STDCALL +LdrpInitializeSystemDll(VOID); + +NTSTATUS +STDCALL +LdrpGetSystemDllEntryPoints(VOID); + PVOID LdrpGetSystemDllEntryPoint (VOID); PVOID diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index 91fc8d9967a..24d06a69c26 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -37,6 +37,7 @@ typedef ULONG PFN_TYPE, *PPFN_TYPE; #define MEMORY_AREA_KERNEL_STACK (11) #define MEMORY_AREA_PAGED_POOL (12) #define MEMORY_AREA_NO_ACCESS (13) +#define MEMORY_AREA_PEB_OR_TEB (14) #define PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(x) \ ((x) / (4*1024*1024)) @@ -496,6 +497,28 @@ BOOLEAN MmIsAvailableSwapPage(VOID); VOID MmShowOutOfSpaceMessagePagingFile(VOID); +/* process.c ****************************************************************/ + +NTSTATUS +STDCALL +MmCreateProcessAddressSpace(IN struct _EPROCESS* Process, + IN PSECTION_OBJECT Section OPTIONAL); + +NTSTATUS +STDCALL +MmCreatePeb(PEPROCESS Process); + +struct _TEB* +STDCALL +MmCreateTeb(PEPROCESS Process, + PCLIENT_ID ClientId, + PINITIAL_TEB InitialTeb); + +VOID +STDCALL +MmDeleteTeb(PEPROCESS Process, + struct _TEB* Teb); + /* i386/pfault.c *************************************************************/ NTSTATUS MmPageFault(ULONG Cs, @@ -579,6 +602,17 @@ MmCheckForPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address, VOID MmInitializePageOp(VOID); +/* process.c *****************************************************************/ + +PVOID +STDCALL +MmCreateKernelStack(BOOLEAN GuiStack); + +VOID +STDCALL +MmDeleteKernelStack(PVOID Stack, + BOOLEAN GuiStack); + /* balace.c ******************************************************************/ VOID MmInitializeMemoryConsumer(ULONG Consumer, @@ -737,7 +771,11 @@ VOID MmDeletePageTable(struct _EPROCESS* Process, PVOID Address); PFN_TYPE MmGetPfnForProcess(struct _EPROCESS* Process, PVOID Address); -NTSTATUS MmCopyMmInfo(struct _EPROCESS* Src, struct _EPROCESS* Dest); +NTSTATUS +STDCALL +MmCopyMmInfo(struct _EPROCESS* Src, + struct _EPROCESS* Dest, + PPHYSICAL_ADDRESS DirectoryTableBase); NTSTATUS MmReleaseMmInfo(struct _EPROCESS* Process); diff --git a/reactos/ntoskrnl/include/internal/module.h b/reactos/ntoskrnl/include/internal/module.h index 57ee469f0ab..c116db9ac7b 100644 --- a/reactos/ntoskrnl/include/internal/module.h +++ b/reactos/ntoskrnl/include/internal/module.h @@ -14,9 +14,7 @@ typedef struct _MODULE_TEXT_SECTION LIST_ENTRY ListEntry; PWCH Name; PIMAGE_OPTIONAL_HEADER OptionalHeader; -#if defined(DBG) || defined(KDBG) PROSSYM_INFO RosSymInfo; -#endif /* KDBG */ } MODULE_TEXT_SECTION, *PMODULE_TEXT_SECTION; typedef struct _MODULE_OBJECT diff --git a/reactos/ntoskrnl/include/internal/ob.h b/reactos/ntoskrnl/include/internal/ob.h index 7e539064202..4efc22fa214 100644 --- a/reactos/ntoskrnl/include/internal/ob.h +++ b/reactos/ntoskrnl/include/internal/ob.h @@ -242,6 +242,14 @@ enum extern PDIRECTORY_OBJECT NameSpaceRoot; extern POBJECT_TYPE ObSymbolicLinkType; +extern PHANDLE_TABLE ObpKernelHandleTable; + +#define KERNEL_HANDLE_FLAG (1 << ((sizeof(HANDLE) * 8) - 1)) +#define ObIsKernelHandle(Handle, ProcessorMode) \ + (((ULONG_PTR)(Handle) & KERNEL_HANDLE_FLAG) && \ + ((ProcessorMode) == KernelMode)) +#define ObKernelHandleToHandle(Handle) \ + (HANDLE)((ULONG_PTR)(Handle) & ~KERNEL_HANDLE_FLAG) VOID ObpAddEntryDirectory(PDIRECTORY_OBJECT Parent, POBJECT_HEADER Header, @@ -264,11 +272,6 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes, PVOID* ReturnedObject, PUNICODE_STRING RemainingPath, POBJECT_TYPE ObjectType); -VOID ObDeleteHandleTable(struct _EPROCESS* Process); - -NTSTATUS -ObDeleteHandle(PEPROCESS Process, - HANDLE Handle); NTSTATUS ObpQueryHandleAttributes(HANDLE Handle, diff --git a/reactos/ntoskrnl/include/internal/ps.h b/reactos/ntoskrnl/include/internal/ps.h index 75e851a2d9e..7a8d9be068a 100644 --- a/reactos/ntoskrnl/include/internal/ps.h +++ b/reactos/ntoskrnl/include/internal/ps.h @@ -85,7 +85,10 @@ typedef struct _KTHREAD CHAR WaitMode; /* 55 */ UCHAR WaitNext; /* 56 */ UCHAR WaitReason; /* 57 */ - PKWAIT_BLOCK WaitBlockList; /* 58 */ + union { /* 58 */ + PKWAIT_BLOCK WaitBlockList; /* 58 */ + PKGATE GateObject; /* 58 */ + }; /* 58 */ LIST_ENTRY WaitListEntry; /* 5C */ ULONG WaitTime; /* 64 */ CHAR BasePriority; /* 68 */ @@ -94,7 +97,13 @@ typedef struct _KTHREAD CHAR Quantum; /* 6B */ KWAIT_BLOCK WaitBlock[4]; /* 6C */ PVOID LegoData; /* CC */ - ULONG KernelApcDisable; /* D0 */ + union { + struct { + USHORT KernelApcDisable; + USHORT SpecialApcDisable; + }; + ULONG CombinedApcDisable; /* D0 */ + }; KAFFINITY UserAffinity; /* D4 */ UCHAR SystemAffinityActive;/* D8 */ UCHAR PowerState; /* D9 */ @@ -428,8 +437,6 @@ struct _EPROCESS */ MADDRESS_SPACE AddressSpace; LIST_ENTRY ProcessListEntry; - PVOID TebBlock; - PVOID TebLastAllocated; }; #define PROCESS_STATE_TERMINATED (1) @@ -483,18 +490,25 @@ VOID STDCALL PsExitSpecialApc(PKAPC Apc, PVOID *NormalContext, PVOID *SystemArgument1, PVOID *SystemArgument2); - -#define THREAD_STATE_INITIALIZED (0) -#define THREAD_STATE_READY (1) -#define THREAD_STATE_RUNNING (2) -#define THREAD_STATE_SUSPENDED (3) -#define THREAD_STATE_FROZEN (4) -#define THREAD_STATE_TERMINATED_1 (5) -#define THREAD_STATE_TERMINATED_2 (6) -#define THREAD_STATE_BLOCKED (7) -#define THREAD_STATE_MAX (8) + +NTSTATUS +STDCALL +PspInitializeProcessSecurity(PEPROCESS Process, + PEPROCESS Parent OPTIONAL); +VOID +STDCALL +PspSystemThreadStartup(PKSTART_ROUTINE StartRoutine, + PVOID StartContext); + +NTSTATUS +PsInitializeIdleOrFirstThread ( + PEPROCESS Process, + PETHREAD* ThreadPtr, + PKSTART_ROUTINE StartRoutine, + KPROCESSOR_MODE AccessMode, + BOOLEAN First); /* * Internal thread priorities, added by Phillip Susi * TODO: rebalence these to make use of all priorities... the ones above 16 @@ -519,6 +533,11 @@ PspExitThread(NTSTATUS ExitStatus); extern LIST_ENTRY PspReaperListHead; extern WORK_QUEUE_ITEM PspReaperWorkItem; extern BOOLEAN PspReaping; +extern PEPROCESS PsInitialSystemProcess; +extern PEPROCESS PsIdleProcess; +extern LIST_ENTRY PsActiveProcessHead; +extern FAST_MUTEX PspActiveProcessMutex; +extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout; VOID STDCALL @@ -530,7 +549,7 @@ VOID PsFreezeOtherThread(PETHREAD Thread); VOID PsFreezeProcessThreads(PEPROCESS Process); VOID PsUnfreezeProcessThreads(PEPROCESS Process); ULONG PsEnumThreadsByProcess(PEPROCESS Process); -PEPROCESS PsGetNextProcess(PEPROCESS OldProcess); +PEPROCESS STDCALL PsGetNextProcess(PEPROCESS OldProcess); VOID PsApplicationProcessorInit(VOID); VOID @@ -665,6 +684,9 @@ VOID PsUnlockProcess(PEPROCESS Process); #define EPROCESS_TO_KPROCESS(pEProcess) (&(pEProcess)->Pcb) #define KPROCESS_TO_EPROCESS(pKProcess) (CONTAINING_RECORD((pKProcess), EPROCESS, Pcb)) +#define MAX_PROCESS_NOTIFY_ROUTINE_COUNT 8 +#define MAX_LOAD_IMAGE_NOTIFY_ROUTINE_COUNT 8 + #endif /* ASSEMBLER */ #endif /* __INCLUDE_INTERNAL_PS_H */ diff --git a/reactos/ntoskrnl/include/internal/se.h b/reactos/ntoskrnl/include/internal/se.h index 58e231a3ec4..d4e5d272af4 100644 --- a/reactos/ntoskrnl/include/internal/se.h +++ b/reactos/ntoskrnl/include/internal/se.h @@ -117,9 +117,7 @@ SepCreateImpersonationTokenDacl(PTOKEN Token, VOID SepInitializeTokenImplementation(VOID); -NTSTATUS SepCreateSystemProcessToken(struct _EPROCESS* Process); -NTSTATUS SepInitializeNewProcess(struct _EPROCESS* NewProcess, - struct _EPROCESS* ParentProcess); +PTOKEN STDCALL SepCreateSystemProcessToken(VOID); NTSTATUS SeExchangePrimaryToken(struct _EPROCESS* Process, PACCESS_TOKEN NewToken, @@ -148,6 +146,16 @@ SepPrivilegeCheck(PTOKEN Token, ULONG PrivilegeControl, KPROCESSOR_MODE PreviousMode); +NTSTATUS +STDCALL +SepDuplicateToken(PTOKEN Token, + POBJECT_ATTRIBUTES ObjectAttributes, + BOOLEAN EffectiveOnly, + TOKEN_TYPE TokenType, + SECURITY_IMPERSONATION_LEVEL Level, + KPROCESSOR_MODE PreviousMode, + PTOKEN* NewAccessToken); + NTSTATUS SepCaptureSecurityQualityOfService(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, diff --git a/reactos/ntoskrnl/include/ntoskrnl.h b/reactos/ntoskrnl/include/ntoskrnl.h index ef8e5ee09be..527c94d1da8 100755 --- a/reactos/ntoskrnl/include/ntoskrnl.h +++ b/reactos/ntoskrnl/include/ntoskrnl.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -53,7 +54,10 @@ #include #include #include -#include +#ifdef KDBG +#include +#endif +#include #include #include #include @@ -64,6 +68,15 @@ #include +#ifndef RTL_CONSTANT_STRING +#define RTL_CONSTANT_STRING(__SOURCE_STRING__) \ +{ \ + sizeof(__SOURCE_STRING__) - sizeof((__SOURCE_STRING__)[0]), \ + sizeof(__SOURCE_STRING__), \ + (__SOURCE_STRING__) \ +} +#endif + #ifdef DBG #ifndef PAGED_CODE #define PAGED_CODE() \ diff --git a/reactos/ntoskrnl/io/buildirp.c b/reactos/ntoskrnl/io/buildirp.c deleted file mode 100644 index 8bfdf453bd8..00000000000 --- a/reactos/ntoskrnl/io/buildirp.c +++ /dev/null @@ -1,555 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/buildirp.c - * PURPOSE: Building various types of irp - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* GLOBALS ******************************************************************/ - -#define TAG_SYS_BUF TAG('S', 'B', 'U', 'F') - -/* FUNCTIONS *****************************************************************/ - -NTSTATUS IoPrepareIrpBuffer(PIRP Irp, - PDEVICE_OBJECT DeviceObject, - PVOID Buffer, - ULONG Length, - ULONG MajorFunction) -/* - * FUNCTION: Prepares the buffer to be used for an IRP - */ -{ - Irp->UserBuffer = Buffer; - if (DeviceObject->Flags & DO_BUFFERED_IO) - { - DPRINT("Doing buffer i/o\n"); - Irp->AssociatedIrp.SystemBuffer = - (PVOID)ExAllocatePoolWithTag(NonPagedPool,Length, TAG_SYS_BUF); - if (Irp->AssociatedIrp.SystemBuffer==NULL) - { - return(STATUS_NOT_IMPLEMENTED); - } - /* FIXME: should copy buffer in on other ops */ - if (MajorFunction == IRP_MJ_WRITE) - { - RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, Buffer, Length); - } - } - if (DeviceObject->Flags & DO_DIRECT_IO) - { - DPRINT("Doing direct i/o\n"); - - Irp->MdlAddress = MmCreateMdl(NULL,Buffer,Length); - if(Irp->MdlAddress == NULL) { - DPRINT("MmCreateMdl: Out of memory!"); - return(STATUS_NO_MEMORY); - } - if (MajorFunction == IRP_MJ_READ) - { - MmProbeAndLockPages(Irp->MdlAddress,UserMode,IoWriteAccess); - } - else - { - MmProbeAndLockPages(Irp->MdlAddress,UserMode,IoReadAccess); - } - Irp->UserBuffer = NULL; - Irp->AssociatedIrp.SystemBuffer = NULL; - } - return(STATUS_SUCCESS); -} - - -/* - * @implemented - */ -PIRP STDCALL -IoBuildAsynchronousFsdRequest(ULONG MajorFunction, - PDEVICE_OBJECT DeviceObject, - PVOID Buffer, - ULONG Length, - PLARGE_INTEGER StartingOffset, - PIO_STATUS_BLOCK IoStatusBlock) -/* - * FUNCTION: Allocates and sets up an IRP to be sent to lower level drivers - * ARGUMENTS: - * MajorFunction = One of IRP_MJ_READ, IRP_MJ_WRITE, - * IRP_MJ_FLUSH_BUFFERS or IRP_MJ_SHUTDOWN - * DeviceObject = Device object to send the irp to - * Buffer = Buffer into which data will be read or written - * Length = Length in bytes of the irp to be allocated - * StartingOffset = Starting offset on the device - * IoStatusBlock (OUT) = Storage for the result of the operation - * RETURNS: The IRP allocated on success, or - * NULL on failure - */ -{ - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - - DPRINT("IoBuildAsynchronousFsdRequest(MajorFunction %x, DeviceObject %x, " - "Buffer %x, Length %x, StartingOffset %x, " - "IoStatusBlock %x\n",MajorFunction,DeviceObject,Buffer,Length, - StartingOffset,IoStatusBlock); - - Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE); - if (Irp==NULL) - { - return(NULL); - } - - Irp->UserIosb = IoStatusBlock; - DPRINT("Irp->UserIosb %x\n", Irp->UserIosb); - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = (UCHAR)MajorFunction; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = NULL; - StackPtr->CompletionRoutine = NULL; - - if (Length > 0) - { - NTSTATUS Status = STATUS_SUCCESS; - - _SEH_FILTER(FreeAndGoOn) - { - IoFreeIrp(Irp); - return EXCEPTION_CONTINUE_SEARCH; - } - _SEH_TRY_FILTER(FreeAndGoOn) - { - Status = IoPrepareIrpBuffer(Irp, - DeviceObject, - Buffer, - Length, - MajorFunction); - } - _SEH_HANDLE - { - KEBUGCHECK(0); - } - _SEH_END; - - if (!NT_SUCCESS(Status)) - { - IoFreeIrp(Irp); - return NULL; - } - } - - if (MajorFunction == IRP_MJ_READ) - { - StackPtr->Parameters.Read.Length = Length; - if (StartingOffset!=NULL) - { - StackPtr->Parameters.Read.ByteOffset = *StartingOffset; - } - else - { - StackPtr->Parameters.Read.ByteOffset.QuadPart = 0; - } - } - else if (MajorFunction == IRP_MJ_WRITE) - { - StackPtr->Parameters.Write.Length = Length; - if (StartingOffset!=NULL) - { - StackPtr->Parameters.Write.ByteOffset = *StartingOffset; - } - else - { - StackPtr->Parameters.Write.ByteOffset.QuadPart = 0; - } - } - - return(Irp); -} - - -/* - * @implemented - */ -PIRP STDCALL -IoBuildDeviceIoControlRequest(ULONG IoControlCode, - PDEVICE_OBJECT DeviceObject, - PVOID InputBuffer, - ULONG InputBufferLength, - PVOID OutputBuffer, - ULONG OutputBufferLength, - BOOLEAN InternalDeviceIoControl, - PKEVENT Event, - PIO_STATUS_BLOCK IoStatusBlock) -/* - * FUNCTION: Allocates and sets up an IRP to be sent to drivers - * ARGUMENTS: - * IoControlCode = Device io control code - * DeviceObject = Device object to send the irp to - * InputBuffer = Buffer from which data will be read by the driver - * InputBufferLength = Length in bytes of the input buffer - * OutputBuffer = Buffer into which data will be written by the driver - * OutputBufferLength = Length in bytes of the output buffer - * InternalDeviceIoControl = Determines weather - * IRP_MJ_INTERNAL_DEVICE_CONTROL or - * IRP_MJ_DEVICE_CONTROL will be used - * Event = Event used to notify the caller of completion - * IoStatusBlock (OUT) = Storage for the result of the operation - * RETURNS: The IRP allocated on success, or - * NULL on failure - */ -{ - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - ULONG BufferLength; - - DPRINT("IoBuildDeviceIoRequest(IoControlCode %x, DeviceObject %x, " - "InputBuffer %x, InputBufferLength %x, OutputBuffer %x, " - "OutputBufferLength %x, InternalDeviceIoControl %x " - "Event %x, IoStatusBlock %x\n",IoControlCode,DeviceObject, - InputBuffer,InputBufferLength,OutputBuffer,OutputBufferLength, - InternalDeviceIoControl,Event,IoStatusBlock); - - Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE); - if (Irp==NULL) - { - return(NULL); - } - - Irp->UserEvent = Event; - Irp->UserIosb = IoStatusBlock; - DPRINT("Irp->UserIosb %x\n", Irp->UserIosb); - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = InternalDeviceIoControl ? - IRP_MJ_INTERNAL_DEVICE_CONTROL : IRP_MJ_DEVICE_CONTROL; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = NULL; - StackPtr->CompletionRoutine = NULL; - StackPtr->Parameters.DeviceIoControl.IoControlCode = IoControlCode; - StackPtr->Parameters.DeviceIoControl.InputBufferLength = InputBufferLength; - StackPtr->Parameters.DeviceIoControl.OutputBufferLength = - OutputBufferLength; - - switch (IO_METHOD_FROM_CTL_CODE(IoControlCode)) - { - case METHOD_BUFFERED: - DPRINT("Using METHOD_BUFFERED!\n"); - - if (InputBufferLength > OutputBufferLength) - { - BufferLength = InputBufferLength; - } - else - { - BufferLength = OutputBufferLength; - } - if (BufferLength) - { - Irp->AssociatedIrp.SystemBuffer = (PVOID) - ExAllocatePoolWithTag(NonPagedPool,BufferLength, TAG_SYS_BUF); - - if (Irp->AssociatedIrp.SystemBuffer == NULL) - { - IoFreeIrp(Irp); - return(NULL); - } - } - - if (InputBuffer && InputBufferLength) - { - RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - InputBuffer, - InputBufferLength); - RtlZeroMemory((char*)Irp->AssociatedIrp.SystemBuffer + InputBufferLength, - BufferLength - InputBufferLength); - } - else - { - RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer, - BufferLength); - } - Irp->UserBuffer = OutputBuffer; - break; - - case METHOD_IN_DIRECT: - DPRINT("Using METHOD_IN_DIRECT!\n"); - - /* build input buffer (control buffer) */ - if (InputBuffer && InputBufferLength) - { - Irp->AssociatedIrp.SystemBuffer = (PVOID) - ExAllocatePoolWithTag(NonPagedPool,InputBufferLength, - TAG_SYS_BUF); - - if (Irp->AssociatedIrp.SystemBuffer==NULL) - { - IoFreeIrp(Irp); - return(NULL); - } - - RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - InputBuffer, - InputBufferLength); - } - - /* build output buffer (data transfer buffer) */ - if (OutputBuffer && OutputBufferLength) - { - Irp->MdlAddress = IoAllocateMdl(OutputBuffer, - OutputBufferLength, - FALSE, - FALSE, - Irp); - if (Irp->MdlAddress == NULL) - { - IoFreeIrp(Irp); - return NULL; - } - - _SEH_FILTER(FreeAndGoOn) - { - IoFreeIrp(Irp); - return EXCEPTION_CONTINUE_SEARCH; - } - _SEH_TRY_FILTER(FreeAndGoOn) - { - MmProbeAndLockPages(Irp->MdlAddress,UserMode,IoReadAccess); - } - _SEH_HANDLE - { - KEBUGCHECK(0); - } - _SEH_END; - - } - break; - - case METHOD_OUT_DIRECT: - DPRINT("Using METHOD_OUT_DIRECT!\n"); - - /* build input buffer (control buffer) */ - if (InputBuffer && InputBufferLength) - { - Irp->AssociatedIrp.SystemBuffer = (PVOID) - ExAllocatePoolWithTag(NonPagedPool,InputBufferLength, - TAG_SYS_BUF); - - if (Irp->AssociatedIrp.SystemBuffer==NULL) - { - IoFreeIrp(Irp); - return(NULL); - } - - RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - InputBuffer, - InputBufferLength); - } - - /* build output buffer (data transfer buffer) */ - if (OutputBuffer && OutputBufferLength) - { - Irp->MdlAddress = IoAllocateMdl(OutputBuffer, - OutputBufferLength, - FALSE, - FALSE, - Irp); - if (Irp->MdlAddress == NULL) - { - IoFreeIrp(Irp); - return NULL; - } - - _SEH_FILTER(FreeAndGoOn) - { - IoFreeIrp(Irp); - return EXCEPTION_CONTINUE_SEARCH; - } - _SEH_TRY_FILTER(FreeAndGoOn) - { - MmProbeAndLockPages(Irp->MdlAddress,UserMode,IoWriteAccess); - } - _SEH_HANDLE - { - KEBUGCHECK(0); - } - _SEH_END; - } - break; - - case METHOD_NEITHER: - DPRINT("Using METHOD_NEITHER!\n"); - - Irp->UserBuffer = OutputBuffer; - StackPtr->Parameters.DeviceIoControl.Type3InputBuffer = InputBuffer; - break; - } - - /* synchronous irp's are queued to requestor thread's irp cancel/cleanup list */ - IoQueueThreadIrp(Irp); - return(Irp); -} - - -/* - * @implemented - */ -PIRP STDCALL -IoBuildSynchronousFsdRequest(ULONG MajorFunction, - PDEVICE_OBJECT DeviceObject, - PVOID Buffer, - ULONG Length, - PLARGE_INTEGER StartingOffset, - PKEVENT Event, - PIO_STATUS_BLOCK IoStatusBlock) -/* - * FUNCTION: Allocates and builds an IRP to be sent synchronously to lower - * level driver(s) - * ARGUMENTS: - * MajorFunction = Major function code, one of IRP_MJ_READ, - * IRP_MJ_WRITE, IRP_MJ_FLUSH_BUFFERS, IRP_MJ_SHUTDOWN - * DeviceObject = Target device object - * Buffer = Buffer containing data for a read or write - * Length = Length in bytes of the information to be transferred - * StartingOffset = Offset to begin the read/write from - * Event (OUT) = Will be set when the operation is complete - * IoStatusBlock (OUT) = Set to the status of the operation - * RETURNS: The IRP allocated on success, or - * NULL on failure - */ -{ - PIRP Irp; - - DPRINT("IoBuildSynchronousFsdRequest(MajorFunction %x, DeviceObject %x, " - "Buffer %x, Length %x, StartingOffset %x, Event %x, " - "IoStatusBlock %x\n",MajorFunction,DeviceObject,Buffer,Length, - StartingOffset,Event,IoStatusBlock); - - Irp = IoBuildAsynchronousFsdRequest(MajorFunction, - DeviceObject, - Buffer, - Length, - StartingOffset, - IoStatusBlock ); - if (Irp==NULL) - { - return(NULL); - } - - Irp->UserEvent = Event; - - /* synchronous irp's are queued to requestor thread's irp cancel/cleanup list */ - IoQueueThreadIrp(Irp); - return(Irp); -} - - -PIRP -IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction, - PDEVICE_OBJECT DeviceObject, - PMDL Mdl, - PLARGE_INTEGER StartingOffset, - PKEVENT Event, - PIO_STATUS_BLOCK IoStatusBlock, - BOOLEAN PagingIo) -/* - * FUNCTION: Allocates and builds an IRP to be sent synchronously to lower - * level driver(s) - * ARGUMENTS: - * MajorFunction = Major function code, one of IRP_MJ_READ, - * IRP_MJ_WRITE, IRP_MJ_FLUSH_BUFFERS, IRP_MJ_SHUTDOWN - * DeviceObject = Target device object - * Buffer = Buffer containing data for a read or write - * Length = Length in bytes of the information to be transferred - * StartingOffset = Offset to begin the read/write from - * Event (OUT) = Will be set when the operation is complete - * IoStatusBlock (OUT) = Set to the status of the operation - * RETURNS: The IRP allocated on success, or - * NULL on failure - */ -{ - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - - DPRINT("IoBuildSynchronousFsdRequestWithMdl(MajorFunction %x, " - "DeviceObject %x, " - "Mdl %x, StartingOffset %x, Event %x, " - "IoStatusBlock %x\n",MajorFunction,DeviceObject,Mdl, - StartingOffset,Event,IoStatusBlock); - - Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE); - if (Irp==NULL) - { - return(NULL); - } - - Irp->UserEvent = Event; - Irp->UserIosb = IoStatusBlock; - DPRINT("Irp->UserIosb %x\n", Irp->UserIosb); - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - if (PagingIo) - { - Irp->Flags = IRP_PAGING_IO; - } - else - { - Irp->Flags = 0; - } - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = (UCHAR)MajorFunction; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = NULL; - StackPtr->CompletionRoutine = NULL; - - Irp->MdlAddress = Mdl; - Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl); - Irp->AssociatedIrp.SystemBuffer = NULL; - - if (MajorFunction == IRP_MJ_READ) - { - if (StartingOffset != NULL) - { - StackPtr->Parameters.Read.ByteOffset = *StartingOffset; - } - else - { - StackPtr->Parameters.Read.ByteOffset.QuadPart = 0; - } - StackPtr->Parameters.Read.Length = MmGetMdlByteCount(Mdl); - } - else - { - if (StartingOffset!=NULL) - { - StackPtr->Parameters.Write.ByteOffset = *StartingOffset; - } - else - { - StackPtr->Parameters.Write.ByteOffset.QuadPart = 0; - } - StackPtr->Parameters.Write.Length = MmGetMdlByteCount(Mdl); - } - - return(Irp); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/cancel.c b/reactos/ntoskrnl/io/cancel.c deleted file mode 100644 index 252fbd2955c..00000000000 --- a/reactos/ntoskrnl/io/cancel.c +++ /dev/null @@ -1,251 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/cancel.c - * PURPOSE: Cancel routine - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* GLOBALS *******************************************************************/ - -static KSPIN_LOCK CancelSpinLock; - -/* FUNCTIONS *****************************************************************/ - -/** - * @name NtCancelIoFile - * - * Cancel all pending I/O operations in the current thread for specified - * file object. - * - * @param FileHandle - * Handle to file object to cancel requests for. No specific - * access rights are needed. - * @param IoStatusBlock - * Pointer to status block which is filled with final completition - * status on successful return. - * - * @return Status. - * - * @implemented - */ - -NTSTATUS STDCALL -NtCancelIoFile( - IN HANDLE FileHandle, - OUT PIO_STATUS_BLOCK IoStatusBlock) -{ - NTSTATUS Status; - PFILE_OBJECT FileObject; - PETHREAD Thread; - PLIST_ENTRY IrpEntry; - PIRP Irp; - KIRQL OldIrql; - BOOLEAN OurIrpsInList = FALSE; - LARGE_INTEGER Interval; - - if ((ULONG_PTR)IoStatusBlock >= MmUserProbeAddress && - KeGetPreviousMode() == UserMode) - return STATUS_ACCESS_VIOLATION; - - Status = ObReferenceObjectByHandle(FileHandle, 0, IoFileObjectType, - KeGetPreviousMode(), (PVOID*)&FileObject, - NULL); - if (!NT_SUCCESS(Status)) - return Status; - - /* IRP cancellations are synchronized at APC_LEVEL. */ - OldIrql = KfRaiseIrql(APC_LEVEL); - - /* - * Walk the list of active IRPs and cancel the ones that belong to - * our file object. - */ - - Thread = PsGetCurrentThread(); - for (IrpEntry = Thread->IrpList.Flink; - IrpEntry != &Thread->IrpList; - IrpEntry = IrpEntry->Flink) - { - Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); - if (Irp->Tail.Overlay.OriginalFileObject == FileObject) - { - IoCancelIrp(Irp); - /* Don't break here, we want to cancel all IRPs for the file object. */ - OurIrpsInList = TRUE; - } - } - - KfLowerIrql(OldIrql); - - while (OurIrpsInList) - { - OurIrpsInList = FALSE; - - /* Wait a short while and then look if all our IRPs were completed. */ - Interval.QuadPart = -1000000; /* 100 milliseconds */ - KeDelayExecutionThread(KernelMode, FALSE, &Interval); - - OldIrql = KfRaiseIrql(APC_LEVEL); - - /* - * Look in the list if all IRPs for the specified file object - * are completed (or cancelled). If someone sends a new IRP - * for our file object while we're here we can happily loop - * forever. - */ - - for (IrpEntry = Thread->IrpList.Flink; - IrpEntry != &Thread->IrpList; - IrpEntry = IrpEntry->Flink) - { - Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); - if (Irp->Tail.Overlay.OriginalFileObject == FileObject) - { - OurIrpsInList = TRUE; - break; - } - } - - KfLowerIrql(OldIrql); - } - - _SEH_TRY - { - IoStatusBlock->Status = STATUS_SUCCESS; - IoStatusBlock->Information = 0; - Status = STATUS_SUCCESS; - } - _SEH_HANDLE - { - Status = STATUS_UNSUCCESSFUL; - } - _SEH_END; - - ObDereferenceObject(FileObject); - - return Status; -} - -/** - * @name IoCancelThreadIo - * - * Cancel all pending I/O request associated with specified thread. - * - * @param Thread - * Thread to cancel requests for. - */ - -VOID STDCALL -IoCancelThreadIo(PETHREAD Thread) -{ - PLIST_ENTRY IrpEntry; - PIRP Irp; - KIRQL OldIrql; - ULONG Retries = 3000; - LARGE_INTEGER Interval; - - OldIrql = KfRaiseIrql(APC_LEVEL); - - /* - * Start by cancelling all the IRPs in the current thread queue. - */ - - for (IrpEntry = Thread->IrpList.Flink; - IrpEntry != &Thread->IrpList; - IrpEntry = IrpEntry->Flink) - { - Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); - IoCancelIrp(Irp); - } - - /* - * Wait till all the IRPs are completed or cancelled. - */ - - while (!IsListEmpty(&Thread->IrpList)) - { - KfLowerIrql(OldIrql); - - /* Wait a short while and then look if all our IRPs were completed. */ - Interval.QuadPart = -1000000; /* 100 milliseconds */ - KeDelayExecutionThread(KernelMode, FALSE, &Interval); - - /* - * Don't stay here forever if some broken driver doesn't complete - * the IRP. - */ - - if (Retries-- == 0) - { - /* FIXME: Handle this gracefully. */ - DPRINT1("Thread with dead IRPs!"); - ASSERT(FALSE); - } - - OldIrql = KfRaiseIrql(APC_LEVEL); - } - - KfLowerIrql(OldIrql); -} - -/* - * @implemented - */ -BOOLEAN STDCALL -IoCancelIrp(PIRP Irp) -{ - KIRQL oldlvl; - PDRIVER_CANCEL CancelRoutine; - - DPRINT("IoCancelIrp(Irp %x)\n",Irp); - - IoAcquireCancelSpinLock(&oldlvl); - - Irp->Cancel = TRUE; - - CancelRoutine = IoSetCancelRoutine(Irp, NULL); - if (CancelRoutine == NULL) - { - IoReleaseCancelSpinLock(oldlvl); - return(FALSE); - } - - Irp->CancelIrql = oldlvl; - CancelRoutine(IoGetCurrentIrpStackLocation(Irp)->DeviceObject, Irp); - return(TRUE); -} - -VOID INIT_FUNCTION -IoInitCancelHandling(VOID) -{ - KeInitializeSpinLock(&CancelSpinLock); -} - -/* - * @implemented - */ -VOID STDCALL -IoAcquireCancelSpinLock(PKIRQL Irql) -{ - KeAcquireSpinLock(&CancelSpinLock,Irql); -} - -/* - * @implemented - */ -VOID STDCALL -IoReleaseCancelSpinLock(KIRQL Irql) -{ - KeReleaseSpinLock(&CancelSpinLock,Irql); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/cleanup.c b/reactos/ntoskrnl/io/cleanup.c deleted file mode 100644 index ef2097c0dc5..00000000000 --- a/reactos/ntoskrnl/io/cleanup.c +++ /dev/null @@ -1,321 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/cleanup.c - * PURPOSE: IRP cleanup - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES ****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS ***************************************************************/ - -VOID IoDeviceControlCompletion(PDEVICE_OBJECT DeviceObject, - PIRP Irp, - PIO_STACK_LOCATION IoStack) -{ - ULONG IoControlCode; - ULONG OutputBufferLength; - - if (IoStack->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL) - { - IoControlCode = - IoStack->Parameters.FileSystemControl.FsControlCode; - OutputBufferLength = - IoStack->Parameters.FileSystemControl.OutputBufferLength; - } - else - { - IoControlCode = IoStack->Parameters.DeviceIoControl.IoControlCode; - if (NT_SUCCESS(Irp->IoStatus.Status)) - { - OutputBufferLength = Irp->IoStatus.Information; - if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < OutputBufferLength) - { - OutputBufferLength = IoStack->Parameters.DeviceIoControl.OutputBufferLength; - } - } - else - { - OutputBufferLength = 0; - } - } - - switch (IO_METHOD_FROM_CTL_CODE(IoControlCode)) - { - case METHOD_BUFFERED: - DPRINT ("Using METHOD_BUFFERED!\n"); - - /* copy output buffer back and free it */ - if (Irp->AssociatedIrp.SystemBuffer) - { - if (OutputBufferLength) - { - RtlCopyMemory(Irp->UserBuffer, - Irp->AssociatedIrp.SystemBuffer, - OutputBufferLength); - } - ExFreePool (Irp->AssociatedIrp.SystemBuffer); - } - break; - - case METHOD_IN_DIRECT: - DPRINT ("Using METHOD_IN_DIRECT!\n"); - /* use the same code as for METHOD_OUT_DIRECT */ - - case METHOD_OUT_DIRECT: - DPRINT ("Using METHOD_OUT_DIRECT!\n"); - - /* free input buffer (control buffer) */ - if (Irp->AssociatedIrp.SystemBuffer) - ExFreePool (Irp->AssociatedIrp.SystemBuffer); - - /* free output buffer (data transfer buffer) */ - if (Irp->MdlAddress) - IoFreeMdl (Irp->MdlAddress); - break; - - case METHOD_NEITHER: - DPRINT ("Using METHOD_NEITHER!\n"); - /* nothing to do */ - break; - } -} - -VOID IoReadWriteCompletion(PDEVICE_OBJECT DeviceObject, - PIRP Irp, - PIO_STACK_LOCATION IoStack) -{ - PFILE_OBJECT FileObject; - - FileObject = IoStack->FileObject; - - if (DeviceObject->Flags & DO_BUFFERED_IO) - { - if (IoStack->MajorFunction == IRP_MJ_READ) - { - DPRINT("Copying buffered io back to user\n"); - memcpy(Irp->UserBuffer,Irp->AssociatedIrp.SystemBuffer, - IoStack->Parameters.Read.Length); - } - ExFreePool(Irp->AssociatedIrp.SystemBuffer); - } - - if (DeviceObject->Flags & DO_DIRECT_IO) - { - if (Irp->MdlAddress) - { - IoFreeMdl(Irp->MdlAddress); - } - } -} - -VOID IoVolumeInformationCompletion(PDEVICE_OBJECT DeviceObject, - PIRP Irp, - PIO_STACK_LOCATION IoStack) -{ -} - - -VOID STDCALL -IoSecondStageCompletion_KernelApcRoutine( - IN PKAPC Apc, - IN OUT PKNORMAL_ROUTINE *NormalRoutine, - IN OUT PVOID *NormalContext, - IN OUT PVOID *SystemArgument1, - IN OUT PVOID *SystemArgument2 - ) -{ - PIRP Irp; - - Irp = CONTAINING_RECORD(Apc, IRP, Tail.Apc); - IoFreeIrp(Irp); -} - - -VOID STDCALL -IoSecondStageCompletion_RundownApcRoutine( - IN PKAPC Apc - ) -{ - PIRP Irp; - - Irp = CONTAINING_RECORD(Apc, IRP, Tail.Apc); - IoFreeIrp(Irp); -} - - -/* - * FUNCTION: Performs the second stage of irp completion for read/write irps - * - * Called as a special kernel APC kernel-routine or directly from IofCompleteRequest() - */ -VOID STDCALL -IoSecondStageCompletion( - PKAPC Apc, - PKNORMAL_ROUTINE* NormalRoutine, - PVOID* NormalContext, - PVOID* SystemArgument1, - PVOID* SystemArgument2) - -{ - PIO_STACK_LOCATION IoStack; - PDEVICE_OBJECT DeviceObject; - PFILE_OBJECT OriginalFileObject; - PIRP Irp; - - if (Apc) DPRINT("IoSecondStageCompletition with APC: %x\n", Apc); - - OriginalFileObject = (PFILE_OBJECT)(*SystemArgument1); - DPRINT("OriginalFileObject: %x\n", OriginalFileObject); - - Irp = CONTAINING_RECORD(Apc, IRP, Tail.Apc); - DPRINT("Irp: %x\n", Irp); - - /* - * Note that we'll never see irp's flagged IRP_PAGING_IO (IRP_MOUNT_OPERATION) - * or IRP_CLOSE_OPERATION (IRP_MJ_CLOSE and IRP_MJ_CLEANUP) here since their - * cleanup/completion is fully taken care of in IoCompleteRequest. - * -Gunnar - */ - - /* - Remove synchronous irp's from the threads cleanup list. - To synchronize with the code inserting the entry, this code must run - at APC_LEVEL - */ - if (!IsListEmpty(&Irp->ThreadListEntry)) - { - RemoveEntryList(&Irp->ThreadListEntry); - InitializeListHead(&Irp->ThreadListEntry); - } - - IoStack = (PIO_STACK_LOCATION)(Irp+1) + Irp->CurrentLocation; - DeviceObject = IoStack->DeviceObject; - - DPRINT("IoSecondStageCompletion(Irp %x, MajorFunction %x)\n", Irp, IoStack->MajorFunction); - - switch (IoStack->MajorFunction) - { - case IRP_MJ_CREATE: - case IRP_MJ_FLUSH_BUFFERS: - /* NOP */ - break; - - case IRP_MJ_READ: - case IRP_MJ_WRITE: - IoReadWriteCompletion(DeviceObject,Irp,IoStack); - break; - - case IRP_MJ_DEVICE_CONTROL: - case IRP_MJ_INTERNAL_DEVICE_CONTROL: - case IRP_MJ_FILE_SYSTEM_CONTROL: - IoDeviceControlCompletion(DeviceObject, Irp, IoStack); - break; - - case IRP_MJ_QUERY_VOLUME_INFORMATION: - case IRP_MJ_SET_VOLUME_INFORMATION: - IoVolumeInformationCompletion(DeviceObject, Irp, IoStack); - break; - - default: - break; - } - - if (Irp->UserIosb!=NULL) - { - if (Irp->RequestorMode == KernelMode) - { - *Irp->UserIosb = Irp->IoStatus; - } - else - { - DPRINT("Irp->RequestorMode == UserMode\n"); - MmSafeCopyToUser(Irp->UserIosb, - &Irp->IoStatus, - sizeof(IO_STATUS_BLOCK)); - } - } - - if (Irp->UserEvent) - { - KeSetEvent(Irp->UserEvent,0,FALSE); - } - - //Windows NT File System Internals, page 169 - if (OriginalFileObject) - { - if (Irp->UserEvent == NULL) - { - KeSetEvent(&OriginalFileObject->Event,0,FALSE); - } - else if (OriginalFileObject->Flags & FO_SYNCHRONOUS_IO && Irp->UserEvent != &OriginalFileObject->Event) - { - KeSetEvent(&OriginalFileObject->Event,0,FALSE); - } - } - - //Windows NT File System Internals, page 154 - if (OriginalFileObject) - { - // if the event is not the one in the file object, it needs dereferenced - if (Irp->UserEvent && Irp->UserEvent != &OriginalFileObject->Event) - { - ObDereferenceObject(Irp->UserEvent); - } - - ObDereferenceObject(OriginalFileObject); - } - - if (Irp->Overlay.AsynchronousParameters.UserApcRoutine != NULL) - { - PKNORMAL_ROUTINE UserApcRoutine; - PVOID UserApcContext; - - DPRINT("Dispatching user APC\n"); - - UserApcRoutine = (PKNORMAL_ROUTINE)Irp->Overlay.AsynchronousParameters.UserApcRoutine; - UserApcContext = (PVOID)Irp->Overlay.AsynchronousParameters.UserApcContext; - - KeInitializeApc( &Irp->Tail.Apc, - KeGetCurrentThread(), - CurrentApcEnvironment, - IoSecondStageCompletion_KernelApcRoutine, - IoSecondStageCompletion_RundownApcRoutine, - UserApcRoutine, - UserMode, - UserApcContext); - - KeInsertQueueApc( &Irp->Tail.Apc, - Irp->UserIosb, - NULL, - 2); - - //NOTE: kernel (or rundown) routine frees the IRP - - return; - - } - - if (NULL != IoStack->FileObject - && NULL != IoStack->FileObject->CompletionContext - && (0 != (Irp->Flags & IRP_SYNCHRONOUS_API) - || 0 == (IoStack->FileObject->Flags & FO_SYNCHRONOUS_IO))) - { - PFILE_OBJECT FileObject = IoStack->FileObject; - IoSetIoCompletion(FileObject->CompletionContext->Port, - FileObject->CompletionContext->Key, - Irp->Overlay.AsynchronousParameters.UserApcContext, - Irp->IoStatus.Status, - Irp->IoStatus.Information, - FALSE); - } - - IoFreeIrp(Irp); -} diff --git a/reactos/ntoskrnl/io/cntrller.c b/reactos/ntoskrnl/io/cntrller.c deleted file mode 100644 index 70a6dba75c8..00000000000 --- a/reactos/ntoskrnl/io/cntrller.c +++ /dev/null @@ -1,175 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/cntrller.c - * PURPOSE: Implements the controller object - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#include - -/* GLOBALS *******************************************************************/ - -#define TAG_CQE TAG('C', 'Q', 'E', ' ') -#define TAG_CONTROLLER TAG('C', 'N', 'T', 'R') -#define TAG_CONTROLLER_EXTENSION TAG('C', 'E', 'X', 'T') - -/* TYPES ********************************************************************/ - -typedef struct -/* - * PURPOSE: A entry in the queue waiting for a controller object - */ -{ - KDEVICE_QUEUE_ENTRY Entry; - PDEVICE_OBJECT DeviceObject; - PDRIVER_CONTROL ExecutionRoutine; - PVOID Context; -} CONTROLLER_QUEUE_ENTRY, *PCONTROLLER_QUEUE_ENTRY; - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -VOID -STDCALL -IoAllocateController(PCONTROLLER_OBJECT ControllerObject, - PDEVICE_OBJECT DeviceObject, - PDRIVER_CONTROL ExecutionRoutine, - PVOID Context) -/* - * FUNCTION: Sets up a call to a driver-supplied ControllerControl routine - * as soon as the device controller, represented by the given controller - * object, is available to carry out an I/O operation for the target device, - * represented by the given device object. - * ARGUMENTS: - * ControllerObject = Driver created controller object - * DeviceObject = Target device for the current irp - * ExecutionRoutine = Routine to be called when the device is available - * Context = Driver supplied context to be passed on to the above routine - * NOTE: Is the below implementation correct. - */ -{ - PCONTROLLER_QUEUE_ENTRY entry; - IO_ALLOCATION_ACTION Result; - - ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); - - entry = - ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTROLLER_QUEUE_ENTRY), - TAG_CQE); - ASSERT(entry!=NULL); - - entry->DeviceObject = DeviceObject; - entry->ExecutionRoutine = ExecutionRoutine; - entry->Context = Context; - - if (KeInsertDeviceQueue(&ControllerObject->DeviceWaitQueue,&entry->Entry)) - { - return; - } - Result = ExecutionRoutine(DeviceObject,DeviceObject->CurrentIrp, - NULL,Context); - if (Result == DeallocateObject) - { - IoFreeController(ControllerObject); - } - ExFreePool(entry); -} - -/* - * @implemented - */ -PCONTROLLER_OBJECT -STDCALL -IoCreateController(ULONG Size) -/* - * FUNCTION: Allocates memory and initializes a controller object - * ARGUMENTS: - * Size = Size (in bytes) to be allocated for the controller extension - * RETURNS: A pointer to the created object - */ -{ - PCONTROLLER_OBJECT controller; - - ASSERT_IRQL(PASSIVE_LEVEL); - - controller = - ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTROLLER_OBJECT), - TAG_CONTROLLER); - if (controller==NULL) - { - return(NULL); - } - - controller->ControllerExtension = - ExAllocatePoolWithTag(NonPagedPool, Size, TAG_CONTROLLER_EXTENSION); - if (controller->ControllerExtension==NULL) - { - ExFreePool(controller); - return(NULL); - } - - KeInitializeDeviceQueue(&controller->DeviceWaitQueue); - return(controller); -} - -/* - * @implemented - */ -VOID -STDCALL -IoDeleteController(PCONTROLLER_OBJECT ControllerObject) -/* - * FUNCTION: Removes a given controller object from the system - * ARGUMENTS: - * ControllerObject = Controller object to be released - */ -{ - ASSERT_IRQL(PASSIVE_LEVEL); - - ExFreePool(ControllerObject->ControllerExtension); - ExFreePool(ControllerObject); -} - -/* - * @implemented - */ -VOID -STDCALL -IoFreeController(PCONTROLLER_OBJECT ControllerObject) -/* - * FUNCTION: Releases a previously allocated controller object when a - * device has finished an I/O request - * ARGUMENTS: - * ControllerObject = Controller object to be released - */ -{ - PKDEVICE_QUEUE_ENTRY QEntry; - CONTROLLER_QUEUE_ENTRY* Entry; - IO_ALLOCATION_ACTION Result; - - do - { - QEntry = KeRemoveDeviceQueue(&ControllerObject->DeviceWaitQueue); - Entry = CONTAINING_RECORD(QEntry,CONTROLLER_QUEUE_ENTRY,Entry); - if (QEntry==NULL) - { - return; - } - Result = Entry->ExecutionRoutine(Entry->DeviceObject, - Entry->DeviceObject->CurrentIrp, - NULL, - Entry->Context); - ExFreePool(Entry); - } while (Result == DeallocateObject); -} - - -/* EOF */ diff --git a/reactos/ntoskrnl/io/controller.c b/reactos/ntoskrnl/io/controller.c new file mode 100644 index 00000000000..7e029792061 --- /dev/null +++ b/reactos/ntoskrnl/io/controller.c @@ -0,0 +1,178 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/io/contrller.c + * PURPOSE: Implements the controller object + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +/* GLOBALS *******************************************************************/ + +POBJECT_TYPE IoControllerObjectType; + +/* FUNCTIONS *****************************************************************/ + +/* + * @implemented + * + * FUNCTION: Sets up a call to a driver-supplied ControllerControl routine + * as soon as the device controller, represented by the given controller + * object, is available to carry out an I/O operation for the target device, + * represented by the given device object. + * ARGUMENTS: + * ControllerObject = Driver created controller object + * DeviceObject = Target device for the current irp + * ExecutionRoutine = Routine to be called when the device is available + * Context = Driver supplied context to be passed on to the above routine + */ +VOID +STDCALL +IoAllocateController(PCONTROLLER_OBJECT ControllerObject, + PDEVICE_OBJECT DeviceObject, + PDRIVER_CONTROL ExecutionRoutine, + PVOID Context) +{ + IO_ALLOCATION_ACTION Result; + + ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); + + /* Initialize the Wait Context Block */ + DeviceObject->Queue.Wcb.DeviceContext = Context; + DeviceObject->Queue.Wcb.DeviceRoutine = ExecutionRoutine; + + /* Insert the Device Queue */ + if (!KeInsertDeviceQueue(&ControllerObject->DeviceWaitQueue, + &DeviceObject->Queue.Wcb.WaitQueueEntry)); + { + Result = ExecutionRoutine(DeviceObject, + DeviceObject->CurrentIrp, + NULL, + Context); + } + + if (Result == DeallocateObject) + { + IoFreeController(ControllerObject); + } +} + +/* + * @implemented + * + * FUNCTION: Allocates memory and initializes a controller object + * ARGUMENTS: + * Size = Size (in bytes) to be allocated for the controller extension + * RETURNS: A pointer to the created object + */ +PCONTROLLER_OBJECT +STDCALL +IoCreateController(ULONG Size) + +{ + PCONTROLLER_OBJECT Controller; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE Handle; + NTSTATUS Status; + ASSERT_IRQL(PASSIVE_LEVEL); + + /* Initialize an empty OBA */ + InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); + + /* Create the Object */ + Status = ObCreateObject(KernelMode, + IoControllerObjectType, + &ObjectAttributes, + KernelMode, + NULL, + sizeof(CONTROLLER_OBJECT) + Size, + 0, + 0, + (PVOID*)&Controller); + if (!NT_SUCCESS(Status)) return NULL; + + /* Insert it */ + Status = ObInsertObject(Controller, + NULL, + FILE_READ_DATA | FILE_WRITE_DATA, + 0, + NULL, + &Handle); + if (!NT_SUCCESS(Status)) return NULL; + + /* Close the dummy handle */ + NtClose(Handle); + + /* Zero the Object and set its data */ + RtlZeroMemory(Controller, sizeof(CONTROLLER_OBJECT) + Size); + Controller->Type = IO_TYPE_CONTROLLER; + Controller->Size = sizeof(CONTROLLER_OBJECT) + Size; + Controller->ControllerExtension = (Controller + 1); + + /* Initialize its Queue */ + KeInitializeDeviceQueue(&Controller->DeviceWaitQueue); + + /* Return Controller */ + return Controller; +} + +/* + * @implemented + * + * FUNCTION: Removes a given controller object from the system + * ARGUMENTS: + * ControllerObject = Controller object to be released + */ +VOID +STDCALL +IoDeleteController(PCONTROLLER_OBJECT ControllerObject) + +{ + /* Just Dereference it */ + ObDereferenceObject(ControllerObject); +} + +/* + * @implemented + * + * FUNCTION: Releases a previously allocated controller object when a + * device has finished an I/O request + * ARGUMENTS: + * ControllerObject = Controller object to be released + */ +VOID +STDCALL +IoFreeController(PCONTROLLER_OBJECT ControllerObject) +{ + PKDEVICE_QUEUE_ENTRY QueueEntry; + PDEVICE_OBJECT DeviceObject; + IO_ALLOCATION_ACTION Result; + + /* Remove the Queue */ + if ((QueueEntry = KeRemoveDeviceQueue(&ControllerObject->DeviceWaitQueue))) + { + /* Get the Device Object */ + DeviceObject = CONTAINING_RECORD(QueueEntry, + DEVICE_OBJECT, + Queue.Wcb.WaitQueueEntry); + /* Call the routine */ + Result = DeviceObject->Queue.Wcb.DeviceRoutine(DeviceObject, + DeviceObject->CurrentIrp, + NULL, + DeviceObject->Queue.Wcb.DeviceContext); + /* Check the result */ + if (Result == DeallocateObject) + { + /* Free it again */ + IoFreeController(ControllerObject); + } + } +} + + +/* EOF */ diff --git a/reactos/ntoskrnl/io/create.c b/reactos/ntoskrnl/io/create.c deleted file mode 100644 index 08d46b0efbc..00000000000 --- a/reactos/ntoskrnl/io/create.c +++ /dev/null @@ -1,716 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/create.c - * PURPOSE: Handling file create/open apis - * - * PROGRAMMERS: David Welch (welch@cwcom.net) - */ - -/* INCLUDES ***************************************************************/ - -#include -#define NDEBUG -#include - -/* GLOBALS *******************************************************************/ - -#define TAG_FILE_NAME TAG('F', 'N', 'A', 'M') - -/* FUNCTIONS *************************************************************/ - -/********************************************************************** - * NAME EXPORTED - * NtDeleteFile@4 - * - * DESCRIPTION - * - * ARGUMENTS - * ObjectAttributes - * ? - * - * RETURN VALUE - * - * REVISIONS - * - * @unimplemented - */ -NTSTATUS STDCALL -NtDeleteFile(IN POBJECT_ATTRIBUTES ObjectAttributes) -{ - UNIMPLEMENTED; - return(STATUS_NOT_IMPLEMENTED); -} - - -/********************************************************************** - * NAME INTERNAL - * IopCreateFile - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - */ -NTSTATUS STDCALL -IopCreateFile(PVOID ObjectBody, - PVOID Parent, - PWSTR RemainingPath, - POBJECT_ATTRIBUTES ObjectAttributes) -{ - PDEVICE_OBJECT DeviceObject; - PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody; - POBJECT_TYPE ParentObjectType; - NTSTATUS Status; - - DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %S)\n", - ObjectBody, - Parent, - RemainingPath); - - if (NULL == Parent) - { - /* This is probably an attempt to create a meta fileobject (eg. for FAT) - for the cache manager, so return STATUS_SUCCESS */ - DPRINT("Parent object was NULL\n"); - return(STATUS_SUCCESS); - } - - ParentObjectType = BODY_TO_HEADER(Parent)->ObjectType; - - if (ParentObjectType != IoDeviceObjectType && - ParentObjectType != IoFileObjectType) - { - DPRINT("Parent [%wZ] is a %S which is neither a file type nor a device type ; remaining path = %S\n", - &BODY_TO_HEADER(Parent)->Name, - BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer, - RemainingPath); - return(STATUS_UNSUCCESSFUL); - } - - Status = ObReferenceObjectByPointer(Parent, - STANDARD_RIGHTS_REQUIRED, - ParentObjectType, - UserMode); - if (!NT_SUCCESS(Status)) - { - CPRINT("Failed to reference parent object %x\n", Parent); - return(Status); - } - - if (ParentObjectType == IoDeviceObjectType) - { - /* Parent is a devce object */ - DeviceObject = IoGetAttachedDevice((PDEVICE_OBJECT)Parent); - DPRINT("DeviceObject %x\n", DeviceObject); - - if (RemainingPath == NULL) - { - FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN; - FileObject->FileName.Buffer = 0; - FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0; - } - else - { - if ((DeviceObject->DeviceType != FILE_DEVICE_FILE_SYSTEM) - && (DeviceObject->DeviceType != FILE_DEVICE_DISK) - && (DeviceObject->DeviceType != FILE_DEVICE_CD_ROM) - && (DeviceObject->DeviceType != FILE_DEVICE_TAPE) - && (DeviceObject->DeviceType != FILE_DEVICE_NETWORK) - && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE) - && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT)) - { - CPRINT("Device was wrong type\n"); - return(STATUS_UNSUCCESSFUL); - } - - if (DeviceObject->DeviceType != FILE_DEVICE_NETWORK - && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE) - && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT)) - { - if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED)) - { - DPRINT("Mount the logical volume\n"); - Status = IoMountVolume(DeviceObject, FALSE); - DPRINT("Status %x\n", Status); - if (!NT_SUCCESS(Status)) - { - CPRINT("Failed to mount logical volume (Status %x)\n", - Status); - return(Status); - } - } - DeviceObject = DeviceObject->Vpb->DeviceObject; - DPRINT("FsDeviceObject %lx\n", DeviceObject); - } - RtlpCreateUnicodeString(&(FileObject->FileName), - RemainingPath, NonPagedPool); - } - } - else - { - /* Parent is a file object */ - if (RemainingPath == NULL) - { - CPRINT("Device is unnamed\n"); - return STATUS_UNSUCCESSFUL; - } - - DeviceObject = ((PFILE_OBJECT)Parent)->DeviceObject; - DPRINT("DeviceObject %x\n", DeviceObject); - - FileObject->RelatedFileObject = (PFILE_OBJECT)Parent; - - RtlpCreateUnicodeString(&(FileObject->FileName), - RemainingPath, NonPagedPool); - } - - DPRINT("FileObject->FileName %wZ\n", - &FileObject->FileName); - FileObject->DeviceObject = DeviceObject; - DPRINT("FileObject %x DeviceObject %x\n", - FileObject, - DeviceObject); - FileObject->Vpb = DeviceObject->Vpb; - FileObject->Type = IO_TYPE_FILE; - - return(STATUS_SUCCESS); -} - - -/********************************************************************** - * NAME EXPORTED - * IoCreateStreamFileObject@8 - * - * DESCRIPTION - * - * ARGUMENTS - * FileObject - * ? - * - * DeviceObject - * ? - * - * RETURN VALUE - * - * NOTE - * - * REVISIONS - * - * @implemented - */ -PFILE_OBJECT STDCALL -IoCreateStreamFileObject(PFILE_OBJECT FileObject, - PDEVICE_OBJECT DeviceObject) -{ - PFILE_OBJECT CreatedFileObject; - NTSTATUS Status; - - DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n", - FileObject, DeviceObject); - - ASSERT_IRQL(PASSIVE_LEVEL); - - Status = ObCreateObject(KernelMode, - IoFileObjectType, - NULL, - KernelMode, - NULL, - sizeof(FILE_OBJECT), - 0, - 0, - (PVOID*)&CreatedFileObject); - if (!NT_SUCCESS(Status)) - { - DPRINT("Could not create FileObject\n"); - return (NULL); - } - - if (FileObject != NULL) - { - DeviceObject = FileObject->DeviceObject; - } - DeviceObject = IoGetAttachedDevice(DeviceObject); - - DPRINT("DeviceObject %x\n", DeviceObject); - - CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject; - CreatedFileObject->Vpb = DeviceObject->Vpb; - CreatedFileObject->Type = IO_TYPE_FILE; - CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN; - - // shouldn't we initialize the lock event, and several other things here too? - KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE); - KeInitializeEvent(&CreatedFileObject->Lock, SynchronizationEvent, TRUE); - - return CreatedFileObject; -} - - -/********************************************************************** - * NAME EXPORTED - * IoCreateFile@56 - * - * DESCRIPTION - * Either causes a new file or directory to be created, or it - * opens an existing file, device, directory or volume, giving - * the caller a handle for the file object. This handle can be - * used by subsequent calls to manipulate data within the file - * or the file object's state of attributes. - * - * ARGUMENTS - * FileHandle (OUT) - * Points to a variable which receives the file handle - * on return; - * - * DesiredAccess - * Desired access to the file; - * - * ObjectAttributes - * Structure describing the file; - * - * IoStatusBlock (OUT) - * Receives information about the operation on return; - * - * AllocationSize [OPTIONAL] - * Initial size of the file in bytes; - * - * FileAttributes - * Attributes to create the file with; - * - * ShareAccess - * Type of shared access the caller would like to the - * file; - * - * CreateDisposition - * Specifies what to do, depending on whether the - * file already exists; - * - * CreateOptions - * Options for creating a new file; - * - * EaBuffer [OPTIONAL] - * Undocumented; - * - * EaLength - * Undocumented; - * - * CreateFileType - * Type of file (normal, named pipe, mailslot) to create; - * - * ExtraCreateParameters [OPTIONAL] - * Additional creation data for named pipe and mailsots; - * - * Options - * Undocumented. - * - * RETURN VALUE - * Status - * - * NOTE - * Prototype taken from Bo Branten's ntifs.h v15. - * Description taken from old NtCreateFile's which is - * now a wrapper of this call. - * - * REVISIONS - * - * @implemented - */ -NTSTATUS STDCALL -IoCreateFile(OUT PHANDLE FileHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN PLARGE_INTEGER AllocationSize OPTIONAL, - IN ULONG FileAttributes, - IN ULONG ShareAccess, - IN ULONG CreateDisposition, - IN ULONG CreateOptions, - IN PVOID EaBuffer OPTIONAL, - IN ULONG EaLength, - IN CREATE_FILE_TYPE CreateFileType, - IN PVOID ExtraCreateParameters OPTIONAL, - IN ULONG Options) -{ - PFILE_OBJECT FileObject; - PIRP Irp; - PIO_STACK_LOCATION StackLoc; - IO_SECURITY_CONTEXT SecurityContext; - KPROCESSOR_MODE AccessMode; - HANDLE LocalFileHandle; - IO_STATUS_BLOCK LocalIoStatusBlock; - LARGE_INTEGER SafeAllocationSize; - PVOID SystemEaBuffer = NULL; - NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("IoCreateFile(FileHandle %x, DesiredAccess %x, " - "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", - FileHandle,DesiredAccess,ObjectAttributes, - ObjectAttributes->ObjectName->Buffer); - - ASSERT_IRQL(PASSIVE_LEVEL); - - if (IoStatusBlock == NULL || FileHandle == NULL) - return STATUS_ACCESS_VIOLATION; - - LocalFileHandle = 0; - - if(Options & IO_NO_PARAMETER_CHECKING) - AccessMode = KernelMode; - else - AccessMode = ExGetPreviousMode(); - - if(AccessMode != KernelMode) - { - _SEH_TRY - { - ProbeForWrite(FileHandle, - sizeof(HANDLE), - sizeof(ULONG)); - ProbeForWrite(IoStatusBlock, - sizeof(IO_STATUS_BLOCK), - sizeof(ULONG)); - if(AllocationSize != NULL) - { - ProbeForRead(AllocationSize, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - SafeAllocationSize = *AllocationSize; - } - else - SafeAllocationSize.QuadPart = 0; - - if(EaBuffer != NULL && EaLength > 0) - { - ProbeForRead(EaBuffer, - EaLength, - sizeof(ULONG)); - - /* marshal EaBuffer */ - SystemEaBuffer = ExAllocatePool(NonPagedPool, - EaLength); - if(SystemEaBuffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - _SEH_LEAVE; - } - - RtlCopyMemory(SystemEaBuffer, - EaBuffer, - EaLength); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(!NT_SUCCESS(Status)) - { - return Status; - } - } - else - { - if(AllocationSize != NULL) - SafeAllocationSize = *AllocationSize; - else - SafeAllocationSize.QuadPart = 0; - - if(EaBuffer != NULL && EaLength > 0) - { - SystemEaBuffer = EaBuffer; - } - } - - if(Options & IO_CHECK_CREATE_PARAMETERS) - { - DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n"); - } - - Status = ObCreateObject(AccessMode, - IoFileObjectType, - ObjectAttributes, - AccessMode, - NULL, - sizeof(FILE_OBJECT), - 0, - 0, - (PVOID*)&FileObject); - if (!NT_SUCCESS(Status)) - { - DPRINT("ObCreateObject() failed! (Status %lx)\n", Status); - return Status; - } - - RtlMapGenericMask(&DesiredAccess, - BODY_TO_HEADER(FileObject)->ObjectType->Mapping); - - Status = ObInsertObject ((PVOID)FileObject, - NULL, - DesiredAccess, - 0, - NULL, - &LocalFileHandle); - if (!NT_SUCCESS(Status)) - { - DPRINT("ObInsertObject() failed! (Status %lx)\n", Status); - ObDereferenceObject (FileObject); - return Status; - } - - if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT) - { - FileObject->Flags |= (FO_ALERTABLE_IO | FO_SYNCHRONOUS_IO); - } - if (CreateOptions & FILE_SYNCHRONOUS_IO_NONALERT) - { - FileObject->Flags |= FO_SYNCHRONOUS_IO; - } - - if (CreateOptions & FILE_NO_INTERMEDIATE_BUFFERING) - FileObject->Flags |= FO_NO_INTERMEDIATE_BUFFERING; - - SecurityContext.SecurityQos = NULL; /* ?? */ - SecurityContext.AccessState = NULL; /* ?? */ - SecurityContext.DesiredAccess = DesiredAccess; - SecurityContext.FullCreateOptions = 0; /* ?? */ - - KeInitializeEvent(&FileObject->Lock, SynchronizationEvent, TRUE); - KeInitializeEvent(&FileObject->Event, NotificationEvent, FALSE); - - DPRINT("FileObject %x\n", FileObject); - DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject); - /* - * Create a new IRP to hand to - * the FS driver: this may fail - * due to resource shortage. - */ - Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, FALSE); - if (Irp == NULL) - { - ZwClose(LocalFileHandle); - return STATUS_UNSUCCESSFUL; - } - - //trigger FileObject/Event dereferencing - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = AccessMode; - Irp->UserIosb = &LocalIoStatusBlock; - Irp->AssociatedIrp.SystemBuffer = SystemEaBuffer; - Irp->Tail.Overlay.AuxiliaryBuffer = NULL; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - Irp->UserEvent = &FileObject->Event; - Irp->Overlay.AllocationSize = SafeAllocationSize; - - /* - * Get the stack location for the new - * IRP and prepare it. - */ - StackLoc = IoGetNextIrpStackLocation(Irp); - StackLoc->MinorFunction = 0; - StackLoc->Flags = (UCHAR)Options; - StackLoc->Control = 0; - StackLoc->DeviceObject = FileObject->DeviceObject; - StackLoc->FileObject = FileObject; - - switch (CreateFileType) - { - default: - case CreateFileTypeNone: - StackLoc->MajorFunction = IRP_MJ_CREATE; - StackLoc->Parameters.Create.SecurityContext = &SecurityContext; - StackLoc->Parameters.Create.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS); - StackLoc->Parameters.Create.Options |= (CreateDisposition << 24); - StackLoc->Parameters.Create.FileAttributes = (USHORT)FileAttributes; - StackLoc->Parameters.Create.ShareAccess = (USHORT)ShareAccess; - StackLoc->Parameters.Create.EaLength = SystemEaBuffer != NULL ? EaLength : 0; - break; - - case CreateFileTypeNamedPipe: - StackLoc->MajorFunction = IRP_MJ_CREATE_NAMED_PIPE; - StackLoc->Parameters.CreatePipe.SecurityContext = &SecurityContext; - StackLoc->Parameters.CreatePipe.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS); - StackLoc->Parameters.CreatePipe.Options |= (CreateDisposition << 24); - StackLoc->Parameters.CreatePipe.ShareAccess = (USHORT)ShareAccess; - StackLoc->Parameters.CreatePipe.Parameters = ExtraCreateParameters; - break; - - case CreateFileTypeMailslot: - StackLoc->MajorFunction = IRP_MJ_CREATE_MAILSLOT; - StackLoc->Parameters.CreateMailslot.SecurityContext = &SecurityContext; - StackLoc->Parameters.CreateMailslot.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS); - StackLoc->Parameters.CreateMailslot.Options |= (CreateDisposition << 24); - StackLoc->Parameters.CreateMailslot.ShareAccess = (USHORT)ShareAccess; - StackLoc->Parameters.CreateMailslot.Parameters = ExtraCreateParameters; - break; - } - - /* - * Now call the driver and - * possibly wait if it can - * not complete the request - * immediately. - */ - Status = IofCallDriver(FileObject->DeviceObject, Irp ); - - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - AccessMode, - FALSE, - NULL); - Status = LocalIoStatusBlock.Status; - } - if (!NT_SUCCESS(Status)) - { - DPRINT("Failing create request with status %x\n", Status); - FileObject->DeviceObject = NULL; - FileObject->Vpb = NULL; - - ZwClose(LocalFileHandle); - } - else - { - _SEH_TRY - { - *FileHandle = LocalFileHandle; - *IoStatusBlock = LocalIoStatusBlock; - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } - - /* cleanup EABuffer if captured */ - if(AccessMode != KernelMode && SystemEaBuffer != NULL) - { - ExFreePool(SystemEaBuffer); - } - - ASSERT_IRQL(PASSIVE_LEVEL); - - DPRINT("Finished IoCreateFile() (*FileHandle) %x\n", (*FileHandle)); - - return Status; -} - - -/********************************************************************** - * NAME EXPORTED - * NtCreateFile@44 - * - * DESCRIPTION - * Entry point to call IoCreateFile with - * default parameters. - * - * ARGUMENTS - * See IoCreateFile. - * - * RETURN VALUE - * See IoCreateFile. - * - * REVISIONS - * 2000-03-25 (ea) - * Code originally in NtCreateFile moved in IoCreateFile. - * - * @implemented - */ -NTSTATUS STDCALL -NtCreateFile(PHANDLE FileHandle, - ACCESS_MASK DesiredAccess, - POBJECT_ATTRIBUTES ObjectAttributes, - PIO_STATUS_BLOCK IoStatusBlock, - PLARGE_INTEGER AllocateSize, - ULONG FileAttributes, - ULONG ShareAccess, - ULONG CreateDisposition, - ULONG CreateOptions, - PVOID EaBuffer, - ULONG EaLength) -{ - return IoCreateFile(FileHandle, - DesiredAccess, - ObjectAttributes, - IoStatusBlock, - AllocateSize, - FileAttributes, - ShareAccess, - CreateDisposition, - CreateOptions, - EaBuffer, - EaLength, - CreateFileTypeNone, - NULL, - 0); -} - - -/********************************************************************** - * NAME EXPORTED - * NtOpenFile@24 - * - * DESCRIPTION - * Opens an existing file (simpler than NtCreateFile). - * - * ARGUMENTS - * FileHandle (OUT) - * Variable that receives the file handle on return; - * - * DesiredAccess - * Access desired by the caller to the file; - * - * ObjectAttributes - * Structue describing the file to be opened; - * - * IoStatusBlock (OUT) - * Receives details about the result of the - * operation; - * - * ShareAccess - * Type of shared access the caller requires; - * - * OpenOptions - * Options for the file open. - * - * RETURN VALUE - * Status. - * - * NOTE - * Undocumented. - * - * @implemented - */ -NTSTATUS STDCALL -NtOpenFile(PHANDLE FileHandle, - ACCESS_MASK DesiredAccess, - POBJECT_ATTRIBUTES ObjectAttributes, - PIO_STATUS_BLOCK IoStatusBlock, - ULONG ShareAccess, - ULONG OpenOptions) -{ - return IoCreateFile(FileHandle, - DesiredAccess, - ObjectAttributes, - IoStatusBlock, - NULL, - 0, - ShareAccess, - FILE_OPEN, - OpenOptions, - NULL, - 0, - CreateFileTypeNone, - NULL, - 0); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/device.c b/reactos/ntoskrnl/io/device.c index ca5a739e07b..91fff63714a 100644 --- a/reactos/ntoskrnl/io/device.c +++ b/reactos/ntoskrnl/io/device.c @@ -1,11 +1,11 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel * FILE: ntoskrnl/io/device.c - * PURPOSE: Manage devices + * PURPOSE: Device Object Management, including Notifications and Queues. * - * PROGRAMMERS: David Welch (welch@cwcom.net) + * PROGRAMMERS: Alex Ionescu + * David Welch (welch@cwcom.net) */ /* INCLUDES *******************************************************************/ @@ -17,15 +17,67 @@ /* GLOBALS ********************************************************************/ #define TAG_DEVICE_EXTENSION TAG('D', 'E', 'X', 'T') +#define TAG_SHUTDOWN_ENTRY TAG('S', 'H', 'U', 'T') static ULONG IopDeviceObjectNumber = 0; +typedef struct _SHUTDOWN_ENTRY +{ + LIST_ENTRY ShutdownList; + PDEVICE_OBJECT DeviceObject; +} SHUTDOWN_ENTRY, *PSHUTDOWN_ENTRY; + +LIST_ENTRY ShutdownListHead; +KSPIN_LOCK ShutdownListLock; + /* PRIVATE FUNCTIONS **********************************************************/ -NTSTATUS FASTCALL -IopInitializeDevice( - PDEVICE_NODE DeviceNode, - PDRIVER_OBJECT DriverObject) +VOID +IoShutdownRegisteredDevices(VOID) +{ + PSHUTDOWN_ENTRY ShutdownEntry; + PLIST_ENTRY Entry; + IO_STATUS_BLOCK StatusBlock; + PIRP Irp; + KEVENT Event; + NTSTATUS Status; + + Entry = ShutdownListHead.Flink; + while (Entry != &ShutdownListHead) + { + ShutdownEntry = CONTAINING_RECORD(Entry, SHUTDOWN_ENTRY, ShutdownList); + + KeInitializeEvent (&Event, + NotificationEvent, + FALSE); + + Irp = IoBuildSynchronousFsdRequest (IRP_MJ_SHUTDOWN, + ShutdownEntry->DeviceObject, + NULL, + 0, + NULL, + &Event, + &StatusBlock); + + Status = IoCallDriver (ShutdownEntry->DeviceObject, + Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject (&Event, + Executive, + KernelMode, + FALSE, + NULL); + } + + Entry = Entry->Flink; + } +} + +NTSTATUS +FASTCALL +IopInitializeDevice(PDEVICE_NODE DeviceNode, + PDRIVER_OBJECT DriverObject) { IO_STATUS_BLOCK IoStatusBlock; IO_STACK_LOCATION Stack; @@ -113,339 +165,64 @@ IopInitializeDevice( return STATUS_SUCCESS; } -NTSTATUS STDCALL -IopCreateDevice( - PVOID ObjectBody, - PVOID Parent, - PWSTR RemainingPath, - POBJECT_ATTRIBUTES ObjectAttributes) +NTSTATUS +STDCALL +IopGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, + IN ACCESS_MASK DesiredAccess, + OUT PFILE_OBJECT *FileObject, + OUT PDEVICE_OBJECT *DeviceObject, + IN ULONG AttachFlag) { - DPRINT("IopCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n", - ObjectBody, Parent, RemainingPath); - - if (RemainingPath != NULL && wcschr(RemainingPath + 1, '\\') != NULL) - return STATUS_OBJECT_PATH_NOT_FOUND; - - return STATUS_SUCCESS; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK StatusBlock; + PFILE_OBJECT LocalFileObject; + HANDLE FileHandle; + NTSTATUS Status; + + DPRINT("IoGetDeviceObjectPointer(ObjectName %wZ, DesiredAccess %x," + "FileObject %p DeviceObject %p)\n", + ObjectName, DesiredAccess, FileObject, DeviceObject); + + /* Open the Device */ + InitializeObjectAttributes(&ObjectAttributes, + ObjectName, + 0, + NULL, + NULL); + Status = ZwOpenFile(&FileHandle, + DesiredAccess, + &ObjectAttributes, + &StatusBlock, + 0, + FILE_NON_DIRECTORY_FILE | AttachFlag); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile failed, Status: 0x%x\n", Status); + return Status; + } + + /* Get File Object */ + Status = ObReferenceObjectByHandle(FileHandle, + 0, + IoFileObjectType, + KernelMode, + (PVOID*)&LocalFileObject, + NULL); + if (NT_SUCCESS(Status)) + { + /* Return the requested data */ + *DeviceObject = IoGetRelatedDeviceObject(LocalFileObject); + *FileObject = LocalFileObject; + } + + /* Close the handle */ + ZwClose(FileHandle); + return Status; } /* PUBLIC FUNCTIONS ***********************************************************/ -/* - * IoAttachDeviceByPointer - * - * Status - * @implemented - */ - -NTSTATUS STDCALL -IoAttachDeviceByPointer( - IN PDEVICE_OBJECT SourceDevice, - IN PDEVICE_OBJECT TargetDevice) -{ - PDEVICE_OBJECT AttachedDevice; - - DPRINT("IoAttachDeviceByPointer(SourceDevice %x, TargetDevice %x)\n", - SourceDevice, TargetDevice); - - AttachedDevice = IoAttachDeviceToDeviceStack(SourceDevice, TargetDevice); - if (AttachedDevice == NULL) - return STATUS_NO_SUCH_DEVICE; - - return STATUS_SUCCESS; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoAttachDeviceToDeviceStackSafe( - IN PDEVICE_OBJECT SourceDevice, - IN PDEVICE_OBJECT TargetDevice, - OUT PDEVICE_OBJECT *AttachedToDeviceObject - ) -{ - /* FIXME: IoAttachDeviceToDeviceStackSafe must not call - * IoAttachDeviceToDeviceStack, but the other way around! */ - DPRINT1("IoAttachDeviceToDeviceStackSafe() badly implemented!\n"); - *AttachedToDeviceObject = IoAttachDeviceToDeviceStack(SourceDevice, TargetDevice); - return STATUS_SUCCESS; -} - -/* - * IoDeleteDevice - * - * Status - * @implemented - */ - -VOID STDCALL -IoDeleteDevice(PDEVICE_OBJECT DeviceObject) -{ - PDEVICE_OBJECT Previous; - - if (DeviceObject->Flags & DO_SHUTDOWN_REGISTERED) - IoUnregisterShutdownNotification(DeviceObject); - - /* Remove the timer if it exists */ - if (DeviceObject->Timer) - { - IopRemoveTimerFromTimerList(DeviceObject->Timer); - ExFreePool(DeviceObject->Timer); - } - - /* Free device extension */ - if (DeviceObject->DeviceObjectExtension) - ExFreePool(DeviceObject->DeviceObjectExtension); - - /* Remove device from driver device list */ - Previous = DeviceObject->DriverObject->DeviceObject; - if (Previous == DeviceObject) - { - DeviceObject->DriverObject->DeviceObject = DeviceObject->NextDevice; - } - else - { - while (Previous->NextDevice != DeviceObject) - Previous = Previous->NextDevice; - Previous->NextDevice = DeviceObject->NextDevice; - } - - ObDereferenceObject(DeviceObject); -} - - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoEnumerateDeviceObjectList( - IN PDRIVER_OBJECT DriverObject, - IN PDEVICE_OBJECT *DeviceObjectList, - IN ULONG DeviceObjectListSize, - OUT PULONG ActualNumberDeviceObjects - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - - -/* - * @unimplemented - */ -PDEVICE_OBJECT -STDCALL -IoGetDeviceAttachmentBaseRef( - IN PDEVICE_OBJECT DeviceObject - ) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoGetDiskDeviceObject( - IN PDEVICE_OBJECT FileSystemDeviceObject, - OUT PDEVICE_OBJECT *DiskDeviceObject - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -PDEVICE_OBJECT -STDCALL -IoGetLowerDeviceObject( - IN PDEVICE_OBJECT DeviceObject - ) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * IoGetRelatedDeviceObject - * - * Remarks - * See "Windows NT File System Internals", page 633 - 634. - * - * Status - * @implemented - */ - -PDEVICE_OBJECT STDCALL -IoGetRelatedDeviceObject( - IN PFILE_OBJECT FileObject) -{ - /* - * Get logical volume mounted on a physical/virtual/logical device - */ - - if (FileObject->Vpb && FileObject->Vpb->DeviceObject) - { - return IoGetAttachedDevice(FileObject->Vpb->DeviceObject); - } - - /* - * Check if file object has an associated device object mounted by some - * other file system. - */ - - if (FileObject->DeviceObject->Vpb && - FileObject->DeviceObject->Vpb->DeviceObject) - { - return IoGetAttachedDevice(FileObject->DeviceObject->Vpb->DeviceObject); - } - - return IoGetAttachedDevice(FileObject->DeviceObject); -} - -/* - * IoGetDeviceObjectPointer - * - * Status - * @implemented - */ - -NTSTATUS STDCALL -IoGetDeviceObjectPointer( - IN PUNICODE_STRING ObjectName, - IN ACCESS_MASK DesiredAccess, - OUT PFILE_OBJECT *FileObject, - OUT PDEVICE_OBJECT *DeviceObject) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK StatusBlock; - PFILE_OBJECT LocalFileObject; - HANDLE FileHandle; - NTSTATUS Status; - - DPRINT("IoGetDeviceObjectPointer(ObjectName %wZ, DesiredAccess %x, FileObject %p DeviceObject %p)\n", - ObjectName, DesiredAccess, FileObject, DeviceObject); - - InitializeObjectAttributes( - &ObjectAttributes, - ObjectName, - 0, - NULL, - NULL); - - Status = ZwOpenFile( - &FileHandle, - DesiredAccess, - &ObjectAttributes, - &StatusBlock, - 0, - FILE_NON_DIRECTORY_FILE); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtOpenFile failed, Status: 0x%x\n", Status); - return Status; - } - - Status = ObReferenceObjectByHandle( - FileHandle, - 0, - IoFileObjectType, - KernelMode, - (PVOID*)&LocalFileObject, - NULL); - - if (NT_SUCCESS(Status)) - { - *DeviceObject = IoGetRelatedDeviceObject(LocalFileObject); - *FileObject = LocalFileObject; - } - - ZwClose(FileHandle); - - return Status; -} - -/* - * IoDetachDevice - * - * Status - * @unimplemented - */ - -VOID STDCALL -IoDetachDevice(PDEVICE_OBJECT TargetDevice) -{ - DPRINT("IoDetachDevice(TargetDevice %x) - UNIMPLEMENTED\n", TargetDevice); -} - -/* - * IoGetAttachedDevice - * - * Status - * @implemented - */ - -PDEVICE_OBJECT STDCALL -IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject) -{ - PDEVICE_OBJECT Current = DeviceObject; - - while (Current->AttachedDevice != NULL) - Current = Current->AttachedDevice; - - return Current; -} - -/* - * IoGetAttachedDeviceReference - * - * Status - * @implemented - */ - -PDEVICE_OBJECT STDCALL -IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject) -{ - PDEVICE_OBJECT Current = IoGetAttachedDevice(DeviceObject); - ObReferenceObject(Current); - return Current; -} - -/* - * IoAttachDeviceToDeviceStack - * - * Status - * @implemented - */ - -PDEVICE_OBJECT STDCALL -IoAttachDeviceToDeviceStack( - PDEVICE_OBJECT SourceDevice, - PDEVICE_OBJECT TargetDevice) -{ - PDEVICE_OBJECT AttachedDevice; - - DPRINT("IoAttachDeviceToDeviceStack(SourceDevice %x, TargetDevice %x)\n", - SourceDevice, TargetDevice); - - AttachedDevice = IoGetAttachedDevice(TargetDevice); - AttachedDevice->AttachedDevice = SourceDevice; - SourceDevice->AttachedDevice = NULL; - SourceDevice->StackSize = AttachedDevice->StackSize + 1; - SourceDevice->AlignmentRequirement = AttachedDevice->AlignmentRequirement; - SourceDevice->SectorSize = AttachedDevice->SectorSize; - SourceDevice->Vpb = AttachedDevice->Vpb; - return AttachedDevice; -} - /* * IoAttachDevice * @@ -464,35 +241,132 @@ IoAttachDeviceToDeviceStack( * Status * @implemented */ - -NTSTATUS STDCALL -IoAttachDevice( - PDEVICE_OBJECT SourceDevice, - PUNICODE_STRING TargetDeviceName, - PDEVICE_OBJECT *AttachedDevice) +NTSTATUS +STDCALL +IoAttachDevice(PDEVICE_OBJECT SourceDevice, + PUNICODE_STRING TargetDeviceName, + PDEVICE_OBJECT *AttachedDevice) { NTSTATUS Status; PFILE_OBJECT FileObject; PDEVICE_OBJECT TargetDevice; - Status = IoGetDeviceObjectPointer( - TargetDeviceName, - FILE_READ_ATTRIBUTES, - &FileObject, - &TargetDevice); + /* Call the helper routine for an attach operation */ + DPRINT("IoAttachDevice\n"); + Status = IopGetDeviceObjectPointer(TargetDeviceName, + FILE_READ_ATTRIBUTES, + &FileObject, + &TargetDevice, + IO_ATTACH_DEVICE_API); - if (!NT_SUCCESS(Status)) - { - return Status; - } + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to get Device Object\n"); + return Status; + } + + /* Attach the device */ + IoAttachDeviceToDeviceStackSafe(SourceDevice, TargetDevice, AttachedDevice); - *AttachedDevice = IoAttachDeviceToDeviceStack( - SourceDevice, - TargetDevice); + /* Derference it */ + ObDereferenceObject(FileObject); + return STATUS_SUCCESS; +} - ObDereferenceObject(FileObject); +/* + * IoAttachDeviceByPointer + * + * Status + * @implemented + */ +NTSTATUS +STDCALL +IoAttachDeviceByPointer(IN PDEVICE_OBJECT SourceDevice, + IN PDEVICE_OBJECT TargetDevice) +{ + PDEVICE_OBJECT AttachedDevice; + NTSTATUS Status = STATUS_SUCCESS; - return STATUS_SUCCESS; + DPRINT("IoAttachDeviceByPointer(SourceDevice %x, TargetDevice %x)\n", + SourceDevice, TargetDevice); + + /* Do the Attach */ + AttachedDevice = IoAttachDeviceToDeviceStack(SourceDevice, TargetDevice); + if (AttachedDevice == NULL) Status = STATUS_NO_SUCH_DEVICE; + + /* Return the status */ + return Status; +} + +/* + * IoAttachDeviceToDeviceStack + * + * Status + * @implemented + */ +PDEVICE_OBJECT +STDCALL +IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice, + PDEVICE_OBJECT TargetDevice) +{ + NTSTATUS Status; + PDEVICE_OBJECT LocalAttach; + + /* Attach it safely */ + DPRINT("IoAttachDeviceToDeviceStack\n"); + Status = IoAttachDeviceToDeviceStackSafe(SourceDevice, + TargetDevice, + &LocalAttach); + + /* Return it */ + DPRINT("IoAttachDeviceToDeviceStack DONE: %x\n", LocalAttach); + return LocalAttach; +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, + IN PDEVICE_OBJECT TargetDevice, + OUT PDEVICE_OBJECT *AttachedToDeviceObject) +{ + PDEVICE_OBJECT AttachedDevice; + PDEVOBJ_EXTENSION SourceDeviceExtension; + + DPRINT("IoAttachDeviceToDeviceStack(SourceDevice %x, TargetDevice %x)\n", + SourceDevice, TargetDevice); + + /* Get the Attached Device and source extension */ + AttachedDevice = IoGetAttachedDevice(TargetDevice); + SourceDeviceExtension = SourceDevice->DeviceObjectExtension; + + /* Make sure that it's in a correct state */ + if (!(AttachedDevice->DeviceObjectExtension->ExtensionFlags & + (DOE_UNLOAD_PENDING | DOE_DELETE_PENDING | + DOE_REMOVE_PENDING | DOE_REMOVE_PROCESSED))) + { + /* Update fields */ + AttachedDevice->AttachedDevice = SourceDevice; + SourceDevice->AttachedDevice = NULL; + SourceDevice->StackSize = AttachedDevice->StackSize + 1; + SourceDevice->AlignmentRequirement = AttachedDevice->AlignmentRequirement; + SourceDevice->SectorSize = AttachedDevice->SectorSize; + SourceDevice->Vpb = AttachedDevice->Vpb; + + /* Set the attachment in the device extension */ + SourceDeviceExtension->AttachedTo = AttachedDevice; + } + else + { + /* Device was unloading or being removed */ + AttachedDevice = NULL; + } + + /* Return the attached device */ + *AttachedToDeviceObject = AttachedDevice; + return STATUS_SUCCESS; } /* @@ -527,262 +401,816 @@ IoAttachDevice( * Status * @implemented */ - -NTSTATUS STDCALL -IoCreateDevice( - PDRIVER_OBJECT DriverObject, - ULONG DeviceExtensionSize, - PUNICODE_STRING DeviceName, - DEVICE_TYPE DeviceType, - ULONG DeviceCharacteristics, - BOOLEAN Exclusive, - PDEVICE_OBJECT *DeviceObject) +NTSTATUS +STDCALL +IoCreateDevice(PDRIVER_OBJECT DriverObject, + ULONG DeviceExtensionSize, + PUNICODE_STRING DeviceName, + DEVICE_TYPE DeviceType, + ULONG DeviceCharacteristics, + BOOLEAN Exclusive, + PDEVICE_OBJECT *DeviceObject) { - WCHAR AutoNameBuffer[20]; - UNICODE_STRING AutoName; - PDEVICE_OBJECT CreatedDeviceObject; - PDEVOBJ_EXTENSION DeviceObjectExtension; - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; + WCHAR AutoNameBuffer[20]; + UNICODE_STRING AutoName; + PDEVICE_OBJECT CreatedDeviceObject; + PDEVOBJ_EXTENSION DeviceObjectExtension; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + ULONG AlignedDeviceExtensionSize; + ULONG TotalSize; + HANDLE TempHandle; - ASSERT_IRQL(PASSIVE_LEVEL); + ASSERT_IRQL(PASSIVE_LEVEL); + DPRINT("IoCreateDevice(DriverObject %x)\n",DriverObject); - if (DeviceName != NULL) + /* Generate a name if we have to */ + if (DeviceCharacteristics & FILE_AUTOGENERATED_DEVICE_NAME) + { + swprintf(AutoNameBuffer, + L"\\Device\\%08lx", + InterlockedIncrementUL(&IopDeviceObjectNumber)); + RtlInitUnicodeString(&AutoName, AutoNameBuffer); + DeviceName = &AutoName; + } + + /* Initialize the Object Attributes */ + InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL); + + /* Honor exclusive flag */ + ObjectAttributes.Attributes |= OBJ_EXCLUSIVE; + + /* Create a permanent object for named devices */ + if (DeviceName != NULL) + { + ObjectAttributes.Attributes |= OBJ_PERMANENT; + } + + /* Align the Extension Size to 8-bytes */ + AlignedDeviceExtensionSize = (DeviceExtensionSize + 7) &~ 7; + DPRINT("AlignedDeviceExtensionSize %x\n", AlignedDeviceExtensionSize); + + /* Total Size */ + TotalSize = AlignedDeviceExtensionSize + + sizeof(DEVICE_OBJECT) + sizeof(DEVOBJ_EXTENSION); + DPRINT("TotalSize %x\n", TotalSize); + + /* Create the Device Object */ + Status = ObCreateObject(KernelMode, + IoDeviceObjectType, + &ObjectAttributes, + KernelMode, + NULL, + TotalSize, + 0, + 0, + (PVOID*)&CreatedDeviceObject); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoCreateDevice() ObCreateObject failed, status: 0x%08X\n", Status); + return Status; + } + + /* Clear the whole Object and extension so we don't null stuff manually */ + RtlZeroMemory(CreatedDeviceObject, TotalSize); + DPRINT("CreatedDeviceObject %x\n", CreatedDeviceObject); + + /* + * Setup the Type and Size. Note that we don't use the aligned size, + * because that's only padding for the DevObjExt and not part of the Object. + */ + CreatedDeviceObject->Type = IO_TYPE_DEVICE; + CreatedDeviceObject->Size = sizeof(DEVICE_OBJECT) + DeviceExtensionSize; + + /* The kernel extension is after the driver internal extension */ + DeviceObjectExtension = (PDEVOBJ_EXTENSION) + ((ULONG_PTR)(CreatedDeviceObject + 1) + + AlignedDeviceExtensionSize); + + /* Set the Type and Size. Question: why is Size 0 on Windows? */ + DPRINT("DeviceObjectExtension %x\n", DeviceObjectExtension); + DeviceObjectExtension->Type = IO_TYPE_DEVICE_OBJECT_EXTENSION; + DeviceObjectExtension->Size = 0; + + /* Link the Object and Extension */ + DeviceObjectExtension->DeviceObject = CreatedDeviceObject; + CreatedDeviceObject->DeviceObjectExtension = DeviceObjectExtension; + + /* Set Device Object Data */ + CreatedDeviceObject->DeviceType = DeviceType; + CreatedDeviceObject->Characteristics = DeviceCharacteristics; + CreatedDeviceObject->DeviceExtension = CreatedDeviceObject + 1; + CreatedDeviceObject->StackSize = 1; + CreatedDeviceObject->AlignmentRequirement = 1; /* FIXME */ + + /* Set the Flags */ + /* FIXME: After the Driver is Loaded, the flag below should be removed */ + CreatedDeviceObject->Flags = DO_DEVICE_INITIALIZING; + if (Exclusive) CreatedDeviceObject->Flags |= DO_EXCLUSIVE; + if (DeviceName) CreatedDeviceObject->Flags |= DO_DEVICE_HAS_NAME; + + /* Attach a Vpb for Disks and Tapes, and create the Device Lock */ + if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK || + CreatedDeviceObject->DeviceType == FILE_DEVICE_VIRTUAL_DISK || + CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM || + CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE) + { + /* Create Vpb */ + IopAttachVpb(CreatedDeviceObject); + + /* Initialize Lock Event */ + KeInitializeEvent(&CreatedDeviceObject->DeviceLock, + SynchronizationEvent, + TRUE); + } + + /* Set the right Sector Size */ + switch (DeviceType) + { + case FILE_DEVICE_DISK_FILE_SYSTEM: + case FILE_DEVICE_DISK: + case FILE_DEVICE_VIRTUAL_DISK: + CreatedDeviceObject->SectorSize = 512; + break; + + case FILE_DEVICE_CD_ROM_FILE_SYSTEM: + CreatedDeviceObject->SectorSize = 2048; + break; + } + + /* Create the Device Queue */ + KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue); + + /* Insert the Object */ + Status = ObInsertObject(CreatedDeviceObject, + NULL, + FILE_READ_DATA | FILE_WRITE_DATA, + 0, + NULL, + &TempHandle); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Cannot insert Device Object into Handle Table\n"); + *DeviceObject = NULL; + return Status; + } + + /* Now do the final linking */ + ObReferenceObject(DriverObject); + CreatedDeviceObject->DriverObject = DriverObject; + CreatedDeviceObject->NextDevice = DriverObject->DeviceObject; + DriverObject->DeviceObject = CreatedDeviceObject; + + NtClose(TempHandle); + + /* Return to caller */ + *DeviceObject = CreatedDeviceObject; + return STATUS_SUCCESS; +} + +/* + * IoDeleteDevice + * + * Status + * @implemented + */ +VOID +STDCALL +IoDeleteDevice(PDEVICE_OBJECT DeviceObject) +{ + PDEVICE_OBJECT Previous; + + if (DeviceObject->Flags & DO_SHUTDOWN_REGISTERED) + IoUnregisterShutdownNotification(DeviceObject); + + /* Remove the timer if it exists */ + if (DeviceObject->Timer) { - DPRINT("IoCreateDevice(DriverObject %x, DeviceName %S)\n", - DriverObject, DeviceName->Buffer); + IopRemoveTimerFromTimerList(DeviceObject->Timer); + ExFreePool(DeviceObject->Timer); + } + + /* Remove device from driver device list */ + Previous = DeviceObject->DriverObject->DeviceObject; + if (Previous == DeviceObject) + { + DeviceObject->DriverObject->DeviceObject = DeviceObject->NextDevice; } else { - DPRINT("IoCreateDevice(DriverObject %x)\n",DriverObject); + while (Previous->NextDevice != DeviceObject) + Previous = Previous->NextDevice; + Previous->NextDevice = DeviceObject->NextDevice; } - if (DeviceCharacteristics & FILE_AUTOGENERATED_DEVICE_NAME) - { - swprintf(AutoNameBuffer, - L"\\Device\\%08lx", - InterlockedIncrementUL(&IopDeviceObjectNumber)); - RtlInitUnicodeString(&AutoName, - AutoNameBuffer); - DeviceName = &AutoName; - } + /* I guess this should be removed later... but it shouldn't cause problems */ + DeviceObject->DeviceObjectExtension->ExtensionFlags |= DOE_DELETE_PENDING; - if (DeviceName != NULL) - { - InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL); - Status = ObCreateObject( - KernelMode, - IoDeviceObjectType, - &ObjectAttributes, - KernelMode, - NULL, - sizeof(DEVICE_OBJECT), - 0, - 0, - (PVOID*)&CreatedDeviceObject); - } - else - { - Status = ObCreateObject( - KernelMode, - IoDeviceObjectType, - NULL, - KernelMode, - NULL, - sizeof(DEVICE_OBJECT), - 0, - 0, - (PVOID*)&CreatedDeviceObject); - } + /* Make the object temporary. This should automatically remove the device + from the namespace */ + ObMakeTemporaryObject(DeviceObject); - *DeviceObject = NULL; + /* Dereference the driver object */ + ObDereferenceObject(DeviceObject->DriverObject); - if (!NT_SUCCESS(Status)) - { - DPRINT("IoCreateDevice() ObCreateObject failed, status: 0x%08X\n", Status); - return Status; - } - - if (DriverObject->DeviceObject == NULL) - { - DriverObject->DeviceObject = CreatedDeviceObject; - CreatedDeviceObject->NextDevice = NULL; - } - else - { - CreatedDeviceObject->NextDevice = DriverObject->DeviceObject; - DriverObject->DeviceObject = CreatedDeviceObject; - } - - CreatedDeviceObject->Type = DeviceType; - CreatedDeviceObject->DriverObject = DriverObject; - CreatedDeviceObject->CurrentIrp = NULL; - CreatedDeviceObject->Flags = 0; + /* Remove the keep-alive reference */ + ObDereferenceObject(DeviceObject); +} - CreatedDeviceObject->DeviceExtension = - ExAllocatePoolWithTag( - NonPagedPool, - DeviceExtensionSize, - TAG_DEVICE_EXTENSION); +/* + * IoDetachDevice + * + * Status + * @implemented + */ +VOID +STDCALL +IoDetachDevice(PDEVICE_OBJECT TargetDevice) +{ + DPRINT("IoDetachDevice(TargetDevice %x)\n", TargetDevice); + + /* Remove the attachment */ + TargetDevice->AttachedDevice->DeviceObjectExtension->AttachedTo = NULL; + TargetDevice->AttachedDevice = NULL; +} - if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL) - { - ExFreePool(CreatedDeviceObject); - DPRINT("IoCreateDevice() ExAllocatePoolWithTag failed, returning: 0x%08X\n", STATUS_INSUFFICIENT_RESOURCES); - return STATUS_INSUFFICIENT_RESOURCES; - } +/* + * @implemented + */ +NTSTATUS +STDCALL +IoEnumerateDeviceObjectList(IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT *DeviceObjectList, + IN ULONG DeviceObjectListSize, + OUT PULONG ActualNumberDeviceObjects) +{ + ULONG ActualDevices = 1; + PDEVICE_OBJECT CurrentDevice = DriverObject->DeviceObject; + + DPRINT1("IoEnumerateDeviceObjectList\n"); + + /* Find out how many devices we'll enumerate */ + while ((CurrentDevice = CurrentDevice->NextDevice)) + { + ActualDevices++; + } + + /* Go back to the first */ + CurrentDevice = DriverObject->DeviceObject; + + /* Start by at least returning this */ + *ActualNumberDeviceObjects = ActualDevices; + + /* Check if we can support so many */ + if ((ActualDevices * 4) > DeviceObjectListSize) + { + /* Fail because the buffer was too small */ + return STATUS_BUFFER_TOO_SMALL; + } + + /* Check if the caller only wanted the size */ + if (DeviceObjectList) + { + /* Loop through all the devices */ + while (ActualDevices) + { + /* Reference each Device */ + ObReferenceObject(CurrentDevice); + + /* Add it to the list */ + *DeviceObjectList = CurrentDevice; + + /* Go to the next one */ + CurrentDevice = CurrentDevice->NextDevice; + ActualDevices--; + DeviceObjectList++; + } + } + + /* Return the status */ + return STATUS_SUCCESS; +} - if (DeviceExtensionSize > 0) - { - RtlZeroMemory(CreatedDeviceObject->DeviceExtension, DeviceExtensionSize); - } +/* + * IoGetAttachedDevice + * + * Status + * @implemented + */ +PDEVICE_OBJECT +STDCALL +IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject) +{ + PDEVICE_OBJECT Current = DeviceObject; + + /* Get the last attached device */ + while (Current->AttachedDevice) + { + Current = Current->AttachedDevice; + } + + /* Return it */ + return Current; +} - CreatedDeviceObject->Size = sizeof(DEVICE_OBJECT) + DeviceExtensionSize; - CreatedDeviceObject->ReferenceCount = 1; - CreatedDeviceObject->AttachedDevice = NULL; - CreatedDeviceObject->DeviceType = DeviceType; - CreatedDeviceObject->StackSize = 1; - CreatedDeviceObject->AlignmentRequirement = 1; - CreatedDeviceObject->Characteristics = DeviceCharacteristics; - CreatedDeviceObject->Timer = NULL; - CreatedDeviceObject->Vpb = NULL; - KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue); - - KeInitializeEvent( - &CreatedDeviceObject->DeviceLock, - SynchronizationEvent, - TRUE); - - /* FIXME: Do we need to add network drives too?! */ - if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK || - CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM || - CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE) - { - IoAttachVpb(CreatedDeviceObject); - } - CreatedDeviceObject->SectorSize = 512; /* FIXME */ - - DeviceObjectExtension = - ExAllocatePoolWithTag( - NonPagedPool, - sizeof(DEVOBJ_EXTENSION), - TAG_DEVICE_EXTENSION); +/* + * IoGetAttachedDeviceReference + * + * Status + * @implemented + */ +PDEVICE_OBJECT +STDCALL +IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject) +{ + PDEVICE_OBJECT Current = IoGetAttachedDevice(DeviceObject); + + /* Reference the ATtached Device */ + ObReferenceObject(Current); + return Current; +} - DeviceObjectExtension->Type = 0 /* ?? */; - DeviceObjectExtension->Size = sizeof(DEVOBJ_EXTENSION); - DeviceObjectExtension->DeviceObject = CreatedDeviceObject; - DeviceObjectExtension->DeviceNode = NULL; +/* + * @implemented + */ +PDEVICE_OBJECT +STDCALL +IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject) +{ + /* Return the attached Device */ + return (DeviceObject->DeviceObjectExtension->AttachedTo); +} - CreatedDeviceObject->DeviceObjectExtension = DeviceObjectExtension; +/* + * IoGetDeviceObjectPointer + * + * Status + * @implemented + */ +NTSTATUS +STDCALL +IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, + IN ACCESS_MASK DesiredAccess, + OUT PFILE_OBJECT *FileObject, + OUT PDEVICE_OBJECT *DeviceObject) +{ + /* Call the helper routine for a normal operation */ + return IopGetDeviceObjectPointer(ObjectName, + DesiredAccess, + FileObject, + DeviceObject, + 0); +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject, + OUT PDEVICE_OBJECT *DiskDeviceObject) +{ + PDEVOBJ_EXTENSION DeviceExtension; + PVPB Vpb; + KIRQL OldIrql; + + /* Make sure there's a VPB */ + if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER; + + /* Acquire it */ + IoAcquireVpbSpinLock(&OldIrql); + + /* Get the Device Extension */ + DeviceExtension = FileSystemDeviceObject->DeviceObjectExtension; + + /* Make sure this one has a VPB too */ + Vpb = DeviceExtension->Vpb; + if (!Vpb) return STATUS_INVALID_PARAMETER; + + /* Make sure someone it's mounted */ + if ((!Vpb->ReferenceCount) || (Vpb->Flags & VPB_MOUNTED)) return STATUS_VOLUME_DISMOUNTED; + + /* Return the Disk Device Object */ + *DiskDeviceObject = Vpb->RealDevice; + + /* Release the lock */ + IoReleaseVpbSpinLock(OldIrql); + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +PDEVICE_OBJECT +STDCALL +IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject) +{ + PDEVOBJ_EXTENSION DeviceExtension = DeviceObject->DeviceObjectExtension; + PDEVICE_OBJECT LowerDeviceObject = NULL; + + /* Make sure it's not getting deleted */ + if (DeviceExtension->ExtensionFlags & (DOE_UNLOAD_PENDING | + DOE_DELETE_PENDING | + DOE_REMOVE_PENDING | + DOE_REMOVE_PROCESSED)) + { + /* Get the Lower Device Object */ + LowerDeviceObject = DeviceExtension->AttachedTo; + + /* Reference it */ + ObReferenceObject(LowerDeviceObject); + } + + /* Return it */ + return LowerDeviceObject; +} + +/* + * IoGetRelatedDeviceObject + * + * Remarks + * See "Windows NT File System Internals", page 633 - 634. + * + * Status + * @implemented + */ +PDEVICE_OBJECT +STDCALL +IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject) +{ + PDEVICE_OBJECT DeviceObject = FileObject->DeviceObject; + + /* Get logical volume mounted on a physical/virtual/logical device */ + if (FileObject->Vpb && FileObject->Vpb->DeviceObject) + { + DeviceObject = FileObject->Vpb->DeviceObject; + } + + /* + * Check if file object has an associated device object mounted by some + * other file system. + */ + if (FileObject->DeviceObject->Vpb && + FileObject->DeviceObject->Vpb->DeviceObject) + { + DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject; + } + + /* Return the highest attached device */ + return IoGetAttachedDevice(DeviceObject); +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoRegisterLastChanceShutdownNotification(IN PDEVICE_OBJECT DeviceObject) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject) +{ + PSHUTDOWN_ENTRY Entry; + + Entry = ExAllocatePoolWithTag(NonPagedPool, sizeof(SHUTDOWN_ENTRY), + TAG_SHUTDOWN_ENTRY); + if (Entry == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Entry->DeviceObject = DeviceObject; + + ExInterlockedInsertHeadList(&ShutdownListHead, + &Entry->ShutdownList, + &ShutdownListLock); + + DeviceObject->Flags |= DO_SHUTDOWN_REGISTERED; - *DeviceObject = CreatedDeviceObject; - return STATUS_SUCCESS; } /* - * IoOpenDeviceInstanceKey - * - * Status - * @unimplemented + * @unimplemented */ +VOID +STDCALL +IoSetStartIoAttributes(IN PDEVICE_OBJECT DeviceObject, + IN BOOLEAN DeferredStartIo, + IN BOOLEAN NonCancelable) +{ + UNIMPLEMENTED; +} +/* + * @implemented + * + * FUNCTION: Dequeues the next packet from the given device object's + * associated device queue according to a specified sort-key value and calls + * the drivers StartIo routine with that IRP + * ARGUMENTS: + * DeviceObject = Device object for which the irp is to dequeued + * Cancelable = True if IRPs in the key can be canceled + * Key = Sort key specifing which entry to remove from the queue + */ +VOID +STDCALL +IoStartNextPacketByKey(PDEVICE_OBJECT DeviceObject, + BOOLEAN Cancelable, + ULONG Key) +{ + PKDEVICE_QUEUE_ENTRY entry; + PIRP Irp; + + entry = KeRemoveByKeyDeviceQueue(&DeviceObject->DeviceQueue, + Key); + + if (entry != NULL) + { + Irp = CONTAINING_RECORD(entry, + IRP, + Tail.Overlay.DeviceQueueEntry); + DeviceObject->CurrentIrp = Irp; + DPRINT("Next irp is %x\n", Irp); + DeviceObject->DriverObject->DriverStartIo(DeviceObject, Irp); + } + else + { + DPRINT("No next irp\n"); + DeviceObject->CurrentIrp = NULL; + } +} + +/* + * @implemented + * + * FUNCTION: Removes the next packet from the device's queue and calls + * the driver's StartIO + * ARGUMENTS: + * DeviceObject = Device + * Cancelable = True if irps in the queue can be canceled + */ +VOID +STDCALL +IoStartNextPacket(PDEVICE_OBJECT DeviceObject, + BOOLEAN Cancelable) +{ + PKDEVICE_QUEUE_ENTRY entry; + PIRP Irp; + + DPRINT("IoStartNextPacket(DeviceObject %x, Cancelable %d)\n", + DeviceObject,Cancelable); + + entry = KeRemoveDeviceQueue(&DeviceObject->DeviceQueue); + + if (entry!=NULL) + { + Irp = CONTAINING_RECORD(entry,IRP,Tail.Overlay.DeviceQueueEntry); + DeviceObject->CurrentIrp = Irp; + DeviceObject->DriverObject->DriverStartIo(DeviceObject,Irp); + } + else + { + DeviceObject->CurrentIrp = NULL; + } +} + +/* + * @implemented + * + * FUNCTION: Either call the device's StartIO routine with the packet or, + * if the device is busy, queue it. + * ARGUMENTS: + * DeviceObject = Device to start the packet on + * Irp = Irp to queue + * Key = Where to insert the irp + * If zero then insert in the tail of the queue + * CancelFunction = Optional function to cancel the irqp + */ +VOID +STDCALL +IoStartPacket(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PULONG Key, + PDRIVER_CANCEL CancelFunction) +{ + BOOLEAN stat; + KIRQL oldirql; + + DPRINT("IoStartPacket(Irp %x)\n", Irp); + + ASSERT_IRQL(DISPATCH_LEVEL); + + IoAcquireCancelSpinLock(&oldirql); + + if (CancelFunction != NULL) + { + Irp->CancelRoutine = CancelFunction; + } + + if (Key!=0) + { + stat = KeInsertByKeyDeviceQueue(&DeviceObject->DeviceQueue, + &Irp->Tail.Overlay.DeviceQueueEntry, + *Key); + } + else + { + stat = KeInsertDeviceQueue(&DeviceObject->DeviceQueue, + &Irp->Tail.Overlay.DeviceQueueEntry); + } + + + if (!stat) + { + IoReleaseCancelSpinLock(DISPATCH_LEVEL); + DeviceObject->CurrentIrp = Irp; + DeviceObject->DriverObject->DriverStartIo(DeviceObject,Irp); + if (oldirql < DISPATCH_LEVEL) + { + KeLowerIrql(oldirql); + } + } + else + { + IoReleaseCancelSpinLock(oldirql); + } + +} + +/* + * @unimplemented + */ +VOID +STDCALL +IoSynchronousInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, + IN DEVICE_RELATION_TYPE Type) +{ + UNIMPLEMENTED; +} + +/* + * @implemented + */ +VOID +STDCALL +IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject) +{ + PSHUTDOWN_ENTRY ShutdownEntry; + PLIST_ENTRY Entry; + KIRQL oldlvl; + + Entry = ShutdownListHead.Flink; + while (Entry != &ShutdownListHead) + { + ShutdownEntry = CONTAINING_RECORD(Entry, SHUTDOWN_ENTRY, ShutdownList); + if (ShutdownEntry->DeviceObject == DeviceObject) + { + DeviceObject->Flags &= ~DO_SHUTDOWN_REGISTERED; + + KeAcquireSpinLock(&ShutdownListLock,&oldlvl); + RemoveEntryList(Entry); + KeReleaseSpinLock(&ShutdownListLock,oldlvl); + + ExFreePool(Entry); + return; + } + + Entry = Entry->Flink; + } +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoValidateDeviceIoControlAccess(IN PIRP Irp, + IN ULONG RequiredAccess) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @implemented + */ NTSTATUS STDCALL -IoOpenDeviceInstanceKey( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4) +NtDeviceIoControlFile (IN HANDLE DeviceHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, + IN PVOID UserApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN ULONG IoControlCode, + IN PVOID InputBuffer, + IN ULONG InputBufferLength OPTIONAL, + OUT PVOID OutputBuffer, + IN ULONG OutputBufferLength OPTIONAL) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} + NTSTATUS Status; + PFILE_OBJECT FileObject; + PDEVICE_OBJECT DeviceObject; + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + PKEVENT EventObject; + KPROCESSOR_MODE PreviousMode; -/* - * @unimplemented - */ -VOID -STDCALL -IoRegisterBootDriverReinitialization( - IN PDRIVER_OBJECT DriverObject, - IN PDRIVER_REINITIALIZE DriverReinitializationRoutine, - IN PVOID Context - ) -{ - UNIMPLEMENTED; -} + DPRINT("NtDeviceIoControlFile(DeviceHandle %x Event %x UserApcRoutine %x " + "UserApcContext %x IoStatusBlock %x IoControlCode %x " + "InputBuffer %x InputBufferLength %x OutputBuffer %x " + "OutputBufferLength %x)\n", + DeviceHandle,Event,UserApcRoutine,UserApcContext,IoStatusBlock, + IoControlCode,InputBuffer,InputBufferLength,OutputBuffer, + OutputBufferLength); + if (IoStatusBlock == NULL) + return STATUS_ACCESS_VIOLATION; -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoRegisterLastChanceShutdownNotification( - IN PDEVICE_OBJECT DeviceObject - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} + PreviousMode = ExGetPreviousMode(); -/* - * IoQueryDeviceEnumInfo - * - * Status - * @unimplemented - */ + /* Check granted access against the access rights from IoContolCode */ + Status = ObReferenceObjectByHandle (DeviceHandle, + (IoControlCode >> 14) & 0x3, + IoFileObjectType, + PreviousMode, + (PVOID *) &FileObject, + NULL); + if (!NT_SUCCESS(Status)) + { + return Status; + } -DWORD STDCALL -IoQueryDeviceEnumInfo( - DWORD Unknown0, - DWORD Unknown1) -{ - UNIMPLEMENTED; - return 0; -} + if (Event != NULL) + { + Status = ObReferenceObjectByHandle (Event, + SYNCHRONIZE, + ExEventObjectType, + PreviousMode, + (PVOID*)&EventObject, + NULL); + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject (FileObject); + return Status; + } + } + else + { + EventObject = &FileObject->Event; + KeResetEvent (EventObject); + } -/* - * @unimplemented - */ -VOID -STDCALL -IoSetStartIoAttributes( - IN PDEVICE_OBJECT DeviceObject, - IN BOOLEAN DeferredStartIo, - IN BOOLEAN NonCancelable - ) -{ - UNIMPLEMENTED; -} + DeviceObject = FileObject->DeviceObject; -/* - * @unimplemented - */ -VOID -STDCALL -IoSynchronousInvalidateDeviceRelations( - IN PDEVICE_OBJECT DeviceObject, - IN DEVICE_RELATION_TYPE Type - ) -{ - UNIMPLEMENTED; -} + Irp = IoBuildDeviceIoControlRequest (IoControlCode, + DeviceObject, + InputBuffer, + InputBufferLength, + OutputBuffer, + OutputBufferLength, + FALSE, + EventObject, + IoStatusBlock); + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoValidateDeviceIoControlAccess( - IN PIRP Irp, - IN ULONG RequiredAccess - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + Irp->RequestorMode = PreviousMode; + Irp->Overlay.AsynchronousParameters.UserApcRoutine = UserApcRoutine; + Irp->Overlay.AsynchronousParameters.UserApcContext = UserApcContext; + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->FileObject = FileObject; + StackPtr->DeviceObject = DeviceObject; + StackPtr->Parameters.DeviceIoControl.InputBufferLength = InputBufferLength; + StackPtr->Parameters.DeviceIoControl.OutputBufferLength = OutputBufferLength; + + Status = IoCallDriver(DeviceObject,Irp); + if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + Status = KeWaitForSingleObject (EventObject, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + if (Status != STATUS_WAIT_0) + { + /* Wait failed. */ + return Status; + } + + Status = IoStatusBlock->Status; + } + + return Status; } /* EOF */ diff --git a/reactos/ntoskrnl/io/deviface.c b/reactos/ntoskrnl/io/deviface.c index e1542f56834..3ecefd15782 100644 --- a/reactos/ntoskrnl/io/deviface.c +++ b/reactos/ntoskrnl/io/deviface.c @@ -7,6 +7,7 @@ * * PROGRAMMERS: Filip Navara (xnavara@volny.cz) * Matthew Brace (ismarc@austin.rr.com) + * Hervé Poussineau (hpoussin@reactos.com) */ /* INCLUDES ******************************************************************/ @@ -16,11 +17,10 @@ #define NDEBUG #include -DEFINE_GUID(GUID_SERENUM_BUS_ENUMERATOR, - 0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18); - /* FUNCTIONS *****************************************************************/ +static PWCHAR BaseKeyString = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\DeviceClasses\\"; + /* * @unimplemented */ @@ -93,7 +93,6 @@ IoGetDeviceInterfaces( IN ULONG Flags, OUT PWSTR *SymbolicLinkList) { - PWCHAR BaseKeyString = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\DeviceClasses\\"; PWCHAR BaseInterfaceString = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"; UNICODE_STRING GuidString; UNICODE_STRING BaseKeyName; @@ -561,7 +560,7 @@ IoGetDeviceInterfaces( } /* - * @unimplemented + * @implemented */ NTSTATUS STDCALL @@ -571,20 +570,232 @@ IoRegisterDeviceInterface( IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName) { - PWCHAR KeyNameString = L"\\Device\\Serenum"; - - DPRINT("IoRegisterDeviceInterface called (UNIMPLEMENTED)\n"); - if (!memcmp(InterfaceClassGuid, (LPGUID)&GUID_SERENUM_BUS_ENUMERATOR, sizeof(GUID))) + PUNICODE_STRING InstancePath; + UNICODE_STRING GuidString; + UNICODE_STRING SubKeyName; + UNICODE_STRING BaseKeyName; + UCHAR PdoNameInfoBuffer[sizeof(OBJECT_NAME_INFORMATION) + (256 * sizeof(WCHAR))]; + POBJECT_NAME_INFORMATION PdoNameInfo = (POBJECT_NAME_INFORMATION)PdoNameInfoBuffer; + UNICODE_STRING DeviceInstance = RTL_CONSTANT_STRING(L"DeviceInstance"); + UNICODE_STRING SymbolicLink = RTL_CONSTANT_STRING(L"SymbolicLink"); + HANDLE InterfaceKey; + HANDLE SubKey; + ULONG StartIndex; + OBJECT_ATTRIBUTES ObjectAttributes; + ULONG i; + NTSTATUS Status; + + Status = RtlStringFromGUID(InterfaceClassGuid, &GuidString); + if (!NT_SUCCESS(Status)) { - RtlInitUnicodeString(SymbolicLinkName, KeyNameString); - return STATUS_SUCCESS; + DPRINT("RtlStringFromGUID() failed with status 0x%08lx\n", Status); + return Status; } - - return STATUS_INVALID_DEVICE_REQUEST; + + /* Create Pdo name: \Device\xxxxxxxx (unnamed device) */ + Status = ObQueryNameString( + PhysicalDeviceObject, + PdoNameInfo, + sizeof(PdoNameInfoBuffer), + &i); + if (!NT_SUCCESS(Status)) + { + DPRINT("ObQueryNameString() failed with status 0x%08lx\n", Status); + return Status; + } + ASSERT(PdoNameInfo->Name.Length); + + /* Create base key name for this interface: HKLM\SYSTEM\CurrentControlSet\DeviceClasses\{GUID}\##?#ACPI#PNP0501#1#{GUID} */ + InstancePath = &PhysicalDeviceObject->DeviceObjectExtension->DeviceNode->InstancePath; + BaseKeyName.Length = wcslen(BaseKeyString) * sizeof(WCHAR); + BaseKeyName.MaximumLength = BaseKeyName.Length + + GuidString.Length + + 5 * sizeof(WCHAR) /* 5 = size of \##?# */ + + InstancePath->Length + + sizeof(WCHAR) /* 1 = size of # */ + + GuidString.Length; + BaseKeyName.Buffer = ExAllocatePool( + NonPagedPool, + BaseKeyName.MaximumLength); + if (!BaseKeyName.Buffer) + { + DPRINT("ExAllocatePool() failed\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + wcscpy(BaseKeyName.Buffer, BaseKeyString); + RtlAppendUnicodeStringToString(&BaseKeyName, &GuidString); + RtlAppendUnicodeToString(&BaseKeyName, L"\\##?#"); + StartIndex = BaseKeyName.Length / sizeof(WCHAR); + RtlAppendUnicodeStringToString(&BaseKeyName, InstancePath); + for (i = 0; i < InstancePath->Length / sizeof(WCHAR); i++) + { + if (BaseKeyName.Buffer[StartIndex + i] == '\\') + BaseKeyName.Buffer[StartIndex + i] = '#'; + } + RtlAppendUnicodeToString(&BaseKeyName, L"#"); + RtlAppendUnicodeStringToString(&BaseKeyName, &GuidString); + + /* Create BaseKeyName key in registry */ + InitializeObjectAttributes( + &ObjectAttributes, + &BaseKeyName, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE | OBJ_OPENIF, + NULL, /* RootDirectory */ + NULL); /* SecurityDescriptor */ + + Status = ZwCreateKey( + &InterfaceKey, + KEY_WRITE, + &ObjectAttributes, + 0, /* TileIndex */ + NULL, /* Class */ + REG_OPTION_VOLATILE, + NULL); /* Disposition */ + + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed with status 0x%08lx\n", Status); + ExFreePool(BaseKeyName.Buffer); + return Status; + } + + /* Write DeviceInstance entry. Value is InstancePath */ + Status = ZwSetValueKey( + InterfaceKey, + &DeviceInstance, + 0, /* TileIndex */ + REG_SZ, + InstancePath->Buffer, + InstancePath->Length); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status); + ZwClose(InterfaceKey); + ExFreePool(BaseKeyName.Buffer); + return Status; + } + + /* Create subkey. Name is #ReferenceString */ + SubKeyName.Length = 0; + SubKeyName.MaximumLength = sizeof(WCHAR); + if (ReferenceString && ReferenceString->Length) + SubKeyName.MaximumLength += ReferenceString->Length; + SubKeyName.Buffer = ExAllocatePool( + NonPagedPool, + SubKeyName.MaximumLength); + if (!SubKeyName.Buffer) + { + DPRINT("ExAllocatePool() failed\n"); + ZwClose(InterfaceKey); + ExFreePool(BaseKeyName.Buffer); + return STATUS_INSUFFICIENT_RESOURCES; + } + RtlAppendUnicodeToString(&SubKeyName, L"#"); + if (ReferenceString && ReferenceString->Length) + RtlAppendUnicodeStringToString(&SubKeyName, ReferenceString); + + /* Create SubKeyName key in registry */ + InitializeObjectAttributes( + &ObjectAttributes, + &SubKeyName, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + InterfaceKey, /* RootDirectory */ + NULL); /* SecurityDescriptor */ + + Status = ZwCreateKey( + &SubKey, + KEY_WRITE, + &ObjectAttributes, + 0, /* TileIndex */ + NULL, /* Class */ + REG_OPTION_VOLATILE, + NULL); /* Disposition */ + + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed with status 0x%08lx\n", Status); + ZwClose(InterfaceKey); + ExFreePool(BaseKeyName.Buffer); + return Status; + } + + /* Create symbolic link name: \??\ACPI#PNP0501#1#{GUID}\ReferenceString */ + SymbolicLinkName->Length = 0; + SymbolicLinkName->MaximumLength = SymbolicLinkName->Length + + 4 * sizeof(WCHAR) /* 4 = size of \??\ */ + + InstancePath->Length + + sizeof(WCHAR) /* 1 = size of # */ + + GuidString.Length + + sizeof(WCHAR); /* final NULL */ + if (ReferenceString && ReferenceString->Length) + SymbolicLinkName->MaximumLength += sizeof(WCHAR) + ReferenceString->Length; + SymbolicLinkName->Buffer = ExAllocatePool( + NonPagedPool, + SymbolicLinkName->MaximumLength); + if (!SymbolicLinkName->Buffer) + { + DPRINT("ExAllocatePool() failed\n"); + ZwClose(InterfaceKey); + ZwClose(SubKey); + ExFreePool(SubKeyName.Buffer); + ExFreePool(BaseKeyName.Buffer); + return STATUS_INSUFFICIENT_RESOURCES; + } + RtlAppendUnicodeToString(SymbolicLinkName, L"\\??\\"); + StartIndex = SymbolicLinkName->Length / sizeof(WCHAR); + RtlAppendUnicodeStringToString(SymbolicLinkName, InstancePath); + for (i = 0; i < InstancePath->Length / sizeof(WCHAR); i++) + { + if (SymbolicLinkName->Buffer[StartIndex + i] == '\\') + SymbolicLinkName->Buffer[StartIndex + i] = '#'; + } + RtlAppendUnicodeToString(SymbolicLinkName, L"#"); + RtlAppendUnicodeStringToString(SymbolicLinkName, &GuidString); + if (ReferenceString && ReferenceString->Length) + { + RtlAppendUnicodeToString(SymbolicLinkName, L"\\"); + RtlAppendUnicodeStringToString(SymbolicLinkName, ReferenceString); + } + SymbolicLinkName->Buffer[SymbolicLinkName->Length] = '\0'; + + /* Create symbolic link */ + DPRINT("IoRegisterDeviceInterface(): creating symbolic link %wZ -> %wZ\n", SymbolicLinkName, &PdoNameInfo->Name); + Status = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoCreateSymbolicLink() failed with status 0x%08lx\n", Status); + ZwClose(InterfaceKey); + ZwClose(SubKey); + ExFreePool(SubKeyName.Buffer); + ExFreePool(BaseKeyName.Buffer); + ExFreePool(SymbolicLinkName->Buffer); + return Status; + } + + /* Write symbolic link name in registry */ + Status = ZwSetValueKey( + SubKey, + &SymbolicLink, + 0, /* TileIndex */ + REG_SZ, + SymbolicLinkName->Buffer, + SymbolicLinkName->Length); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status); + ExFreePool(SymbolicLinkName->Buffer); + } + + ZwClose(InterfaceKey); + ZwClose(SubKey); + ExFreePool(SubKeyName.Buffer); + ExFreePool(BaseKeyName.Buffer); + + return Status; } /* - * @unimplemented + * @implemented */ NTSTATUS STDCALL @@ -592,7 +803,43 @@ IoSetDeviceInterfaceState( IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable) { - return STATUS_NOT_IMPLEMENTED; + PDEVICE_OBJECT PhysicalDeviceObject; + PFILE_OBJECT FileObject; + UNICODE_STRING GuidString; + PWCHAR StartPosition; + PWCHAR EndPosition; + NTSTATUS Status; + + if (SymbolicLinkName == NULL) + return STATUS_INVALID_PARAMETER_1; + + DPRINT("IoSetDeviceInterfaceState('%wZ', %d)\n", SymbolicLinkName, Enable); + Status = IoGetDeviceObjectPointer(SymbolicLinkName, + 0, /* DesiredAccess */ + &FileObject, + &PhysicalDeviceObject); + if (!NT_SUCCESS(Status)) + return Status; + + /* Symbolic link name is \??\ACPI#PNP0501#1#{GUID}\ReferenceString */ + /* Get GUID from SymbolicLinkName */ + StartPosition = wcschr(SymbolicLinkName->Buffer, L'{'); + EndPosition = wcschr(SymbolicLinkName->Buffer, L'}'); + if (!StartPosition ||!EndPosition || StartPosition > EndPosition) + return STATUS_INVALID_PARAMETER_1; + GuidString.Buffer = StartPosition; + GuidString.MaximumLength = GuidString.Length = (ULONG_PTR)(EndPosition + 1) - (ULONG_PTR)StartPosition; + + IopNotifyPlugPlayNotification( + PhysicalDeviceObject, + EventCategoryDeviceInterfaceChange, + Enable ? (LPGUID)&GUID_DEVICE_INTERFACE_ARRIVAL : (LPGUID)&GUID_DEVICE_INTERFACE_REMOVAL, + &GuidString, + (PVOID)SymbolicLinkName); + + ObDereferenceObject(FileObject); + + return STATUS_SUCCESS; } /* EOF */ diff --git a/reactos/ntoskrnl/io/dir.c b/reactos/ntoskrnl/io/dir.c deleted file mode 100644 index 7d09e476253..00000000000 --- a/reactos/ntoskrnl/io/dir.c +++ /dev/null @@ -1,291 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/dir.c - * PURPOSE: Directory functions - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - - - -/* - * @implemented - */ -NTSTATUS -STDCALL -NtNotifyChangeDirectoryFile ( - IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID Buffer, - IN ULONG BufferSize, - IN ULONG CompletionFilter, - IN BOOLEAN WatchTree - ) -{ - PIRP Irp; - PDEVICE_OBJECT DeviceObject; - PFILE_OBJECT FileObject; - PIO_STACK_LOCATION IoStack; - KPROCESSOR_MODE PreviousMode; - NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("NtNotifyChangeDirectoryFile()\n"); - - PAGED_CODE(); - - PreviousMode = ExGetPreviousMode(); - - if(PreviousMode != KernelMode) - { - _SEH_TRY - { - ProbeForWrite(IoStatusBlock, - sizeof(IO_STATUS_BLOCK), - sizeof(ULONG)); - if(BufferSize != 0) - { - ProbeForWrite(Buffer, - BufferSize, - sizeof(ULONG)); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(!NT_SUCCESS(Status)) - { - return Status; - } - } - - Status = ObReferenceObjectByHandle(FileHandle, - FILE_LIST_DIRECTORY, - IoFileObjectType, - PreviousMode, - (PVOID *)&FileObject, - NULL); - - if (Status != STATUS_SUCCESS) - { - return(Status); - } - DeviceObject = FileObject->DeviceObject; - - Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); - if (Irp==NULL) - { - ObDereferenceObject(FileObject); - return STATUS_UNSUCCESSFUL; - } - - if (Event == NULL) - { - Event = &FileObject->Event; - } - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = PreviousMode; - Irp->UserIosb = IoStatusBlock; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - Irp->UserEvent = Event; - KeResetEvent( Event ); - Irp->UserBuffer = Buffer; - Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; - Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - - IoStack = IoGetNextIrpStackLocation(Irp); - - IoStack->MajorFunction = IRP_MJ_DIRECTORY_CONTROL; - IoStack->MinorFunction = IRP_MN_NOTIFY_CHANGE_DIRECTORY; - IoStack->Flags = 0; - IoStack->Control = 0; - IoStack->DeviceObject = DeviceObject; - IoStack->FileObject = FileObject; - - if (WatchTree) - { - IoStack->Flags = SL_WATCH_TREE; - } - - IoStack->Parameters.NotifyDirectory.CompletionFilter = CompletionFilter; - IoStack->Parameters.NotifyDirectory.Length = BufferSize; - - Status = IoCallDriver(FileObject->DeviceObject,Irp); - - /* FIXME: Should we wait here or not for synchronously opened files? */ - - return Status; -} - - -/* - * @implemented - */ -NTSTATUS -STDCALL -NtQueryDirectoryFile( - IN HANDLE FileHandle, - IN HANDLE PEvent OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID FileInformation, - IN ULONG Length, - IN FILE_INFORMATION_CLASS FileInformationClass, - IN BOOLEAN ReturnSingleEntry, - IN PUNICODE_STRING FileName OPTIONAL, - IN BOOLEAN RestartScan - ) -/* - * FUNCTION: Queries a directory file. - * ARGUMENTS: - * FileHandle = Handle to a directory file - * EventHandle = Handle to the event signaled on completion - * ApcRoutine = Asynchroneous procedure callback, called on completion - * ApcContext = Argument to the apc. - * IoStatusBlock = Caller supplies storage for extended status information. - * FileInformation = Caller supplies storage for the resulting information. - * - * FileNameInformation FILE_NAMES_INFORMATION - * FileDirectoryInformation FILE_DIRECTORY_INFORMATION - * FileFullDirectoryInformation FILE_FULL_DIRECTORY_INFORMATION - * FileBothDirectoryInformation FILE_BOTH_DIR_INFORMATION - * - * Length = Size of the storage supplied - * FileInformationClass = Indicates the type of information requested. - * ReturnSingleEntry = Specify true if caller only requests the first - * directory found. - * FileName = Initial directory name to query, that may contain wild - * cards. - * RestartScan = Number of times the action should be repeated - * RETURNS: Status [ STATUS_SUCCESS, STATUS_ACCESS_DENIED, STATUS_INSUFFICIENT_RESOURCES, - * STATUS_INVALID_PARAMETER, STATUS_INVALID_DEVICE_REQUEST, STATUS_BUFFER_OVERFLOW, - * STATUS_INVALID_INFO_CLASS, STATUS_NO_SUCH_FILE, STATUS_NO_MORE_FILES ] - */ -{ - PIRP Irp; - PDEVICE_OBJECT DeviceObject; - PFILE_OBJECT FileObject; - PIO_STACK_LOCATION IoStack; - KPROCESSOR_MODE PreviousMode; - NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("NtQueryDirectoryFile()\n"); - - PAGED_CODE(); - - PreviousMode = ExGetPreviousMode(); - - if(PreviousMode != KernelMode) - { - _SEH_TRY - { - ProbeForWrite(IoStatusBlock, - sizeof(IO_STATUS_BLOCK), - sizeof(ULONG)); - ProbeForWrite(FileInformation, - Length, - sizeof(ULONG)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(!NT_SUCCESS(Status)) - { - return Status; - } - } - - Status = ObReferenceObjectByHandle(FileHandle, - FILE_LIST_DIRECTORY, - IoFileObjectType, - PreviousMode, - (PVOID *)&FileObject, - NULL); - - if (Status != STATUS_SUCCESS) - { - return(Status); - } - DeviceObject = FileObject->DeviceObject; - - Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); - if (Irp==NULL) - { - ObDereferenceObject(FileObject); - return STATUS_UNSUCCESSFUL; - } - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = PreviousMode; - Irp->UserIosb = IoStatusBlock; - Irp->UserEvent = &FileObject->Event; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - KeResetEvent( &FileObject->Event ); - Irp->UserBuffer=FileInformation; - Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; - Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - - IoStack = IoGetNextIrpStackLocation(Irp); - - IoStack->MajorFunction = IRP_MJ_DIRECTORY_CONTROL; - IoStack->MinorFunction = IRP_MN_QUERY_DIRECTORY; - IoStack->Flags = 0; - IoStack->Control = 0; - IoStack->DeviceObject = DeviceObject; - IoStack->FileObject = FileObject; - - if (RestartScan) - { - IoStack->Flags = IoStack->Flags | SL_RESTART_SCAN; - } - if (ReturnSingleEntry) - { - IoStack->Flags = IoStack->Flags | SL_RETURN_SINGLE_ENTRY; - } - if (((PFILE_DIRECTORY_INFORMATION)FileInformation)->FileIndex != 0) - { - IoStack->Flags = IoStack->Flags | SL_INDEX_SPECIFIED; - } - - IoStack->Parameters.QueryDirectory.FileInformationClass = - FileInformationClass; - IoStack->Parameters.QueryDirectory.FileName = FileName; - IoStack->Parameters.QueryDirectory.Length = Length; - - Status = IoCallDriver(FileObject->DeviceObject,Irp); - if (Status==STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - Status = IoStatusBlock->Status; - } - - return(Status); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/xhaldrv.c b/reactos/ntoskrnl/io/disk.c similarity index 89% rename from reactos/ntoskrnl/io/xhaldrv.c rename to reactos/ntoskrnl/io/disk.c index 5737f7ed3d3..8eded0b698d 100644 --- a/reactos/ntoskrnl/io/xhaldrv.c +++ b/reactos/ntoskrnl/io/disk.c @@ -1,9 +1,8 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/xhaldrv.c - * PURPOSE: Hal drive routines + * FILE: ntoskrnl/io/disk.c + * PURPOSE: I/O Support for Hal Disk (Partition Table/MBR) Routines. * * PROGRAMMERS: Eric Kohl (ekohl@rz-online.de) * Casper S. Hornstrup (chorns@users.sourceforge.net) @@ -59,6 +58,38 @@ typedef enum _DISK_MANAGER EZ_Drive } DISK_MANAGER; +HAL_DISPATCH EXPORTED HalDispatchTable = +{ + HAL_DISPATCH_VERSION, + (pHalQuerySystemInformation) NULL, // HalQuerySystemInformation + (pHalSetSystemInformation) NULL, // HalSetSystemInformation + (pHalQueryBusSlots) NULL, // HalQueryBusSlots + 0, + (pHalExamineMBR) xHalExamineMBR, + (pHalIoAssignDriveLetters) xHalIoAssignDriveLetters, + (pHalIoReadPartitionTable) xHalIoReadPartitionTable, + (pHalIoSetPartitionInformation) xHalIoSetPartitionInformation, + (pHalIoWritePartitionTable) xHalIoWritePartitionTable, + (pHalHandlerForBus) NULL, // HalReferenceHandlerForBus + (pHalReferenceBusHandler) NULL, // HalReferenceBusHandler + (pHalReferenceBusHandler) NULL, // HalDereferenceBusHandler + (pHalInitPnpDriver) NULL, //HalInitPnpDriver; + (pHalInitPowerManagement) NULL, //HalInitPowerManagement; + (pHalGetDmaAdapter) NULL, //HalGetDmaAdapter; + (pHalGetInterruptTranslator) NULL, //HalGetInterruptTranslator; + (pHalStartMirroring) NULL, //HalStartMirroring; + (pHalEndMirroring) NULL, //HalEndMirroring; + (pHalMirrorPhysicalMemory) NULL, //HalMirrorPhysicalMemory; + (pHalEndOfBoot) NULL, //HalEndOfBoot; + (pHalMirrorVerify) NULL //HalMirrorVerify; +}; + + +HAL_PRIVATE_DISPATCH EXPORTED HalPrivateDispatchTable = +{ + HAL_PRIVATE_DISPATCH_VERSION +}; + /* FUNCTIONS *****************************************************************/ NTSTATUS @@ -1430,4 +1461,189 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, return Status; } +/* + * @unimplemented + * +STDCALL +VOID +IoAssignDriveLetters( + IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN PSTRING NtDeviceName, + OUT PUCHAR NtSystemPath, + OUT PSTRING NtSystemPathString + ) +{ + UNIMPLEMENTED; +*/ + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoCreateDisk( + IN PDEVICE_OBJECT DeviceObject, + IN struct _CREATE_DISK* Disk + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoGetBootDiskInformation( + IN OUT PBOOTDISK_INFORMATION BootDiskInformation, + IN ULONG Size + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoReadDiskSignature( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG BytesPerSector, + OUT PDISK_SIGNATURE Signature + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoReadPartitionTableEx( + IN PDEVICE_OBJECT DeviceObject, + IN struct _DRIVE_LAYOUT_INFORMATION_EX** DriveLayout + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoSetPartitionInformationEx( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG PartitionNumber, + IN struct _SET_PARTITION_INFORMATION_EX* PartitionInfo + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoSetSystemPartition( + PUNICODE_STRING VolumeNameString + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoVerifyPartitionTable( + IN PDEVICE_OBJECT DeviceObject, + IN BOOLEAN FixErrors + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoVolumeDeviceToDosName( + IN PVOID VolumeDeviceObject, + OUT PUNICODE_STRING DosName + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoWritePartitionTableEx( + IN PDEVICE_OBJECT DeviceObject, + IN struct _DRIVE_LAYOUT_INFORMATION_EX* DriveLayfout + ) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @implemented + */ +NTSTATUS FASTCALL +IoReadPartitionTable(PDEVICE_OBJECT DeviceObject, + ULONG SectorSize, + BOOLEAN ReturnRecognizedPartitions, + PDRIVE_LAYOUT_INFORMATION *PartitionBuffer) +{ + return(HalIoReadPartitionTable(DeviceObject, + SectorSize, + ReturnRecognizedPartitions, + PartitionBuffer)); +} + + +NTSTATUS FASTCALL +IoSetPartitionInformation(PDEVICE_OBJECT DeviceObject, + ULONG SectorSize, + ULONG PartitionNumber, + ULONG PartitionType) +{ + return(HalIoSetPartitionInformation(DeviceObject, + SectorSize, + PartitionNumber, + PartitionType)); +} + + +NTSTATUS FASTCALL +IoWritePartitionTable(PDEVICE_OBJECT DeviceObject, + ULONG SectorSize, + ULONG SectorsPerTrack, + ULONG NumberOfHeads, + PDRIVE_LAYOUT_INFORMATION PartitionBuffer) +{ + return(HalIoWritePartitionTable(DeviceObject, + SectorSize, + SectorsPerTrack, + NumberOfHeads, + PartitionBuffer)); +} /* EOF */ diff --git a/reactos/ntoskrnl/io/driver.c b/reactos/ntoskrnl/io/driver.c index e2452677368..b199b23584c 100644 --- a/reactos/ntoskrnl/io/driver.c +++ b/reactos/ntoskrnl/io/driver.c @@ -60,8 +60,12 @@ typedef struct _DRIVER_REINIT_ITEM /* GLOBALS ********************************************************************/ static LIST_ENTRY DriverReinitListHead; -static PLIST_ENTRY DriverReinitTailEntry; static KSPIN_LOCK DriverReinitListLock; +static PLIST_ENTRY DriverReinitTailEntry; + +static PLIST_ENTRY DriverBootReinitTailEntry; +static LIST_ENTRY DriverBootReinitListHead; +static KSPIN_LOCK DriverBootReinitListLock; static LIST_ENTRY GroupListHead = {NULL, NULL}; static LIST_ENTRY ServiceListHead = {NULL, NULL}; @@ -117,6 +121,10 @@ IopInitDriverImplementation(VOID) InitializeListHead(&DriverReinitListHead); KeInitializeSpinLock(&DriverReinitListLock); DriverReinitTailEntry = NULL; + + InitializeListHead(&DriverBootReinitListHead); + KeInitializeSpinLock(&DriverBootReinitListLock); + DriverBootReinitTailEntry = NULL; } NTSTATUS STDCALL @@ -199,6 +207,7 @@ NTSTATUS FASTCALL IopCreateDriverObject( PDRIVER_OBJECT *DriverObject, PUNICODE_STRING ServiceName, + ULONG CreateAttributes, BOOLEAN FileSystem, PVOID DriverImageStart, ULONG DriverImageSize) @@ -240,7 +249,7 @@ IopCreateDriverObject( InitializeObjectAttributes( &ObjectAttributes, &DriverName, - OBJ_PERMANENT, + CreateAttributes | OBJ_PERMANENT, NULL, NULL); @@ -265,9 +274,14 @@ IopCreateDriverObject( Object->DriverSize = DriverImageSize; if (Buffer) { - Object->DriverName.Buffer = Buffer; - Object->DriverName.Length = Object->DriverName.MaximumLength = DriverName.Length; - RtlCopyMemory(Object->DriverName.Buffer, DriverName.Buffer, DriverName.Length); + if (!Object->DriverName.Buffer) + { + Object->DriverName.Buffer = Buffer; + Object->DriverName.Length = Object->DriverName.MaximumLength = DriverName.Length; + RtlCopyMemory(Object->DriverName.Buffer, DriverName.Buffer, DriverName.Length); + } + else + ExFreePool(Buffer); } *DriverObject = Object; @@ -479,7 +493,7 @@ IopLoadServiceModule( else { DPRINT("Module already loaded\n"); - Status = STATUS_SUCCESS; + Status = STATUS_IMAGE_ALREADY_LOADED; } RtlFreeUnicodeString(&ServiceImagePath); @@ -511,6 +525,9 @@ IopLoadServiceModule( * Module object representing the driver. It can be retrieve by * IopLoadServiceModule. * + * ServiceName + * Name of the service (as in registry). + * * FileSystemDriver * Set to TRUE for file system drivers. * @@ -523,6 +540,7 @@ NTSTATUS FASTCALL IopInitializeDriverModule( IN PDEVICE_NODE DeviceNode, IN PMODULE_OBJECT ModuleObject, + IN PUNICODE_STRING ServiceName, IN BOOLEAN FileSystemDriver, OUT PDRIVER_OBJECT *DriverObject) { @@ -533,7 +551,8 @@ IopInitializeDriverModule( Status = IopCreateDriverObject( DriverObject, - &DeviceNode->ServiceName, + ServiceName, + 0, FileSystemDriver, ModuleObject->Base, ModuleObject->Length); @@ -544,14 +563,14 @@ IopInitializeDriverModule( return Status; } - if (DeviceNode->ServiceName.Buffer) + if (ServiceName->Buffer) { - RegistryKey.Length = DeviceNode->ServiceName.Length + + RegistryKey.Length = ServiceName->Length + sizeof(ServicesKeyName) - sizeof(UNICODE_NULL); RegistryKey.MaximumLength = RegistryKey.Length + sizeof(UNICODE_NULL); RegistryKey.Buffer = ExAllocatePool(PagedPool, RegistryKey.MaximumLength); wcscpy(RegistryKey.Buffer, ServicesKeyName); - wcscat(RegistryKey.Buffer, DeviceNode->ServiceName.Buffer); + wcscat(RegistryKey.Buffer, ServiceName->Buffer); } else { @@ -610,12 +629,29 @@ IopAttachFilterDriversCallback( /* Load and initialize the filter driver */ Status = IopLoadServiceModule(&ServiceName, &ModuleObject); - if (!NT_SUCCESS(Status)) - continue; + if (Status != STATUS_IMAGE_ALREADY_LOADED) + { + if (!NT_SUCCESS(Status)) + continue; - Status = IopInitializeDriverModule(DeviceNode, ModuleObject, FALSE, &DriverObject); - if (!NT_SUCCESS(Status)) - continue; + Status = IopInitializeDriverModule(DeviceNode, ModuleObject, &ServiceName, + FALSE, &DriverObject); + if (!NT_SUCCESS(Status)) + continue; + } + else + { + /* get existing DriverObject pointer */ + Status = IopCreateDriverObject( + &DriverObject, + &ServiceName, + OBJ_OPENIF, + FALSE, + ModuleObject->Base, + ModuleObject->Length); + if (!NT_SUCCESS(Status)) + continue; + } Status = IopInitializeDevice(DeviceNode, DriverObject); if (!NT_SUCCESS(Status)) @@ -1165,8 +1201,8 @@ IopInitializeBuiltinDriver( * Initialize the driver */ - Status = IopInitializeDriverModule(DeviceNode, ModuleObject, FALSE, - &DriverObject); + Status = IopInitializeDriverModule(DeviceNode, ModuleObject, + &DeviceNode->ServiceName, FALSE, &DriverObject); if (!NT_SUCCESS(Status)) { @@ -1613,6 +1649,7 @@ IoCreateDriver ( PDRIVER_OBJECT DriverObject; UNICODE_STRING ServiceKeyName; HANDLE hDriver; + ULONG i; /* First, create a unique name for the driver if we don't have one */ if (!DriverName) { @@ -1659,7 +1696,12 @@ IoCreateDriver ( DriverObject->DriverExtension = (PDRIVER_EXTENSION)(DriverObject + 1); DriverObject->DriverExtension->DriverObject = DriverObject; DriverObject->DriverInit = InitializationFunction; - /* FIXME: Invalidate all Major Functions b/c now they are NULL and might crash */ + + /* Invalidate all Major Functions */ + for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) + { + DriverObject->MajorFunction[i] = IopInvalidDeviceRequest; + } /* Set up the Service Key Name */ ServiceKeyName.Buffer = ExAllocatePool(PagedPool, LocalDriverName.Length + sizeof(WCHAR)); @@ -1873,6 +1915,7 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName) Status = IopInitializeDriverModule( DeviceNode, ModuleObject, + &DeviceNode->ServiceName, (Type == 2 /* SERVICE_FILE_SYSTEM_DRIVER */ || Type == 8 /* SERVICE_RECOGNIZER_DRIVER */), &DriverObject); @@ -1934,6 +1977,8 @@ IoRegisterDriverReinitialization( ReinitItem->DriverObject = DriverObject; ReinitItem->ReinitRoutine = ReinitRoutine; ReinitItem->Context = Context; + + DriverObject->Flags |= DRVO_REINIT_REGISTERED; ExInterlockedInsertTailList( &DriverReinitListHead, @@ -1941,6 +1986,35 @@ IoRegisterDriverReinitialization( &DriverReinitListLock); } +/* + * @implemented + */ +VOID +STDCALL +IoRegisterBootDriverReinitialization( + IN PDRIVER_OBJECT DriverObject, + IN PDRIVER_REINITIALIZE DriverReinitializationRoutine, + IN PVOID Context + ) +{ + PDRIVER_REINIT_ITEM ReinitItem; + + ReinitItem = ExAllocatePool(NonPagedPool, sizeof(DRIVER_REINIT_ITEM)); + if (ReinitItem == NULL) + return; + + ReinitItem->DriverObject = DriverObject; + ReinitItem->ReinitRoutine = DriverReinitializationRoutine; + ReinitItem->Context = Context; + + DriverObject->Flags |= DRVO_BOOTREINIT_REGISTERED; + + ExInterlockedInsertTailList( + &DriverBootReinitListHead, + &ReinitItem->ItemEntry, + &DriverReinitListLock); +} + /* * IoAllocateDriverObjectExtension * diff --git a/reactos/ntoskrnl/io/efi.c b/reactos/ntoskrnl/io/efi.c index f93fea0d784..a02a1d40bed 100644 --- a/reactos/ntoskrnl/io/efi.c +++ b/reactos/ntoskrnl/io/efi.c @@ -1,5 +1,4 @@ -/* $Id:$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/io/efi.c @@ -15,9 +14,6 @@ /* FUNCTIONS *****************************************************************/ -/* - * @unimplemented - */ NTSTATUS STDCALL NtAddBootEntry( @@ -28,9 +24,7 @@ NtAddBootEntry( UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } -/* - * @unimplemented - */ + NTSTATUS STDCALL NtDeleteBootEntry( @@ -41,9 +35,7 @@ NtDeleteBootEntry( UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } -/* - * @unimplemented - */ + NTSTATUS STDCALL NtEnumerateBootEntries( @@ -54,9 +46,7 @@ NtEnumerateBootEntries( UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } -/* - * @unimplemented - */ + NTSTATUS STDCALL NtQueryBootEntryOrder( @@ -67,9 +57,7 @@ NtQueryBootEntryOrder( UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } -/* - * @unimplemented - */ + NTSTATUS STDCALL NtQueryBootOptions( @@ -80,9 +68,7 @@ NtQueryBootOptions( UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } -/* - * @unimplemented - */ + NTSTATUS STDCALL NtSetBootEntryOrder( @@ -93,10 +79,7 @@ NtSetBootEntryOrder( UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } - -/* - * @unimplemented - */ + NTSTATUS STDCALL NtSetBootOptions( @@ -106,12 +89,8 @@ NtSetBootOptions( { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; -} - - -/* - * @unimplemented - */ +} + NTSTATUS STDCALL NtTranslateFilePath( @@ -124,5 +103,4 @@ NtTranslateFilePath( return STATUS_NOT_IMPLEMENTED; } - /* EOF */ diff --git a/reactos/ntoskrnl/io/errlog.c b/reactos/ntoskrnl/io/errlog.c deleted file mode 100644 index 43e13d76fa8..00000000000 --- a/reactos/ntoskrnl/io/errlog.c +++ /dev/null @@ -1,450 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/errlog.c - * PURPOSE: Error logging - * - * PROGRAMMERS: David Welch (welch@cwcom.net) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* TYPES *********************************************************************/ - -typedef struct _ERROR_LOG_ENTRY -{ - LIST_ENTRY Entry; - LARGE_INTEGER TimeStamp; - PVOID IoObject; - ULONG PacketSize; -} ERROR_LOG_ENTRY, *PERROR_LOG_ENTRY; - -typedef struct _LOG_WORKER_DPC -{ - KDPC Dpc; - KTIMER Timer; -} LOG_WORKER_DPC, *PLOG_WORKER_DPC; - - -static VOID STDCALL -IopLogWorker (PVOID Parameter); - - -/* GLOBALS *******************************************************************/ - -static KSPIN_LOCK IopAllocationLock; -static ULONG IopTotalLogSize; - -static KSPIN_LOCK IopLogListLock; -static LIST_ENTRY IopLogListHead; - -static BOOLEAN IopLogWorkerRunning = FALSE; -static BOOLEAN IopLogPortConnected = FALSE; -static HANDLE IopLogPort; - - -/* FUNCTIONS *****************************************************************/ - -NTSTATUS -IopInitErrorLog (VOID) -{ - IopTotalLogSize = 0; - KeInitializeSpinLock (&IopAllocationLock); - - KeInitializeSpinLock (&IopLogListLock); - InitializeListHead (&IopLogListHead); - - return STATUS_SUCCESS; -} - - -static VOID STDCALL -IopLogDpcRoutine (PKDPC Dpc, - PVOID DeferredContext, - PVOID SystemArgument1, - PVOID SystemArgument2) -{ - PWORK_QUEUE_ITEM LogWorkItem; - - DPRINT ("\nIopLogDpcRoutine() called\n"); - - /* Release the WorkerDpc struct */ - ExFreePool (DeferredContext); - - /* Allocate, initialize and restart a work item */ - LogWorkItem = ExAllocatePool (NonPagedPool, - sizeof(WORK_QUEUE_ITEM)); - if (LogWorkItem == NULL) - { - IopLogWorkerRunning = FALSE; - return; - } - - ExInitializeWorkItem (LogWorkItem, - IopLogWorker, - LogWorkItem); - - ExQueueWorkItem (LogWorkItem, - DelayedWorkQueue); -} - - -static VOID -IopRestartLogWorker (VOID) -{ - PLOG_WORKER_DPC WorkerDpc; - LARGE_INTEGER Timeout; - - DPRINT ("IopRestartWorker() called\n"); - - WorkerDpc = ExAllocatePool (NonPagedPool, - sizeof(LOG_WORKER_DPC)); - if (WorkerDpc == NULL) - { - IopLogWorkerRunning = FALSE; - return; - } - - /* Initialize DPC and Timer */ - KeInitializeDpc (&WorkerDpc->Dpc, - IopLogDpcRoutine, - WorkerDpc); - KeInitializeTimer (&WorkerDpc->Timer); - - /* Restart after 30 seconds */ - Timeout.QuadPart = (LONGLONG)-300000000; - KeSetTimer (&WorkerDpc->Timer, - Timeout, - &WorkerDpc->Dpc); -} - - -static BOOLEAN -IopConnectLogPort (VOID) -{ - UNICODE_STRING PortName; - NTSTATUS Status; - - DPRINT ("IopConnectLogPort() called\n"); - - RtlInitUnicodeString (&PortName, - L"\\ErrorLogPort"); - - Status = ZwConnectPort (&IopLogPort, - &PortName, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT ("ZwConnectPort() failed (Status %lx)\n", Status); - return FALSE; - } - - DPRINT ("IopConnectLogPort() done\n"); - - return TRUE; -} - - -static VOID STDCALL -IopLogWorker (PVOID Parameter) -{ - PERROR_LOG_ENTRY LogEntry; - PLPC_MAX_MESSAGE Request; - PIO_ERROR_LOG_MESSAGE Message; - PIO_ERROR_LOG_PACKET Packet; - KIRQL Irql; - NTSTATUS Status; - - UCHAR Buffer[256]; - POBJECT_NAME_INFORMATION ObjectNameInfo; - ULONG ReturnedLength; - PWCHAR DriverName; - ULONG DriverNameLength; - - DPRINT ("IopLogWorker() called\n"); - - /* Release the work item */ - ExFreePool (Parameter); - - /* Connect to the error log port */ - if (IopLogPortConnected == FALSE) - { - if (IopConnectLogPort () == FALSE) - { - IopRestartLogWorker (); - return; - } - - IopLogPortConnected = TRUE; - } - - while (TRUE) - { - /* Remove last entry from the list */ - KeAcquireSpinLock (&IopLogListLock, - &Irql); - - if (!IsListEmpty (&IopLogListHead)) - { - LogEntry = CONTAINING_RECORD (IopLogListHead.Blink, - ERROR_LOG_ENTRY, - Entry); - RemoveEntryList (&LogEntry->Entry); - } - else - { - LogEntry = NULL; - } - - KeReleaseSpinLock (&IopLogListLock, - Irql); - - if (LogEntry == NULL) - { - DPRINT ("No message in log list\n"); - break; - } - - /* Get pointer to the log packet */ - Packet = (PIO_ERROR_LOG_PACKET)((ULONG_PTR)LogEntry + sizeof(ERROR_LOG_ENTRY)); - - - /* Get driver or device name */ - ObjectNameInfo = (POBJECT_NAME_INFORMATION)Buffer; - Status = ObQueryNameString (LogEntry->IoObject, - ObjectNameInfo, - 256, - &ReturnedLength); - if (NT_SUCCESS(Status)) - { - DPRINT ("ReturnedLength: %lu\n", ReturnedLength); - DPRINT ("Length: %hu\n", ObjectNameInfo->Name.Length); - DPRINT ("MaximumLength: %hu\n", ObjectNameInfo->Name.MaximumLength); - DPRINT ("Object: %wZ\n", &ObjectNameInfo->Name); - - DriverName = wcsrchr(ObjectNameInfo->Name.Buffer, L'\\'); - if (DriverName != NULL) - DriverName++; - else - DriverName = ObjectNameInfo->Name.Buffer; - - DriverNameLength = wcslen (DriverName) * sizeof(WCHAR); - DPRINT ("Driver name '%S'\n", DriverName); - } - else - { - DriverName = NULL; - DriverNameLength = 0; - } - - /* Allocate request buffer */ - Request = ExAllocatePool (NonPagedPool, - sizeof(LPC_MAX_MESSAGE)); - if (Request == NULL) - { - DPRINT ("Failed to allocate request buffer!\n"); - - /* Requeue log message and restart the worker */ - ExInterlockedInsertTailList (&IopLogListHead, - &LogEntry->Entry, - &IopLogListLock); - IopRestartLogWorker (); - - return; - } - - /* Initialize the log message */ - Message = (PIO_ERROR_LOG_MESSAGE)Request->Data; - Message->Type = 0xC; //IO_TYPE_ERROR_MESSAGE; - Message->Size = - sizeof(IO_ERROR_LOG_MESSAGE) - sizeof(IO_ERROR_LOG_PACKET) + - LogEntry->PacketSize + DriverNameLength; - Message->DriverNameLength = (USHORT)DriverNameLength; - Message->TimeStamp.QuadPart = LogEntry->TimeStamp.QuadPart; - Message->DriverNameOffset = (DriverName != NULL) ? LogEntry->PacketSize : 0; - - /* Copy error log packet */ - RtlCopyMemory (&Message->EntryData, - Packet, - LogEntry->PacketSize); - - /* Copy driver or device name */ - RtlCopyMemory ((PVOID)((ULONG_PTR)Message + Message->DriverNameOffset), - DriverName, - DriverNameLength); - - DPRINT ("SequenceNumber %lx\n", Packet->SequenceNumber); - - Request->Header.DataSize = Message->Size; - Request->Header.MessageSize = - Request->Header.DataSize + sizeof(LPC_MESSAGE); - - /* Send the error message to the log port */ - Status = ZwRequestPort (IopLogPort, - &Request->Header); - - /* Release request buffer */ - ExFreePool (Request); - - if (!NT_SUCCESS(Status)) - { - DPRINT ("ZwRequestPort() failed (Status %lx)\n", Status); - - /* Requeue log message and restart the worker */ - ExInterlockedInsertTailList (&IopLogListHead, - &LogEntry->Entry, - &IopLogListLock); - IopRestartLogWorker (); - - return; - } - - /* Release error log entry */ - KeAcquireSpinLock (&IopAllocationLock, - &Irql); - - IopTotalLogSize -= (LogEntry->PacketSize - sizeof(ERROR_LOG_ENTRY)); - ExFreePool (LogEntry); - - KeReleaseSpinLock (&IopAllocationLock, - Irql); - } - - IopLogWorkerRunning = FALSE; - - DPRINT ("IopLogWorker() done\n"); -} - - -/* - * @implemented - */ -PVOID STDCALL -IoAllocateErrorLogEntry (IN PVOID IoObject, - IN UCHAR EntrySize) -{ - PERROR_LOG_ENTRY LogEntry; - ULONG LogEntrySize; - KIRQL Irql; - - DPRINT("IoAllocateErrorLogEntry() called\n"); - - if (IoObject == NULL) - return NULL; - - KeAcquireSpinLock (&IopAllocationLock, - &Irql); - - if (IopTotalLogSize > PAGE_SIZE) - { - KeReleaseSpinLock (&IopAllocationLock, - Irql); - return NULL; - } - - LogEntrySize = sizeof(ERROR_LOG_ENTRY) + EntrySize; - LogEntry = ExAllocatePool (NonPagedPool, - LogEntrySize); - if (LogEntry == NULL) - { - KeReleaseSpinLock (&IopAllocationLock, - Irql); - return NULL; - } - - IopTotalLogSize += EntrySize; - - LogEntry->IoObject = IoObject; - LogEntry->PacketSize = LogEntrySize; - - KeReleaseSpinLock (&IopAllocationLock, - Irql); - - return (PVOID)((ULONG_PTR)LogEntry + sizeof(ERROR_LOG_ENTRY)); -} - - -/* - * @implemented - */ -VOID STDCALL -IoFreeErrorLogEntry(IN PVOID ElEntry) -{ - PERROR_LOG_ENTRY LogEntry; - KIRQL Irql; - - DPRINT("IoFreeErrorLogEntry() called\n"); - - if (ElEntry == NULL) - return; - - LogEntry = (PERROR_LOG_ENTRY)((ULONG_PTR)ElEntry - sizeof(ERROR_LOG_ENTRY)); - - KeAcquireSpinLock(&IopAllocationLock, - &Irql); - - IopTotalLogSize -= (LogEntry->PacketSize - sizeof(ERROR_LOG_ENTRY)); - ExFreePool(LogEntry); - - KeReleaseSpinLock(&IopAllocationLock, - Irql); -} - - -/* - * @implemented - */ -VOID STDCALL -IoWriteErrorLogEntry (IN PVOID ElEntry) -{ - PWORK_QUEUE_ITEM LogWorkItem; - PERROR_LOG_ENTRY LogEntry; - KIRQL Irql; - - DPRINT("IoWriteErrorLogEntry() called\n"); - - LogEntry = (PERROR_LOG_ENTRY)((ULONG_PTR)ElEntry - sizeof(ERROR_LOG_ENTRY)); - - /* Get time stamp */ - KeQuerySystemTime (&LogEntry->TimeStamp); - - KeAcquireSpinLock (&IopLogListLock, - &Irql); - - InsertHeadList (&IopLogListHead, - &LogEntry->Entry); - - if (IopLogWorkerRunning == FALSE) - { - LogWorkItem = ExAllocatePool (NonPagedPool, - sizeof(WORK_QUEUE_ITEM)); - if (LogWorkItem != NULL) - { - ExInitializeWorkItem (LogWorkItem, - IopLogWorker, - LogWorkItem); - - ExQueueWorkItem (LogWorkItem, - DelayedWorkQueue); - - IopLogWorkerRunning = TRUE; - } - } - - KeReleaseSpinLock (&IopLogListLock, - Irql); - - DPRINT("IoWriteErrorLogEntry() done\n"); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/error.c b/reactos/ntoskrnl/io/error.c index 5b85dd926ff..b7364da68f2 100644 --- a/reactos/ntoskrnl/io/error.c +++ b/reactos/ntoskrnl/io/error.c @@ -2,49 +2,556 @@ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/error.c - * PURPOSE: Handle media errors - * - * PROGRAMMERS: David Welch (welch@mcmail.com) + * FILE: ntoskrnl/io/errlog.c + * PURPOSE: Error logging + * + * PROGRAMMERS: David Welch (welch@cwcom.net) */ /* INCLUDES *****************************************************************/ #include +#define NDEBUG #include +/* TYPES *********************************************************************/ + +typedef struct _ERROR_LOG_ENTRY +{ + LIST_ENTRY Entry; + LARGE_INTEGER TimeStamp; + PVOID IoObject; + ULONG PacketSize; +} ERROR_LOG_ENTRY, *PERROR_LOG_ENTRY; + +typedef struct _LOG_WORKER_DPC +{ + KDPC Dpc; + KTIMER Timer; +} LOG_WORKER_DPC, *PLOG_WORKER_DPC; + + +static VOID STDCALL +IopLogWorker (PVOID Parameter); + + +/* GLOBALS *******************************************************************/ + +static KSPIN_LOCK IopAllocationLock; +static ULONG IopTotalLogSize; + +static KSPIN_LOCK IopLogListLock; +static LIST_ENTRY IopLogListHead; + +static BOOLEAN IopLogWorkerRunning = FALSE; +static BOOLEAN IopLogPortConnected = FALSE; +static HANDLE IopLogPort; + + /* FUNCTIONS *****************************************************************/ +NTSTATUS +IopInitErrorLog (VOID) +{ + IopTotalLogSize = 0; + KeInitializeSpinLock (&IopAllocationLock); + + KeInitializeSpinLock (&IopLogListLock); + InitializeListHead (&IopLogListHead); + + return STATUS_SUCCESS; +} + + +static VOID STDCALL +IopLogDpcRoutine (PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2) +{ + PWORK_QUEUE_ITEM LogWorkItem; + + DPRINT ("\nIopLogDpcRoutine() called\n"); + + /* Release the WorkerDpc struct */ + ExFreePool (DeferredContext); + + /* Allocate, initialize and restart a work item */ + LogWorkItem = ExAllocatePool (NonPagedPool, + sizeof(WORK_QUEUE_ITEM)); + if (LogWorkItem == NULL) + { + IopLogWorkerRunning = FALSE; + return; + } + + ExInitializeWorkItem (LogWorkItem, + IopLogWorker, + LogWorkItem); + + ExQueueWorkItem (LogWorkItem, + DelayedWorkQueue); +} + + +static VOID +IopRestartLogWorker (VOID) +{ + PLOG_WORKER_DPC WorkerDpc; + LARGE_INTEGER Timeout; + + DPRINT ("IopRestartWorker() called\n"); + + WorkerDpc = ExAllocatePool (NonPagedPool, + sizeof(LOG_WORKER_DPC)); + if (WorkerDpc == NULL) + { + IopLogWorkerRunning = FALSE; + return; + } + + /* Initialize DPC and Timer */ + KeInitializeDpc (&WorkerDpc->Dpc, + IopLogDpcRoutine, + WorkerDpc); + KeInitializeTimer (&WorkerDpc->Timer); + + /* Restart after 30 seconds */ + Timeout.QuadPart = (LONGLONG)-300000000; + KeSetTimer (&WorkerDpc->Timer, + Timeout, + &WorkerDpc->Dpc); +} + + +static BOOLEAN +IopConnectLogPort (VOID) +{ + UNICODE_STRING PortName; + NTSTATUS Status; + + DPRINT ("IopConnectLogPort() called\n"); + + RtlInitUnicodeString (&PortName, + L"\\ErrorLogPort"); + + Status = ZwConnectPort (&IopLogPort, + &PortName, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT ("ZwConnectPort() failed (Status %lx)\n", Status); + return FALSE; + } + + DPRINT ("IopConnectLogPort() done\n"); + + return TRUE; +} + + +static VOID STDCALL +IopLogWorker (PVOID Parameter) +{ + PERROR_LOG_ENTRY LogEntry; + PLPC_MAX_MESSAGE Request; + PIO_ERROR_LOG_MESSAGE Message; + PIO_ERROR_LOG_PACKET Packet; + KIRQL Irql; + NTSTATUS Status; + + UCHAR Buffer[256]; + POBJECT_NAME_INFORMATION ObjectNameInfo; + ULONG ReturnedLength; + PWCHAR DriverName; + ULONG DriverNameLength; + + DPRINT ("IopLogWorker() called\n"); + + /* Release the work item */ + ExFreePool (Parameter); + + /* Connect to the error log port */ + if (IopLogPortConnected == FALSE) + { + if (IopConnectLogPort () == FALSE) + { + IopRestartLogWorker (); + return; + } + + IopLogPortConnected = TRUE; + } + + while (TRUE) + { + /* Remove last entry from the list */ + KeAcquireSpinLock (&IopLogListLock, + &Irql); + + if (!IsListEmpty (&IopLogListHead)) + { + LogEntry = CONTAINING_RECORD (IopLogListHead.Blink, + ERROR_LOG_ENTRY, + Entry); + RemoveEntryList (&LogEntry->Entry); + } + else + { + LogEntry = NULL; + } + + KeReleaseSpinLock (&IopLogListLock, + Irql); + + if (LogEntry == NULL) + { + DPRINT ("No message in log list\n"); + break; + } + + /* Get pointer to the log packet */ + Packet = (PIO_ERROR_LOG_PACKET)((ULONG_PTR)LogEntry + sizeof(ERROR_LOG_ENTRY)); + + + /* Get driver or device name */ + ObjectNameInfo = (POBJECT_NAME_INFORMATION)Buffer; + Status = ObQueryNameString (LogEntry->IoObject, + ObjectNameInfo, + 256, + &ReturnedLength); + if (NT_SUCCESS(Status)) + { + DPRINT ("ReturnedLength: %lu\n", ReturnedLength); + DPRINT ("Length: %hu\n", ObjectNameInfo->Name.Length); + DPRINT ("MaximumLength: %hu\n", ObjectNameInfo->Name.MaximumLength); + DPRINT ("Object: %wZ\n", &ObjectNameInfo->Name); + + DriverName = wcsrchr(ObjectNameInfo->Name.Buffer, L'\\'); + if (DriverName != NULL) + DriverName++; + else + DriverName = ObjectNameInfo->Name.Buffer; + + DriverNameLength = wcslen (DriverName) * sizeof(WCHAR); + DPRINT ("Driver name '%S'\n", DriverName); + } + else + { + DriverName = NULL; + DriverNameLength = 0; + } + + /* Allocate request buffer */ + Request = ExAllocatePool (NonPagedPool, + sizeof(LPC_MAX_MESSAGE)); + if (Request == NULL) + { + DPRINT ("Failed to allocate request buffer!\n"); + + /* Requeue log message and restart the worker */ + ExInterlockedInsertTailList (&IopLogListHead, + &LogEntry->Entry, + &IopLogListLock); + IopRestartLogWorker (); + + return; + } + + /* Initialize the log message */ + Message = (PIO_ERROR_LOG_MESSAGE)Request->Data; + Message->Type = 0xC; //IO_TYPE_ERROR_MESSAGE; + Message->Size = + sizeof(IO_ERROR_LOG_MESSAGE) - sizeof(IO_ERROR_LOG_PACKET) + + LogEntry->PacketSize + DriverNameLength; + Message->DriverNameLength = (USHORT)DriverNameLength; + Message->TimeStamp.QuadPart = LogEntry->TimeStamp.QuadPart; + Message->DriverNameOffset = (DriverName != NULL) ? LogEntry->PacketSize : 0; + + /* Copy error log packet */ + RtlCopyMemory (&Message->EntryData, + Packet, + LogEntry->PacketSize); + + /* Copy driver or device name */ + RtlCopyMemory ((PVOID)((ULONG_PTR)Message + Message->DriverNameOffset), + DriverName, + DriverNameLength); + + DPRINT ("SequenceNumber %lx\n", Packet->SequenceNumber); + + Request->Header.DataSize = Message->Size; + Request->Header.MessageSize = + Request->Header.DataSize + sizeof(LPC_MESSAGE); + + /* Send the error message to the log port */ + Status = ZwRequestPort (IopLogPort, + &Request->Header); + + /* Release request buffer */ + ExFreePool (Request); + + if (!NT_SUCCESS(Status)) + { + DPRINT ("ZwRequestPort() failed (Status %lx)\n", Status); + + /* Requeue log message and restart the worker */ + ExInterlockedInsertTailList (&IopLogListHead, + &LogEntry->Entry, + &IopLogListLock); + IopRestartLogWorker (); + + return; + } + + /* Release error log entry */ + KeAcquireSpinLock (&IopAllocationLock, + &Irql); + + IopTotalLogSize -= (LogEntry->PacketSize - sizeof(ERROR_LOG_ENTRY)); + ExFreePool (LogEntry); + + KeReleaseSpinLock (&IopAllocationLock, + Irql); + } + + IopLogWorkerRunning = FALSE; + + DPRINT ("IopLogWorker() done\n"); +} + /* - * @unimplemented + * @implemented */ -VOID STDCALL +PVOID STDCALL +IoAllocateErrorLogEntry (IN PVOID IoObject, + IN UCHAR EntrySize) +{ + PERROR_LOG_ENTRY LogEntry; + ULONG LogEntrySize; + KIRQL Irql; + + DPRINT("IoAllocateErrorLogEntry() called\n"); + + if (IoObject == NULL) + return NULL; + + KeAcquireSpinLock (&IopAllocationLock, + &Irql); + + if (IopTotalLogSize > PAGE_SIZE) + { + KeReleaseSpinLock (&IopAllocationLock, + Irql); + return NULL; + } + + LogEntrySize = sizeof(ERROR_LOG_ENTRY) + EntrySize; + LogEntry = ExAllocatePool (NonPagedPool, + LogEntrySize); + if (LogEntry == NULL) + { + KeReleaseSpinLock (&IopAllocationLock, + Irql); + return NULL; + } + + IopTotalLogSize += EntrySize; + + LogEntry->IoObject = IoObject; + LogEntry->PacketSize = LogEntrySize; + + KeReleaseSpinLock (&IopAllocationLock, + Irql); + + return (PVOID)((ULONG_PTR)LogEntry + sizeof(ERROR_LOG_ENTRY)); +} + + +/* + * @implemented + */ +VOID STDCALL +IoFreeErrorLogEntry(IN PVOID ElEntry) +{ + PERROR_LOG_ENTRY LogEntry; + KIRQL Irql; + + DPRINT("IoFreeErrorLogEntry() called\n"); + + if (ElEntry == NULL) + return; + + LogEntry = (PERROR_LOG_ENTRY)((ULONG_PTR)ElEntry - sizeof(ERROR_LOG_ENTRY)); + + KeAcquireSpinLock(&IopAllocationLock, + &Irql); + + IopTotalLogSize -= (LogEntry->PacketSize - sizeof(ERROR_LOG_ENTRY)); + ExFreePool(LogEntry); + + KeReleaseSpinLock(&IopAllocationLock, + Irql); +} + + +/* + * @implemented + */ +VOID STDCALL +IoWriteErrorLogEntry (IN PVOID ElEntry) +{ + PWORK_QUEUE_ITEM LogWorkItem; + PERROR_LOG_ENTRY LogEntry; + KIRQL Irql; + + DPRINT("IoWriteErrorLogEntry() called\n"); + + LogEntry = (PERROR_LOG_ENTRY)((ULONG_PTR)ElEntry - sizeof(ERROR_LOG_ENTRY)); + + /* Get time stamp */ + KeQuerySystemTime (&LogEntry->TimeStamp); + + KeAcquireSpinLock (&IopLogListLock, + &Irql); + + InsertHeadList (&IopLogListHead, + &LogEntry->Entry); + + if (IopLogWorkerRunning == FALSE) + { + LogWorkItem = ExAllocatePool (NonPagedPool, + sizeof(WORK_QUEUE_ITEM)); + if (LogWorkItem != NULL) + { + ExInitializeWorkItem (LogWorkItem, + IopLogWorker, + LogWorkItem); + + ExQueueWorkItem (LogWorkItem, + DelayedWorkQueue); + + IopLogWorkerRunning = TRUE; + } + } + + KeReleaseSpinLock (&IopLogListLock, + Irql); + + DPRINT("IoWriteErrorLogEntry() done\n"); +} + +VOID +STDCALL +IopFreeApc(PKAPC Apc, + PKNORMAL_ROUTINE *NormalRoutine, + PVOID *NormalContext, + PVOID *SystemArgument1, + PVOID *SystemArgument2) +{ + /* Free the APC */ + ExFreePool(Apc); +} + +VOID +STDCALL +IopRaiseHardError(PKAPC Apc, + PKNORMAL_ROUTINE *NormalRoutine, + PVOID *NormalContext, + PVOID *SystemArgument1, + PVOID *SystemArgument2) +{ + PIRP Irp = (PIRP)NormalContext; + //PVPB Vpb = (PVPB)SystemArgument1; + //PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)SystemArgument2; + + /* FIXME: UNIMPLEMENTED */ + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); +} + +/* + * @implemented + */ +VOID +STDCALL IoRaiseHardError(PIRP Irp, - PVPB Vpb, - PDEVICE_OBJECT RealDeviceObject) + PVPB Vpb, + PDEVICE_OBJECT RealDeviceObject) { - UNIMPLEMENTED; -} - -BOOLEAN -IoIsTotalDeviceFailure(NTSTATUS Status) -{ - UNIMPLEMENTED; - return(FALSE); + PETHREAD Thread = (PETHREAD)&Irp->Tail.Overlay.Thread; + PKAPC ErrorApc; + + /* Don't do anything if hard errors are disabled on the thread */ + if (Thread->HardErrorsAreDisabled) + { + /* Complete the request */ + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + return; + } + + /* Setup an APC */ + ErrorApc = ExAllocatePoolWithTag(NonPagedPool, + sizeof(KAPC), + TAG('K', 'A', 'P', 'C')); + KeInitializeApc(ErrorApc, + &Thread->Tcb, + Irp->ApcEnvironment, + NULL, + (PKRUNDOWN_ROUTINE)IopFreeApc, + (PKNORMAL_ROUTINE)IopRaiseHardError, + KernelMode, + Irp); + + /* Queue an APC to deal with the error (see osr documentation) */ + KeInsertQueueApc(ErrorApc, Vpb, RealDeviceObject, 0); } /* * @unimplemented */ -BOOLEAN STDCALL +BOOLEAN +STDCALL IoRaiseInformationalHardError(NTSTATUS ErrorStatus, - PUNICODE_STRING String, - PKTHREAD Thread) + PUNICODE_STRING String, + PKTHREAD Thread) { - UNIMPLEMENTED; - return(FALSE); + UNIMPLEMENTED; + return(FALSE); } +/********************************************************************** + * NAME EXPORTED + * IoSetThreadHardErrorMode@4 + * + * ARGUMENTS + * HardErrorEnabled + * TRUE : enable hard errors processing; + * FALSE: do NOT process hard errors. + * + * RETURN VALUE + * Previous value for the current thread's hard errors + * processing policy. + * + * @implemented + */ +BOOLEAN +STDCALL +IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled) +{ + BOOLEAN PreviousHEM = (BOOLEAN)(NtCurrentTeb()->HardErrorDisabled); + + NtCurrentTeb()->HardErrorDisabled = ((TRUE == HardErrorEnabled) ? FALSE : TRUE); + + return((TRUE == PreviousHEM) ? FALSE : TRUE); +} /* EOF */ diff --git a/reactos/ntoskrnl/io/file.c b/reactos/ntoskrnl/io/file.c index f95a5fc9f39..67aeba53be3 100644 --- a/reactos/ntoskrnl/io/file.c +++ b/reactos/ntoskrnl/io/file.c @@ -1,9 +1,8 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/io/file.c - * PURPOSE: Graceful system shutdown if a bug is detected + * PURPOSE: I/O File Object & NT File Handle Access/Managment of Files. * * PROGRAMMERS: David Welch (welch@mcmail.com) */ @@ -14,115 +13,950 @@ #define NDEBUG #include - /* GLOBALS *******************************************************************/ -#define TAG_SYSB TAG('S', 'Y', 'S', 'B') +#define TAG_SYSB TAG('S', 'Y', 'S', 'B') +#define TAG_LOCK TAG('F','l','c','k') +#define TAG_FILE_NAME TAG('F', 'N', 'A', 'M') +extern GENERIC_MAPPING IopFileMapping; + +/* INTERNAL FUNCTIONS ********************************************************/ + +static +NTSTATUS +STDCALL +IopLockFileCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN PVOID Context) +{ + ExFreePool(Context); + return STATUS_SUCCESS; + // FIXME: Should I call IoFreeIrp and return STATUS_MORE_PROCESSING_REQUIRED? +} + +/* + * NAME INTERNAL + * IopCreateFile + * + * DESCRIPTION + * + * ARGUMENTS + * + * RETURN VALUE + * + * REVISIONS + */ +NTSTATUS +STDCALL +IopCreateFile(PVOID ObjectBody, + PVOID Parent, + PWSTR RemainingPath, + POBJECT_ATTRIBUTES ObjectAttributes) +{ + PDEVICE_OBJECT DeviceObject; + PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody; + POBJECT_TYPE ParentObjectType; + NTSTATUS Status; + + DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %S)\n", + ObjectBody, + Parent, + RemainingPath); + + if (NULL == Parent) + { + /* This is probably an attempt to create a meta fileobject (eg. for FAT) + for the cache manager, so return STATUS_SUCCESS */ + DPRINT("Parent object was NULL\n"); + return(STATUS_SUCCESS); + } + + ParentObjectType = BODY_TO_HEADER(Parent)->ObjectType; + + if (ParentObjectType != IoDeviceObjectType && + ParentObjectType != IoFileObjectType) + { + DPRINT("Parent [%wZ] is a %S which is neither a file type nor a device type ; remaining path = %S\n", + &BODY_TO_HEADER(Parent)->Name, + BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer, + RemainingPath); + return(STATUS_UNSUCCESSFUL); + } + + Status = ObReferenceObjectByPointer(Parent, + STANDARD_RIGHTS_REQUIRED, + ParentObjectType, + UserMode); + if (!NT_SUCCESS(Status)) + { + CPRINT("Failed to reference parent object %x\n", Parent); + return(Status); + } + + if (ParentObjectType == IoDeviceObjectType) + { + /* Parent is a devce object */ + DeviceObject = IoGetAttachedDevice((PDEVICE_OBJECT)Parent); + DPRINT("DeviceObject %x\n", DeviceObject); + + if (RemainingPath == NULL) + { + FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN; + FileObject->FileName.Buffer = 0; + FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0; + } + else + { + if ((DeviceObject->DeviceType != FILE_DEVICE_FILE_SYSTEM) + && (DeviceObject->DeviceType != FILE_DEVICE_DISK) + && (DeviceObject->DeviceType != FILE_DEVICE_CD_ROM) + && (DeviceObject->DeviceType != FILE_DEVICE_TAPE) + && (DeviceObject->DeviceType != FILE_DEVICE_NETWORK) + && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE) + && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT)) + { + CPRINT("Device was wrong type\n"); + return(STATUS_UNSUCCESSFUL); + } + + if (DeviceObject->DeviceType != FILE_DEVICE_NETWORK + && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE) + && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT)) + { + if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED)) + { + DPRINT("Mount the logical volume\n"); + Status = IoMountVolume(DeviceObject, FALSE); + DPRINT("Status %x\n", Status); + if (!NT_SUCCESS(Status)) + { + CPRINT("Failed to mount logical volume (Status %x)\n", + Status); + return(Status); + } + } + DeviceObject = DeviceObject->Vpb->DeviceObject; + DPRINT("FsDeviceObject %lx\n", DeviceObject); + } + RtlpCreateUnicodeString(&(FileObject->FileName), + RemainingPath, NonPagedPool); + } + } + else + { + /* Parent is a file object */ + if (RemainingPath == NULL) + { + CPRINT("Device is unnamed\n"); + return STATUS_UNSUCCESSFUL; + } + + DeviceObject = ((PFILE_OBJECT)Parent)->DeviceObject; + DPRINT("DeviceObject %x\n", DeviceObject); + + FileObject->RelatedFileObject = (PFILE_OBJECT)Parent; + + RtlpCreateUnicodeString(&(FileObject->FileName), + RemainingPath, NonPagedPool); + } + + DPRINT("FileObject->FileName %wZ\n", + &FileObject->FileName); + FileObject->DeviceObject = DeviceObject; + DPRINT("FileObject %x DeviceObject %x\n", + FileObject, + DeviceObject); + FileObject->Vpb = DeviceObject->Vpb; + FileObject->Type = IO_TYPE_FILE; + + return(STATUS_SUCCESS); +} + +VOID +STDCALL +IopDeleteFile(PVOID ObjectBody) +{ + PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody; + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + NTSTATUS Status; + KEVENT Event; + PDEVICE_OBJECT DeviceObject; + + DPRINT("IopDeleteFile()\n"); + + if (FileObject->DeviceObject) + { + /* Check if this is a direct open or not */ + if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) + { + DeviceObject = IoGetAttachedDevice(FileObject->DeviceObject); + } + else + { + DeviceObject = IoGetRelatedDeviceObject(FileObject); + } + + /* Clear and set up Events */ + KeClearEvent(&FileObject->Event); + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + + /* Allocate an IRP */ + Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); + + /* Set it up */ + Irp->UserEvent = &Event; + Irp->UserIosb = &Irp->IoStatus; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API; + + /* Set up Stack Pointer Data */ + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_CLOSE; + StackPtr->DeviceObject = DeviceObject; + StackPtr->FileObject = FileObject; + + /* Call the FS Driver */ + Status = IoCallDriver(DeviceObject, Irp); + + /* Wait for completion */ + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + } + + /* Clear the file name */ + if (FileObject->FileName.Buffer) + { + ExFreePool(FileObject->FileName.Buffer); + FileObject->FileName.Buffer = NULL; + } + + /* Free the completion context */ + if (FileObject->CompletionContext) + { + ObDereferenceObject(FileObject->CompletionContext->Port); + ExFreePool(FileObject->CompletionContext); + } + } +} + +static +NTSTATUS +IopSetDefaultSecurityDescriptor(SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR SecurityDescriptor, + PULONG BufferLength) +{ + ULONG_PTR Current; + ULONG SidSize; + ULONG SdSize; + NTSTATUS Status; + + DPRINT("IopSetDefaultSecurityDescriptor() called\n"); + + if (SecurityInformation == 0) + { + return STATUS_ACCESS_DENIED; + } + + SidSize = RtlLengthSid(SeWorldSid); + SdSize = sizeof(SECURITY_DESCRIPTOR) + (2 * SidSize); + + if (*BufferLength < SdSize) + { + *BufferLength = SdSize; + return STATUS_BUFFER_TOO_SMALL; + } + + *BufferLength = SdSize; + + Status = RtlCreateSecurityDescriptor(SecurityDescriptor, + SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + SecurityDescriptor->Control |= SE_SELF_RELATIVE; + Current = (ULONG_PTR)SecurityDescriptor + sizeof(SECURITY_DESCRIPTOR); + + if (SecurityInformation & OWNER_SECURITY_INFORMATION) + { + RtlCopyMemory((PVOID)Current, + SeWorldSid, + SidSize); + SecurityDescriptor->Owner = (PSID)((ULONG_PTR)Current - (ULONG_PTR)SecurityDescriptor); + Current += SidSize; + } + + if (SecurityInformation & GROUP_SECURITY_INFORMATION) + { + RtlCopyMemory((PVOID)Current, + SeWorldSid, + SidSize); + SecurityDescriptor->Group = (PSID)((ULONG_PTR)Current - (ULONG_PTR)SecurityDescriptor); + Current += SidSize; + } + + if (SecurityInformation & DACL_SECURITY_INFORMATION) + { + SecurityDescriptor->Control |= SE_DACL_PRESENT; + } + + if (SecurityInformation & SACL_SECURITY_INFORMATION) + { + SecurityDescriptor->Control |= SE_SACL_PRESENT; + } + + return STATUS_SUCCESS; +} + +NTSTATUS +STDCALL +IopSecurityFile(PVOID ObjectBody, + SECURITY_OPERATION_CODE OperationCode, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR SecurityDescriptor, + PULONG BufferLength) +{ + IO_STATUS_BLOCK IoStatusBlock; + PIO_STACK_LOCATION StackPtr; + PFILE_OBJECT FileObject; + PIRP Irp; + NTSTATUS Status; + + DPRINT("IopSecurityFile() called\n"); + + FileObject = (PFILE_OBJECT)ObjectBody; + + switch (OperationCode) + { + case SetSecurityDescriptor: + DPRINT("Set security descriptor\n"); + KeResetEvent(&FileObject->Event); + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_SET_SECURITY, + FileObject->DeviceObject, + NULL, + 0, + NULL, + &FileObject->Event, + &IoStatusBlock); + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->FileObject = FileObject; + + StackPtr->Parameters.SetSecurity.SecurityInformation = SecurityInformation; + StackPtr->Parameters.SetSecurity.SecurityDescriptor = SecurityDescriptor; + + Status = IoCallDriver(FileObject->DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = IoStatusBlock.Status; + } + + if (Status == STATUS_INVALID_DEVICE_REQUEST) + { + Status = STATUS_SUCCESS; + } + return Status; + + case QuerySecurityDescriptor: + DPRINT("Query security descriptor\n"); + KeResetEvent(&FileObject->Event); + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_QUERY_SECURITY, + FileObject->DeviceObject, + NULL, + 0, + NULL, + &FileObject->Event, + &IoStatusBlock); + + Irp->UserBuffer = SecurityDescriptor; + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->FileObject = FileObject; + + StackPtr->Parameters.QuerySecurity.SecurityInformation = SecurityInformation; + StackPtr->Parameters.QuerySecurity.Length = *BufferLength; + + Status = IoCallDriver(FileObject->DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = IoStatusBlock.Status; + } + + if (Status == STATUS_INVALID_DEVICE_REQUEST) + { + Status = IopSetDefaultSecurityDescriptor(SecurityInformation, + SecurityDescriptor, + BufferLength); + } + else + { + /* FIXME: Is this correct?? */ + *BufferLength = IoStatusBlock.Information; + } + return Status; + + case DeleteSecurityDescriptor: + DPRINT("Delete security descriptor\n"); + return STATUS_SUCCESS; + + case AssignSecurityDescriptor: + DPRINT("Assign security descriptor\n"); + return STATUS_SUCCESS; + } + + return STATUS_UNSUCCESSFUL; +} + +NTSTATUS +STDCALL +IopQueryNameFile(PVOID ObjectBody, + POBJECT_NAME_INFORMATION ObjectNameInfo, + ULONG Length, + PULONG ReturnLength) +{ + POBJECT_NAME_INFORMATION LocalInfo; + PFILE_NAME_INFORMATION FileNameInfo; + PFILE_OBJECT FileObject; + ULONG LocalReturnLength; + NTSTATUS Status; + + DPRINT ("IopQueryNameFile() called\n"); + + FileObject = (PFILE_OBJECT)ObjectBody; + + LocalInfo = ExAllocatePool (NonPagedPool, + sizeof(OBJECT_NAME_INFORMATION) + + MAX_PATH * sizeof(WCHAR)); + if (LocalInfo == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Status = ObQueryNameString (FileObject->DeviceObject->Vpb->RealDevice, + LocalInfo, + MAX_PATH * sizeof(WCHAR), + &LocalReturnLength); + if (!NT_SUCCESS (Status)) + { + ExFreePool (LocalInfo); + return Status; + } + DPRINT ("Device path: %wZ\n", &LocalInfo->Name); + + Status = RtlAppendUnicodeStringToString (&ObjectNameInfo->Name, + &LocalInfo->Name); + + ExFreePool (LocalInfo); + + FileNameInfo = ExAllocatePool (NonPagedPool, + MAX_PATH * sizeof(WCHAR) + sizeof(ULONG)); + if (FileNameInfo == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Status = IoQueryFileInformation (FileObject, + FileNameInformation, + MAX_PATH * sizeof(WCHAR) + sizeof(ULONG), + FileNameInfo, + NULL); + if (Status != STATUS_SUCCESS) + { + ExFreePool (FileNameInfo); + return Status; + } + + Status = RtlAppendUnicodeToString (&ObjectNameInfo->Name, + FileNameInfo->FileName); + + DPRINT ("Total path: %wZ\n", &ObjectNameInfo->Name); + + ExFreePool (FileNameInfo); + + return Status; +} + +VOID +STDCALL +IopCloseFile(PVOID ObjectBody, + ULONG HandleCount) +{ + PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody; + KEVENT Event; + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + NTSTATUS Status; + PDEVICE_OBJECT DeviceObject; + + DPRINT("IopCloseFile()\n"); + + if (HandleCount > 1 || FileObject->DeviceObject == NULL) return; + + /* Check if this is a direct open or not */ + if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) + { + DeviceObject = IoGetAttachedDevice(FileObject->DeviceObject); + } + else + { + DeviceObject = IoGetRelatedDeviceObject(FileObject); + } + + /* Clear and set up Events */ + KeClearEvent(&FileObject->Event); + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + + /* Allocate an IRP */ + Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); + + /* Set it up */ + Irp->UserEvent = &Event; + Irp->UserIosb = &Irp->IoStatus; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API; + + /* Set up Stack Pointer Data */ + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_CLEANUP; + StackPtr->FileObject = FileObject; + + /* Call the FS Driver */ + Status = IoCallDriver(DeviceObject, Irp); + + /* Wait for completion */ + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + } +} /* FUNCTIONS *****************************************************************/ /* + * @unimplemented + */ +NTSTATUS +STDCALL +IoCheckQuerySetFileInformation(IN FILE_INFORMATION_CLASS FileInformationClass, + IN ULONG Length, + IN BOOLEAN SetOperation) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoCheckQuotaBufferValidity(IN PFILE_QUOTA_INFORMATION QuotaBuffer, + IN ULONG QuotaLength, + OUT PULONG ErrorOffset) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * NAME EXPORTED + * IoCreateFile@56 + * + * DESCRIPTION + * Either causes a new file or directory to be created, or it + * opens an existing file, device, directory or volume, giving + * the caller a handle for the file object. This handle can be + * used by subsequent calls to manipulate data within the file + * or the file object's state of attributes. + * + * ARGUMENTS + * FileHandle (OUT) + * Points to a variable which receives the file handle + * on return; + * + * DesiredAccess + * Desired access to the file; + * + * ObjectAttributes + * Structure describing the file; + * + * IoStatusBlock (OUT) + * Receives information about the operation on return; + * + * AllocationSize [OPTIONAL] + * Initial size of the file in bytes; + * + * FileAttributes + * Attributes to create the file with; + * + * ShareAccess + * Type of shared access the caller would like to the + * file; + * + * CreateDisposition + * Specifies what to do, depending on whether the + * file already exists; + * + * CreateOptions + * Options for creating a new file; + * + * EaBuffer [OPTIONAL] + * Undocumented; + * + * EaLength + * Undocumented; + * + * CreateFileType + * Type of file (normal, named pipe, mailslot) to create; + * + * ExtraCreateParameters [OPTIONAL] + * Additional creation data for named pipe and mailsots; + * + * Options + * Undocumented. + * + * RETURN VALUE + * Status + * + * NOTE + * Prototype taken from Bo Branten's ntifs.h v15. + * Description taken from old NtCreateFile's which is + * now a wrapper of this call. + * + * REVISIONS + * * @implemented */ -NTSTATUS STDCALL -NtQueryInformationFile(HANDLE FileHandle, - PIO_STATUS_BLOCK IoStatusBlock, - PVOID FileInformation, - ULONG Length, - FILE_INFORMATION_CLASS FileInformationClass) +NTSTATUS +STDCALL +IoCreateFile(OUT PHANDLE FileHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PLARGE_INTEGER AllocationSize OPTIONAL, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN PVOID EaBuffer OPTIONAL, + IN ULONG EaLength, + IN CREATE_FILE_TYPE CreateFileType, + IN PVOID ExtraCreateParameters OPTIONAL, + IN ULONG Options) { - PFILE_OBJECT FileObject; - NTSTATUS Status; - PIRP Irp; + PFILE_OBJECT FileObject = NULL; PDEVICE_OBJECT DeviceObject; - PIO_STACK_LOCATION StackPtr; - PVOID SystemBuffer; - KPROCESSOR_MODE PreviousMode; + PIRP Irp; + PIO_STACK_LOCATION StackLoc; + IO_SECURITY_CONTEXT SecurityContext; + KPROCESSOR_MODE AccessMode; + HANDLE LocalHandle; + IO_STATUS_BLOCK LocalIoStatusBlock; + LARGE_INTEGER SafeAllocationSize; + PVOID SystemEaBuffer = NULL; + NTSTATUS Status = STATUS_SUCCESS; - ASSERT(IoStatusBlock != NULL); - ASSERT(FileInformation != NULL); + DPRINT("IoCreateFile(FileHandle %x, DesiredAccess %x, " + "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", + FileHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes->ObjectName->Buffer); - DPRINT("NtQueryInformationFile(Handle %x StatBlk %x FileInfo %x Length %d " - "Class %d)\n", FileHandle, IoStatusBlock, FileInformation, - Length, FileInformationClass); + ASSERT_IRQL(PASSIVE_LEVEL); - PreviousMode = ExGetPreviousMode(); + if (IoStatusBlock == NULL || FileHandle == NULL) + return STATUS_ACCESS_VIOLATION; - Status = ObReferenceObjectByHandle(FileHandle, - 0, /* FIXME - access depends on the information class! */ - IoFileObjectType, - PreviousMode, - (PVOID *)&FileObject, - NULL); + LocalHandle = 0; + + if(Options & IO_NO_PARAMETER_CHECKING) + AccessMode = KernelMode; + else + AccessMode = ExGetPreviousMode(); + + if(AccessMode != KernelMode) + { + _SEH_TRY + { + ProbeForWrite(FileHandle, + sizeof(HANDLE), + sizeof(ULONG)); + ProbeForWrite(IoStatusBlock, + sizeof(IO_STATUS_BLOCK), + sizeof(ULONG)); + if(AllocationSize != NULL) + { + ProbeForRead(AllocationSize, + sizeof(LARGE_INTEGER), + sizeof(ULONG)); + SafeAllocationSize = *AllocationSize; + } + else + SafeAllocationSize.QuadPart = 0; + + if(EaBuffer != NULL && EaLength > 0) + { + ProbeForRead(EaBuffer, + EaLength, + sizeof(ULONG)); + + /* marshal EaBuffer */ + SystemEaBuffer = ExAllocatePool(NonPagedPool, + EaLength); + if(SystemEaBuffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + _SEH_LEAVE; + } + + RtlCopyMemory(SystemEaBuffer, + EaBuffer, + EaLength); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } + } + else + { + if(AllocationSize != NULL) + SafeAllocationSize = *AllocationSize; + else + SafeAllocationSize.QuadPart = 0; + + if(EaBuffer != NULL && EaLength > 0) + { + SystemEaBuffer = EaBuffer; + } + } + + if(Options & IO_CHECK_CREATE_PARAMETERS) + { + DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n"); + } + + if (CreateDisposition == FILE_OPEN || + CreateDisposition == FILE_OPEN_IF) + { + Status = ObOpenObjectByName(ObjectAttributes, + NULL, + NULL, + AccessMode, + DesiredAccess, + NULL, + &LocalHandle); + if (NT_SUCCESS(Status)) + { + Status = ObReferenceObjectByHandle(LocalHandle, + DesiredAccess, + NULL, + AccessMode, + (PVOID*)&DeviceObject, + NULL); + ZwClose(LocalHandle); + if (!NT_SUCCESS(Status)) + { + return Status; + } + if (BODY_TO_HEADER(DeviceObject)->ObjectType != IoDeviceObjectType) + { + ObDereferenceObject (DeviceObject); + return STATUS_OBJECT_NAME_COLLISION; + } + FileObject = IoCreateStreamFileObject(NULL, DeviceObject); + ObDereferenceObject (DeviceObject); + } + } + + + if (FileObject == NULL) + { + Status = ObCreateObject(AccessMode, + IoFileObjectType, + ObjectAttributes, + AccessMode, + NULL, + sizeof(FILE_OBJECT), + 0, + 0, + (PVOID*)&FileObject); + if (!NT_SUCCESS(Status)) + { + DPRINT("ObCreateObject() failed! (Status %lx)\n", Status); + return Status; + } + } + RtlMapGenericMask(&DesiredAccess, + BODY_TO_HEADER(FileObject)->ObjectType->Mapping); + + Status = ObInsertObject ((PVOID)FileObject, + NULL, + DesiredAccess, + 0, + NULL, + &LocalHandle); if (!NT_SUCCESS(Status)) { - return(Status); + DPRINT("ObInsertObject() failed! (Status %lx)\n", Status); + ObDereferenceObject (FileObject); + return Status; } + + if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT) + { + FileObject->Flags |= (FO_ALERTABLE_IO | FO_SYNCHRONOUS_IO); + } + if (CreateOptions & FILE_SYNCHRONOUS_IO_NONALERT) + { + FileObject->Flags |= FO_SYNCHRONOUS_IO; + } + + if (CreateOptions & FILE_NO_INTERMEDIATE_BUFFERING) + FileObject->Flags |= FO_NO_INTERMEDIATE_BUFFERING; + + SecurityContext.SecurityQos = NULL; /* ?? */ + SecurityContext.AccessState = NULL; /* ?? */ + SecurityContext.DesiredAccess = DesiredAccess; + SecurityContext.FullCreateOptions = 0; /* ?? */ + + KeInitializeEvent(&FileObject->Lock, SynchronizationEvent, TRUE); + KeInitializeEvent(&FileObject->Event, NotificationEvent, FALSE); + DPRINT("FileObject %x\n", FileObject); - - DeviceObject = FileObject->DeviceObject; - - Irp = IoAllocateIrp(DeviceObject->StackSize, - TRUE); + DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject); + /* + * Create a new IRP to hand to + * the FS driver: this may fail + * due to resource shortage. + */ + Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, FALSE); if (Irp == NULL) { - ObDereferenceObject(FileObject); - return STATUS_INSUFFICIENT_RESOURCES; + ZwClose(LocalHandle); + return STATUS_UNSUCCESSFUL; } - - SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, - Length, - TAG_SYSB); - if (SystemBuffer == NULL) - { - IoFreeIrp(Irp); - ObDereferenceObject(FileObject); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - /* Trigger FileObject/Event dereferencing */ + + //trigger FileObject/Event dereferencing Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = PreviousMode; - Irp->AssociatedIrp.SystemBuffer = SystemBuffer; - Irp->UserIosb = IoStatusBlock; - Irp->UserEvent = &FileObject->Event; + Irp->RequestorMode = AccessMode; + Irp->UserIosb = &LocalIoStatusBlock; + Irp->AssociatedIrp.SystemBuffer = SystemEaBuffer; + Irp->Tail.Overlay.AuxiliaryBuffer = NULL; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - KeResetEvent( &FileObject->Event ); + Irp->UserEvent = &FileObject->Event; + Irp->Overlay.AllocationSize = SafeAllocationSize; - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = FileObject; - - StackPtr->Parameters.QueryFile.FileInformationClass = - FileInformationClass; - StackPtr->Parameters.QueryFile.Length = Length; - - Status = IoCallDriver(FileObject->DeviceObject, - Irp); - if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) + /* + * Get the stack location for the new + * IRP and prepare it. + */ + StackLoc = IoGetNextIrpStackLocation(Irp); + StackLoc->MinorFunction = 0; + StackLoc->Flags = (UCHAR)Options; + StackLoc->Control = 0; + StackLoc->DeviceObject = FileObject->DeviceObject; + StackLoc->FileObject = FileObject; + + switch (CreateFileType) { - KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - Status = IoStatusBlock->Status; + default: + case CreateFileTypeNone: + StackLoc->MajorFunction = IRP_MJ_CREATE; + StackLoc->Parameters.Create.SecurityContext = &SecurityContext; + StackLoc->Parameters.Create.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS); + StackLoc->Parameters.Create.Options |= (CreateDisposition << 24); + StackLoc->Parameters.Create.FileAttributes = (USHORT)FileAttributes; + StackLoc->Parameters.Create.ShareAccess = (USHORT)ShareAccess; + StackLoc->Parameters.Create.EaLength = SystemEaBuffer != NULL ? EaLength : 0; + break; + + case CreateFileTypeNamedPipe: + StackLoc->MajorFunction = IRP_MJ_CREATE_NAMED_PIPE; + StackLoc->Parameters.CreatePipe.SecurityContext = &SecurityContext; + StackLoc->Parameters.CreatePipe.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS); + StackLoc->Parameters.CreatePipe.Options |= (CreateDisposition << 24); + StackLoc->Parameters.CreatePipe.ShareAccess = (USHORT)ShareAccess; + StackLoc->Parameters.CreatePipe.Parameters = ExtraCreateParameters; + break; + + case CreateFileTypeMailslot: + StackLoc->MajorFunction = IRP_MJ_CREATE_MAILSLOT; + StackLoc->Parameters.CreateMailslot.SecurityContext = &SecurityContext; + StackLoc->Parameters.CreateMailslot.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS); + StackLoc->Parameters.CreateMailslot.Options |= (CreateDisposition << 24); + StackLoc->Parameters.CreateMailslot.ShareAccess = (USHORT)ShareAccess; + StackLoc->Parameters.CreateMailslot.Parameters = ExtraCreateParameters; + break; } - if (NT_SUCCESS(Status)) - { - DPRINT("Information %lu\n", IoStatusBlock->Information); - MmSafeCopyToUser(FileInformation, - SystemBuffer, - IoStatusBlock->Information); - } + /* + * Now call the driver and + * possibly wait if it can + * not complete the request + * immediately. + */ + Status = IofCallDriver(FileObject->DeviceObject, Irp ); + DPRINT("Status :%x\n", Status); + + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + AccessMode, + FALSE, + NULL); + Status = LocalIoStatusBlock.Status; + } + if (!NT_SUCCESS(Status)) + { + DPRINT("Failing create request with status %x\n", Status); + FileObject->DeviceObject = NULL; + FileObject->Vpb = NULL; - ExFreePool(SystemBuffer); + ZwClose(LocalHandle); + } + else + { + _SEH_TRY + { + *FileHandle = LocalHandle; + *IoStatusBlock = LocalIoStatusBlock; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + + /* cleanup EABuffer if captured */ + if(AccessMode != KernelMode && SystemEaBuffer != NULL) + { + ExFreePool(SystemEaBuffer); + } + + ASSERT_IRQL(PASSIVE_LEVEL); + + DPRINT("Finished IoCreateFile() (*FileHandle) %x\n", (*FileHandle)); return Status; } @@ -132,20 +966,1604 @@ NtQueryInformationFile(HANDLE FileHandle, */ NTSTATUS STDCALL -NtQueryQuotaInformationFile( - IN HANDLE FileHandle, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID Buffer, - IN ULONG Length, - IN BOOLEAN ReturnSingleEntry, - IN PVOID SidList OPTIONAL, - IN ULONG SidListLength, - IN PSID StartSid OPTIONAL, - IN BOOLEAN RestartScan - ) +IoCreateFileSpecifyDeviceObjectHint(OUT PHANDLE FileHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PLARGE_INTEGER AllocationSize OPTIONAL, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG Disposition, + IN ULONG CreateOptions, + IN PVOID EaBuffer OPTIONAL, + IN ULONG EaLength, + IN CREATE_FILE_TYPE CreateFileType, + IN PVOID ExtraCreateParameters OPTIONAL, + IN ULONG Options, + IN PVOID DeviceObject) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * NAME EXPORTED + * IoCreateStreamFileObject@8 + * + * DESCRIPTION + * + * ARGUMENTS + * FileObject + * ? + * + * DeviceObject + * ? + * + * RETURN VALUE + * + * NOTE + * + * REVISIONS + * + * @implemented + */ +PFILE_OBJECT +STDCALL +IoCreateStreamFileObject(PFILE_OBJECT FileObject, + PDEVICE_OBJECT DeviceObject) +{ + PFILE_OBJECT CreatedFileObject; + NTSTATUS Status; + + DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n", + FileObject, DeviceObject); + + ASSERT_IRQL(PASSIVE_LEVEL); + + Status = ObCreateObject(KernelMode, + IoFileObjectType, + NULL, + KernelMode, + NULL, + sizeof(FILE_OBJECT), + 0, + 0, + (PVOID*)&CreatedFileObject); + if (!NT_SUCCESS(Status)) + { + DPRINT("Could not create FileObject\n"); + return (NULL); + } + + if (FileObject != NULL) + { + DeviceObject = FileObject->DeviceObject; + } + DeviceObject = IoGetAttachedDevice(DeviceObject); + + DPRINT("DeviceObject %x\n", DeviceObject); + + if (DeviceObject->Vpb && + DeviceObject->Vpb->DeviceObject) + { + CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject; + } + else + { + CreatedFileObject->DeviceObject = DeviceObject; + } + CreatedFileObject->Vpb = DeviceObject->Vpb; + CreatedFileObject->Type = IO_TYPE_FILE; + CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN; + + // shouldn't we initialize the lock event, and several other things here too? + KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE); + KeInitializeEvent(&CreatedFileObject->Lock, SynchronizationEvent, TRUE); + + return CreatedFileObject; +} + +/* + * @unimplemented + */ +PFILE_OBJECT +STDCALL +IoCreateStreamFileObjectEx(IN PFILE_OBJECT FileObject OPTIONAL, + IN PDEVICE_OBJECT DeviceObject OPTIONAL, + OUT PHANDLE FileObjectHandle OPTIONAL) +{ + UNIMPLEMENTED; + return 0; +} +/* + * @unimplemented + */ +PFILE_OBJECT +STDCALL +IoCreateStreamFileObjectLite(IN PFILE_OBJECT FileObject OPTIONAL, + IN PDEVICE_OBJECT DeviceObject OPTIONAL) +{ + UNIMPLEMENTED; + return 0; +} + +/* + * @implemented + */ +PGENERIC_MAPPING +STDCALL +IoGetFileObjectGenericMapping(VOID) +{ + return &IopFileMapping; +} + +/* + * @implemented + */ +BOOLEAN +STDCALL +IoIsFileOriginRemote(IN PFILE_OBJECT FileObject) +{ + /* Return the flag status */ + return (FileObject->Flags & FO_REMOTE_ORIGIN); +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoQueryFileDosDeviceName(IN PFILE_OBJECT FileObject, + OUT POBJECT_NAME_INFORMATION *ObjectNameInformation) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +IoQueryFileInformation(IN PFILE_OBJECT FileObject, + IN FILE_INFORMATION_CLASS FileInformationClass, + IN ULONG Length, + OUT PVOID FileInformation, + OUT PULONG ReturnedLength) +{ + IO_STATUS_BLOCK IoStatusBlock; + PIRP Irp; + PDEVICE_OBJECT DeviceObject; + PIO_STACK_LOCATION StackPtr; + BOOLEAN LocalEvent = FALSE; + KEVENT Event; + NTSTATUS Status; + + ASSERT(FileInformation != NULL); + + Status = ObReferenceObjectByPointer(FileObject, + FILE_READ_ATTRIBUTES, + IoFileObjectType, + KernelMode); + if (!NT_SUCCESS(Status)) return(Status); + + DPRINT("FileObject %x\n", FileObject); + + /* Get the Device Object */ + DeviceObject = IoGetRelatedDeviceObject(FileObject); + + /* Check if we should use Sync IO or not */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) + { + /* Use File Object event */ + KeClearEvent(&FileObject->Event); + } + else + { + /* Use local event */ + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + LocalEvent = TRUE; + } + + /* Allocate the IRP */ + Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); + + /* Set the IRP */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->RequestorMode = KernelMode; + Irp->AssociatedIrp.SystemBuffer = FileInformation; + Irp->UserIosb = &IoStatusBlock; + Irp->UserEvent = (LocalEvent) ? &Event : NULL; + Irp->Flags = (LocalEvent) ? IRP_SYNCHRONOUS_API : 0; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + + /* Set the Stack Data */ + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION; + StackPtr->FileObject = FileObject; + + /* Set Parameters */ + StackPtr->Parameters.QueryFile.FileInformationClass = FileInformationClass; + StackPtr->Parameters.QueryFile.Length = Length; + + /* Call the Driver */ + Status = IoCallDriver(FileObject->DeviceObject, Irp); + + if (Status == STATUS_PENDING) + { + if (LocalEvent) + { + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = IoStatusBlock.Status; + } + else + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + KernelMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = FileObject->FinalStatus; + } + } + + + /* Return the Length and Status. ReturnedLength is NOT optional */ + *ReturnedLength = IoStatusBlock.Information; + return Status; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoSetFileOrigin(IN PFILE_OBJECT FileObject, + IN BOOLEAN Remote) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/** + * @name NtCancelIoFile + * + * Cancel all pending I/O operations in the current thread for specified + * file object. + * + * @param FileHandle + * Handle to file object to cancel requests for. No specific + * access rights are needed. + * @param IoStatusBlock + * Pointer to status block which is filled with final completition + * status on successful return. + * + * @return Status. + * + * @implemented + */ +NTSTATUS +STDCALL +NtCancelIoFile(IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock) +{ + NTSTATUS Status; + PFILE_OBJECT FileObject; + PETHREAD Thread; + PLIST_ENTRY IrpEntry; + PIRP Irp; + KIRQL OldIrql; + BOOLEAN OurIrpsInList = FALSE; + LARGE_INTEGER Interval; + + if ((ULONG_PTR)IoStatusBlock >= MmUserProbeAddress && + KeGetPreviousMode() == UserMode) + return STATUS_ACCESS_VIOLATION; + + Status = ObReferenceObjectByHandle(FileHandle, 0, IoFileObjectType, + KeGetPreviousMode(), (PVOID*)&FileObject, + NULL); + if (!NT_SUCCESS(Status)) + return Status; + + /* IRP cancellations are synchronized at APC_LEVEL. */ + OldIrql = KfRaiseIrql(APC_LEVEL); + + /* + * Walk the list of active IRPs and cancel the ones that belong to + * our file object. + */ + + Thread = PsGetCurrentThread(); + for (IrpEntry = Thread->IrpList.Flink; + IrpEntry != &Thread->IrpList; + IrpEntry = IrpEntry->Flink) + { + Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); + if (Irp->Tail.Overlay.OriginalFileObject == FileObject) + { + IoCancelIrp(Irp); + /* Don't break here, we want to cancel all IRPs for the file object. */ + OurIrpsInList = TRUE; + } + } + + KfLowerIrql(OldIrql); + + while (OurIrpsInList) + { + OurIrpsInList = FALSE; + + /* Wait a short while and then look if all our IRPs were completed. */ + Interval.QuadPart = -1000000; /* 100 milliseconds */ + KeDelayExecutionThread(KernelMode, FALSE, &Interval); + + OldIrql = KfRaiseIrql(APC_LEVEL); + + /* + * Look in the list if all IRPs for the specified file object + * are completed (or cancelled). If someone sends a new IRP + * for our file object while we're here we can happily loop + * forever. + */ + + for (IrpEntry = Thread->IrpList.Flink; + IrpEntry != &Thread->IrpList; + IrpEntry = IrpEntry->Flink) + { + Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); + if (Irp->Tail.Overlay.OriginalFileObject == FileObject) + { + OurIrpsInList = TRUE; + break; + } + } + + KfLowerIrql(OldIrql); + } + + _SEH_TRY + { + IoStatusBlock->Status = STATUS_SUCCESS; + IoStatusBlock->Information = 0; + Status = STATUS_SUCCESS; + } + _SEH_HANDLE + { + Status = STATUS_UNSUCCESSFUL; + } + _SEH_END; + + ObDereferenceObject(FileObject); + + return Status; +} + +/* + * NAME EXPORTED + * NtCreateFile@44 + * + * DESCRIPTION + * Entry point to call IoCreateFile with + * default parameters. + * + * ARGUMENTS + * See IoCreateFile. + * + * RETURN VALUE + * See IoCreateFile. + * + * REVISIONS + * 2000-03-25 (ea) + * Code originally in NtCreateFile moved in IoCreateFile. + * + * @implemented + */ +NTSTATUS +STDCALL +NtCreateFile(PHANDLE FileHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + PIO_STATUS_BLOCK IoStatusBlock, + PLARGE_INTEGER AllocateSize, + ULONG FileAttributes, + ULONG ShareAccess, + ULONG CreateDisposition, + ULONG CreateOptions, + PVOID EaBuffer, + ULONG EaLength) +{ + /* Call the I/O Function */ + return IoCreateFile(FileHandle, + DesiredAccess, + ObjectAttributes, + IoStatusBlock, + AllocateSize, + FileAttributes, + ShareAccess, + CreateDisposition, + CreateOptions, + EaBuffer, + EaLength, + CreateFileTypeNone, + NULL, + 0); +} + +NTSTATUS +STDCALL +NtCreateMailslotFile(OUT PHANDLE FileHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN ULONG CreateOptions, + IN ULONG MailslotQuota, + IN ULONG MaxMessageSize, + IN PLARGE_INTEGER TimeOut) +{ + MAILSLOT_CREATE_PARAMETERS Buffer; + + DPRINT("NtCreateMailslotFile(FileHandle %x, DesiredAccess %x, " + "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", + FileHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes->ObjectName->Buffer); + + ASSERT_IRQL(PASSIVE_LEVEL); + + if (TimeOut != NULL) + { + Buffer.ReadTimeout.QuadPart = TimeOut->QuadPart; + Buffer.TimeoutSpecified = TRUE; + } + else + { + Buffer.TimeoutSpecified = FALSE; + } + Buffer.MailslotQuota = MailslotQuota; + Buffer.MaximumMessageSize = MaxMessageSize; + + return IoCreateFile(FileHandle, + DesiredAccess, + ObjectAttributes, + IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_CREATE, + CreateOptions, + NULL, + 0, + CreateFileTypeMailslot, + (PVOID)&Buffer, + 0); +} + +NTSTATUS +STDCALL +NtCreateNamedPipeFile(PHANDLE FileHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG ShareAccess, + ULONG CreateDisposition, + ULONG CreateOptions, + ULONG NamedPipeType, + ULONG ReadMode, + ULONG CompletionMode, + ULONG MaximumInstances, + ULONG InboundQuota, + ULONG OutboundQuota, + PLARGE_INTEGER DefaultTimeout) +{ + NAMED_PIPE_CREATE_PARAMETERS Buffer; + + DPRINT("NtCreateNamedPipeFile(FileHandle %x, DesiredAccess %x, " + "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", + FileHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes->ObjectName->Buffer); + + ASSERT_IRQL(PASSIVE_LEVEL); + + if (DefaultTimeout != NULL) + { + Buffer.DefaultTimeout.QuadPart = DefaultTimeout->QuadPart; + Buffer.TimeoutSpecified = TRUE; + } + else + { + Buffer.TimeoutSpecified = FALSE; + } + Buffer.NamedPipeType = NamedPipeType; + Buffer.ReadMode = ReadMode; + Buffer.CompletionMode = CompletionMode; + Buffer.MaximumInstances = MaximumInstances; + Buffer.InboundQuota = InboundQuota; + Buffer.OutboundQuota = OutboundQuota; + + return IoCreateFile(FileHandle, + DesiredAccess, + ObjectAttributes, + IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + ShareAccess, + CreateDisposition, + CreateOptions, + NULL, + 0, + CreateFileTypeNamedPipe, + (PVOID)&Buffer, + 0); +} + +/* + * NAME EXPORTED + * NtDeleteFile@4 + * + * DESCRIPTION + * + * ARGUMENTS + * ObjectAttributes + * ? + * + * RETURN VALUE + * + * REVISIONS + * + * @unimplemented + */ +NTSTATUS +STDCALL +NtDeleteFile(IN POBJECT_ATTRIBUTES ObjectAttributes) +{ + UNIMPLEMENTED; + return(STATUS_NOT_IMPLEMENTED); +} + +NTSTATUS +STDCALL +NtFlushWriteBuffer(VOID) +{ + KeFlushWriteBuffer(); + return STATUS_SUCCESS; +} + +/* + * FUNCTION: Flushes cached file data to disk + * ARGUMENTS: + * FileHandle = Points to the file + * IoStatusBlock = Caller must supply storage to receive the result of + * the flush buffers operation. The information field is + * set to number of bytes flushed to disk. + * RETURNS: Status + * REMARKS: This function maps to the win32 FlushFileBuffers + */ +NTSTATUS +STDCALL +NtFlushBuffersFile(IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock) +{ + PFILE_OBJECT FileObject = NULL; + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + NTSTATUS Status; + PDEVICE_OBJECT DeviceObject; + KEVENT Event; + BOOLEAN LocalEvent = FALSE; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + + /* Get the File Object */ + Status = ObReferenceObjectByHandle(FileHandle, + FILE_WRITE_DATA, + NULL, + PreviousMode, + (PVOID*)&FileObject, + NULL); + if (Status != STATUS_SUCCESS) return(Status); + + /* Check if this is a direct open or not */ + if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) + { + DeviceObject = IoGetAttachedDevice(FileObject->DeviceObject); + } + else + { + DeviceObject = IoGetRelatedDeviceObject(FileObject); + } + + /* Check if we should use Sync IO or not */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) + { + /* Use File Object event */ + KeClearEvent(&FileObject->Event); + } + else + { + /* Use local event */ + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + LocalEvent = TRUE; + } + + /* Allocate the IRP */ + if (!(Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE))) + { + ObDereferenceObject(FileObject); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Set up the IRP */ + Irp->Flags = (LocalEvent) ? IRP_SYNCHRONOUS_API : 0; + Irp->RequestorMode = PreviousMode; + Irp->UserIosb = IoStatusBlock; + Irp->UserEvent = (LocalEvent) ? &Event : NULL; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + Irp->Tail.Overlay.OriginalFileObject = FileObject; + + /* Set up Stack Data */ + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_FLUSH_BUFFERS; + StackPtr->FileObject = FileObject; + + /* Call the Driver */ + Status = IoCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + if (LocalEvent) + { + KeWaitForSingleObject(&Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = IoStatusBlock->Status; + } + else + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = FileObject->FinalStatus; + } + } + + /* Return the Status */ + return Status; +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +NtNotifyChangeDirectoryFile(IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID Buffer, + IN ULONG BufferSize, + IN ULONG CompletionFilter, + IN BOOLEAN WatchTree) +{ + PIRP Irp; + PDEVICE_OBJECT DeviceObject; + PFILE_OBJECT FileObject; + PIO_STACK_LOCATION IoStack; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; + + DPRINT("NtNotifyChangeDirectoryFile()\n"); + + PAGED_CODE(); + + PreviousMode = ExGetPreviousMode(); + + if(PreviousMode != KernelMode) + { + _SEH_TRY + { + ProbeForWrite(IoStatusBlock, + sizeof(IO_STATUS_BLOCK), + sizeof(ULONG)); + if(BufferSize != 0) + { + ProbeForWrite(Buffer, + BufferSize, + sizeof(ULONG)); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } + } + + Status = ObReferenceObjectByHandle(FileHandle, + FILE_LIST_DIRECTORY, + IoFileObjectType, + PreviousMode, + (PVOID *)&FileObject, + NULL); + if (Status != STATUS_SUCCESS) return(Status); + + + DeviceObject = FileObject->DeviceObject; + + + Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); + if (Irp==NULL) + { + ObDereferenceObject(FileObject); + return STATUS_UNSUCCESSFUL; + } + + if (Event == NULL) + { + Event = &FileObject->Event; + } + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->RequestorMode = PreviousMode; + Irp->UserIosb = IoStatusBlock; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + Irp->UserEvent = Event; + KeResetEvent( Event ); + Irp->UserBuffer = Buffer; + Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; + Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; + + IoStack = IoGetNextIrpStackLocation(Irp); + + IoStack->MajorFunction = IRP_MJ_DIRECTORY_CONTROL; + IoStack->MinorFunction = IRP_MN_NOTIFY_CHANGE_DIRECTORY; + IoStack->Flags = 0; + IoStack->Control = 0; + IoStack->DeviceObject = DeviceObject; + IoStack->FileObject = FileObject; + + if (WatchTree) + { + IoStack->Flags = SL_WATCH_TREE; + } + + IoStack->Parameters.NotifyDirectory.CompletionFilter = CompletionFilter; + IoStack->Parameters.NotifyDirectory.Length = BufferSize; + + Status = IoCallDriver(FileObject->DeviceObject,Irp); + + /* FIXME: Should we wait here or not for synchronously opened files? */ + + return Status; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +NtLockFile(IN HANDLE FileHandle, + IN HANDLE EventHandle OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PLARGE_INTEGER ByteOffset, + IN PLARGE_INTEGER Length, + IN PULONG Key, + IN BOOLEAN FailImmediatedly, + IN BOOLEAN ExclusiveLock + ) +{ + PFILE_OBJECT FileObject = NULL; + PLARGE_INTEGER LocalLength = NULL; + PKEVENT Event = NULL; + PIRP Irp = NULL; + PIO_STACK_LOCATION StackPtr; + PDEVICE_OBJECT DeviceObject; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status; + + // FIXME: instead of this, use SEH when available? + if (!Length || !ByteOffset) + { + Status = STATUS_INVALID_PARAMETER; + goto fail; + } + + PreviousMode = ExGetPreviousMode(); + + Status = ObReferenceObjectByHandle(FileHandle, + 0, + IoFileObjectType, + PreviousMode, + (PVOID*)&FileObject, + NULL); + if (!NT_SUCCESS(Status)) + { + goto fail; + } + + DeviceObject = IoGetRelatedDeviceObject(FileObject); + + Irp = IoAllocateIrp(DeviceObject->StackSize, + TRUE); + if (Irp == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto fail; + } + + if (EventHandle != NULL && !FailImmediatedly) + { + Status = ObReferenceObjectByHandle(EventHandle, + SYNCHRONIZE, + ExEventObjectType, + PreviousMode, + (PVOID*)&Event, + NULL); + if (!NT_SUCCESS(Status)) + { + goto fail; + } + } + else + { + Event = &FileObject->Event; + KeResetEvent(Event); + } + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + + Irp->RequestorMode = PreviousMode; + Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; + Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; + + Irp->UserEvent = Event; + Irp->UserIosb = IoStatusBlock; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_LOCK_CONTROL; + StackPtr->MinorFunction = IRP_MN_LOCK; + StackPtr->FileObject = FileObject; + + if (ExclusiveLock) + StackPtr->Flags |= SL_EXCLUSIVE_LOCK; + + if (FailImmediatedly) + StackPtr->Flags |= SL_FAIL_IMMEDIATELY; + + LocalLength = ExAllocatePoolWithTag(NonPagedPool, + sizeof(LARGE_INTEGER), + TAG_LOCK); + if (!LocalLength) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto fail; + } + + *LocalLength = *Length; + + StackPtr->Parameters.LockControl.Length = LocalLength; + StackPtr->Parameters.LockControl.ByteOffset = *ByteOffset; + StackPtr->Parameters.LockControl.Key = Key ? *Key : 0; + + IoSetCompletionRoutine(Irp, + IopLockFileCompletionRoutine, + LocalLength, + TRUE, + TRUE, + TRUE); + + /* Can't touch FileObject after IoCallDriver since it might be freed */ + Status = IofCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + Status = KeWaitForSingleObject(Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + + if (Status != STATUS_WAIT_0) + { + DPRINT1("NtLockFile -> KeWaitForSingleObject failed!\n"); + /* + * FIXME: Should do some special processing here if alertable wait + * was interupted by user apc or a thread alert (STATUS_ALERTED, STATUS_USER_APC) + */ + return Status; /* Set status to something else? */ + } + + Status = IoStatusBlock->Status; + } + + return Status; + +fail:; + if (LocalLength) + ExFreePool(LocalLength); + + if (Irp) + IoFreeIrp(Irp); + + if (Event) + ObDereferenceObject(Event); + + if (FileObject) + ObDereferenceObject(FileObject); + + return Status; +} + +/* + * NAME EXPORTED + * NtOpenFile@24 + * + * DESCRIPTION + * Opens an existing file (simpler than NtCreateFile). + * + * ARGUMENTS + * FileHandle (OUT) + * Variable that receives the file handle on return; + * + * DesiredAccess + * Access desired by the caller to the file; + * + * ObjectAttributes + * Structue describing the file to be opened; + * + * IoStatusBlock (OUT) + * Receives details about the result of the + * operation; + * + * ShareAccess + * Type of shared access the caller requires; + * + * OpenOptions + * Options for the file open. + * + * RETURN VALUE + * Status. + * + * NOTE + * Undocumented. + * + * @implemented + */ +NTSTATUS +STDCALL +NtOpenFile(PHANDLE FileHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG ShareAccess, + ULONG OpenOptions) +{ + /* Call the I/O Function */ + return IoCreateFile(FileHandle, + DesiredAccess, + ObjectAttributes, + IoStatusBlock, + NULL, + 0, + ShareAccess, + FILE_OPEN, + OpenOptions, + NULL, + 0, + CreateFileTypeNone, + NULL, + 0); +} + +NTSTATUS +STDCALL +NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, + OUT PFILE_BASIC_INFORMATION FileInformation) +{ + IO_STATUS_BLOCK IoStatusBlock; + HANDLE FileHandle; + NTSTATUS Status; + + /* Open the file */ + Status = ZwOpenFile (&FileHandle, + SYNCHRONIZE | FILE_READ_ATTRIBUTES, + ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS (Status)) + { + DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status); + return Status; + } + + /* Get file attributes */ + Status = ZwQueryInformationFile (FileHandle, + &IoStatusBlock, + FileInformation, + sizeof(FILE_BASIC_INFORMATION), + FileBasicInformation); + ZwClose (FileHandle); + if (!NT_SUCCESS (Status)) + { + DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status); + } + + return Status; +} + +/* + * @implemented + * + * FUNCTION: Queries a directory file. + * ARGUMENTS: + * FileHandle = Handle to a directory file + * EventHandle = Handle to the event signaled on completion + * ApcRoutine = Asynchroneous procedure callback, called on completion + * ApcContext = Argument to the apc. + * IoStatusBlock = Caller supplies storage for extended status information. + * FileInformation = Caller supplies storage for the resulting information. + * + * FileNameInformation FILE_NAMES_INFORMATION + * FileDirectoryInformation FILE_DIRECTORY_INFORMATION + * FileFullDirectoryInformation FILE_FULL_DIRECTORY_INFORMATION + * FileBothDirectoryInformation FILE_BOTH_DIR_INFORMATION + * + * Length = Size of the storage supplied + * FileInformationClass = Indicates the type of information requested. + * ReturnSingleEntry = Specify true if caller only requests the first + * directory found. + * FileName = Initial directory name to query, that may contain wild + * cards. + * RestartScan = Number of times the action should be repeated + * RETURNS: Status [ STATUS_SUCCESS, STATUS_ACCESS_DENIED, STATUS_INSUFFICIENT_RESOURCES, + * STATUS_INVALID_PARAMETER, STATUS_INVALID_DEVICE_REQUEST, STATUS_BUFFER_OVERFLOW, + * STATUS_INVALID_INFO_CLASS, STATUS_NO_SUCH_FILE, STATUS_NO_MORE_FILES ] + */ +NTSTATUS +STDCALL +NtQueryDirectoryFile(IN HANDLE FileHandle, + IN HANDLE PEvent OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID FileInformation, + IN ULONG Length, + IN FILE_INFORMATION_CLASS FileInformationClass, + IN BOOLEAN ReturnSingleEntry, + IN PUNICODE_STRING FileName OPTIONAL, + IN BOOLEAN RestartScan + ) + +{ + PIRP Irp; + PDEVICE_OBJECT DeviceObject; + PFILE_OBJECT FileObject; + PIO_STACK_LOCATION IoStack; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; + + DPRINT("NtQueryDirectoryFile()\n"); + + PAGED_CODE(); + + PreviousMode = ExGetPreviousMode(); + + if(PreviousMode != KernelMode) + { + _SEH_TRY + { + ProbeForWrite(IoStatusBlock, + sizeof(IO_STATUS_BLOCK), + sizeof(ULONG)); + ProbeForWrite(FileInformation, + Length, + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } + } + + Status = ObReferenceObjectByHandle(FileHandle, + FILE_LIST_DIRECTORY, + IoFileObjectType, + PreviousMode, + (PVOID *)&FileObject, + NULL); + + if (Status != STATUS_SUCCESS) + { + return(Status); + } + DeviceObject = FileObject->DeviceObject; + + Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); + if (Irp==NULL) + { + ObDereferenceObject(FileObject); + return STATUS_UNSUCCESSFUL; + } + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->RequestorMode = PreviousMode; + Irp->UserIosb = IoStatusBlock; + Irp->UserEvent = &FileObject->Event; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + KeResetEvent( &FileObject->Event ); + Irp->UserBuffer=FileInformation; + Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; + Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; + + IoStack = IoGetNextIrpStackLocation(Irp); + + IoStack->MajorFunction = IRP_MJ_DIRECTORY_CONTROL; + IoStack->MinorFunction = IRP_MN_QUERY_DIRECTORY; + IoStack->Flags = 0; + IoStack->Control = 0; + IoStack->DeviceObject = DeviceObject; + IoStack->FileObject = FileObject; + + if (RestartScan) + { + IoStack->Flags = IoStack->Flags | SL_RESTART_SCAN; + } + if (ReturnSingleEntry) + { + IoStack->Flags = IoStack->Flags | SL_RETURN_SINGLE_ENTRY; + } + if (((PFILE_DIRECTORY_INFORMATION)FileInformation)->FileIndex != 0) + { + IoStack->Flags = IoStack->Flags | SL_INDEX_SPECIFIED; + } + + IoStack->Parameters.QueryDirectory.FileInformationClass = + FileInformationClass; + IoStack->Parameters.QueryDirectory.FileName = FileName; + IoStack->Parameters.QueryDirectory.Length = Length; + + Status = IoCallDriver(FileObject->DeviceObject,Irp); + if (Status==STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = IoStatusBlock->Status; + } + + return(Status); +} + +/* + * @unimplemented + */ +NTSTATUS STDCALL +NtQueryEaFile(IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID Buffer, + IN ULONG Length, + IN BOOLEAN ReturnSingleEntry, + IN PVOID EaList OPTIONAL, + IN ULONG EaListLength, + IN PULONG EaIndex OPTIONAL, + IN BOOLEAN RestartScan) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +STDCALL +NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, + OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation) +{ + IO_STATUS_BLOCK IoStatusBlock; + HANDLE FileHandle; + NTSTATUS Status; + + /* Open the file */ + Status = ZwOpenFile (&FileHandle, + SYNCHRONIZE | FILE_READ_ATTRIBUTES, + ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS (Status)) + { + DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status); + return Status; + } + + /* Get file attributes */ + Status = ZwQueryInformationFile (FileHandle, + &IoStatusBlock, + FileInformation, + sizeof(FILE_NETWORK_OPEN_INFORMATION), + FileNetworkOpenInformation); + ZwClose (FileHandle); + if (!NT_SUCCESS (Status)) + { + DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status); + } + + return Status; +} + +/* + * @implemented + */ +NTSTATUS STDCALL +NtQueryInformationFile(HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass) +{ + OBJECT_HANDLE_INFORMATION HandleInformation; + PFILE_OBJECT FileObject; + NTSTATUS Status; + PIRP Irp; + PDEVICE_OBJECT DeviceObject; + PIO_STACK_LOCATION StackPtr; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + KEVENT Event; + BOOLEAN LocalEvent = FALSE; + BOOLEAN Failed = FALSE; + + ASSERT(IoStatusBlock != NULL); + ASSERT(FileInformation != NULL); + + DPRINT("NtQueryInformationFile(Handle %x StatBlk %x FileInfo %x Length %d " + "Class %d)\n", FileHandle, IoStatusBlock, FileInformation, + Length, FileInformationClass); + + /* Reference the Handle */ + Status = ObReferenceObjectByHandle(FileHandle, + 0, + IoFileObjectType, + PreviousMode, + (PVOID *)&FileObject, + &HandleInformation); + if (!NT_SUCCESS(Status)) return Status; + + /* Check information class specific access rights */ + switch (FileInformationClass) + { + case FileBasicInformation: + if (!(HandleInformation.GrantedAccess & FILE_READ_ATTRIBUTES)) + Failed = TRUE; + break; + + case FilePositionInformation: + if (!(HandleInformation.GrantedAccess & (FILE_READ_DATA | FILE_WRITE_DATA)) || + !(FileObject->Flags & FO_SYNCHRONOUS_IO)) + Failed = TRUE; + break; + + case FileAlignmentInformation: + if (!(FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING)) + Failed = TRUE; + break; + + default: + break; + } + + if (Failed) + { + DPRINT1("NtQueryInformationFile() returns STATUS_ACCESS_DENIED!\n"); + ObDereferenceObject(FileObject); + return STATUS_ACCESS_DENIED; + } + + DPRINT("FileObject %x\n", FileObject); + + /* Check if this is a direct open or not */ + if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) + { + DeviceObject = IoGetAttachedDevice(FileObject->DeviceObject); + } + else + { + DeviceObject = IoGetRelatedDeviceObject(FileObject); + } + + /* Check if we should use Sync IO or not */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) + { + /* Use File Object event */ + KeClearEvent(&FileObject->Event); + } + else + { + /* Use local event */ + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + LocalEvent = TRUE; + } + + /* Allocate the IRP */ + if (!(Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE))) + { + ObDereferenceObject(FileObject); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Allocate the System Buffer */ + if (!(Irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, + Length, + TAG_SYSB))) + { + IoFreeIrp(Irp); + ObDereferenceObject(FileObject); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Set up the IRP */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->RequestorMode = PreviousMode; + Irp->UserIosb = IoStatusBlock; + Irp->UserEvent = (LocalEvent) ? &Event : NULL; + Irp->UserBuffer = FileInformation; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + Irp->Flags = IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER | IRP_INPUT_OPERATION; + Irp->Flags |= (LocalEvent) ? IRP_SYNCHRONOUS_API : 0; + + /* Set up Stack Data */ + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION; + StackPtr->FileObject = FileObject; + + /* Set the Parameters */ + StackPtr->Parameters.QueryFile.FileInformationClass = FileInformationClass; + StackPtr->Parameters.QueryFile.Length = Length; + + /* Call the Driver */ + Status = IoCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + if (LocalEvent) + { + KeWaitForSingleObject(&Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = IoStatusBlock->Status; + } + else + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = FileObject->FinalStatus; + } + } + + /* Return the Status */ + return Status; +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +NtQueryQuotaInformationFile(IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID Buffer, + IN ULONG Length, + IN BOOLEAN ReturnSingleEntry, + IN PVOID SidList OPTIONAL, + IN ULONG SidListLength, + IN PSID StartSid OPTIONAL, + IN BOOLEAN RestartScan) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * NAME EXPORTED + * NtReadFile + * + * DESCRIPTION + * + * ARGUMENTS + * + * RETURN VALUE + * + * REVISIONS + * + * @implemented + */ +NTSTATUS +STDCALL +NtReadFile(IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset OPTIONAL, /* NOT optional for asynch. operations! */ + IN PULONG Key OPTIONAL) +{ + NTSTATUS Status; + PFILE_OBJECT FileObject; + PIRP Irp = NULL; + PIO_STACK_LOCATION StackPtr; + KPROCESSOR_MODE PreviousMode; + PKEVENT EventObject = NULL; + + DPRINT("NtReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, " + "IoStatusBlock %x)\n", FileHandle, Buffer, Length, ByteOffset, + IoStatusBlock); + + if (IoStatusBlock == NULL) + return STATUS_ACCESS_VIOLATION; + + PreviousMode = ExGetPreviousMode(); + + Status = ObReferenceObjectByHandle(FileHandle, + FILE_READ_DATA, + IoFileObjectType, + PreviousMode, + (PVOID*)&FileObject, + NULL); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + if (ByteOffset == NULL || + (ByteOffset->u.LowPart == FILE_USE_FILE_POINTER_POSITION && + ByteOffset->u.HighPart == 0xffffffff)) + { + /* a valid ByteOffset is required if asynch. op. */ + if (!(FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + DPRINT1("NtReadFile: missing ByteOffset for asynch. op\n"); + ObDereferenceObject(FileObject); + return STATUS_INVALID_PARAMETER; + } + + ByteOffset = &FileObject->CurrentByteOffset; + } + + if (Event != NULL) + { + Status = ObReferenceObjectByHandle(Event, + SYNCHRONIZE, + ExEventObjectType, + PreviousMode, + (PVOID*)&EventObject, + NULL); + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject(FileObject); + return Status; + } + + KeClearEvent(EventObject); + } + + _SEH_TRY + { + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, + FileObject->DeviceObject, + Buffer, + Length, + ByteOffset, + EventObject, + IoStatusBlock); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if (!NT_SUCCESS(Status) || Irp == NULL) + { + if (Event) + { + ObDereferenceObject(&EventObject); + } + ObDereferenceObject(FileObject); + if (Irp) + { + IoFreeIrp(Irp); + } + return NT_SUCCESS(Status) ? STATUS_INSUFFICIENT_RESOURCES : Status; + } + + KeClearEvent(&FileObject->Event); + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + + Irp->RequestorMode = PreviousMode; + + Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; + Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->FileObject = FileObject; + StackPtr->Parameters.Read.Key = Key ? *Key : 0; + + Status = IoCallDriver(FileObject->DeviceObject, Irp); + if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + Status = KeWaitForSingleObject(&FileObject->Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + if (Status != STATUS_WAIT_0) + { + /* Wait failed. */ + return Status; + } + + Status = IoStatusBlock->Status; + } + + return Status; +} + +/* + * NAME EXPORTED + * NtReadFileScatter + * + * DESCRIPTION + * + * ARGUMENTS + * + * RETURN VALUE + * + * REVISIONS + */ +NTSTATUS +STDCALL +NtReadFileScatter(IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, + IN PVOID UserApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK UserIoStatusBlock, + IN FILE_SEGMENT_ELEMENT BufferDescription [], + IN ULONG BufferLength, + IN PLARGE_INTEGER ByteOffset, + IN PULONG Key OPTIONAL) +{ + UNIMPLEMENTED; + return(STATUS_NOT_IMPLEMENTED); } /* @@ -153,485 +2571,505 @@ NtQueryQuotaInformationFile( */ NTSTATUS STDCALL -NtSetQuotaInformationFile( - HANDLE FileHandle, - PIO_STATUS_BLOCK IoStatusBlock, - PFILE_USER_QUOTA_INFORMATION Buffer, - ULONG BufferLength) +NtSetEaFile(IN HANDLE FileHandle, + IN PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID EaBuffer, + IN ULONG EaBufferSize) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoCheckQuerySetFileInformation( - IN FILE_INFORMATION_CLASS FileInformationClass, - IN ULONG Length, - IN BOOLEAN SetOperation - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoCheckQuerySetVolumeInformation( - IN FS_INFORMATION_CLASS FsInformationClass, - IN ULONG Length, - IN BOOLEAN SetOperation - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoCheckQuotaBufferValidity( - IN PFILE_QUOTA_INFORMATION QuotaBuffer, - IN ULONG QuotaLength, - OUT PULONG ErrorOffset - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoCreateFileSpecifyDeviceObjectHint( - OUT PHANDLE FileHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN PLARGE_INTEGER AllocationSize OPTIONAL, - IN ULONG FileAttributes, - IN ULONG ShareAccess, - IN ULONG Disposition, - IN ULONG CreateOptions, - IN PVOID EaBuffer OPTIONAL, - IN ULONG EaLength, - IN CREATE_FILE_TYPE CreateFileType, - IN PVOID ExtraCreateParameters OPTIONAL, - IN ULONG Options, - IN PVOID DeviceObject - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -PFILE_OBJECT -STDCALL -IoCreateStreamFileObjectEx( - IN PFILE_OBJECT FileObject OPTIONAL, - IN PDEVICE_OBJECT DeviceObject OPTIONAL, - OUT PHANDLE FileObjectHandle OPTIONAL - ) -{ - UNIMPLEMENTED; - return 0; -} -/* - * @unimplemented - */ -PFILE_OBJECT -STDCALL -IoCreateStreamFileObjectLite( - IN PFILE_OBJECT FileObject OPTIONAL, - IN PDEVICE_OBJECT DeviceObject OPTIONAL - ) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * @unimplemented - */ -BOOLEAN -STDCALL -IoIsFileOriginRemote( - IN PFILE_OBJECT FileObject - ) -{ - UNIMPLEMENTED; - return FALSE; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoQueryFileDosDeviceName( - IN PFILE_OBJECT FileObject, - OUT POBJECT_NAME_INFORMATION *ObjectNameInformation - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @implemented - */ -NTSTATUS STDCALL -IoQueryFileInformation(IN PFILE_OBJECT FileObject, - IN FILE_INFORMATION_CLASS FileInformationClass, - IN ULONG Length, - OUT PVOID FileInformation, - OUT PULONG ReturnedLength) -{ - IO_STATUS_BLOCK IoStatusBlock; - PIRP Irp; - PDEVICE_OBJECT DeviceObject; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - - ASSERT(FileInformation != NULL); - - Status = ObReferenceObjectByPointer(FileObject, - FILE_READ_ATTRIBUTES, - IoFileObjectType, - KernelMode); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - DPRINT("FileObject %x\n", FileObject); - - DeviceObject = FileObject->DeviceObject; - - Irp = IoAllocateIrp(DeviceObject->StackSize, - TRUE); - if (Irp == NULL) - { - ObDereferenceObject(FileObject); - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = KernelMode; - Irp->AssociatedIrp.SystemBuffer = FileInformation; - Irp->UserIosb = &IoStatusBlock; - Irp->UserEvent = &FileObject->Event; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - KeResetEvent( &FileObject->Event ); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = FileObject; - - StackPtr->Parameters.QueryFile.FileInformationClass = - FileInformationClass; - StackPtr->Parameters.QueryFile.Length = Length; - - Status = IoCallDriver(FileObject->DeviceObject, - Irp); - if (Status==STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - KernelMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - Status = IoStatusBlock.Status; - } - - if (ReturnedLength != NULL) - { - *ReturnedLength = IoStatusBlock.Information; - } - - - return Status; -} - - /* * @implemented */ NTSTATUS STDCALL NtSetInformationFile(HANDLE FileHandle, - PIO_STATUS_BLOCK IoStatusBlock, - PVOID FileInformation, - ULONG Length, - FILE_INFORMATION_CLASS FileInformationClass) + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass) { - PIO_STACK_LOCATION StackPtr; - PFILE_OBJECT FileObject; - PDEVICE_OBJECT DeviceObject; - PIRP Irp; - NTSTATUS Status; - PVOID SystemBuffer; - KPROCESSOR_MODE PreviousMode; - - ASSERT(IoStatusBlock != NULL); - ASSERT(FileInformation != NULL); - - DPRINT("NtSetInformationFile(Handle %x StatBlk %x FileInfo %x Length %d " - "Class %d)\n", FileHandle, IoStatusBlock, FileInformation, - Length, FileInformationClass); + OBJECT_HANDLE_INFORMATION HandleInformation; + PIO_STACK_LOCATION StackPtr; + PFILE_OBJECT FileObject; + PDEVICE_OBJECT DeviceObject; + PIRP Irp; + NTSTATUS Status; + PVOID SystemBuffer; + KPROCESSOR_MODE PreviousMode; + BOOLEAN Failed = FALSE; - PreviousMode = ExGetPreviousMode(); + ASSERT(IoStatusBlock != NULL); + ASSERT(FileInformation != NULL); - /* Get the file object from the file handle */ - Status = ObReferenceObjectByHandle(FileHandle, - 0, /* FIXME - depends on the information class */ - IoFileObjectType, - PreviousMode, - (PVOID *)&FileObject, - NULL); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - DPRINT("FileObject %x\n", FileObject); + DPRINT("NtSetInformationFile(Handle %x StatBlk %x FileInfo %x Length %d " + "Class %d)\n", FileHandle, IoStatusBlock, FileInformation, + Length, FileInformationClass); - /* io completion port? */ - if (FileInformationClass == FileCompletionInformation) - { - PKQUEUE Queue; + PreviousMode = ExGetPreviousMode(); - if (Length < sizeof(FILE_COMPLETION_INFORMATION)) + /* Get the file object from the file handle */ + Status = ObReferenceObjectByHandle(FileHandle, + 0, + IoFileObjectType, + PreviousMode, + (PVOID *)&FileObject, + &HandleInformation); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Check information class specific access rights */ + switch (FileInformationClass) + { + case FileBasicInformation: + if (!(HandleInformation.GrantedAccess & FILE_WRITE_ATTRIBUTES)) + Failed = TRUE; + break; + + case FileDispositionInformation: + if (!(HandleInformation.GrantedAccess & DELETE)) + Failed = TRUE; + break; + + case FilePositionInformation: + if (!(HandleInformation.GrantedAccess & (FILE_READ_DATA | FILE_WRITE_DATA)) || + !(FileObject->Flags & FO_SYNCHRONOUS_IO)) + Failed = TRUE; + break; + + case FileEndOfFileInformation: + if (!(HandleInformation.GrantedAccess & FILE_WRITE_DATA)) + Failed = TRUE; + break; + + default: + break; + } + + if (Failed) + { + DPRINT1("NtSetInformationFile() returns STATUS_ACCESS_DENIED!\n"); + ObDereferenceObject(FileObject); + return STATUS_ACCESS_DENIED; + } + + DPRINT("FileObject %x\n", FileObject); + + /* io completion port? */ + if (FileInformationClass == FileCompletionInformation) + { + PKQUEUE Queue; + + if (Length < sizeof(FILE_COMPLETION_INFORMATION)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + else + { + Status = ObReferenceObjectByHandle(((PFILE_COMPLETION_INFORMATION)FileInformation)->IoCompletionHandle, + IO_COMPLETION_MODIFY_STATE,//??? + ExIoCompletionType, + PreviousMode, + (PVOID*)&Queue, + NULL); + if (NT_SUCCESS(Status)) { - Status = STATUS_INFO_LENGTH_MISMATCH; + /* FIXME: maybe use lookaside list */ + FileObject->CompletionContext = ExAllocatePool(NonPagedPool, sizeof(IO_COMPLETION_CONTEXT)); + FileObject->CompletionContext->Key = ((PFILE_COMPLETION_INFORMATION)FileInformation)->CompletionKey; + FileObject->CompletionContext->Port = Queue; + + ObDereferenceObject(Queue); } - else - { - Status = ObReferenceObjectByHandle(((PFILE_COMPLETION_INFORMATION)FileInformation)->IoCompletionHandle, - IO_COMPLETION_MODIFY_STATE,//??? - ExIoCompletionType, - PreviousMode, - (PVOID*)&Queue, - NULL); - if (NT_SUCCESS(Status)) - { - /* FIXME: maybe use lookaside list */ - FileObject->CompletionContext = ExAllocatePool(NonPagedPool, sizeof(IO_COMPLETION_CONTEXT)); - FileObject->CompletionContext->Key = ((PFILE_COMPLETION_INFORMATION)FileInformation)->CompletionKey; - FileObject->CompletionContext->Port = Queue; + } - ObDereferenceObject(Queue); - } - } + ObDereferenceObject(FileObject); + return Status; + } - ObDereferenceObject(FileObject); - return Status; - } + DeviceObject = FileObject->DeviceObject; - DeviceObject = FileObject->DeviceObject; - - Irp = IoAllocateIrp(DeviceObject->StackSize, - TRUE); - if (Irp == NULL) - { - ObDereferenceObject(FileObject); - return STATUS_INSUFFICIENT_RESOURCES; - } - - SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, - Length, - TAG_SYSB); - if (SystemBuffer == NULL) - { - IoFreeIrp(Irp); - ObDereferenceObject(FileObject); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - MmSafeCopyFromUser(SystemBuffer, - FileInformation, - Length); - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = PreviousMode; - Irp->AssociatedIrp.SystemBuffer = SystemBuffer; - Irp->UserIosb = IoStatusBlock; - Irp->UserEvent = &FileObject->Event; - KeResetEvent( &FileObject->Event ); - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = FileObject; - - StackPtr->Parameters.SetFile.FileInformationClass = - FileInformationClass; - StackPtr->Parameters.SetFile.Length = Length; - - /* - * Pass the IRP to the FSD (and wait for - * it if required) - */ - DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject); - Status = IoCallDriver(FileObject->DeviceObject, - Irp); - if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - Status = IoStatusBlock->Status; - } + Irp = IoAllocateIrp(DeviceObject->StackSize, + TRUE); + if (Irp == NULL) + { + ObDereferenceObject(FileObject); + return STATUS_INSUFFICIENT_RESOURCES; + } - ExFreePool(SystemBuffer); + SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, + Length, + TAG_SYSB); + if (SystemBuffer == NULL) + { + IoFreeIrp(Irp); + ObDereferenceObject(FileObject); + return STATUS_INSUFFICIENT_RESOURCES; + } - return Status; + MmSafeCopyFromUser(SystemBuffer, + FileInformation, + Length); + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->RequestorMode = PreviousMode; + Irp->AssociatedIrp.SystemBuffer = SystemBuffer; + Irp->UserIosb = IoStatusBlock; + Irp->UserEvent = &FileObject->Event; + KeResetEvent(&FileObject->Event); + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION; + StackPtr->MinorFunction = 0; + StackPtr->Flags = 0; + StackPtr->Control = 0; + StackPtr->DeviceObject = DeviceObject; + StackPtr->FileObject = FileObject; + + StackPtr->Parameters.SetFile.FileInformationClass = + FileInformationClass; + StackPtr->Parameters.SetFile.Length = Length; + + /* + * Pass the IRP to the FSD (and wait for + * it if required) + */ + DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject); + Status = IoCallDriver(FileObject->DeviceObject, + Irp); + if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = IoStatusBlock->Status; + } + + ExFreePool(SystemBuffer); + + return Status; } +/* + * @unimplemented + */ +NTSTATUS +STDCALL +NtSetQuotaInformationFile(HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PFILE_USER_QUOTA_INFORMATION Buffer, + ULONG BufferLength) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} /* * @unimplemented */ NTSTATUS STDCALL -IoSetFileOrigin( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Remote - ) +NtUnlockFile(IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PLARGE_INTEGER ByteOffset, + IN PLARGE_INTEGER Length, + OUT PULONG Key OPTIONAL) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS STDCALL -NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, - OUT PFILE_BASIC_INFORMATION FileInformation) -{ - IO_STATUS_BLOCK IoStatusBlock; - HANDLE FileHandle; + PFILE_OBJECT FileObject = NULL; + PLARGE_INTEGER LocalLength = NULL; + PIRP Irp = NULL; + PIO_STACK_LOCATION StackPtr; + PDEVICE_OBJECT DeviceObject; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; - /* Open the file */ - Status = ZwOpenFile (&FileHandle, - SYNCHRONIZE | FILE_READ_ATTRIBUTES, - ObjectAttributes, - &IoStatusBlock, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS (Status)) - { - DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status); - return Status; - } + // FIXME: instead of this, use SEH when available + if (!Length || !ByteOffset) + { + Status = STATUS_INVALID_PARAMETER; + goto fail; + } - /* Get file attributes */ - Status = ZwQueryInformationFile (FileHandle, - &IoStatusBlock, - FileInformation, - sizeof(FILE_BASIC_INFORMATION), - FileBasicInformation); - ZwClose (FileHandle); - if (!NT_SUCCESS (Status)) - { - DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status); - } + PreviousMode = ExGetPreviousMode(); + + /* + * BUGBUG: ObReferenceObjectByHandle fails if DesiredAccess=0 and mode=UserMode + * It should ONLY fail if we desire an access that conflict with granted access! + */ + Status = ObReferenceObjectByHandle(FileHandle, + 0, //FILE_READ_DATA,//BUGBUG: have to use something...but shouldn't have to! + IoFileObjectType, + PreviousMode, + (PVOID*)&FileObject, + NULL); + if (!NT_SUCCESS(Status)) + { + goto fail; + } + + DeviceObject = IoGetRelatedDeviceObject(FileObject); + + Irp = IoAllocateIrp(DeviceObject->StackSize, + TRUE); + if (Irp == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto fail; + } + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->RequestorMode = PreviousMode; + Irp->UserIosb = IoStatusBlock; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_LOCK_CONTROL; + StackPtr->MinorFunction = IRP_MN_UNLOCK_SINGLE; + StackPtr->DeviceObject = DeviceObject; + StackPtr->FileObject = FileObject; + + LocalLength = ExAllocatePoolWithTag(NonPagedPool, + sizeof(LARGE_INTEGER), + TAG_LOCK); + if (!LocalLength) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto fail; + } + + *LocalLength = *Length; + + StackPtr->Parameters.LockControl.Length = LocalLength; + StackPtr->Parameters.LockControl.ByteOffset = *ByteOffset; + StackPtr->Parameters.LockControl.Key = Key ? *Key : 0; + + /* Allways synchronous */ + Status = IofCallDriver(DeviceObject, Irp); + + ExFreePool(LocalLength); + + return Status; + +fail:; + if (LocalLength) + ExFreePool(LocalLength); + + if (Irp) + IoFreeIrp(Irp); + + if (FileObject) + ObDereferenceObject(FileObject); return Status; } - -NTSTATUS STDCALL -NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, - OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation) +/* + * NAME EXPORTED + * NtWriteFile + * + * DESCRIPTION + * + * ARGUMENTS + * + * RETURN VALUE + * + * REVISIONS + * + * @implemented + */ +NTSTATUS +STDCALL +NtWriteFile (IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset OPTIONAL, /* NOT optional for asynch. operations! */ + IN PULONG Key OPTIONAL) { - IO_STATUS_BLOCK IoStatusBlock; - HANDLE FileHandle; + OBJECT_HANDLE_INFORMATION HandleInformation; NTSTATUS Status; + PFILE_OBJECT FileObject; + PIRP Irp = NULL; + PIO_STACK_LOCATION StackPtr; + KPROCESSOR_MODE PreviousMode; + PKEVENT EventObject = NULL; + LARGE_INTEGER Offset; - /* Open the file */ - Status = ZwOpenFile (&FileHandle, - SYNCHRONIZE | FILE_READ_ATTRIBUTES, - ObjectAttributes, - &IoStatusBlock, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS (Status)) + DPRINT("NtWriteFile(FileHandle %x Buffer %x Length %x ByteOffset %x, " + "IoStatusBlock %x)\n", FileHandle, Buffer, Length, ByteOffset, + IoStatusBlock); + + if (IoStatusBlock == NULL) + return STATUS_ACCESS_VIOLATION; + + PreviousMode = ExGetPreviousMode(); + + Status = ObReferenceObjectByHandle(FileHandle, + 0, + IoFileObjectType, + PreviousMode, + (PVOID*)&FileObject, + &HandleInformation); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Must have FILE_WRITE_DATA | FILE_APPEND_DATA access */ + if (!(HandleInformation.GrantedAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA))) + { + DPRINT1("Invalid access rights\n"); + ObDereferenceObject(FileObject); + return STATUS_ACCESS_DENIED; + } + + if (HandleInformation.GrantedAccess & FILE_WRITE_DATA) + { + if (ByteOffset == NULL) { - DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status); + /* a valid ByteOffset is required if asynch. op. */ + if (!(FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + DPRINT1("NtWriteFile: missing ByteOffset for asynch. op\n"); + ObDereferenceObject(FileObject); + return STATUS_INVALID_PARAMETER; + } + + ByteOffset = &FileObject->CurrentByteOffset; + } + } + else if (HandleInformation.GrantedAccess & FILE_APPEND_DATA) + { + /* a valid ByteOffset is required if asynch. op. */ + if (!(FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + DPRINT1("NtWriteFile: missing ByteOffset for asynch. op\n"); + ObDereferenceObject(FileObject); + return STATUS_INVALID_PARAMETER; + } + + Offset.u.LowPart = FILE_WRITE_TO_END_OF_FILE; + Offset.u.HighPart = 0xffffffff; + ByteOffset = &Offset; + } + + if (Event != NULL) + { + Status = ObReferenceObjectByHandle(Event, + SYNCHRONIZE, + ExEventObjectType, + PreviousMode, + (PVOID*)&EventObject, + NULL); + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject(FileObject); return Status; } - /* Get file attributes */ - Status = ZwQueryInformationFile (FileHandle, - &IoStatusBlock, - FileInformation, - sizeof(FILE_NETWORK_OPEN_INFORMATION), - FileNetworkOpenInformation); - ZwClose (FileHandle); - if (!NT_SUCCESS (Status)) + KeClearEvent(EventObject); + } + + _SEH_TRY + { + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE, + FileObject->DeviceObject, + Buffer, + Length, + ByteOffset, + EventObject, + IoStatusBlock); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if (!NT_SUCCESS(Status) || Irp == NULL) + { + if (Event) + { + ObDereferenceObject(&EventObject); + } + ObDereferenceObject(FileObject); + if (Irp) + { + IoFreeIrp(Irp); + } + return NT_SUCCESS(Status) ? STATUS_INSUFFICIENT_RESOURCES : Status; + } + + KeClearEvent(&FileObject->Event); + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + + Irp->RequestorMode = PreviousMode; + + Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; + Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->FileObject = FileObject; + StackPtr->Parameters.Write.Key = Key ? *Key : 0; + + Status = IoCallDriver(FileObject->DeviceObject, Irp); + if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) + { + Status = KeWaitForSingleObject(&FileObject->Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + if (Status != STATUS_WAIT_0) { - DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status); + /* Wait failed. */ + return Status; } + Status = IoStatusBlock->Status; + } + return Status; } - /* - * @unimplemented + * NAME EXPORTED + * NtWriteFileGather + * + * DESCRIPTION + * + * ARGUMENTS + * + * RETURN VALUE + * + * REVISIONS */ -NTSTATUS STDCALL -NtQueryEaFile(IN HANDLE FileHandle, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID Buffer, - IN ULONG Length, - IN BOOLEAN ReturnSingleEntry, - IN PVOID EaList OPTIONAL, - IN ULONG EaListLength, - IN PULONG EaIndex OPTIONAL, - IN BOOLEAN RestartScan) +NTSTATUS +STDCALL +NtWriteFileGather(IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, + IN PVOID UserApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK UserIoStatusBlock, + IN FILE_SEGMENT_ELEMENT BufferDescription [], + IN ULONG BufferLength, + IN PLARGE_INTEGER ByteOffset, + IN PULONG Key OPTIONAL) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return(STATUS_NOT_IMPLEMENTED); } - - -/* - * @unimplemented - */ -NTSTATUS STDCALL -NtSetEaFile(IN HANDLE FileHandle, - IN PIO_STATUS_BLOCK IoStatusBlock, - IN PVOID EaBuffer, - IN ULONG EaBufferSize) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - /* EOF */ diff --git a/reactos/ntoskrnl/io/flush.c b/reactos/ntoskrnl/io/flush.c deleted file mode 100644 index d944745b3f4..00000000000 --- a/reactos/ntoskrnl/io/flush.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/flush.c - * PURPOSE: Flushing file buffer - * - * PROGRAMMERS: David Welch (welch@cwcom.net) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - - -NTSTATUS -STDCALL -NtFlushWriteBuffer(VOID) -{ - KeFlushWriteBuffer(); - return STATUS_SUCCESS; -} - -NTSTATUS -STDCALL -NtFlushBuffersFile ( - IN HANDLE FileHandle, - OUT PIO_STATUS_BLOCK IoStatusBlock - ) -/* - * FUNCTION: Flushes cached file data to disk - * ARGUMENTS: - * FileHandle = Points to the file - * IoStatusBlock = Caller must supply storage to receive the result of - * the flush buffers operation. The information field is - * set to number of bytes flushed to disk. - * RETURNS: Status - * REMARKS: This function maps to the win32 FlushFileBuffers - */ -{ - PFILE_OBJECT FileObject = NULL; - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - KPROCESSOR_MODE PreviousMode; - - PreviousMode = ExGetPreviousMode(); - - Status = ObReferenceObjectByHandle(FileHandle, - FILE_WRITE_DATA, - NULL, - PreviousMode, - (PVOID*)&FileObject, - NULL); - if (Status != STATUS_SUCCESS) - { - return(Status); - } - KeResetEvent( &FileObject->Event ); - Irp = IoBuildSynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS, - FileObject->DeviceObject, - NULL, - 0, - NULL, - &FileObject->Event, - IoStatusBlock); - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - - Irp->RequestorMode = PreviousMode; - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - - Status = IoCallDriver(FileObject->DeviceObject,Irp); - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - Status = IoStatusBlock->Status; - } - - return(Status); -} diff --git a/reactos/ntoskrnl/io/ioctrl.c b/reactos/ntoskrnl/io/ioctrl.c deleted file mode 100644 index f404ae16296..00000000000 --- a/reactos/ntoskrnl/io/ioctrl.c +++ /dev/null @@ -1,133 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/ioctrl.c - * PURPOSE: Device IO control - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - * Eric Kohl (ekohl@rz-online.de) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -NTSTATUS STDCALL -NtDeviceIoControlFile (IN HANDLE DeviceHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, - IN PVOID UserApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN ULONG IoControlCode, - IN PVOID InputBuffer, - IN ULONG InputBufferLength OPTIONAL, - OUT PVOID OutputBuffer, - IN ULONG OutputBufferLength OPTIONAL) -{ - NTSTATUS Status; - PFILE_OBJECT FileObject; - PDEVICE_OBJECT DeviceObject; - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - PKEVENT EventObject; - KPROCESSOR_MODE PreviousMode; - - DPRINT("NtDeviceIoControlFile(DeviceHandle %x Event %x UserApcRoutine %x " - "UserApcContext %x IoStatusBlock %x IoControlCode %x " - "InputBuffer %x InputBufferLength %x OutputBuffer %x " - "OutputBufferLength %x)\n", - DeviceHandle,Event,UserApcRoutine,UserApcContext,IoStatusBlock, - IoControlCode,InputBuffer,InputBufferLength,OutputBuffer, - OutputBufferLength); - - if (IoStatusBlock == NULL) - return STATUS_ACCESS_VIOLATION; - - PreviousMode = ExGetPreviousMode(); - - /* Check granted access against the access rights from IoContolCode */ - Status = ObReferenceObjectByHandle (DeviceHandle, - (IoControlCode >> 14) & 0x3, - IoFileObjectType, - PreviousMode, - (PVOID *) &FileObject, - NULL); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - if (Event != NULL) - { - Status = ObReferenceObjectByHandle (Event, - SYNCHRONIZE, - ExEventObjectType, - PreviousMode, - (PVOID*)&EventObject, - NULL); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject (FileObject); - return Status; - } - } - else - { - EventObject = &FileObject->Event; - KeResetEvent (EventObject); - } - - DeviceObject = FileObject->DeviceObject; - - Irp = IoBuildDeviceIoControlRequest (IoControlCode, - DeviceObject, - InputBuffer, - InputBufferLength, - OutputBuffer, - OutputBufferLength, - FALSE, - EventObject, - IoStatusBlock); - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - - Irp->RequestorMode = PreviousMode; - Irp->Overlay.AsynchronousParameters.UserApcRoutine = UserApcRoutine; - Irp->Overlay.AsynchronousParameters.UserApcContext = UserApcContext; - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - StackPtr->DeviceObject = DeviceObject; - StackPtr->Parameters.DeviceIoControl.InputBufferLength = InputBufferLength; - StackPtr->Parameters.DeviceIoControl.OutputBufferLength = OutputBufferLength; - - Status = IoCallDriver(DeviceObject,Irp); - if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - Status = KeWaitForSingleObject (EventObject, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - if (Status != STATUS_WAIT_0) - { - /* Wait failed. */ - return Status; - } - - Status = IoStatusBlock->Status; - } - - return Status; -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/iomgr.c b/reactos/ntoskrnl/io/iomgr.c index 0cc528d837d..1e2849be1c6 100644 --- a/reactos/ntoskrnl/io/iomgr.c +++ b/reactos/ntoskrnl/io/iomgr.c @@ -1,9 +1,8 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel * FILE: ntoskrnl/io/iomgr.c - * PURPOSE: Initializes the io manager + * PURPOSE: I/O Manager Initialization and Misc Utility Functions * * PROGRAMMERS: David Welch (welch@mcmail.com) */ @@ -11,7 +10,6 @@ /* INCLUDES ****************************************************************/ #include -#include "../dbg/kdb.h" #define NDEBUG #include @@ -23,7 +21,6 @@ /* DATA ********************************************************************/ - POBJECT_TYPE EXPORTED IoDeviceObjectType = NULL; POBJECT_TYPE EXPORTED IoFileObjectType = NULL; ULONG EXPORTED IoReadOperationCount = 0; @@ -34,358 +31,35 @@ ULONG IoOtherOperationCount = 0; ULONGLONG IoOtherTransferCount = 0; KSPIN_LOCK EXPORTED IoStatisticsLock = 0; -static GENERIC_MAPPING IopFileMapping = {FILE_GENERIC_READ, - FILE_GENERIC_WRITE, - FILE_GENERIC_EXECUTE, - FILE_ALL_ACCESS}; +GENERIC_MAPPING IopFileMapping = { + FILE_GENERIC_READ, + FILE_GENERIC_WRITE, + FILE_GENERIC_EXECUTE, + FILE_ALL_ACCESS}; + +static KSPIN_LOCK CancelSpinLock; +extern LIST_ENTRY ShutdownListHead; +extern KSPIN_LOCK ShutdownListLock; -/* FUNCTIONS ****************************************************************/ +/* INIT FUNCTIONS ************************************************************/ -VOID STDCALL -IopCloseFile(PVOID ObjectBody, - ULONG HandleCount) +VOID +INIT_FUNCTION +IoInitCancelHandling(VOID) { - PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody; - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - - DPRINT("IopCloseFile()\n"); - - if (HandleCount > 1 || FileObject->DeviceObject == NULL) - { - return; - } - -#if 0 -//NOTE: Allmost certain that the latest changes to I/O Mgr makes this redundant (OriginalFileObject case) - ObReferenceObjectByPointer(FileObject, - STANDARD_RIGHTS_REQUIRED, - IoFileObjectType, - UserMode); -#endif - - KeResetEvent( &FileObject->Event ); - - Irp = IoBuildSynchronousFsdRequest(IRP_MJ_CLEANUP, - FileObject->DeviceObject, - NULL, - 0, - NULL, - &FileObject->Event, - NULL); - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, Executive, KernelMode, FALSE, NULL); - } + KeInitializeSpinLock(&CancelSpinLock); } - -VOID STDCALL -IopDeleteFile(PVOID ObjectBody) +VOID +INIT_FUNCTION +IoInitShutdownNotification (VOID) { - PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody; - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - - DPRINT("IopDeleteFile()\n"); - - if (FileObject->DeviceObject) - { -#if 0 -//NOTE: Allmost certain that the latest changes to I/O Mgr makes this redundant (OriginalFileObject case) - - ObReferenceObjectByPointer(ObjectBody, - STANDARD_RIGHTS_REQUIRED, - IoFileObjectType, - UserMode); -#endif - KeResetEvent( &FileObject->Event ); - - Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, TRUE); - if (Irp == NULL) - { - /* - * FIXME: This case should eventually be handled. We should wait - * until enough memory is available to allocate the IRP. - */ - ASSERT(FALSE); - } - - Irp->UserEvent = &FileObject->Event; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - Irp->Flags |= IRP_CLOSE_OPERATION; - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_CLOSE; - StackPtr->DeviceObject = FileObject->DeviceObject; - StackPtr->FileObject = FileObject; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, Executive, KernelMode, FALSE, NULL); - } - } - - if (FileObject->FileName.Buffer != NULL) - { - ExFreePool(FileObject->FileName.Buffer); - FileObject->FileName.Buffer = 0; - } + InitializeListHead(&ShutdownListHead); + KeInitializeSpinLock(&ShutdownListLock); } - -static NTSTATUS -IopSetDefaultSecurityDescriptor(SECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR SecurityDescriptor, - PULONG BufferLength) -{ - ULONG_PTR Current; - ULONG SidSize; - ULONG SdSize; - NTSTATUS Status; - - DPRINT("IopSetDefaultSecurityDescriptor() called\n"); - - if (SecurityInformation == 0) - { - return STATUS_ACCESS_DENIED; - } - - SidSize = RtlLengthSid(SeWorldSid); - SdSize = sizeof(SECURITY_DESCRIPTOR) + (2 * SidSize); - - if (*BufferLength < SdSize) - { - *BufferLength = SdSize; - return STATUS_BUFFER_TOO_SMALL; - } - - *BufferLength = SdSize; - - Status = RtlCreateSecurityDescriptor(SecurityDescriptor, - SECURITY_DESCRIPTOR_REVISION); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - SecurityDescriptor->Control |= SE_SELF_RELATIVE; - Current = (ULONG_PTR)SecurityDescriptor + sizeof(SECURITY_DESCRIPTOR); - - if (SecurityInformation & OWNER_SECURITY_INFORMATION) - { - RtlCopyMemory((PVOID)Current, - SeWorldSid, - SidSize); - SecurityDescriptor->Owner = (PSID)((ULONG_PTR)Current - (ULONG_PTR)SecurityDescriptor); - Current += SidSize; - } - - if (SecurityInformation & GROUP_SECURITY_INFORMATION) - { - RtlCopyMemory((PVOID)Current, - SeWorldSid, - SidSize); - SecurityDescriptor->Group = (PSID)((ULONG_PTR)Current - (ULONG_PTR)SecurityDescriptor); - Current += SidSize; - } - - if (SecurityInformation & DACL_SECURITY_INFORMATION) - { - SecurityDescriptor->Control |= SE_DACL_PRESENT; - } - - if (SecurityInformation & SACL_SECURITY_INFORMATION) - { - SecurityDescriptor->Control |= SE_SACL_PRESENT; - } - - return STATUS_SUCCESS; -} - - -NTSTATUS STDCALL -IopSecurityFile(PVOID ObjectBody, - SECURITY_OPERATION_CODE OperationCode, - SECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR SecurityDescriptor, - PULONG BufferLength) -{ - IO_STATUS_BLOCK IoStatusBlock; - PIO_STACK_LOCATION StackPtr; - PFILE_OBJECT FileObject; - PIRP Irp; - NTSTATUS Status; - - DPRINT("IopSecurityFile() called\n"); - - FileObject = (PFILE_OBJECT)ObjectBody; - - switch (OperationCode) - { - case SetSecurityDescriptor: - DPRINT("Set security descriptor\n"); - KeResetEvent(&FileObject->Event); - Irp = IoBuildSynchronousFsdRequest(IRP_MJ_SET_SECURITY, - FileObject->DeviceObject, - NULL, - 0, - NULL, - &FileObject->Event, - &IoStatusBlock); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - - StackPtr->Parameters.SetSecurity.SecurityInformation = SecurityInformation; - StackPtr->Parameters.SetSecurity.SecurityDescriptor = SecurityDescriptor; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - KernelMode, - FALSE, - NULL); - Status = IoStatusBlock.Status; - } - - if (Status == STATUS_INVALID_DEVICE_REQUEST) - { - Status = STATUS_SUCCESS; - } - return Status; - - case QuerySecurityDescriptor: - DPRINT("Query security descriptor\n"); - KeResetEvent(&FileObject->Event); - Irp = IoBuildSynchronousFsdRequest(IRP_MJ_QUERY_SECURITY, - FileObject->DeviceObject, - NULL, - 0, - NULL, - &FileObject->Event, - &IoStatusBlock); - - Irp->UserBuffer = SecurityDescriptor; - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - - StackPtr->Parameters.QuerySecurity.SecurityInformation = SecurityInformation; - StackPtr->Parameters.QuerySecurity.Length = *BufferLength; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - KernelMode, - FALSE, - NULL); - Status = IoStatusBlock.Status; - } - - if (Status == STATUS_INVALID_DEVICE_REQUEST) - { - Status = IopSetDefaultSecurityDescriptor(SecurityInformation, - SecurityDescriptor, - BufferLength); - } - else - { - /* FIXME: Is this correct?? */ - *BufferLength = IoStatusBlock.Information; - } - return Status; - - case DeleteSecurityDescriptor: - DPRINT("Delete security descriptor\n"); - return STATUS_SUCCESS; - - case AssignSecurityDescriptor: - DPRINT("Assign security descriptor\n"); - return STATUS_SUCCESS; - } - - return STATUS_UNSUCCESSFUL; -} - - -NTSTATUS STDCALL -IopQueryNameFile(PVOID ObjectBody, - POBJECT_NAME_INFORMATION ObjectNameInfo, - ULONG Length, - PULONG ReturnLength) -{ - POBJECT_NAME_INFORMATION LocalInfo; - PFILE_NAME_INFORMATION FileNameInfo; - PFILE_OBJECT FileObject; - ULONG LocalReturnLength; - NTSTATUS Status; - - DPRINT ("IopQueryNameFile() called\n"); - - FileObject = (PFILE_OBJECT)ObjectBody; - - LocalInfo = ExAllocatePool (NonPagedPool, - sizeof(OBJECT_NAME_INFORMATION) + - MAX_PATH * sizeof(WCHAR)); - if (LocalInfo == NULL) - return STATUS_INSUFFICIENT_RESOURCES; - - Status = ObQueryNameString (FileObject->DeviceObject->Vpb->RealDevice, - LocalInfo, - MAX_PATH * sizeof(WCHAR), - &LocalReturnLength); - if (!NT_SUCCESS (Status)) - { - ExFreePool (LocalInfo); - return Status; - } - DPRINT ("Device path: %wZ\n", &LocalInfo->Name); - - Status = RtlAppendUnicodeStringToString (&ObjectNameInfo->Name, - &LocalInfo->Name); - - ExFreePool (LocalInfo); - - FileNameInfo = ExAllocatePool (NonPagedPool, - MAX_PATH * sizeof(WCHAR) + sizeof(ULONG)); - if (FileNameInfo == NULL) - return STATUS_INSUFFICIENT_RESOURCES; - - Status = IoQueryFileInformation (FileObject, - FileNameInformation, - MAX_PATH * sizeof(WCHAR) + sizeof(ULONG), - FileNameInfo, - NULL); - if (Status != STATUS_SUCCESS) - { - ExFreePool (FileNameInfo); - return Status; - } - - Status = RtlAppendUnicodeToString (&ObjectNameInfo->Name, - FileNameInfo->FileName); - - DPRINT ("Total path: %wZ\n", &ObjectNameInfo->Name); - - ExFreePool (FileNameInfo); - - return Status; -} - - -VOID INIT_FUNCTION +VOID +INIT_FUNCTION IoInit (VOID) { OBJECT_ATTRIBUTES ObjectAttributes; @@ -417,7 +91,7 @@ IoInit (VOID) IoDeviceObjectType->Security = NULL; IoDeviceObjectType->QueryName = NULL; IoDeviceObjectType->OkayToClose = NULL; - IoDeviceObjectType->Create = IopCreateDevice; + IoDeviceObjectType->Create = NULL; IoDeviceObjectType->DuplicationNotify = NULL; RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device"); @@ -542,6 +216,7 @@ IoInit (VOID) IoInitFileSystemImplementation(); IoInitVpbImplementation(); IoInitShutdownNotification(); + IopInitPnpNotificationImplementation(); IopInitErrorLog(); IopInitTimerImplementation(); IopInitIoCompletionImplementation(); @@ -562,7 +237,6 @@ IoInit (VOID) PnpInit(); } - VOID INIT_FUNCTION IoInit2(BOOLEAN BootLog) @@ -595,6 +269,7 @@ IoInit2(BOOLEAN BootLog) Status = IopInitializeDriverModule( DeviceNode, &ModuleObject, + &DeviceNode->ServiceName, TRUE, &DriverObject); if (!NT_SUCCESS(Status)) @@ -641,17 +316,14 @@ IoInit3(VOID) Status = IoCreateSystemRootLink((PCHAR)KeLoaderBlock.CommandLine); if (!NT_SUCCESS(Status)) { DbgPrint("IoCreateSystemRootLink FAILED: (0x%x) - ", Status); - DbgPrintErrorMessage (Status); KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE); } - /* Start Profiling on a Debug Build */ -#if defined(KDBG) + /* Read KDB Data */ KdbInit(); -#endif /* KDBG */ - /* I/O is now setup for disk access, so start the debugging logger thread. */ - if (KdDebugState & KD_DEBUG_FILELOG) DebugLogInit2(); + /* I/O is now setup for disk access, so phase 3 */ + KdInitSystem(3, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); /* Load services for devices found by PnP manager */ IopInitializePnpServices(IopRootDeviceNode, FALSE); @@ -670,13 +342,81 @@ IoInit3(VOID) NULL); } +/* FUNCTIONS *****************************************************************/ + /* * @implemented */ -PGENERIC_MAPPING STDCALL -IoGetFileObjectGenericMapping(VOID) +VOID +STDCALL +IoAcquireCancelSpinLock(PKIRQL Irql) { - return(&IopFileMapping); + KeAcquireSpinLock(&CancelSpinLock,Irql); +} + +/* + * @implemented + */ +PVOID +STDCALL +IoGetInitialStack(VOID) +{ + return(PsGetCurrentThread()->Tcb.InitialStack); +} + +/* + * @implemented + */ +VOID +STDCALL +IoGetStackLimits(OUT PULONG LowLimit, + OUT PULONG HighLimit) +{ + *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit; + *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase; +} + +/* + * @implemented + */ +BOOLEAN +STDCALL +IoIsSystemThread(IN PETHREAD Thread) +{ + /* Call the Ps Function */ + return PsIsSystemThread(Thread); +} + +/* + * @implemented + */ +BOOLEAN STDCALL +IoIsWdmVersionAvailable(IN UCHAR MajorVersion, + IN UCHAR MinorVersion) +{ + if (MajorVersion <= 1 && MinorVersion <= 10) + return TRUE; + return FALSE; +} + +/* + * @implemented + */ +VOID +STDCALL +IoReleaseCancelSpinLock(KIRQL Irql) +{ + KeReleaseSpinLock(&CancelSpinLock,Irql); +} + +/* + * @implemented + */ +PEPROCESS +STDCALL +IoThreadToProcess(IN PETHREAD Thread) +{ + return(Thread->ThreadsProcess); } /* EOF */ diff --git a/reactos/ntoskrnl/io/irp.c b/reactos/ntoskrnl/io/irp.c index 7f3a7701689..12dcdc052f6 100644 --- a/reactos/ntoskrnl/io/irp.c +++ b/reactos/ntoskrnl/io/irp.c @@ -1,30 +1,11 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/io/irp.c * PURPOSE: Handle IRPs * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* NOTES ******************************************************************* - * - * Layout of an IRP - * - * ################ - * # Headers # - * ################ - * # # - * # Variable # - * # length list # - * # of io stack # - * # locations # - * # # - * ################ - * - * - * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * David Welch (welch@mcmail.com) */ /* INCLUDES ****************************************************************/ @@ -35,180 +16,541 @@ /* GLOBALS *******************************************************************/ -#define TAG_IRP TAG('I', 'R', 'P', ' ') +#define TAG_IRP TAG('I', 'R', 'P', ' ') +#define TAG_SYS_BUF TAG('I', 'o', ' ' , ' ') - -/* FUNCTIONS ****************************************************************/ - -/* - * @unimplemented - */ -BOOLEAN -STDCALL -IoForwardIrpSynchronously( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ) -{ - UNIMPLEMENTED; - return FALSE; -} +/* FUNCTIONS *****************************************************************/ /* * @implemented - */ -VOID STDCALL -IoFreeIrp(PIRP Irp) -/* - * FUNCTION: Releases a caller allocated irp + * + * FUNCTION: Allocates an IRP * ARGUMENTS: - * Irp = Irp to free + * StackSize = the size of the stack required for the irp + * ChargeQuota = Charge allocation to current threads quota + * RETURNS: Irp allocated */ -{ - ExFreePool(Irp); -} - -/* - * @unimplemented - */ -ULONG +PIRP STDCALL -IoGetRequestorProcessId( - IN PIRP Irp - ) +IoAllocateIrp(CCHAR StackSize, + BOOLEAN ChargeQuota) { - UNIMPLEMENTED; - return 0; -} + PIRP Irp; + USHORT Size = IoSizeOfIrp(StackSize); + + /* Check if we shoudl charge quota */ + if (ChargeQuota) + { + /* Irp = ExAllocatePoolWithQuotaTag(NonPagedPool,IoSizeOfIrp(StackSize), TAG_IRP); */ + /* FIXME */ + Irp = ExAllocatePoolWithTag(NonPagedPool, + Size, + TAG_IRP); + } + else + { + /* Allocate the IRP With no Quota charge */ + Irp = ExAllocatePoolWithTag(NonPagedPool, + Size, + TAG_IRP); + } -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoGetRequestorSessionId( - IN PIRP Irp, - OUT PULONG pSessionId - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} + /* Make sure it was sucessful */ + if (Irp==NULL) return(NULL); - -/* - * @unimplemented - */ -BOOLEAN -STDCALL -IoIsValidNameGraftingBuffer( - IN PIRP Irp, - IN PREPARSE_DATA_BUFFER ReparseBuffer - ) -{ - UNIMPLEMENTED; - return FALSE; + /* Now Initialize it */ + IoInitializeIrp(Irp, Size, StackSize); + + /* Return it */ + return Irp; } /* * @implemented - */ -PIRP STDCALL -IoMakeAssociatedIrp(PIRP Irp, - CCHAR StackSize) -/* - * FUNCTION: Allocates and initializes an irp to associated with a master irp + * + * FUNCTION: Allocates and sets up an IRP to be sent to lower level drivers * ARGUMENTS: - * Irp = Master irp - * StackSize = Number of stack locations to be allocated in the irp - * RETURNS: The irp allocated - * NOTE: The caller is responsible for incrementing - * Irp->AssociatedIrp.IrpCount. + * MajorFunction = One of IRP_MJ_READ, IRP_MJ_WRITE, + * IRP_MJ_FLUSH_BUFFERS or IRP_MJ_SHUTDOWN + * DeviceObject = Device object to send the irp to + * Buffer = Buffer into which data will be read or written + * Length = Length in bytes of the irp to be allocated + * StartingOffset = Starting offset on the device + * IoStatusBlock (OUT) = Storage for the result of the operation + * RETURNS: The IRP allocated on success, or + * NULL on failure */ +PIRP +STDCALL +IoBuildAsynchronousFsdRequest(ULONG MajorFunction, + PDEVICE_OBJECT DeviceObject, + PVOID Buffer, + ULONG Length, + PLARGE_INTEGER StartingOffset, + PIO_STATUS_BLOCK IoStatusBlock) { - PIRP AssocIrp; + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + LOCK_OPERATION AccessType; - /* Allocate the IRP */ - AssocIrp = IoAllocateIrp(StackSize,FALSE); - if (AssocIrp == NULL) - return NULL; + DPRINT("IoBuildAsynchronousFsdRequest(MajorFunction %x, DeviceObject %x, " + "Buffer %x, Length %x, StartingOffset %x, " + "IoStatusBlock %x\n",MajorFunction,DeviceObject,Buffer,Length, + StartingOffset,IoStatusBlock); - /* Set the Flags */ - AssocIrp->Flags |= IRP_ASSOCIATED_IRP; + /* Allocate IRP */ + if (!(Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE))) return Irp; + + /* Get the Stack */ + StackPtr = IoGetNextIrpStackLocation(Irp); + + /* Write the Major function and then deal with it */ + StackPtr->MajorFunction = (UCHAR)MajorFunction; + + /* Do not handle the following here */ + if (MajorFunction != IRP_MJ_FLUSH_BUFFERS && + MajorFunction != IRP_MJ_SHUTDOWN && + MajorFunction != IRP_MJ_PNP) + { + /* Check if this is Buffered IO */ + if (DeviceObject->Flags & DO_BUFFERED_IO) + { + /* Allocate the System Buffer */ + Irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, + Length, + TAG_SYS_BUF); + + /* Set flags */ + Irp->Flags = IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER; + + /* Handle special IRP_MJ_WRITE Case */ + if (MajorFunction == IRP_MJ_WRITE) + { + /* Copy the buffer data */ + RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, Buffer, Length); + } + else + { + /* Set the Input Operation flag and set this as a User Buffer */ + Irp->Flags |= IRP_INPUT_OPERATION; + Irp->UserBuffer = Buffer; + } + } + else if (DeviceObject->Flags & DO_DIRECT_IO) + { + /* Use an MDL for Direct I/O */ + Irp->MdlAddress = MmCreateMdl(NULL, Buffer, Length); + + /* Use the right Access Type */ + if (MajorFunction == IRP_MJ_READ) + { + AccessType = IoReadAccess; + } + else + { + AccessType = IoWriteAccess; + } + + /* Probe and Lock */ + _SEH_FILTER(FreeAndGoOn) + { + /* Free the IRP and its MDL */ + IoFreeMdl(Irp->MdlAddress); + IoFreeIrp(Irp); + return EXCEPTION_CONTINUE_SEARCH; + } + _SEH_TRY + { + /* Do the probe */ + MmProbeAndLockPages(Irp->MdlAddress, KernelMode, AccessType); + } + _SEH_HANDLE + { + /* Free the IRP and its MDL */ + IoFreeMdl(Irp->MdlAddress); + IoFreeIrp(Irp); + /* FIXME - pass the exception to the caller? */ + Irp = NULL; + } + _SEH_END; + + if (!Irp) + return NULL; + } + else + { + /* Neither, use the buffer */ + Irp->UserBuffer = Buffer; + } - /* Set the Thread */ - AssocIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread; - - /* Associate them */ - AssocIrp->AssociatedIrp.MasterIrp = Irp; - - return AssocIrp; + if (MajorFunction == IRP_MJ_READ) + { + StackPtr->Parameters.Read.Length = Length; + StackPtr->Parameters.Read.ByteOffset = *StartingOffset; + } + else if (MajorFunction == IRP_MJ_WRITE) + { + StackPtr->Parameters.Write.Length = Length; + StackPtr->Parameters.Write.ByteOffset = *StartingOffset; + } + } + + /* Set the Current Thread and IOSB */ + if (!IoStatusBlock) KEBUGCHECK(0); /* Temporary to catch illegal ROS Drivers */ + Irp->UserIosb = IoStatusBlock; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + + /* Set the Status Block after all is done */ + return Irp; } /* * @implemented - */ -VOID STDCALL -IoInitializeIrp(PIRP Irp, - USHORT PacketSize, - CCHAR StackSize) -/* - * FUNCTION: Initalizes an irp allocated by the caller + * + * FUNCTION: Allocates and sets up an IRP to be sent to drivers * ARGUMENTS: - * Irp = IRP to initalize - * PacketSize = Size in bytes of the IRP - * StackSize = Number of stack locations in the IRP + * IoControlCode = Device io control code + * DeviceObject = Device object to send the irp to + * InputBuffer = Buffer from which data will be read by the driver + * InputBufferLength = Length in bytes of the input buffer + * OutputBuffer = Buffer into which data will be written by the driver + * OutputBufferLength = Length in bytes of the output buffer + * InternalDeviceIoControl = Determines weather + * IRP_MJ_INTERNAL_DEVICE_CONTROL or + * IRP_MJ_DEVICE_CONTROL will be used + * Event = Event used to notify the caller of completion + * IoStatusBlock (OUT) = Storage for the result of the operation + * RETURNS: The IRP allocated on success, or + * NULL on failure */ +PIRP +STDCALL +IoBuildDeviceIoControlRequest (ULONG IoControlCode, + PDEVICE_OBJECT DeviceObject, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength, + BOOLEAN InternalDeviceIoControl, + PKEVENT Event, + PIO_STATUS_BLOCK IoStatusBlock) { - ASSERT(Irp != NULL); + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + ULONG BufferLength; + LOCK_OPERATION AccessType; - DPRINT("IoInitializeIrp(StackSize %x, Irp %x)\n",StackSize, Irp); - memset(Irp, 0, PacketSize); - Irp->Size = PacketSize; - Irp->StackCount = StackSize; - Irp->CurrentLocation = StackSize; - InitializeListHead(&Irp->ThreadListEntry); - Irp->Tail.Overlay.CurrentStackLocation = (PIO_STACK_LOCATION)(Irp + 1) + StackSize; - DPRINT("Irp->Tail.Overlay.CurrentStackLocation %x\n", Irp->Tail.Overlay.CurrentStackLocation); - Irp->ApcEnvironment = KeGetCurrentThread()->ApcStateIndex; + DPRINT("IoBuildDeviceIoRequest(IoControlCode %x, DeviceObject %x, " + "InputBuffer %x, InputBufferLength %x, OutputBuffer %x, " + "OutputBufferLength %x, InternalDeviceIoControl %x " + "Event %x, IoStatusBlock %x\n",IoControlCode,DeviceObject, + InputBuffer,InputBufferLength,OutputBuffer,OutputBufferLength, + InternalDeviceIoControl,Event,IoStatusBlock); + + /* Allocate IRP */ + if (!(Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE))) return Irp; + + /* Get the Stack */ + StackPtr = IoGetNextIrpStackLocation(Irp); + + /* Set the DevCtl Type */ + StackPtr->MajorFunction = InternalDeviceIoControl ? + IRP_MJ_INTERNAL_DEVICE_CONTROL : IRP_MJ_DEVICE_CONTROL; + + /* Set the IOCTL Data */ + StackPtr->Parameters.DeviceIoControl.IoControlCode = IoControlCode; + StackPtr->Parameters.DeviceIoControl.InputBufferLength = InputBufferLength; + StackPtr->Parameters.DeviceIoControl.OutputBufferLength = OutputBufferLength; + + /* Handle the Methods */ + switch (IO_METHOD_FROM_CTL_CODE(IoControlCode)) + { + case METHOD_BUFFERED: + DPRINT("Using METHOD_BUFFERED!\n"); + + /* Select the right Buffer Length */ + BufferLength = InputBufferLength > OutputBufferLength ? InputBufferLength : OutputBufferLength; + + /* Make sure there is one */ + if (BufferLength) + { + /* Allocate the System Buffer */ + Irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, + BufferLength, + TAG_SYS_BUF); + + /* Fail if we couldn't */ + if (Irp->AssociatedIrp.SystemBuffer == NULL) + { + IoFreeIrp(Irp); + return(NULL); + } + + /* Check if we got a buffer */ + if (InputBuffer) + { + /* Copy into the System Buffer */ + RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, + InputBuffer, + InputBufferLength); + } + + /* Write the flags */ + Irp->Flags = IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER; + if (OutputBuffer) Irp->Flags |= IRP_INPUT_OPERATION; + + /* Save the Buffer */ + Irp->UserBuffer = OutputBuffer; + } + else + { + /* Clear the Flags and Buffer */ + Irp->Flags = 0; + Irp->UserBuffer = NULL; + } + break; + + case METHOD_IN_DIRECT: + case METHOD_OUT_DIRECT: + DPRINT("Using METHOD_IN/OUT DIRECT!\n"); + + /* Check if we got an input buffer */ + if (InputBuffer) + { + /* Allocate the System Buffer */ + Irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, + InputBufferLength, + TAG_SYS_BUF); + + /* Fail if we couldn't */ + if (Irp->AssociatedIrp.SystemBuffer == NULL) + { + IoFreeIrp(Irp); + return(NULL); + } + + /* Copy into the System Buffer */ + RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, + InputBuffer, + InputBufferLength); + + /* Write the flags */ + Irp->Flags = IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER; + } + else + { + Irp->Flags = 0; + } + + /* Check if we got an output buffer */ + if (OutputBuffer) + { + /* Allocate the System Buffer */ + Irp->MdlAddress = IoAllocateMdl(OutputBuffer, + OutputBufferLength, + FALSE, + FALSE, + Irp); + + /* Fail if we couldn't */ + if (Irp->MdlAddress == NULL) + { + IoFreeIrp(Irp); + return NULL; + } + + /* Probe and Lock */ + _SEH_TRY + { + /* Use the right Access Type */ + if (IO_METHOD_FROM_CTL_CODE(IoControlCode) == METHOD_IN_DIRECT) + { + AccessType = IoReadAccess; + } + else + { + AccessType = IoWriteAccess; + } + + /* Do the probe */ + MmProbeAndLockPages(Irp->MdlAddress, KernelMode, AccessType); + } + _SEH_HANDLE + { + /* Free the MDL and IRP */ + IoFreeMdl(Irp->MdlAddress); + IoFreeIrp(Irp); + /* FIXME - pass the exception to the caller? */ + Irp = NULL; + } + _SEH_END; + + if (!Irp) + return NULL; + } + break; + + case METHOD_NEITHER: + + /* Just save the Buffer */ + Irp->UserBuffer = OutputBuffer; + StackPtr->Parameters.DeviceIoControl.Type3InputBuffer = InputBuffer; + break; + } + + /* Now write the Event and IoSB */ + if (!IoStatusBlock) KEBUGCHECK(0); /* Temporary to catch illegal ROS Drivers */ + Irp->UserIosb = IoStatusBlock; + Irp->UserEvent = Event; + + /* Sync IRPs are queued to requestor thread's irp cancel/cleanup list */ + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + IoQueueThreadIrp(Irp); + + /* Return the IRP */ + return Irp; } +/* + * @implemented + * + * FUNCTION: Allocates and builds an IRP to be sent synchronously to lower + * level driver(s) + * ARGUMENTS: + * MajorFunction = Major function code, one of IRP_MJ_READ, + * IRP_MJ_WRITE, IRP_MJ_FLUSH_BUFFERS, IRP_MJ_SHUTDOWN + * DeviceObject = Target device object + * Buffer = Buffer containing data for a read or write + * Length = Length in bytes of the information to be transferred + * StartingOffset = Offset to begin the read/write from + * Event (OUT) = Will be set when the operation is complete + * IoStatusBlock (OUT) = Set to the status of the operation + * RETURNS: The IRP allocated on success, or + * NULL on failure + */ +PIRP +STDCALL +IoBuildSynchronousFsdRequest(ULONG MajorFunction, + PDEVICE_OBJECT DeviceObject, + PVOID Buffer, + ULONG Length, + PLARGE_INTEGER StartingOffset, + PKEVENT Event, + PIO_STATUS_BLOCK IoStatusBlock) +{ + PIRP Irp; + + DPRINT("IoBuildSynchronousFsdRequest(MajorFunction %x, DeviceObject %x, " + "Buffer %x, Length %x, StartingOffset %x, Event %x, " + "IoStatusBlock %x\n",MajorFunction,DeviceObject,Buffer,Length, + StartingOffset,Event,IoStatusBlock); + + /* Do the big work to set up the IRP */ + Irp = IoBuildAsynchronousFsdRequest(MajorFunction, + DeviceObject, + Buffer, + Length, + StartingOffset, + IoStatusBlock ); + + /* Set the Event which makes it Syncronous */ + Irp->UserEvent = Event; + + /* Sync IRPs are queued to requestor thread's irp cancel/cleanup list */ + IoQueueThreadIrp(Irp); + return(Irp); +} /* * @implemented */ -NTSTATUS FASTCALL -IofCallDriver(PDEVICE_OBJECT DeviceObject, - PIRP Irp) -/* - * FUNCTION: Sends an IRP to the next lower driver - */ +BOOLEAN +STDCALL +IoCancelIrp(PIRP Irp) { - PDRIVER_OBJECT DriverObject; - PIO_STACK_LOCATION Param; + KIRQL oldlvl; + PDRIVER_CANCEL CancelRoutine; + + DPRINT("IoCancelIrp(Irp %x)\n",Irp); + + IoAcquireCancelSpinLock(&oldlvl); + + Irp->Cancel = TRUE; + + CancelRoutine = IoSetCancelRoutine(Irp, NULL); + if (CancelRoutine == NULL) + { + IoReleaseCancelSpinLock(oldlvl); + return(FALSE); + } + + Irp->CancelIrql = oldlvl; + CancelRoutine(IoGetCurrentIrpStackLocation(Irp)->DeviceObject, Irp); + return(TRUE); +} - DPRINT("IofCallDriver(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); +/** + * @name IoCancelThreadIo + * + * Cancel all pending I/O request associated with specified thread. + * + * @param Thread + * Thread to cancel requests for. + */ - ASSERT(Irp); - ASSERT(DeviceObject); +VOID +STDCALL +IoCancelThreadIo(PETHREAD Thread) +{ + PLIST_ENTRY IrpEntry; + PIRP Irp; + KIRQL OldIrql; + ULONG Retries = 3000; + LARGE_INTEGER Interval; - DriverObject = DeviceObject->DriverObject; + OldIrql = KfRaiseIrql(APC_LEVEL); - ASSERT(DriverObject); + /* + * Start by cancelling all the IRPs in the current thread queue. + */ - IoSetNextIrpStackLocation(Irp); - Param = IoGetCurrentIrpStackLocation(Irp); + for (IrpEntry = Thread->IrpList.Flink; + IrpEntry != &Thread->IrpList; + IrpEntry = IrpEntry->Flink) + { + Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); + IoCancelIrp(Irp); + } - DPRINT("IrpSp 0x%X\n", Param); + /* + * Wait till all the IRPs are completed or cancelled. + */ - Param->DeviceObject = DeviceObject; + while (!IsListEmpty(&Thread->IrpList)) + { + KfLowerIrql(OldIrql); - DPRINT("MajorFunction %d\n", Param->MajorFunction); - DPRINT("DriverObject->MajorFunction[Param->MajorFunction] %x\n", - DriverObject->MajorFunction[Param->MajorFunction]); + /* Wait a short while and then look if all our IRPs were completed. */ + Interval.QuadPart = -1000000; /* 100 milliseconds */ + KeDelayExecutionThread(KernelMode, FALSE, &Interval); - return DriverObject->MajorFunction[Param->MajorFunction](DeviceObject, Irp); + /* + * Don't stay here forever if some broken driver doesn't complete + * the IRP. + */ + + if (Retries-- == 0) + { + /* FIXME: Handle this gracefully. */ + DPRINT1("Thread with dead IRPs!"); + ASSERT(FALSE); + } + + OldIrql = KfRaiseIrql(APC_LEVEL); + } + + KfLowerIrql(OldIrql); } #ifdef IoCallDriver @@ -221,60 +563,64 @@ NTSTATUS STDCALL IoCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp) { - return(IofCallDriver(DeviceObject, - Irp)); + /* Call fast call */ + return IofCallDriver(DeviceObject, Irp); } - /* * @implemented */ -PIRP STDCALL -IoAllocateIrp(CCHAR StackSize, - BOOLEAN ChargeQuota) -/* - * FUNCTION: Allocates an IRP - * ARGUMENTS: - * StackSize = the size of the stack required for the irp - * ChargeQuota = Charge allocation to current threads quota - * RETURNS: Irp allocated - */ +VOID +STDCALL +IoCompleteRequest(PIRP Irp, + CCHAR PriorityBoost) { - PIRP Irp; + /* Call the fastcall */ + IofCompleteRequest(Irp, PriorityBoost); +} -#if 0 - DbgPrint("IoAllocateIrp(StackSize %d ChargeQuota %d)\n", - StackSize, - ChargeQuota); - KeDumpStackFrames(0,8); -#endif - - if (ChargeQuota) - { -// Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize)); - Irp = ExAllocatePoolWithTag(NonPagedPool, - IoSizeOfIrp(StackSize), - TAG_IRP); - } - else - { - Irp = ExAllocatePoolWithTag(NonPagedPool, - IoSizeOfIrp(StackSize), - TAG_IRP); - } +/* + * @implemented + */ +VOID +STDCALL +IoEnqueueIrp(IN PIRP Irp) +{ + IoQueueThreadIrp(Irp); +} - if (Irp==NULL) - { - return(NULL); - } +/* + * @implemented + * + * FUNCTION: Sends an IRP to the next lower driver + */ +NTSTATUS +FASTCALL +IofCallDriver(PDEVICE_OBJECT DeviceObject, + PIRP Irp) - IoInitializeIrp(Irp, - IoSizeOfIrp(StackSize), - StackSize); +{ + PDRIVER_OBJECT DriverObject; + PIO_STACK_LOCATION Param; -// DPRINT("Irp %x Irp->StackPtr %d\n", Irp, Irp->CurrentLocation); + DPRINT("IofCallDriver(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); - return(Irp); + /* Get the Driver Object */ + DriverObject = DeviceObject->DriverObject; + + /* Set the Stack Location */ + IoSetNextIrpStackLocation(Irp); + + /* Get the current one */ + Param = IoGetCurrentIrpStackLocation(Irp); + + DPRINT("IrpSp 0x%X\n", Param); + + /* Get the Device Object */ + Param->DeviceObject = DeviceObject; + + /* Call it */ + return DriverObject->MajorFunction[Param->MajorFunction](DeviceObject, Irp); } #ifdef IoCompleteRequest @@ -501,19 +847,112 @@ IofCompleteRequest(PIRP Irp, } } +/* + * @unimplemented + */ +BOOLEAN +STDCALL +IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + UNIMPLEMENTED; + return FALSE; +} + +/* + * @implemented + * + * FUNCTION: Releases a caller allocated irp + * ARGUMENTS: + * Irp = Irp to free + */ +VOID +STDCALL +IoFreeIrp(PIRP Irp) +{ + /* Free the pool memory associated with it */ + ExFreePool(Irp); +} /* * @implemented */ -VOID STDCALL -IoCompleteRequest(PIRP Irp, - CCHAR PriorityBoost) +PEPROCESS STDCALL +IoGetRequestorProcess(IN PIRP Irp) { - IofCompleteRequest(Irp, PriorityBoost); + return(Irp->Tail.Overlay.Thread->ThreadsProcess); } +/* + * @implemented + */ +ULONG +STDCALL +IoGetRequestorProcessId(IN PIRP Irp) +{ + return (ULONG)(IoGetRequestorProcess(Irp)->UniqueProcessId); +} -/********************************************************************** +/* + * @implemented + */ +NTSTATUS +STDCALL +IoGetRequestorSessionId(IN PIRP Irp, + OUT PULONG pSessionId) +{ + *pSessionId = IoGetRequestorProcess(Irp)->SessionId; + + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +PIRP +STDCALL +IoGetTopLevelIrp(VOID) +{ + return(PsGetCurrentThread()->TopLevelIrp); +} + +/* + * @implemented + * + * FUNCTION: Initalizes an irp allocated by the caller + * ARGUMENTS: + * Irp = IRP to initalize + * PacketSize = Size in bytes of the IRP + * StackSize = Number of stack locations in the IRP + */ +VOID +STDCALL +IoInitializeIrp(PIRP Irp, + USHORT PacketSize, + CCHAR StackSize) +{ + ASSERT(Irp != NULL); + + DPRINT("IoInitializeIrp(StackSize %x, Irp %x)\n",StackSize, Irp); + + /* Clear it */ + RtlZeroMemory(Irp, PacketSize); + + /* Set the Header and other data */ + Irp->Type = IO_TYPE_IRP; + Irp->Size = PacketSize; + Irp->StackCount = StackSize; + Irp->CurrentLocation = StackSize; + Irp->ApcEnvironment = KeGetCurrentThread()->ApcStateIndex; + Irp->Tail.Overlay.CurrentStackLocation = (PIO_STACK_LOCATION)(Irp + 1) + StackSize; + + /* Initialize the Thread List */ + InitializeListHead(&Irp->ThreadListEntry); + + DPRINT("Irp->Tail.Overlay.CurrentStackLocation %x\n", Irp->Tail.Overlay.CurrentStackLocation); +} + +/* * NAME EXPORTED * IoIsOperationSynchronous@4 * @@ -529,105 +968,440 @@ IoCompleteRequest(PIRP Irp, * * @implemented */ -BOOLEAN STDCALL +BOOLEAN +STDCALL IoIsOperationSynchronous(IN PIRP Irp) { - PFILE_OBJECT FileObject = NULL; + /* Check the flags */ + if ((Irp->Flags & IRP_SYNCHRONOUS_PAGING_IO) || + (Irp->Flags & IRP_SYNCHRONOUS_API) || + (IoGetCurrentIrpStackLocation(Irp)->FileObject->Flags & + FO_SYNCHRONOUS_IO)) + { + /* Synch API or Paging I/O is OK, as is Sync File I/O */ + return TRUE; + } - FileObject = IoGetCurrentIrpStackLocation(Irp)->FileObject; - - if (Irp->Flags & IRP_SYNCHRONOUS_PAGING_IO) - { - return TRUE; - } - - if (Irp->Flags & IRP_PAGING_IO) - { - return FALSE; - } - - //NOTE: Windows 2000 crash if IoStack->FileObject == NULL, so I guess we should too;-) - if (Irp->Flags & IRP_SYNCHRONOUS_API || FileObject->Flags & FO_SYNCHRONOUS_IO) - { - return TRUE; - } - - /* Otherwise, it is an asynchronous operation. */ - return FALSE; + /* Otherwise, it is an asynchronous operation. */ + return FALSE; } - /* - * @implemented + * @unimplemented */ -VOID STDCALL -IoEnqueueIrp(IN PIRP Irp) +BOOLEAN +STDCALL +IoIsValidNameGraftingBuffer(IN PIRP Irp, + IN PREPARSE_DATA_BUFFER ReparseBuffer) { - IoQueueThreadIrp(Irp); + UNIMPLEMENTED; + return FALSE; } - /* * @implemented + * + * FUNCTION: Allocates and initializes an irp to associated with a master irp + * ARGUMENTS: + * Irp = Master irp + * StackSize = Number of stack locations to be allocated in the irp + * RETURNS: The irp allocated + * NOTE: The caller is responsible for incrementing + * Irp->AssociatedIrp.IrpCount. */ -VOID STDCALL -IoSetTopLevelIrp(IN PIRP Irp) +PIRP +STDCALL +IoMakeAssociatedIrp(PIRP Irp, + CCHAR StackSize) { - PETHREAD Thread; + PIRP AssocIrp; - Thread = PsGetCurrentThread(); - Thread->TopLevelIrp = Irp; + /* Allocate the IRP */ + AssocIrp = IoAllocateIrp(StackSize,FALSE); + if (AssocIrp == NULL) return NULL; + + /* Set the Flags */ + AssocIrp->Flags |= IRP_ASSOCIATED_IRP; + + /* Set the Thread */ + AssocIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread; + + /* Associate them */ + AssocIrp->AssociatedIrp.MasterIrp = Irp; + + return AssocIrp; } - /* * @implemented */ -PIRP STDCALL -IoGetTopLevelIrp(VOID) +NTSTATUS +STDCALL +IoPageRead(PFILE_OBJECT FileObject, + PMDL Mdl, + PLARGE_INTEGER Offset, + PKEVENT Event, + PIO_STATUS_BLOCK StatusBlock) { - return(PsGetCurrentThread()->TopLevelIrp); + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + PDEVICE_OBJECT DeviceObject; + + DPRINT("IoPageRead(FileObject %x, Mdl %x)\n", + FileObject, Mdl); + + /* Get the Device Object */ + DeviceObject = IoGetRelatedDeviceObject(FileObject); + + /* Allocate IRP */ + Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); + + /* Get the Stack */ + StackPtr = IoGetNextIrpStackLocation(Irp); + + /* Create the IRP Settings */ + Irp->MdlAddress = Mdl; + Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl); + Irp->UserIosb = StatusBlock; + Irp->UserEvent = Event; + Irp->RequestorMode = KernelMode; + Irp->Flags = IRP_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_PAGING_IO | IRP_INPUT_OPERATION; + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + + /* Set the Stack Settings */ + StackPtr->Parameters.Read.Length = MmGetMdlByteCount(Mdl); + StackPtr->Parameters.Read.ByteOffset = *Offset; + StackPtr->MajorFunction = IRP_MJ_READ; + StackPtr->FileObject = FileObject; + + /* Call the Driver */ + return IofCallDriver(DeviceObject, Irp); } - /* * @implemented */ -VOID STDCALL +VOID +STDCALL IoQueueThreadIrp(IN PIRP Irp) { - KIRQL OldIrql; + KIRQL OldIrql; - OldIrql = KfRaiseIrql(APC_LEVEL); + /* Raise to APC */ + OldIrql = KfRaiseIrql(APC_LEVEL); /* * Synchronous irp's are queued to requestor thread. If they are not * completed when the thread exits, they are canceled (cleaned up). * - Gunnar */ - - InsertTailList(&Irp->Tail.Overlay.Thread->IrpList, &Irp->ThreadListEntry); + InsertTailList(&Irp->Tail.Overlay.Thread->IrpList, &Irp->ThreadListEntry); - KfLowerIrql(OldIrql); + /* Lower back */ + KfLowerIrql(OldIrql); } +/* + * @implemented + * Reference: Chris Cant's "Writing WDM Device Drivers" + */ +VOID +STDCALL +IoReuseIrp(IN OUT PIRP Irp, + IN NTSTATUS Status) +{ + UCHAR AllocationFlags; + + /* Get the old flags */ + AllocationFlags = Irp->AllocationFlags; + + /* Reinitialize the IRP */ + IoInitializeIrp(Irp, Irp->Size, Irp->StackCount); + + /* Duplicate the data */ + Irp->IoStatus.Status = Status; + Irp->AllocationFlags = AllocationFlags; +} /* * @implemented */ -VOID STDCALL -IoReuseIrp( - IN OUT PIRP Irp, - IN NTSTATUS Status) +VOID +STDCALL +IoSetTopLevelIrp(IN PIRP Irp) { - - UCHAR AllocationFlags; - - /* Reference: Chris Cant's "Writing WDM Device Drivers" */ - AllocationFlags = Irp->AllocationFlags; - IoInitializeIrp(Irp, Irp->Size, Irp->StackCount); - Irp->IoStatus.Status = Status; - Irp->AllocationFlags = AllocationFlags; + PsGetCurrentThread()->TopLevelIrp = Irp; +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +IoSynchronousPageWrite(PFILE_OBJECT FileObject, + PMDL Mdl, + PLARGE_INTEGER Offset, + PKEVENT Event, + PIO_STATUS_BLOCK StatusBlock) +{ + PIRP Irp; + PIO_STACK_LOCATION StackPtr; + PDEVICE_OBJECT DeviceObject; + + DPRINT("IoSynchronousPageWrite(FileObject %x, Mdl %x)\n", + FileObject, Mdl); + + /* Get the Device Object */ + DeviceObject = IoGetRelatedDeviceObject(FileObject); + + /* Allocate IRP */ + Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); + + /* Get the Stack */ + StackPtr = IoGetNextIrpStackLocation(Irp); + + /* Create the IRP Settings */ + Irp->MdlAddress = Mdl; + Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl); + Irp->UserIosb = StatusBlock; + Irp->UserEvent = Event; + Irp->RequestorMode = KernelMode; + Irp->Flags = IRP_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_PAGING_IO; + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + + /* Set the Stack Settings */ + StackPtr->Parameters.Write.Length = MmGetMdlByteCount(Mdl); + StackPtr->Parameters.Write.ByteOffset = *Offset; + StackPtr->MajorFunction = IRP_MJ_WRITE; + StackPtr->FileObject = FileObject; + + /* Call the Driver */ + return IofCallDriver(DeviceObject, Irp); +} + +VOID +STDCALL +IoSecondStageCompletion_KernelApcRoutine(PKAPC Apc, + PKNORMAL_ROUTINE *NormalRoutine, + PVOID *NormalContext, + PVOID *SystemArgument1, + PVOID *SystemArgument2) +{ + /* Free the IRP */ + IoFreeIrp(CONTAINING_RECORD(Apc, IRP, Tail.Apc)); +} + +VOID +STDCALL +IoSecondStageCompletion_RundownApcRoutine(PKAPC Apc) +{ + /* Free the IRP */ + IoFreeIrp(CONTAINING_RECORD(Apc, IRP, Tail.Apc)); +} + +/* + * FUNCTION: Performs the second stage of irp completion for read/write irps + * + * Called as a special kernel APC kernel-routine or directly from IofCompleteRequest() + * + * Note that we'll never see irp's flagged IRP_PAGING_IO (IRP_MOUNT_OPERATION) + * or IRP_CLOSE_OPERATION (IRP_MJ_CLOSE and IRP_MJ_CLEANUP) here since their + * cleanup/completion is fully taken care of in IoCompleteRequest. + * -Gunnar + */ +VOID +STDCALL +IoSecondStageCompletion(PKAPC Apc, + PKNORMAL_ROUTINE* NormalRoutine, + PVOID* NormalContext, + PVOID* SystemArgument1, + PVOID* SystemArgument2) +{ + PFILE_OBJECT FileObject; + PIRP Irp; + PMDL Mdl, NextMdl; + + if (Apc) DPRINT("IoSecondStageCompletition with APC: %x\n", Apc); + + /* Get data from the APC */ + FileObject = (PFILE_OBJECT)(*SystemArgument1); + Irp = CONTAINING_RECORD(Apc, IRP, Tail.Apc); + DPRINT("IoSecondStageCompletition, %x\n", Irp); + + /* Handle Buffered case first */ + if (Irp->Flags & IRP_BUFFERED_IO) + { + /* Check if we have an input buffer and if we suceeded */ + if (Irp->Flags & IRP_INPUT_OPERATION && NT_SUCCESS(Irp->IoStatus.Status)) + { + /* Copy the buffer back to the user */ + RtlCopyMemory(Irp->UserBuffer, + Irp->AssociatedIrp.SystemBuffer, + Irp->IoStatus.Information); + } + + /* Also check if we should de-allocate it */ + if (Irp->Flags & IRP_DEALLOCATE_BUFFER) + { + ExFreePool(Irp->AssociatedIrp.SystemBuffer); + } + } + + /* Now we got rid of these two... */ + Irp->Flags &= ~(IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER); + + /* Check if there's an MDL */ + if ((Mdl = Irp->MdlAddress)) + { + /* Clear all of them */ + do + { + NextMdl = Mdl->Next; + IoFreeMdl(Mdl); + Mdl = NextMdl; + } while (Mdl); + } + Irp->MdlAddress = NULL; + + if (Irp->UserIosb) + { + /* Save the IOSB Information */ + *Irp->UserIosb = Irp->IoStatus; + } + + /* Check for Success but allow failure for Async IRPs */ + if (NT_SUCCESS(Irp->IoStatus.Status) || + (Irp->PendingReturned && + !(Irp->Flags & IRP_SYNCHRONOUS_API) && + (FileObject == NULL || FileObject->Flags & FO_SYNCHRONOUS_IO))) + { + + /* Check if there's an event */ + if (Irp->UserEvent) + { + /* Signal the Event */ + KeSetEvent(Irp->UserEvent, 0, FALSE); + + /* Check if we should signal the File Object Event as well */ + if (FileObject) + { + /* Dereference the Event if this is an ASYNC IRP */ + if (!Irp->Flags & IRP_SYNCHRONOUS_API) + { + ObDereferenceObject(Irp->UserEvent); + } + + /* If the File Object is SYNC, then we need to signal its event too */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) + { + /* Signal Event */ + KeSetEvent(&FileObject->Event, 0, FALSE); + + /* Set the Status */ + FileObject->FinalStatus = Irp->IoStatus.Status; + } + } + } + else if (FileObject) + { + /* Signal the File Object Instead */ + KeSetEvent(&FileObject->Event, 0, FALSE); + + /* Set the Status */ + FileObject->FinalStatus = Irp->IoStatus.Status; + } + + /* Remove the IRP from the list of Thread Pending IRPs */ + RemoveEntryList(&Irp->ThreadListEntry); + InitializeListHead(&Irp->ThreadListEntry); + + /* Now call the User APC if one was requested */ + if (Irp->Overlay.AsynchronousParameters.UserApcRoutine != NULL) + { + KeInitializeApc(&Irp->Tail.Apc, + KeGetCurrentThread(), + CurrentApcEnvironment, + IoSecondStageCompletion_KernelApcRoutine, + IoSecondStageCompletion_RundownApcRoutine, + (PKNORMAL_ROUTINE)Irp->Overlay.AsynchronousParameters.UserApcRoutine, + Irp->RequestorMode, + Irp->Overlay.AsynchronousParameters.UserApcContext); + + KeInsertQueueApc(&Irp->Tail.Apc, + Irp->UserIosb, + NULL, + 2); + } + else if (FileObject && FileObject->CompletionContext) + { + /* Call the IO Completion Port if we have one, instead */ + IoSetIoCompletion(FileObject->CompletionContext->Port, + FileObject->CompletionContext->Key, + Irp->Overlay.AsynchronousParameters.UserApcContext, + Irp->IoStatus.Status, + Irp->IoStatus.Information, + FALSE); + } + else + { + /* Don't have anything, free it */ + IoFreeIrp(Irp); + } + + /* Dereference the File Object */ + if (FileObject) ObDereferenceObject(FileObject); + } + else + { + /* Remove the IRP from the list of Thread Pending IRPs */ + RemoveEntryList(&Irp->ThreadListEntry); + InitializeListHead(&Irp->ThreadListEntry); + + /* Signal the Events only if PendingReturned and we have a File Object */ + if (FileObject && Irp->PendingReturned) + { + /* Check for SYNC IRP */ + if (Irp->Flags & IRP_SYNCHRONOUS_API) + { + + /* Signal our event if we have one */ + if (Irp->UserEvent) + { + KeSetEvent(Irp->UserEvent, 0, FALSE); + } + else + { + /* Signal the File's Event instead */ + KeSetEvent(&FileObject->Event, 0, FALSE); + } + } + else + { + /* We'll report the Status to the File Object, not the IRP */ + FileObject->FinalStatus = Irp->IoStatus.Status; + + /* Signal the File Object ONLY if this was Async */ + KeSetEvent(&FileObject->Event, 0, FALSE); + } + } + + /* Dereference the Event if it's an ASYNC IRP on a File Object */ + if (Irp->UserEvent && !(Irp->Flags & IRP_SYNCHRONOUS_API) && FileObject) + { + if (Irp->UserEvent != &FileObject->Event) + { + ObDereferenceObject(Irp->UserEvent); + } + } + + /* Dereference the File Object */ + if (FileObject) ObDereferenceObject(FileObject); + + /* Free the IRP */ + IoFreeIrp(Irp); + } } /* EOF */ diff --git a/reactos/ntoskrnl/io/lock.c b/reactos/ntoskrnl/io/lock.c deleted file mode 100644 index 26bad31c09b..00000000000 --- a/reactos/ntoskrnl/io/lock.c +++ /dev/null @@ -1,296 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/lock.c - * PURPOSE: No purpose listed. - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - - -#define TAG_LOCK TAG('F','l','c','k') - -/* FUNCTIONS *****************************************************************/ - -static NTSTATUS STDCALL -IopLockFileCompletionRoutine( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PVOID Context - ) -{ - ExFreePool(Context); - return STATUS_SUCCESS; - // FIXME: Should I call IoFreeIrp and return STATUS_MORE_PROCESSING_REQUIRED? -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -NtLockFile ( - IN HANDLE FileHandle, - IN HANDLE EventHandle OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN PLARGE_INTEGER ByteOffset, - IN PLARGE_INTEGER Length, - IN PULONG Key, - IN BOOLEAN FailImmediatedly, - IN BOOLEAN ExclusiveLock - ) -{ - PFILE_OBJECT FileObject = NULL; - PLARGE_INTEGER LocalLength = NULL; - PKEVENT Event = NULL; - PIRP Irp = NULL; - PIO_STACK_LOCATION StackPtr; - PDEVICE_OBJECT DeviceObject; - KPROCESSOR_MODE PreviousMode; - NTSTATUS Status; - - // FIXME: instead of this, use SEH when available? - if (!Length || !ByteOffset) - { - Status = STATUS_INVALID_PARAMETER; - goto fail; - } - - PreviousMode = ExGetPreviousMode(); - - Status = ObReferenceObjectByHandle(FileHandle, - 0, - IoFileObjectType, - PreviousMode, - (PVOID*)&FileObject, - NULL); - if (!NT_SUCCESS(Status)) - { - goto fail; - } - - DeviceObject = IoGetRelatedDeviceObject(FileObject); - - Irp = IoAllocateIrp(DeviceObject->StackSize, - TRUE); - if (Irp == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto fail; - } - - if (EventHandle != NULL && !FailImmediatedly) - { - Status = ObReferenceObjectByHandle(EventHandle, - SYNCHRONIZE, - ExEventObjectType, - PreviousMode, - (PVOID*)&Event, - NULL); - if (!NT_SUCCESS(Status)) - { - goto fail; - } - } - else - { - Event = &FileObject->Event; - KeResetEvent(Event); - } - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - - Irp->RequestorMode = PreviousMode; - Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; - Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - - Irp->UserEvent = Event; - Irp->UserIosb = IoStatusBlock; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_LOCK_CONTROL; - StackPtr->MinorFunction = IRP_MN_LOCK; - StackPtr->FileObject = FileObject; - - if (ExclusiveLock) - StackPtr->Flags |= SL_EXCLUSIVE_LOCK; - - if (FailImmediatedly) - StackPtr->Flags |= SL_FAIL_IMMEDIATELY; - - LocalLength = ExAllocatePoolWithTag(NonPagedPool, - sizeof(LARGE_INTEGER), - TAG_LOCK); - if (!LocalLength) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto fail; - } - - *LocalLength = *Length; - - StackPtr->Parameters.LockControl.Length = LocalLength; - StackPtr->Parameters.LockControl.ByteOffset = *ByteOffset; - StackPtr->Parameters.LockControl.Key = Key ? *Key : 0; - - IoSetCompletionRoutine(Irp, - IopLockFileCompletionRoutine, - LocalLength, - TRUE, - TRUE, - TRUE); - - /* Can't touch FileObject after IoCallDriver since it might be freed */ - Status = IofCallDriver(DeviceObject, Irp); - if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - Status = KeWaitForSingleObject(Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - - if (Status != STATUS_WAIT_0) - { - DPRINT1("NtLockFile -> KeWaitForSingleObject failed!\n"); - /* - * FIXME: Should do some special processing here if alertable wait - * was interupted by user apc or a thread alert (STATUS_ALERTED, STATUS_USER_APC) - */ - return Status; /* Set status to something else? */ - } - - Status = IoStatusBlock->Status; - } - - return Status; - -fail:; - if (LocalLength) - ExFreePool(LocalLength); - - if (Irp) - IoFreeIrp(Irp); - - if (Event) - ObDereferenceObject(Event); - - if (FileObject) - ObDereferenceObject(FileObject); - - return Status; -} - - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -NtUnlockFile ( - IN HANDLE FileHandle, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN PLARGE_INTEGER ByteOffset, - IN PLARGE_INTEGER Length, - OUT PULONG Key OPTIONAL - ) -{ - PFILE_OBJECT FileObject = NULL; - PLARGE_INTEGER LocalLength = NULL; - PIRP Irp = NULL; - PIO_STACK_LOCATION StackPtr; - PDEVICE_OBJECT DeviceObject; - KPROCESSOR_MODE PreviousMode; - NTSTATUS Status; - - // FIXME: instead of this, use SEH when available - if (!Length || !ByteOffset) - { - Status = STATUS_INVALID_PARAMETER; - goto fail; - } - - PreviousMode = ExGetPreviousMode(); - - /* - * BUGBUG: ObReferenceObjectByHandle fails if DesiredAccess=0 and mode=UserMode - * It should ONLY fail if we desire an access that conflict with granted access! - */ - Status = ObReferenceObjectByHandle(FileHandle, - 0, //FILE_READ_DATA,//BUGBUG: have to use something...but shouldn't have to! - IoFileObjectType, - PreviousMode, - (PVOID*)&FileObject, - NULL); - if (!NT_SUCCESS(Status)) - { - goto fail; - } - - DeviceObject = IoGetRelatedDeviceObject(FileObject); - - Irp = IoAllocateIrp(DeviceObject->StackSize, - TRUE); - if (Irp == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto fail; - } - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = PreviousMode; - Irp->UserIosb = IoStatusBlock; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_LOCK_CONTROL; - StackPtr->MinorFunction = IRP_MN_UNLOCK_SINGLE; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = FileObject; - - LocalLength = ExAllocatePoolWithTag(NonPagedPool, - sizeof(LARGE_INTEGER), - TAG_LOCK); - if (!LocalLength) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto fail; - } - - *LocalLength = *Length; - - StackPtr->Parameters.LockControl.Length = LocalLength; - StackPtr->Parameters.LockControl.ByteOffset = *ByteOffset; - StackPtr->Parameters.LockControl.Key = Key ? *Key : 0; - - /* Allways synchronous */ - Status = IofCallDriver(DeviceObject, Irp); - - ExFreePool(LocalLength); - - return Status; - -fail:; - if (LocalLength) - ExFreePool(LocalLength); - - if (Irp) - IoFreeIrp(Irp); - - if (FileObject) - ObDereferenceObject(FileObject); - - return Status; -} diff --git a/reactos/ntoskrnl/io/mailslot.c b/reactos/ntoskrnl/io/mailslot.c deleted file mode 100644 index 5d62b6b6643..00000000000 --- a/reactos/ntoskrnl/io/mailslot.c +++ /dev/null @@ -1,66 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/mailslot.c - * PURPOSE: No purpose listed. - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -NTSTATUS STDCALL -NtCreateMailslotFile(OUT PHANDLE FileHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN ULONG CreateOptions, - IN ULONG MailslotQuota, - IN ULONG MaxMessageSize, - IN PLARGE_INTEGER TimeOut) -{ - MAILSLOT_CREATE_PARAMETERS Buffer; - - DPRINT("NtCreateMailslotFile(FileHandle %x, DesiredAccess %x, " - "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", - FileHandle,DesiredAccess,ObjectAttributes, - ObjectAttributes->ObjectName->Buffer); - - ASSERT_IRQL(PASSIVE_LEVEL); - - if (TimeOut != NULL) - { - Buffer.ReadTimeout.QuadPart = TimeOut->QuadPart; - Buffer.TimeoutSpecified = TRUE; - } - else - { - Buffer.TimeoutSpecified = FALSE; - } - Buffer.MailslotQuota = MailslotQuota; - Buffer.MaximumMessageSize = MaxMessageSize; - - return IoCreateFile(FileHandle, - DesiredAccess, - ObjectAttributes, - IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - FILE_SHARE_READ | FILE_SHARE_WRITE, - FILE_CREATE, - CreateOptions, - NULL, - 0, - CreateFileTypeMailslot, - (PVOID)&Buffer, - 0); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/npipe.c b/reactos/ntoskrnl/io/npipe.c deleted file mode 100644 index cd3bd499b79..00000000000 --- a/reactos/ntoskrnl/io/npipe.c +++ /dev/null @@ -1,76 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/npipe.c - * PURPOSE: Named pipe helper function - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -NTSTATUS STDCALL -NtCreateNamedPipeFile(PHANDLE FileHandle, - ACCESS_MASK DesiredAccess, - POBJECT_ATTRIBUTES ObjectAttributes, - PIO_STATUS_BLOCK IoStatusBlock, - ULONG ShareAccess, - ULONG CreateDisposition, - ULONG CreateOptions, - ULONG NamedPipeType, - ULONG ReadMode, - ULONG CompletionMode, - ULONG MaximumInstances, - ULONG InboundQuota, - ULONG OutboundQuota, - PLARGE_INTEGER DefaultTimeout) -{ - NAMED_PIPE_CREATE_PARAMETERS Buffer; - - DPRINT("NtCreateNamedPipeFile(FileHandle %x, DesiredAccess %x, " - "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", - FileHandle,DesiredAccess,ObjectAttributes, - ObjectAttributes->ObjectName->Buffer); - - ASSERT_IRQL(PASSIVE_LEVEL); - - if (DefaultTimeout != NULL) - { - Buffer.DefaultTimeout.QuadPart = DefaultTimeout->QuadPart; - Buffer.TimeoutSpecified = TRUE; - } - else - { - Buffer.TimeoutSpecified = FALSE; - } - Buffer.NamedPipeType = NamedPipeType; - Buffer.ReadMode = ReadMode; - Buffer.CompletionMode = CompletionMode; - Buffer.MaximumInstances = MaximumInstances; - Buffer.InboundQuota = InboundQuota; - Buffer.OutboundQuota = OutboundQuota; - - return IoCreateFile(FileHandle, - DesiredAccess, - ObjectAttributes, - IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - ShareAccess, - CreateDisposition, - CreateOptions, - NULL, - 0, - CreateFileTypeNamedPipe, - (PVOID)&Buffer, - 0); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/page.c b/reactos/ntoskrnl/io/page.c deleted file mode 100644 index 49734f0f4fc..00000000000 --- a/reactos/ntoskrnl/io/page.c +++ /dev/null @@ -1,134 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/page.c - * PURPOSE: No purpose listed. - * - * PROGRAMMERS: No programmer listed. - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -NTSTATUS STDCALL -IoPageWrite(PFILE_OBJECT FileObject, - PMDL Mdl, - PLARGE_INTEGER Offset, - PKEVENT Event, - PIO_STATUS_BLOCK StatusBlock) -{ - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - - DPRINT("IoPageWrite(FileObject %x, Mdl %x)\n", - FileObject, Mdl); - - Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_WRITE, - FileObject->DeviceObject, - Mdl, - Offset, - Event, - StatusBlock, - TRUE); - if (Irp == NULL) - { - return (STATUS_INSUFFICIENT_RESOURCES); - } - Irp->Flags = IRP_NOCACHE|IRP_PAGING_IO; - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - StackPtr->Parameters.Write.Length = MmGetMdlByteCount(Mdl); - DPRINT("Before IoCallDriver\n"); - Status = IofCallDriver(FileObject->DeviceObject,Irp); - DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING); - return(Status); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -IoPageRead(PFILE_OBJECT FileObject, - PMDL Mdl, - PLARGE_INTEGER Offset, - PKEVENT Event, - PIO_STATUS_BLOCK StatusBlock) -{ - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - - DPRINT("IoPageRead(FileObject %x, Mdl %x)\n", - FileObject, Mdl); - - Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_READ, - FileObject->DeviceObject, - Mdl, - Offset, - Event, - StatusBlock, - TRUE); - if (Irp == NULL) - { - return (STATUS_INSUFFICIENT_RESOURCES); - } - Irp->Flags = IRP_NOCACHE|IRP_PAGING_IO; - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - StackPtr->Parameters.Read.Length = MmGetMdlByteCount(Mdl); - DPRINT("Before IoCallDriver\n"); - Status = IofCallDriver(FileObject->DeviceObject, Irp); - DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING); - - return(Status); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -IoSynchronousPageWrite (PFILE_OBJECT FileObject, - PMDL Mdl, - PLARGE_INTEGER Offset, - PKEVENT Event, - PIO_STATUS_BLOCK StatusBlock) -{ - PIRP Irp; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - - DPRINT("IoSynchronousPageWrite(FileObject %x, Mdl %x)\n", - FileObject, Mdl); - - Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_WRITE, - FileObject->DeviceObject, - Mdl, - Offset, - Event, - StatusBlock, - TRUE); - if (Irp == NULL) - { - return (STATUS_INSUFFICIENT_RESOURCES); - } - Irp->Flags = IRP_NOCACHE|IRP_PAGING_IO|IRP_SYNCHRONOUS_PAGING_IO; - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - StackPtr->Parameters.Write.Length = MmGetMdlByteCount(Mdl); - DPRINT("Before IoCallDriver\n"); - Status = IofCallDriver(FileObject->DeviceObject,Irp); - DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING); - return(Status); -} - - -/* EOF */ diff --git a/reactos/ntoskrnl/io/parttab.c b/reactos/ntoskrnl/io/parttab.c deleted file mode 100644 index 3bab16d9c7a..00000000000 --- a/reactos/ntoskrnl/io/parttab.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/parttab.c - * PURPOSE: Handling fixed disks (partition table functions) - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -NTSTATUS FASTCALL -IoReadPartitionTable(PDEVICE_OBJECT DeviceObject, - ULONG SectorSize, - BOOLEAN ReturnRecognizedPartitions, - PDRIVE_LAYOUT_INFORMATION *PartitionBuffer) -{ - return(HalIoReadPartitionTable(DeviceObject, - SectorSize, - ReturnRecognizedPartitions, - PartitionBuffer)); -} - - -NTSTATUS FASTCALL -IoSetPartitionInformation(PDEVICE_OBJECT DeviceObject, - ULONG SectorSize, - ULONG PartitionNumber, - ULONG PartitionType) -{ - return(HalIoSetPartitionInformation(DeviceObject, - SectorSize, - PartitionNumber, - PartitionType)); -} - - -NTSTATUS FASTCALL -IoWritePartitionTable(PDEVICE_OBJECT DeviceObject, - ULONG SectorSize, - ULONG SectorsPerTrack, - ULONG NumberOfHeads, - PDRIVE_LAYOUT_INFORMATION PartitionBuffer) -{ - return(HalIoWritePartitionTable(DeviceObject, - SectorSize, - SectorsPerTrack, - NumberOfHeads, - PartitionBuffer)); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr.c index d706ba06031..e06433b36b9 100644 --- a/reactos/ntoskrnl/io/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr.c @@ -1499,9 +1499,22 @@ IopActionInitChildServices( PDRIVER_OBJECT DriverObject; Status = IopLoadServiceModule(&DeviceNode->ServiceName, &ModuleObject); - if (NT_SUCCESS(Status)) + if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED) { - Status = IopInitializeDriverModule(DeviceNode, ModuleObject, FALSE, &DriverObject); + if (Status != STATUS_IMAGE_ALREADY_LOADED) + Status = IopInitializeDriverModule(DeviceNode, ModuleObject, + &DeviceNode->ServiceName, FALSE, &DriverObject); + else + { + /* get existing DriverObject pointer */ + Status = IopCreateDriverObject( + &DriverObject, + &DeviceNode->ServiceName, + OBJ_OPENIF, + FALSE, + ModuleObject->Base, + ModuleObject->Length); + } if (NT_SUCCESS(Status)) { /* Attach lower level filter drivers. */ @@ -1786,7 +1799,7 @@ PnpInit(VOID) * Create root device node */ - Status = IopCreateDriverObject(&IopRootDriverObject, NULL, FALSE, NULL, 0); + Status = IopCreateDriverObject(&IopRootDriverObject, NULL, 0, FALSE, NULL, 0); if (!NT_SUCCESS(Status)) { CPRINT("IoCreateDriverObject() failed\n"); diff --git a/reactos/ntoskrnl/io/pnpnotify.c b/reactos/ntoskrnl/io/pnpnotify.c index 1cd818d2a5e..a3d5a0d2b9c 100644 --- a/reactos/ntoskrnl/io/pnpnotify.c +++ b/reactos/ntoskrnl/io/pnpnotify.c @@ -6,13 +6,32 @@ * PURPOSE: Plug & Play notification functions * * PROGRAMMERS: Filip Navara (xnavara@volny.cz) + * Hervé Poussineau (hpoussin@reactos.com) */ /* INCLUDES ******************************************************************/ +#define NDEBUG #include #include +/* TYPES *******************************************************************/ + +typedef struct _PNP_NOTIFY_ENTRY +{ + LIST_ENTRY PnpNotifyList; + IO_NOTIFICATION_EVENT_CATEGORY EventCategory; + PVOID Context; + UNICODE_STRING Guid; + PFILE_OBJECT FileObject; + PDRIVER_NOTIFICATION_CALLBACK_ROUTINE PnpNotificationProc; +} PNP_NOTIFY_ENTRY, *PPNP_NOTIFY_ENTRY; + +static KGUARDED_MUTEX PnpNotifyListLock; +static LIST_ENTRY PnpNotifyListHead; + +#define TAG_PNP_NOTIFY TAG('P', 'n', 'P', 'N') + /* FUNCTIONS *****************************************************************/ /* @@ -32,33 +51,262 @@ IoPnPDeliverServicePowerNotification( } /* - * @unimplemented + * @implemented */ NTSTATUS STDCALL IoRegisterPlugPlayNotification( - IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, - IN ULONG EventCategoryFlags, - IN PVOID EventCategoryData OPTIONAL, - IN PDRIVER_OBJECT DriverObject, - IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, - IN PVOID Context, - OUT PVOID *NotificationEntry) + IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, + IN ULONG EventCategoryFlags, + IN PVOID EventCategoryData OPTIONAL, + IN PDRIVER_OBJECT DriverObject, + IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, + IN PVOID Context, + OUT PVOID *NotificationEntry) { - DPRINT("IoRegisterPlugPlayNotification called (UNIMPLEMENTED)\n"); - return STATUS_NOT_IMPLEMENTED; + PPNP_NOTIFY_ENTRY Entry; + PWSTR SymbolicLinkList; + NTSTATUS Status; + + PAGED_CODE(); + + DPRINT("IoRegisterPlugPlayNotification(EventCategory 0x%x, EventCategoryFlags 0x%lx, DriverObject %p) called.\n", + EventCategory, + EventCategoryFlags, + DriverObject); + + ObReferenceObject(DriverObject); + + /* Try to allocate entry for notification before sending any notification */ + Entry = ExAllocatePoolWithTag( + NonPagedPool, + sizeof(PNP_NOTIFY_ENTRY), + TAG_PNP_NOTIFY); + if (!Entry) + { + DPRINT("ExAllocatePool() failed\n"); + ObDereferenceObject(DriverObject); + return STATUS_INSUFFICIENT_RESOURCES; + } + + if (EventCategory == EventCategoryTargetDeviceChange + && EventCategoryFlags & PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES) + { + Status = IoGetDeviceInterfaces( + (LPGUID)EventCategoryData, + NULL, /* PhysicalDeviceObject OPTIONAL */ + 0, /* Flags */ + &SymbolicLinkList); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoGetDeviceInterfaces() failed with status 0x%08lx\n", Status); + ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); + ObDereferenceObject(DriverObject); + return Status; + } + /* FIXME: enumerate SymbolicLinkList */ + DPRINT1("IoRegisterPlugPlayNotification(): need to send notifications for existing interfaces!\n"); + ExFreePool(SymbolicLinkList); + } + + Entry->PnpNotificationProc = CallbackRoutine; + Entry->EventCategory = EventCategory; + Entry->Context = Context; + switch (EventCategory) + { + case EventCategoryDeviceInterfaceChange: + { + Status = RtlStringFromGUID(EventCategoryData, &Entry->Guid); + if (!NT_SUCCESS(Status)) + { + ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); + ObDereferenceObject(DriverObject); + return Status; + } + break; + } + case EventCategoryHardwareProfileChange: + { + /* nothing to do */ + break; + } + case EventCategoryTargetDeviceChange: + { + Entry->FileObject = (PFILE_OBJECT)EventCategoryData; + break; + } + default: + { + DPRINT1("IoRegisterPlugPlayNotification(): unknown EventCategory 0x%x UNIMPLEMENTED\n", EventCategory); + break; + } + } + + KeAcquireGuardedMutex(&PnpNotifyListLock); + InsertHeadList(&PnpNotifyListHead, + &Entry->PnpNotifyList); + KeReleaseGuardedMutex(&PnpNotifyListLock); + + DPRINT("IoRegisterPlugPlayNotification() returns NotificationEntry %p\n", + Entry); + *NotificationEntry = Entry; + return STATUS_SUCCESS; } /* - * @unimplemented + * @implemented */ NTSTATUS STDCALL IoUnregisterPlugPlayNotification( - IN PVOID NotificationEntry) + IN PVOID NotificationEntry) { - DPRINT("IoUnregisterPlugPlayNotification called (UNIMPLEMENTED)\n"); - return STATUS_NOT_IMPLEMENTED; + PPNP_NOTIFY_ENTRY Entry; + + PAGED_CODE(); + + Entry = (PPNP_NOTIFY_ENTRY)NotificationEntry; + DPRINT("IoUnregisterPlugPlayNotification(NotificationEntry %p) called\n", + Entry); + + KeAcquireGuardedMutex(&PnpNotifyListLock); + RtlFreeUnicodeString(&Entry->Guid); + RemoveEntryList(&Entry->PnpNotifyList); + KeReleaseGuardedMutex(&PnpNotifyListLock); + + return STATUS_SUCCESS; +} + +VOID +IopNotifyPlugPlayNotification( + IN PDEVICE_OBJECT DeviceObject, + IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, + IN GUID* Event, + IN PVOID EventCategoryData1, + IN PVOID EventCategoryData2) +{ + PPNP_NOTIFY_ENTRY ChangeEntry; + PLIST_ENTRY Entry; + PVOID NotificationStructure; + BOOLEAN CallCurrentEntry; + + ASSERT(DeviceObject); + + KeAcquireGuardedMutex(&PnpNotifyListLock); + if (IsListEmpty(&PnpNotifyListHead)) + { + KeReleaseGuardedMutex(&PnpNotifyListLock); + return; + } + + switch (EventCategory) + { + case EventCategoryDeviceInterfaceChange: + { + PDEVICE_INTERFACE_CHANGE_NOTIFICATION NotificationInfos; + NotificationStructure = NotificationInfos = ExAllocatePoolWithTag( + PagedPool, + sizeof(DEVICE_INTERFACE_CHANGE_NOTIFICATION), + TAG_PNP_NOTIFY); + NotificationInfos->Version = 1; + NotificationInfos->Size = sizeof(DEVICE_INTERFACE_CHANGE_NOTIFICATION); + RtlCopyMemory(&NotificationInfos->Event, Event, sizeof(GUID)); + RtlCopyMemory(&NotificationInfos->InterfaceClassGuid, EventCategoryData1, sizeof(GUID)); + NotificationInfos->SymbolicLinkName = (PUNICODE_STRING)EventCategoryData2; + break; + } + case EventCategoryHardwareProfileChange: + { + PHWPROFILE_CHANGE_NOTIFICATION NotificationInfos; + NotificationStructure = NotificationInfos = ExAllocatePoolWithTag( + PagedPool, + sizeof(HWPROFILE_CHANGE_NOTIFICATION), + TAG_PNP_NOTIFY); + NotificationInfos->Version = 1; + NotificationInfos->Size = sizeof(HWPROFILE_CHANGE_NOTIFICATION); + RtlCopyMemory(&NotificationInfos->Event, Event, sizeof(GUID)); + break; + } + case EventCategoryTargetDeviceChange: + { + PTARGET_DEVICE_REMOVAL_NOTIFICATION NotificationInfos; + NotificationStructure = NotificationInfos = ExAllocatePoolWithTag( + PagedPool, + sizeof(TARGET_DEVICE_REMOVAL_NOTIFICATION), + TAG_PNP_NOTIFY); + NotificationInfos->Version = 1; + NotificationInfos->Size = sizeof(TARGET_DEVICE_REMOVAL_NOTIFICATION); + RtlCopyMemory(&NotificationInfos->Event, Event, sizeof(GUID)); + NotificationInfos->FileObject = (PFILE_OBJECT)EventCategoryData1; + break; + } + default: + { + DPRINT1("IopNotifyPlugPlayNotification(): unknown EventCategory 0x%x UNIMPLEMENTED\n", EventCategory); + return; + } + } + + /* Loop through procedures registred in PnpNotifyListHead + * list to find those that meet some criteria. + */ + + Entry = PnpNotifyListHead.Flink; + while (Entry != &PnpNotifyListHead) + { + ChangeEntry = CONTAINING_RECORD(Entry, PNP_NOTIFY_ENTRY, PnpNotifyList); + CallCurrentEntry = FALSE; + + switch (EventCategory) + { + case EventCategoryDeviceInterfaceChange: + { + if (ChangeEntry->EventCategory == EventCategory + && RtlCompareUnicodeString(&ChangeEntry->Guid, (PUNICODE_STRING)EventCategoryData1, FALSE) == 0) + { + CallCurrentEntry = TRUE; + } + break; + } + case EventCategoryHardwareProfileChange: + { + CallCurrentEntry = TRUE; + break; + } + case EventCategoryTargetDeviceChange: + { + if (ChangeEntry->FileObject == (PFILE_OBJECT)EventCategoryData1) + CallCurrentEntry = TRUE; + } + default: + { + DPRINT1("IopNotifyPlugPlayNotification(): unknown EventCategory 0x%x UNIMPLEMENTED\n", EventCategory); + break; + } + } + + if (CallCurrentEntry) + { + /* Call entry into new allocated memory */ + DPRINT("IopNotifyPlugPlayNotification(): found suitable callback %p\n", + ChangeEntry); + + (ChangeEntry->PnpNotificationProc)( + NotificationStructure, + ChangeEntry->Context); + } + + Entry = Entry->Flink; + } + KeReleaseGuardedMutex(&PnpNotifyListLock); + ExFreePoolWithTag(NotificationStructure, TAG_PNP_NOTIFY); +} + +VOID INIT_FUNCTION +IopInitPnpNotificationImplementation(VOID) +{ + KeInitializeGuardedMutex(&PnpNotifyListLock); + InitializeListHead(&PnpNotifyListHead); } /* EOF */ diff --git a/reactos/ntoskrnl/io/pnpreport.c b/reactos/ntoskrnl/io/pnpreport.c index 775e1da6997..b3db2dc21ba 100644 --- a/reactos/ntoskrnl/io/pnpreport.c +++ b/reactos/ntoskrnl/io/pnpreport.c @@ -81,42 +81,18 @@ IoReportResourceForDetection( OUT PBOOLEAN ConflictDetected) { *ConflictDetected = FALSE; - DPRINT1("IoReportResourceForDetection unimplemented\n"); + DPRINT1("IoReportResourceForDetection partly implemented\n"); - /* HACK: check if serial debug output is enabled. If yes, - * prevent serial port driver to detect this serial port - * by indicating a conflict - */ - if ((KdDebugState & KD_DEBUG_SERIAL) && DriverList != NULL) + /* FIXME: Manually indicate conflicts with KD Ports */ + if (DriverList) { - ULONG ComPortBase = 0; - ULONG i; - PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; - - switch (LogPortInfo.ComPort) - { - case 1: ComPortBase = 0x3f8; break; - case 2: ComPortBase = 0x2f8; break; - case 3: ComPortBase = 0x3e8; break; - case 4: ComPortBase = 0x2e8; break; - } - - /* search for this port address in DriverList */ - for (i = 0; i < DriverList->List[0].PartialResourceList.Count; i++) - { - ResourceDescriptor = &DriverList->List[0].PartialResourceList.PartialDescriptors[i]; - if (ResourceDescriptor->Type == CmResourceTypePort) + if (KdpDetectConflicts(DriverList)) { - if (ResourceDescriptor->u.Port.Start.u.LowPart <= ComPortBase - && ResourceDescriptor->u.Port.Start.u.LowPart + ResourceDescriptor->u.Port.Length > ComPortBase) - { - *ConflictDetected = TRUE; - return STATUS_CONFLICTING_ADDRESSES; - } + *ConflictDetected = TRUE; + return STATUS_CONFLICTING_ADDRESSES; } - } } - + if (PopSystemPowerDeviceNode != NULL && DriverListSize > 0) { /* We hope legacy devices will be enumerated by ACPI */ diff --git a/reactos/ntoskrnl/io/pnproot.c b/reactos/ntoskrnl/io/pnproot.c index 96191e9dae1..43b00655a05 100644 --- a/reactos/ntoskrnl/io/pnproot.c +++ b/reactos/ntoskrnl/io/pnproot.c @@ -130,7 +130,7 @@ PnpRootCreateDevice( sizeof(PNPROOT_PDO_DEVICE_EXTENSION), NULL, FILE_DEVICE_CONTROLLER, - 0, + FILE_AUTOGENERATED_DEVICE_NAME, FALSE, &Device->Pdo); if (!NT_SUCCESS(Status)) { @@ -634,7 +634,7 @@ PnpRootQueryBusRelations( sizeof(PNPROOT_PDO_DEVICE_EXTENSION), NULL, FILE_DEVICE_CONTROLLER, - 0, + FILE_AUTOGENERATED_DEVICE_NAME, FALSE, &Device->Pdo); if (!NT_SUCCESS(Status)) diff --git a/reactos/ntoskrnl/io/process.c b/reactos/ntoskrnl/io/process.c deleted file mode 100644 index 4d04d24fa0f..00000000000 --- a/reactos/ntoskrnl/io/process.c +++ /dev/null @@ -1,97 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/process.c - * PURPOSE: Process functions that, bizarrely, are in the iomgr - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -PVOID STDCALL -IoGetInitialStack(VOID) -{ - return(PsGetCurrentThread()->Tcb.InitialStack); -} - - -/* - * @implemented - */ -VOID STDCALL -IoGetStackLimits(OUT PULONG LowLimit, - OUT PULONG HighLimit) -{ - *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit; - *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase; -} - -/* - * @unimplemented - */ -BOOLEAN -STDCALL -IoIsSystemThread( - IN PETHREAD Thread - ) -{ - UNIMPLEMENTED; - return FALSE; -} - -/* - * @implemented - */ -PEPROCESS STDCALL -IoThreadToProcess(IN PETHREAD Thread) -{ - return(Thread->ThreadsProcess); -} - - -/* - * @implemented - */ -PEPROCESS STDCALL -IoGetRequestorProcess(IN PIRP Irp) -{ - return(Irp->Tail.Overlay.Thread->ThreadsProcess); -} - - -/********************************************************************** - * NAME EXPORTED - * IoSetThreadHardErrorMode@4 - * - * ARGUMENTS - * HardErrorEnabled - * TRUE : enable hard errors processing; - * FALSE: do NOT process hard errors. - * - * RETURN VALUE - * Previous value for the current thread's hard errors - * processing policy. - * - * @implemented - */ -BOOLEAN STDCALL -IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled) -{ - BOOLEAN PreviousHEM = (BOOLEAN)(NtCurrentTeb()->HardErrorDisabled); - - NtCurrentTeb()->HardErrorDisabled = ((TRUE == HardErrorEnabled) ? FALSE : TRUE); - - return((TRUE == PreviousHEM) ? FALSE : TRUE); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/queue.c b/reactos/ntoskrnl/io/queue.c deleted file mode 100644 index 543f433e4bb..00000000000 --- a/reactos/ntoskrnl/io/queue.c +++ /dev/null @@ -1,156 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/queue.c - * PURPOSE: Implement device queueing - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES ******************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -VOID -STDCALL -IoStartNextPacketByKey(PDEVICE_OBJECT DeviceObject, - BOOLEAN Cancelable, - ULONG Key) -/* - * FUNCTION: Dequeues the next packet from the given device object's - * associated device queue according to a specified sort-key value and calls - * the drivers StartIo routine with that IRP - * ARGUMENTS: - * DeviceObject = Device object for which the irp is to dequeued - * Cancelable = True if IRPs in the key can be canceled - * Key = Sort key specifing which entry to remove from the queue - */ -{ - PKDEVICE_QUEUE_ENTRY entry; - PIRP Irp; - - entry = KeRemoveByKeyDeviceQueue(&DeviceObject->DeviceQueue, - Key); - - if (entry != NULL) - { - Irp = CONTAINING_RECORD(entry, - IRP, - Tail.Overlay.DeviceQueueEntry); - DeviceObject->CurrentIrp = Irp; - DPRINT("Next irp is %x\n", Irp); - DeviceObject->DriverObject->DriverStartIo(DeviceObject, Irp); - } - else - { - DPRINT("No next irp\n"); - DeviceObject->CurrentIrp = NULL; - } -} - -/* - * @implemented - */ -VOID -STDCALL -IoStartNextPacket(PDEVICE_OBJECT DeviceObject, BOOLEAN Cancelable) -/* - * FUNCTION: Removes the next packet from the device's queue and calls - * the driver's StartIO - * ARGUMENTS: - * DeviceObject = Device - * Cancelable = True if irps in the queue can be canceled - */ -{ - PKDEVICE_QUEUE_ENTRY entry; - PIRP Irp; - - DPRINT("IoStartNextPacket(DeviceObject %x, Cancelable %d)\n", - DeviceObject,Cancelable); - - entry = KeRemoveDeviceQueue(&DeviceObject->DeviceQueue); - - if (entry!=NULL) - { - Irp = CONTAINING_RECORD(entry,IRP,Tail.Overlay.DeviceQueueEntry); - DeviceObject->CurrentIrp = Irp; - DeviceObject->DriverObject->DriverStartIo(DeviceObject,Irp); - } - else - { - DeviceObject->CurrentIrp = NULL; - } -} - -/* - * @implemented - */ -VOID -STDCALL -IoStartPacket(PDEVICE_OBJECT DeviceObject, - PIRP Irp, PULONG Key, PDRIVER_CANCEL CancelFunction) -/* - * FUNCTION: Either call the device's StartIO routine with the packet or, - * if the device is busy, queue it. - * ARGUMENTS: - * DeviceObject = Device to start the packet on - * Irp = Irp to queue - * Key = Where to insert the irp - * If zero then insert in the tail of the queue - * CancelFunction = Optional function to cancel the irqp - */ -{ - BOOLEAN stat; - KIRQL oldirql; - - DPRINT("IoStartPacket(Irp %x)\n", Irp); - - ASSERT_IRQL(DISPATCH_LEVEL); - - IoAcquireCancelSpinLock(&oldirql); - - if (CancelFunction != NULL) - { - Irp->CancelRoutine = CancelFunction; - } - - if (Key!=0) - { - stat = KeInsertByKeyDeviceQueue(&DeviceObject->DeviceQueue, - &Irp->Tail.Overlay.DeviceQueueEntry, - *Key); - } - else - { - stat = KeInsertDeviceQueue(&DeviceObject->DeviceQueue, - &Irp->Tail.Overlay.DeviceQueueEntry); - } - - - if (!stat) - { - IoReleaseCancelSpinLock(DISPATCH_LEVEL); - DeviceObject->CurrentIrp = Irp; - DeviceObject->DriverObject->DriverStartIo(DeviceObject,Irp); - if (oldirql < DISPATCH_LEVEL) - { - KeLowerIrql(oldirql); - } - } - else - { - IoReleaseCancelSpinLock(oldirql); - } - -} - - -/* EOF */ diff --git a/reactos/ntoskrnl/io/rw.c b/reactos/ntoskrnl/io/rw.c deleted file mode 100644 index 8acddcae173..00000000000 --- a/reactos/ntoskrnl/io/rw.c +++ /dev/null @@ -1,405 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/rw.c - * PURPOSE: Implements read/write APIs - * - * PROGRAMMERS: David Welch (welch@cwcom.net) - */ - -/* INCLUDES ****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS ***************************************************************/ - - -/********************************************************************** - * NAME EXPORTED - * NtReadFile - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * @implemented - */ -NTSTATUS STDCALL -NtReadFile (IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID Buffer, - IN ULONG Length, - IN PLARGE_INTEGER ByteOffset OPTIONAL, /* NOT optional for asynch. operations! */ - IN PULONG Key OPTIONAL) -{ - NTSTATUS Status; - PFILE_OBJECT FileObject; - PIRP Irp = NULL; - PIO_STACK_LOCATION StackPtr; - KPROCESSOR_MODE PreviousMode; - PKEVENT EventObject = NULL; - - DPRINT("NtReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, " - "IoStatusBlock %x)\n", FileHandle, Buffer, Length, ByteOffset, - IoStatusBlock); - - if (IoStatusBlock == NULL) - return STATUS_ACCESS_VIOLATION; - - PreviousMode = ExGetPreviousMode(); - - Status = ObReferenceObjectByHandle(FileHandle, - FILE_READ_DATA, - IoFileObjectType, - PreviousMode, - (PVOID*)&FileObject, - NULL); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - if (ByteOffset == NULL || - (ByteOffset->u.LowPart == FILE_USE_FILE_POINTER_POSITION && - ByteOffset->u.HighPart == 0xffffffff)) - { - /* a valid ByteOffset is required if asynch. op. */ - if (!(FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - DPRINT1("NtReadFile: missing ByteOffset for asynch. op\n"); - ObDereferenceObject(FileObject); - return STATUS_INVALID_PARAMETER; - } - - ByteOffset = &FileObject->CurrentByteOffset; - } - - if (Event != NULL) - { - Status = ObReferenceObjectByHandle(Event, - SYNCHRONIZE, - ExEventObjectType, - PreviousMode, - (PVOID*)&EventObject, - NULL); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject(FileObject); - return Status; - } - - KeClearEvent(EventObject); - } - - _SEH_TRY - { - Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, - FileObject->DeviceObject, - Buffer, - Length, - ByteOffset, - EventObject, - IoStatusBlock); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if (!NT_SUCCESS(Status) || Irp == NULL) - { - if (Event) - { - ObDereferenceObject(&EventObject); - } - ObDereferenceObject(FileObject); - if (Irp) - { - IoFreeIrp(Irp); - } - return NT_SUCCESS(Status) ? STATUS_INSUFFICIENT_RESOURCES : Status; - } - - KeClearEvent(&FileObject->Event); - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - - Irp->RequestorMode = PreviousMode; - - Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; - Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - StackPtr->Parameters.Read.Key = Key ? *Key : 0; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - Status = KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - if (Status != STATUS_WAIT_0) - { - /* Wait failed. */ - return Status; - } - - Status = IoStatusBlock->Status; - } - - return Status; -} - - -/********************************************************************** - * NAME EXPORTED - * NtWriteFile - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * @implemented - */ -NTSTATUS STDCALL -NtWriteFile (IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN PVOID Buffer, - IN ULONG Length, - IN PLARGE_INTEGER ByteOffset OPTIONAL, /* NOT optional for asynch. operations! */ - IN PULONG Key OPTIONAL) -{ - OBJECT_HANDLE_INFORMATION HandleInformation; - NTSTATUS Status; - PFILE_OBJECT FileObject; - PIRP Irp = NULL; - PIO_STACK_LOCATION StackPtr; - KPROCESSOR_MODE PreviousMode; - PKEVENT EventObject = NULL; - LARGE_INTEGER Offset; - - DPRINT("NtWriteFile(FileHandle %x Buffer %x Length %x ByteOffset %x, " - "IoStatusBlock %x)\n", FileHandle, Buffer, Length, ByteOffset, - IoStatusBlock); - - if (IoStatusBlock == NULL) - return STATUS_ACCESS_VIOLATION; - - PreviousMode = ExGetPreviousMode(); - - Status = ObReferenceObjectByHandle(FileHandle, - 0, - IoFileObjectType, - PreviousMode, - (PVOID*)&FileObject, - &HandleInformation); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - /* Must have FILE_WRITE_DATA | FILE_APPEND_DATA access */ - if (!(HandleInformation.GrantedAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA))) - { - DPRINT1("Invalid access rights\n"); - ObDereferenceObject(FileObject); - return STATUS_ACCESS_DENIED; - } - - if (HandleInformation.GrantedAccess & FILE_WRITE_DATA) - { - if (ByteOffset == NULL) - { - /* a valid ByteOffset is required if asynch. op. */ - if (!(FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - DPRINT1("NtWriteFile: missing ByteOffset for asynch. op\n"); - ObDereferenceObject(FileObject); - return STATUS_INVALID_PARAMETER; - } - - ByteOffset = &FileObject->CurrentByteOffset; - } - } - else if (HandleInformation.GrantedAccess & FILE_APPEND_DATA) - { - /* a valid ByteOffset is required if asynch. op. */ - if (!(FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - DPRINT1("NtWriteFile: missing ByteOffset for asynch. op\n"); - ObDereferenceObject(FileObject); - return STATUS_INVALID_PARAMETER; - } - - Offset.u.LowPart = FILE_WRITE_TO_END_OF_FILE; - Offset.u.HighPart = 0xffffffff; - ByteOffset = &Offset; - } - - if (Event != NULL) - { - Status = ObReferenceObjectByHandle(Event, - SYNCHRONIZE, - ExEventObjectType, - PreviousMode, - (PVOID*)&EventObject, - NULL); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject(FileObject); - return Status; - } - - KeClearEvent(EventObject); - } - - _SEH_TRY - { - Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE, - FileObject->DeviceObject, - Buffer, - Length, - ByteOffset, - EventObject, - IoStatusBlock); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if (!NT_SUCCESS(Status) || Irp == NULL) - { - if (Event) - { - ObDereferenceObject(&EventObject); - } - ObDereferenceObject(FileObject); - if (Irp) - { - IoFreeIrp(Irp); - } - return NT_SUCCESS(Status) ? STATUS_INSUFFICIENT_RESOURCES : Status; - } - - KeClearEvent(&FileObject->Event); - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - - Irp->RequestorMode = PreviousMode; - - Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; - Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->FileObject = FileObject; - StackPtr->Parameters.Write.Key = Key ? *Key : 0; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) - { - Status = KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - if (Status != STATUS_WAIT_0) - { - /* Wait failed. */ - return Status; - } - - Status = IoStatusBlock->Status; - } - - return Status; -} - - -/********************************************************************** - * NAME EXPORTED - * NtReadFileScatter - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - */ -NTSTATUS -STDCALL -NtReadFileScatter ( - IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, - IN PVOID UserApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK UserIoStatusBlock, - IN FILE_SEGMENT_ELEMENT BufferDescription [], - IN ULONG BufferLength, - IN PLARGE_INTEGER ByteOffset, - IN PULONG Key OPTIONAL - ) -{ - UNIMPLEMENTED; - return(STATUS_NOT_IMPLEMENTED); -} - - -/********************************************************************** - * NAME EXPORTED - * NtWriteFileGather - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - */ -NTSTATUS -STDCALL -NtWriteFileGather ( - IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN FILE_SEGMENT_ELEMENT BufferDescription [], - IN ULONG BufferLength, - IN PLARGE_INTEGER ByteOffset, - IN PULONG Key OPTIONAL - ) -{ - UNIMPLEMENTED; - return(STATUS_NOT_IMPLEMENTED); -} - - -/* EOF */ diff --git a/reactos/ntoskrnl/io/shutdown.c b/reactos/ntoskrnl/io/shutdown.c deleted file mode 100644 index 6602ceba835..00000000000 --- a/reactos/ntoskrnl/io/shutdown.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/shutdown.c - * PURPOSE: Implements shutdown notification - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* LOCAL DATA ***************************************************************/ - -typedef struct _SHUTDOWN_ENTRY -{ - LIST_ENTRY ShutdownList; - PDEVICE_OBJECT DeviceObject; -} SHUTDOWN_ENTRY, *PSHUTDOWN_ENTRY; - -static LIST_ENTRY ShutdownListHead; -static KSPIN_LOCK ShutdownListLock; - -#define TAG_SHUTDOWN_ENTRY TAG('S', 'H', 'U', 'T') - -/* FUNCTIONS *****************************************************************/ - -VOID INIT_FUNCTION -IoInitShutdownNotification (VOID) -{ - InitializeListHead(&ShutdownListHead); - KeInitializeSpinLock(&ShutdownListLock); -} - -VOID IoShutdownRegisteredDevices(VOID) -{ - PSHUTDOWN_ENTRY ShutdownEntry; - PLIST_ENTRY Entry; - IO_STATUS_BLOCK StatusBlock; - PIRP Irp; - KEVENT Event; - NTSTATUS Status; - - Entry = ShutdownListHead.Flink; - while (Entry != &ShutdownListHead) - { - ShutdownEntry = CONTAINING_RECORD(Entry, SHUTDOWN_ENTRY, ShutdownList); - - KeInitializeEvent (&Event, - NotificationEvent, - FALSE); - - Irp = IoBuildSynchronousFsdRequest (IRP_MJ_SHUTDOWN, - ShutdownEntry->DeviceObject, - NULL, - 0, - NULL, - &Event, - &StatusBlock); - - Status = IoCallDriver (ShutdownEntry->DeviceObject, - Irp); - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject (&Event, - Executive, - KernelMode, - FALSE, - NULL); - } - - Entry = Entry->Flink; - } -} - -/* - * @implemented - */ -NTSTATUS STDCALL IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject) -{ - PSHUTDOWN_ENTRY Entry; - - Entry = ExAllocatePoolWithTag(NonPagedPool, sizeof(SHUTDOWN_ENTRY), - TAG_SHUTDOWN_ENTRY); - if (Entry == NULL) - return STATUS_INSUFFICIENT_RESOURCES; - - Entry->DeviceObject = DeviceObject; - - ExInterlockedInsertHeadList(&ShutdownListHead, - &Entry->ShutdownList, - &ShutdownListLock); - - DeviceObject->Flags |= DO_SHUTDOWN_REGISTERED; - - return STATUS_SUCCESS; -} - -/* - * @implemented - */ -VOID STDCALL IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject) -{ - PSHUTDOWN_ENTRY ShutdownEntry; - PLIST_ENTRY Entry; - KIRQL oldlvl; - - Entry = ShutdownListHead.Flink; - while (Entry != &ShutdownListHead) - { - ShutdownEntry = CONTAINING_RECORD(Entry, SHUTDOWN_ENTRY, ShutdownList); - if (ShutdownEntry->DeviceObject == DeviceObject) - { - DeviceObject->Flags &= ~DO_SHUTDOWN_REGISTERED; - - KeAcquireSpinLock(&ShutdownListLock,&oldlvl); - RemoveEntryList(Entry); - KeReleaseSpinLock(&ShutdownListLock,oldlvl); - - ExFreePool(Entry); - return; - } - - Entry = Entry->Flink; - } -} - -/* EOF */ diff --git a/reactos/ntoskrnl/io/vpb.c b/reactos/ntoskrnl/io/vpb.c index c6ff88de451..afe88324ec3 100644 --- a/reactos/ntoskrnl/io/vpb.c +++ b/reactos/ntoskrnl/io/vpb.c @@ -30,34 +30,29 @@ IoInitVpbImplementation(VOID) } NTSTATUS -IoAttachVpb(PDEVICE_OBJECT DeviceObject) +STDCALL +IopAttachVpb(PDEVICE_OBJECT DeviceObject) { - PVPB Vpb; + PVPB Vpb; - Vpb = ExAllocatePoolWithTag(NonPagedPool, - sizeof(VPB), - TAG_VPB); - if (Vpb == NULL) - { - return(STATUS_UNSUCCESSFUL); - } + /* Allocate the Vpb */ + Vpb = ExAllocatePoolWithTag(NonPagedPool, + sizeof(VPB), + TAG_VPB); + if (Vpb == NULL) return(STATUS_UNSUCCESSFUL); + + /* Clear it so we don't waste time manually */ + RtlZeroMemory(Vpb, sizeof(VPB)); - Vpb->Type = 0; - Vpb->Size = sizeof(VPB) / sizeof(DWORD); - Vpb->Flags = 0; - Vpb->VolumeLabelLength = 0; - Vpb->DeviceObject = NULL; - Vpb->RealDevice = DeviceObject; - Vpb->SerialNumber = 0; - Vpb->ReferenceCount = 0; - RtlZeroMemory(Vpb->VolumeLabel, - sizeof(WCHAR) * MAXIMUM_VOLUME_LABEL_LENGTH); - - DeviceObject->Vpb = Vpb; - - return(STATUS_SUCCESS); -} + /* Set the Header and Device Field */ + Vpb->Type = IO_TYPE_VPB; + Vpb->Size = sizeof(VPB); + Vpb->RealDevice = DeviceObject; + /* link it to the Device Object */ + DeviceObject->Vpb = Vpb; + return(STATUS_SUCCESS); +} /* * FUNCTION: Queries the volume information @@ -381,4 +376,17 @@ IoReleaseVpbSpinLock(IN KIRQL Irql) Irql); } +/* + * @unimplemented + */ +NTSTATUS +STDCALL +IoCheckQuerySetVolumeInformation(IN FS_INFORMATION_CLASS FsInformationClass, + IN ULONG Length, + IN BOOLEAN SetOperation) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + /* EOF */ diff --git a/reactos/ntoskrnl/io/wdm.c b/reactos/ntoskrnl/io/wdm.c deleted file mode 100644 index e62843f6d4d..00000000000 --- a/reactos/ntoskrnl/io/wdm.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/wdm.c - * PURPOSE: Various Windows Driver Model routines - * - * PROGRAMMERS: Filip Navara (xnavara@volny.cz) - */ - -#include - -/* - * @implemented - */ -BOOLEAN STDCALL -IoIsWdmVersionAvailable( - IN UCHAR MajorVersion, - IN UCHAR MinorVersion - ) -{ - if (MajorVersion <= 1 && MinorVersion <= 10) - return TRUE; - return FALSE; -} diff --git a/reactos/ntoskrnl/io/xhaldisp.c b/reactos/ntoskrnl/io/xhaldisp.c deleted file mode 100644 index 4c4cea3d5ab..00000000000 --- a/reactos/ntoskrnl/io/xhaldisp.c +++ /dev/null @@ -1,205 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/xhaldisp.c - * PURPOSE: Hal dispatch tables - * - * PROGRAMMERS: Eric Kohl (ekohl@rz-online.de) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - - -/* DATA **********************************************************************/ - - -HAL_DISPATCH EXPORTED HalDispatchTable = -{ - HAL_DISPATCH_VERSION, - (pHalQuerySystemInformation) NULL, // HalQuerySystemInformation - (pHalSetSystemInformation) NULL, // HalSetSystemInformation - (pHalQueryBusSlots) NULL, // HalQueryBusSlots - 0, - (pHalExamineMBR) xHalExamineMBR, - (pHalIoAssignDriveLetters) xHalIoAssignDriveLetters, - (pHalIoReadPartitionTable) xHalIoReadPartitionTable, - (pHalIoSetPartitionInformation) xHalIoSetPartitionInformation, - (pHalIoWritePartitionTable) xHalIoWritePartitionTable, - (pHalHandlerForBus) NULL, // HalReferenceHandlerForBus - (pHalReferenceBusHandler) NULL, // HalReferenceBusHandler - (pHalReferenceBusHandler) NULL, // HalDereferenceBusHandler - (pHalInitPnpDriver) NULL, //HalInitPnpDriver; - (pHalInitPowerManagement) NULL, //HalInitPowerManagement; - (pHalGetDmaAdapter) NULL, //HalGetDmaAdapter; - (pHalGetInterruptTranslator) NULL, //HalGetInterruptTranslator; - (pHalStartMirroring) NULL, //HalStartMirroring; - (pHalEndMirroring) NULL, //HalEndMirroring; - (pHalMirrorPhysicalMemory) NULL, //HalMirrorPhysicalMemory; - (pHalEndOfBoot) NULL, //HalEndOfBoot; - (pHalMirrorVerify) NULL //HalMirrorVerify; -}; - - -HAL_PRIVATE_DISPATCH EXPORTED HalPrivateDispatchTable = -{ - HAL_PRIVATE_DISPATCH_VERSION - // HalHandlerForBus - // HalHandlerForConfigSpace - // HalCompleteDeviceControl - // HalRegisterBusHandler - // ?? - // ?? - // ?? - // ?? - // ?? -}; - -/* - * @unimplemented - * -STDCALL -VOID -IoAssignDriveLetters( - IN PLOADER_PARAMETER_BLOCK LoaderBlock, - IN PSTRING NtDeviceName, - OUT PUCHAR NtSystemPath, - OUT PSTRING NtSystemPathString - ) -{ - UNIMPLEMENTED; -*/ - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoCreateDisk( - IN PDEVICE_OBJECT DeviceObject, - IN struct _CREATE_DISK* Disk - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoGetBootDiskInformation( - IN OUT PBOOTDISK_INFORMATION BootDiskInformation, - IN ULONG Size - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoReadDiskSignature( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG BytesPerSector, - OUT PDISK_SIGNATURE Signature - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoReadPartitionTableEx( - IN PDEVICE_OBJECT DeviceObject, - IN struct _DRIVE_LAYOUT_INFORMATION_EX** DriveLayout - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoSetPartitionInformationEx( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG PartitionNumber, - IN struct _SET_PARTITION_INFORMATION_EX* PartitionInfo - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoSetSystemPartition( - PUNICODE_STRING VolumeNameString - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoVerifyPartitionTable( - IN PDEVICE_OBJECT DeviceObject, - IN BOOLEAN FixErrors - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoVolumeDeviceToDosName( - IN PVOID VolumeDeviceObject, - OUT PUNICODE_STRING DosName - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWritePartitionTableEx( - IN PDEVICE_OBJECT DeviceObject, - IN struct _DRIVE_LAYOUT_INFORMATION_EX* DriveLayfout - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* EOF */ diff --git a/reactos/ntoskrnl/kd/dlog.c b/reactos/ntoskrnl/kd/dlog.c deleted file mode 100644 index 3b8e48afedf..00000000000 --- a/reactos/ntoskrnl/kd/dlog.c +++ /dev/null @@ -1,230 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/kd/kdebug.c - * PURPOSE: Kernel debugger - * - * PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de) - */ - -/* INCLUDES ******************************************************************/ - -#include - -/* GLOBALS *******************************************************************/ - -#define DEBUGLOG_SIZE (32*1024) - -static CHAR DebugLog[DEBUGLOG_SIZE]; -static ULONG DebugLogStart; -static ULONG DebugLogEnd; -static ULONG DebugLogCount; -static KSPIN_LOCK DebugLogLock; -static ULONG DebugLogOverflow; -static HANDLE DebugLogThreadHandle; -static CLIENT_ID DebugLogThreadCid; -static HANDLE DebugLogFile; -static KEVENT DebugLogEvent; - -/* FUNCTIONS *****************************************************************/ - -VOID -DebugLogDumpMessages(VOID) -{ - static CHAR Buffer[256]; - ULONG Offset; - ULONG Length; - - if (!(KdDebugState & KD_DEBUG_FILELOG)) - { - return; - } - KdDebugState &= ~KD_DEBUG_FILELOG; - - Offset = (DebugLogEnd + 1) % DEBUGLOG_SIZE; - do - { - if (Offset <= DebugLogEnd) - { - Length = min(255, DebugLogEnd - Offset); - } - else - { - Length = min(255, DEBUGLOG_SIZE - Offset); - } - memcpy(Buffer, DebugLog + Offset, Length); - Buffer[Length] = 0; - DbgPrint(Buffer); - Offset = (Offset + Length) % DEBUGLOG_SIZE; - } - while (Length > 0); -} - -VOID INIT_FUNCTION -DebugLogInit(VOID) -{ - KeInitializeSpinLock(&DebugLogLock); - DebugLogStart = 0; - DebugLogEnd = 0; - DebugLogOverflow = 0; - DebugLogCount = 0; - KeInitializeEvent(&DebugLogEvent, NotificationEvent, FALSE); -} - -VOID STDCALL -DebugLogThreadMain(PVOID Context) -{ - KIRQL oldIrql; - IO_STATUS_BLOCK Iosb; - static CHAR Buffer[256]; - ULONG WLen; - - for (;;) - { - LARGE_INTEGER TimeOut; - TimeOut.QuadPart = -5000000; /* Half a second. */ - KeWaitForSingleObject(&DebugLogEvent, - 0, - KernelMode, - FALSE, - &TimeOut); - KeAcquireSpinLock(&DebugLogLock, &oldIrql); - while (DebugLogCount > 0) - { - if (DebugLogStart > DebugLogEnd) - { - WLen = min(256, DEBUGLOG_SIZE - DebugLogStart); - memcpy(Buffer, &DebugLog[DebugLogStart], WLen); - Buffer[WLen + 1] = '\n'; - DebugLogStart = - (DebugLogStart + WLen) % DEBUGLOG_SIZE; - DebugLogCount = DebugLogCount - WLen; - KeReleaseSpinLock(&DebugLogLock, oldIrql); - NtWriteFile(DebugLogFile, - NULL, - NULL, - NULL, - &Iosb, - Buffer, - WLen + 1, - NULL, - NULL); - } - else - { - WLen = min(255, DebugLogEnd - DebugLogStart); - memcpy(Buffer, &DebugLog[DebugLogStart], WLen); - DebugLogStart = - (DebugLogStart + WLen) % DEBUGLOG_SIZE; - DebugLogCount = DebugLogCount - WLen; - KeReleaseSpinLock(&DebugLogLock, oldIrql); - NtWriteFile(DebugLogFile, - NULL, - NULL, - NULL, - &Iosb, - Buffer, - WLen, - NULL, - NULL); - } - KeAcquireSpinLock(&DebugLogLock, &oldIrql); - } - KeResetEvent(&DebugLogEvent); - KeReleaseSpinLock(&DebugLogLock, oldIrql); - } -} - -VOID INIT_FUNCTION -DebugLogInit2(VOID) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING FileName; - IO_STATUS_BLOCK Iosb; - - RtlInitUnicodeString(&FileName, L"\\SystemRoot\\debug.log"); - InitializeObjectAttributes(&ObjectAttributes, - &FileName, - 0, - NULL, - NULL); - - Status = NtCreateFile(&DebugLogFile, - FILE_ALL_ACCESS, - &ObjectAttributes, - &Iosb, - NULL, - FILE_ATTRIBUTE_NORMAL, - FILE_SHARE_READ, - FILE_SUPERSEDE, - FILE_WRITE_THROUGH | FILE_SYNCHRONOUS_IO_NONALERT, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - DbgPrint("Failed to create debug log file\n"); - return; - } - - Status = PsCreateSystemThread(&DebugLogThreadHandle, - THREAD_ALL_ACCESS, - NULL, - NULL, - &DebugLogThreadCid, - DebugLogThreadMain, - NULL); -} - -VOID -DebugLogWrite(PCH String) -{ - KIRQL oldIrql; - - if (KeGetCurrentIrql() > DISPATCH_LEVEL) - { - DebugLogOverflow++; - return; - } - - KeAcquireSpinLock(&DebugLogLock, &oldIrql); - - if (DebugLogCount == DEBUGLOG_SIZE) - { - DebugLogOverflow++; - KeReleaseSpinLock(&DebugLogLock, oldIrql); - if (oldIrql < DISPATCH_LEVEL) - { - KeSetEvent(&DebugLogEvent, IO_NO_INCREMENT, FALSE); - } - return; - } - - while ((*String) != 0) - { - DebugLog[DebugLogEnd] = *String; - String++; - DebugLogCount++; - - if (DebugLogCount == DEBUGLOG_SIZE) - { - DebugLogOverflow++; - KeReleaseSpinLock(&DebugLogLock, oldIrql); - if (oldIrql < DISPATCH_LEVEL) - { - KeSetEvent(&DebugLogEvent, IO_NO_INCREMENT, FALSE); - } - return; - } - DebugLogEnd = (DebugLogEnd + 1) % DEBUGLOG_SIZE; - } - - KeReleaseSpinLock(&DebugLogLock, oldIrql); - - if (oldIrql < DISPATCH_LEVEL) - { - KeSetEvent(&DebugLogEvent, IO_NO_INCREMENT, FALSE); - } -} - diff --git a/reactos/ntoskrnl/kd/kdebug.c b/reactos/ntoskrnl/kd/kdebug.c deleted file mode 100644 index 6e823db8837..00000000000 --- a/reactos/ntoskrnl/kd/kdebug.c +++ /dev/null @@ -1,527 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/kd/kdebug.c - * PURPOSE: Kernel debugger - * - * PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de) - */ - -#include -#include "../dbg/kdb.h" -#include - -/* serial debug connection */ -#define DEFAULT_DEBUG_PORT 2 /* COM2 */ -#define DEFAULT_DEBUG_COM1_IRQ 4 /* COM1 IRQ */ -#define DEFAULT_DEBUG_COM2_IRQ 3 /* COM2 IRQ */ -#define DEFAULT_DEBUG_BAUD_RATE 115200 /* 115200 Baud */ - -/* bochs debug output */ -#define BOCHS_LOGGER_PORT (0xe9) - -/* VARIABLES ***************************************************************/ - -BOOLEAN -__declspec(dllexport) -KdDebuggerEnabled = FALSE; /* EXPORTED */ - -BOOLEAN -__declspec(dllexport) -KdEnteredDebugger = FALSE; /* EXPORTED */ - -BOOLEAN -__declspec(dllexport) -KdDebuggerNotPresent = TRUE; /* EXPORTED */ - -ULONG -__declspec(dllexport) -KiBugCheckData; /* EXPORTED */ - -BOOLEAN -__declspec(dllexport) -KiEnableTimerWatchdog = FALSE; /* EXPORTED */ - - -static BOOLEAN KdpBreakPending = FALSE; -ULONG KdDebugState = KD_DEBUG_DISABLED; -ULONG KdpPortIrq = 0; - -KD_PORT_INFORMATION GdbPortInfo; -KD_PORT_INFORMATION LogPortInfo; - -/* PRIVATE FUNCTIONS ********************************************************/ - -static VOID -PrintString(char* fmt,...) -{ - char buffer[512]; - va_list ap; - - va_start(ap, fmt); - _vsnprintf(buffer, sizeof(buffer) - 1, fmt, ap); - buffer[sizeof(buffer) - 1] = 0; - va_end(ap); - - HalDisplayString(buffer); -} - - -VOID INIT_FUNCTION -KdInitSystem(ULONG BootPhase, - PLOADER_PARAMETER_BLOCK LoaderBlock) -{ - KD_PORT_INFORMATION PortInfo; - ULONG Value; - PCHAR p1, p2; - - if (BootPhase > 0) - { -#ifdef KDBG - /* Initialize runtime debugging if available */ - DbgRDebugInit(); -#endif - -#ifdef KDBG - /* Initialize the local kernel debugger. */ - KdDebuggerEnabled = TRUE; - KdDebugState |= KD_DEBUG_KDB; -#endif - } - - if (BootPhase == 0) - { - /* Set debug port default values */ - PortInfo.ComPort = DEFAULT_DEBUG_PORT; - PortInfo.BaudRate = DEFAULT_DEBUG_BAUD_RATE; - KdpPortIrq = DEFAULT_DEBUG_COM2_IRQ; - - /* Set serial log port default values */ - LogPortInfo.ComPort = DEFAULT_DEBUG_PORT; - LogPortInfo.BaudRate = DEFAULT_DEBUG_BAUD_RATE; - } - - /* Parse kernel command line */ - - /* Check for 'DEBUGPORT' */ - p1 = (PCHAR)LoaderBlock->CommandLine; - while (p1 && (p2 = strchr(p1, '/'))) - { - p2++; - if (!_strnicmp(p2, "DEBUGPORT", 9)) - { - p2 += 9; - if (*p2 == '=') - { - p2++; - if (!_strnicmp(p2, "SCREEN", 6) && BootPhase > 0) - { - p2 += 6; - KdDebugState |= KD_DEBUG_SCREEN; - } - else if (!_strnicmp(p2, "BOCHS", 5) && BootPhase == 0) - { - p2 += 5; - KdDebugState |= KD_DEBUG_BOCHS; - } - else if (!_strnicmp(p2, "GDB", 3) && BootPhase == 0) - { - p2 += 3; - KdDebuggerEnabled = TRUE; - KdDebugState |= KD_DEBUG_GDB; - - /* Reset port information to defaults */ - RtlMoveMemory(&GdbPortInfo, &PortInfo, sizeof(KD_PORT_INFORMATION)); - PortInfo.ComPort = DEFAULT_DEBUG_PORT; - PortInfo.BaudRate = DEFAULT_DEBUG_BAUD_RATE; - } - else if (!_strnicmp(p2, "PICE", 4) && BootPhase > 0) - { - p2 += 4; - KdDebuggerEnabled = TRUE; - KdDebugState |= KD_DEBUG_PICE; - } - else if (!_strnicmp(p2, "COM", 3) && BootPhase == 0) - { - p2 += 3; - Value = (ULONG)atol(p2); - if (Value > 0 && Value < 5) - { - KdDebugState |= KD_DEBUG_SERIAL; - LogPortInfo.ComPort = Value; - } - } - else if (!_strnicmp(p2, "FILE", 4) && BootPhase > 0) - { - p2 += 4; - KdDebugState |= KD_DEBUG_FILELOG; - } - else if (!_strnicmp(p2, "MDA", 3) && BootPhase > 0) - { - p2 += 3; - KdDebugState |= KD_DEBUG_MDA; - } - } - } - else if (!_strnicmp(p2, "KDSERIAL", 8) && BootPhase > 0) - { - p2 += 8; - KdDebugState |= KD_DEBUG_SERIAL | KD_DEBUG_KDSERIAL; - } - else if (!_strnicmp(p2, "KDNOECHO", 8) && BootPhase > 0) - { - p2 += 8; - KdDebugState |= KD_DEBUG_KDNOECHO; - } - else if (!_strnicmp(p2, "DEBUG", 5) && BootPhase == 0) - { - p2 += 5; - KdDebuggerEnabled = TRUE; - KdDebugState |= KD_DEBUG_SERIAL; - } - else if (!_strnicmp(p2, "NODEBUG", 7) && BootPhase == 0) - { - p2 += 7; - KdDebuggerEnabled = FALSE; - KdDebugState = KD_DEBUG_DISABLED; - } - else if (!_strnicmp(p2, "CRASHDEBUG", 10) && BootPhase == 0) - { - p2 += 10; - KdDebuggerEnabled = FALSE; - KdDebugState = KD_DEBUG_DISABLED; - } - else if (!_strnicmp(p2, "BREAK", 5) && BootPhase > 0) - { - p2 += 5; - KdpBreakPending = TRUE; - } - else if (!_strnicmp(p2, "COM", 3) && BootPhase == 0) - { - p2 += 3; - if ('=' == *p2) - { - p2++; - Value = (ULONG)atol(p2); - if (0 < Value && Value < 5) - { - PortInfo.ComPort = Value; - } - } - } - else if (!_strnicmp(p2, "BAUDRATE", 8) && BootPhase == 0) - { - p2 += 8; - if ('=' == *p2) - { - p2++; - Value = (ULONG)atol(p2); - if (0 < Value) - { - PortInfo.BaudRate = Value; - } - } - } - else if (!_strnicmp(p2, "IRQ", 3) && BootPhase == 0) - { - p2 += 3; - if ('=' == *p2) - { - p2++; - Value = (ULONG)atol(p2); - if (0 < Value) - { - KdpPortIrq = Value; - } - } - } - p1 = p2; - } - - /* Perform any initialization nescessary */ - if (KdDebugState & KD_DEBUG_GDB && BootPhase == 0) - KdPortInitializeEx(&GdbPortInfo, 0, 0); - - if (KdDebugState & KD_DEBUG_SERIAL && BootPhase == 0) - KdPortInitializeEx(&LogPortInfo, 0, 0); - - if (KdDebugState & KD_DEBUG_FILELOG && BootPhase > 0) - DebugLogInit(); - - if (KdDebugState & KD_DEBUG_MDA && BootPhase > 0) - KdInitializeMda(); -} - - -VOID INIT_FUNCTION -KdInit1(VOID) -{ - /* Initialize kernel debugger (phase 0) */ - if ((KdDebuggerEnabled) && - (KdDebugState & KD_DEBUG_GDB)) - { - KdGdbStubInit(0); - } -} - - -VOID INIT_FUNCTION -KdInit2(VOID) -{ - /* Initialize kernel debugger (phase 1) */ - if ((KdDebuggerEnabled) && - (KdDebugState & KD_DEBUG_GDB)) - { - KdGdbStubInit(1); - } -} - - -VOID INIT_FUNCTION -KdInit3(VOID) -{ - /* Print some information */ - if (KdDebugState & KD_DEBUG_GDB) - PrintString("\n GDB debugging enabled. COM%ld %ld Baud\n\n", - GdbPortInfo.ComPort, GdbPortInfo.BaudRate); - - if (KdDebugState & KD_DEBUG_PICE) - PrintString("\n Private ICE debugger enabled\n\n"); - - if (KdDebugState & KD_DEBUG_SCREEN) - PrintString("\n Screen debugging enabled\n\n"); - - if (KdDebugState & KD_DEBUG_BOCHS) - PrintString("\n Bochs debugging enabled\n\n"); - - if (KdDebugState & KD_DEBUG_SERIAL) - PrintString("\n Serial debugging enabled. COM%ld %ld Baud\n\n", - LogPortInfo.ComPort, LogPortInfo.BaudRate); - - if (KdDebugState & KD_DEBUG_FILELOG) - PrintString("\n File log debugging enabled\n\n"); - if (KdDebugState & KD_DEBUG_MDA) - PrintString("\n MDA debugging enabled\n\n"); -} - - -VOID -KdSerialDebugPrint (LPSTR Message) -{ - PCHAR pch = (PCHAR) Message; - - while (*pch != 0) - { - if (*pch == '\n') - { - KdPortPutByteEx (&LogPortInfo, '\r'); - } - KdPortPutByteEx (&LogPortInfo, *pch); - pch++; - } -} - - -VOID -KdBochsDebugPrint(IN LPSTR Message) -{ - while (*Message != 0) - { - if (*Message == '\n') - { - WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r'); - } - WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *Message); - Message++; - } -} - - -ULONG -KdpPrintString(PANSI_STRING String) -{ - PCH pch = String->Buffer; - - if (KdDebugState & KD_DEBUG_GDB) - KdGdbDebugPrint(pch); - - if (KdDebugState & KD_DEBUG_SCREEN) - HalDisplayString(pch); - - if (KdDebugState & KD_DEBUG_SERIAL) - KdSerialDebugPrint(pch); - - if (KdDebugState & KD_DEBUG_BOCHS) - KdBochsDebugPrint(pch); - - if (KdDebugState & KD_DEBUG_FILELOG) - DebugLogWrite(pch); - - if (KdDebugState & KD_DEBUG_MDA) - KdPrintMda(pch); - - return((ULONG)String->Length); -} - -/* PUBLIC FUNCTIONS *********************************************************/ - -/* NTOSKRNL.KdPollBreakIn */ - -/* - * @unimplemented - */ -VOID -STDCALL -KdDisableDebugger( - VOID - ) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -STDCALL -KdEnableDebugger ( - VOID - ) -{ - UNIMPLEMENTED; -} - -/* - * @implemented - */ -BOOLEAN STDCALL -KdPollBreakIn(VOID) -{ - if ((!KdDebuggerEnabled) || (!(KdDebugState & KD_DEBUG_SERIAL))) - return FALSE; - return KdpBreakPending; -} - -/* - * @implemented - */ -VOID STDCALL -KeEnterKernelDebugger(VOID) -{ - HalDisplayString("\n\n *** Entered kernel debugger ***\n"); - - for (;;) - { -#if defined(__GNUC__) - __asm__("hlt\n\t"); -#elif defined(_MSC_VER) - __asm hlt -#else -#error Unknown compiler for inline assembler -#endif - } -} - -VOID STDCALL -KdSystemDebugControl(ULONG Code) -{ - extern VOID PsDumpThreads(BOOLEAN IncludeSystem); - - /* A - Dump the entire contents of the non-paged pool. */ - if (Code == 0) - { - MiDebugDumpNonPagedPool(FALSE); - } - /* B - Bug check the system. */ - else if (Code == 1) - { - KEBUGCHECK(MANUALLY_INITIATED_CRASH); - } - /* - * C - Dump statistics about the distribution of tagged blocks in - * the non-paged pool. - */ - else if (Code == 2) - { - MiDebugDumpNonPagedPoolStats(FALSE); - } - /* - * D - Dump the blocks created in the non-paged pool since the last - * SysRq + D and SysRq + E command. - */ - else if (Code == 3) - { - MiDebugDumpNonPagedPool(TRUE); - } - /* E - Dump statistics about the tags of newly created blocks. */ - else if (Code == 4) - { - MiDebugDumpNonPagedPoolStats(TRUE); - } - /* F */ - else if (Code == 5) - { - PsDumpThreads(TRUE); - } - /* G */ - else if (Code == 6) - { - PsDumpThreads(FALSE); - } - /* H */ - else if (Code == 7) - { - } - /* I */ - else if (Code == 8) - { - } - /* J */ - else if (Code == 9) - { - } - /* K - Enter the system debugger. */ - else if (Code == 10) - { -#ifdef KDBG - KdbEnter(); -#else /* KDBG */ - DbgPrint("No local kernel debugger\n"); -#endif /* not KDBG */ - } -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -KdPowerTransition( - ULONG PowerState - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* Support routines for the GDB stubs */ - -VOID -KdPutChar(UCHAR Value) -{ - KdPortPutByteEx (&GdbPortInfo, Value); -} - - -UCHAR -KdGetChar(VOID) -{ - UCHAR Value; - - while (!KdPortGetByteEx (&GdbPortInfo, &Value)); - - return Value; -} - - /* EOF */ diff --git a/reactos/ntoskrnl/kd/kdinit.c b/reactos/ntoskrnl/kd/kdinit.c new file mode 100644 index 00000000000..7a1d1f5dd8b --- /dev/null +++ b/reactos/ntoskrnl/kd/kdinit.c @@ -0,0 +1,241 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/kd/kdinit.c + * PURPOSE: Kernel Debugger Initializtion + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +#include +#define NDEBUG +#include + +/* VARIABLES ***************************************************************/ + +KD_PORT_INFORMATION PortInfo = {DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0}; +ULONG KdpPortIrq; +KDP_DEBUG_MODE KdpDebugMode; +LIST_ENTRY KdProviders; +PKDP_INIT_ROUTINE WrapperInitRoutine; +KD_DISPATCH_TABLE DispatchTable[KdMax]; +KD_DISPATCH_TABLE WrapperTable; + +PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit, + KdpSerialInit, + KdpInitDebugLog}; + +/* PRIVATE FUNCTIONS *********************************************************/ + +PCHAR +STDCALL +KdpGetWrapperDebugMode(PCHAR Currentp2, + PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PCHAR p2 = Currentp2; + +#ifdef DBG + /* Check for BOCHS Debugging */ + if (!_strnicmp(p2, "BOCHS", 5)) + { + /* Enable It */ + p2 += 5; + KdpDebugMode.Bochs = TRUE; + WrapperInitRoutine = KdpBochsInit; + } + + /* Check for GDB Debugging */ + if (!_strnicmp(p2, "GDB", 3)) + { + /* Enable it */ + p2 += 3; + KdpDebugMode.Gdb = TRUE; + + /* Enable Debugging */ + KdDebuggerEnabled = TRUE; + WrapperInitRoutine = KdpGdbStubInit; + } + + /* Check for PICE Debugging */ + else if (!_strnicmp(p2, "PICE", 4)) + { + /* Enable it */ + p2 += 4; + KdpDebugMode.Pice = TRUE; + + /* Enable Debugging */ + KdDebuggerEnabled = TRUE; + } +#endif + +#ifdef KDBG + /* Get the KDBG Settings and enable it */ + KdDebuggerEnabled = TRUE; + KdpDebugMode.Gdb = TRUE; + KdbpGetCommandLineSettings((PCHAR)LoaderBlock->CommandLine); +#endif + return p2; +} + +PCHAR +STDCALL +KdpGetDebugMode(PCHAR Currentp2) +{ + PCHAR p2 = Currentp2; + ULONG Value; + + /* Check for Screen Debugging */ + if (!_strnicmp(p2, "SCREEN", 6)) + { + /* Enable It */ + p2 += 6; + KdpDebugMode.Screen = TRUE; + } + /* Check for Serial Debugging */ + else if (!_strnicmp(p2, "COM", 3)) + { + /* Gheck for a valid Serial Port */ + p2 += 3; + Value = (ULONG)atol(p2); + if (Value > 0 && Value < 5) + { + /* Valid port found, enable Serial Debugging */ + KdpDebugMode.Serial = TRUE; + + /* Set the port to use */ + SerialPortInfo.ComPort = Value; + KdpPort = Value; + } + } + /* Check for Debug Log Debugging */ + else if (!_strnicmp(p2, "FILE", 4)) + { + /* Enable It */ + p2 += 4; + KdpDebugMode.File = TRUE; + } + + return p2; +} + +VOID +STDCALL +KdpCallInitRoutine(ULONG BootPhase) +{ + PLIST_ENTRY CurrentEntry; + PKD_DISPATCH_TABLE CurrentTable; + + /* Call the registered handlers */ + CurrentEntry = KdProviders.Flink; + while (CurrentEntry != &KdProviders) + { + /* Get the current table */ + CurrentTable = CONTAINING_RECORD(CurrentEntry, + KD_DISPATCH_TABLE, + KdProvidersList); + + /* Call it */ + CurrentTable->KdpInitRoutine(CurrentTable, BootPhase); + + /* Next Table */ + CurrentEntry = CurrentEntry->Flink; + } + + /* Call the Wrapper Init Routine */ + if (WrapperInitRoutine) + WrapperTable.KdpInitRoutine(&WrapperTable, BootPhase); +} + +VOID +INIT_FUNCTION +KdInitSystem(ULONG BootPhase, + PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + ULONG Value; + ULONG i; + PCHAR p1, p2; + + /* Set Default Port Options */ + if (BootPhase == 0) + { + /* Initialize the Provider List */ + InitializeListHead(&KdProviders); + + /* Parse the Command Line */ + p1 = (PCHAR)LoaderBlock->CommandLine; + while (p1 && (p2 = strchr(p1, '/'))) + { + /* Move past the slash */ + p2++; + + /* Identify the Debug Type being Used */ + if (!_strnicmp(p2, "DEBUGPORT=", 10)) + { + p2 += 10; + p2 = KdpGetDebugMode(p2); + p2 = KdpGetWrapperDebugMode(p2, LoaderBlock); + } + /* Check for Kernel Debugging Enable */ + else if (!_strnicmp(p2, "DEBUG", 5)) + { + /* Enable it on the Serial Port */ + p2 += 5; + KdDebuggerEnabled = TRUE; + KdpDebugMode.Serial = TRUE; + } + /* Check for Kernel Debugging Bypass */ + else if (!_strnicmp(p2, "NODEBUG", 7)) + { + /* Disable Debugging */ + p2 += 7; + KdDebuggerEnabled = FALSE; + } + /* Check for Kernel Debugging Bypass unless STOP Error */ + else if (!_strnicmp(p2, "CRASHDEBUG", 10)) + { + /* Disable Debugging */ + p2 += 10; + KdDebuggerEnabled = FALSE; + } + /* Check Serial Port Settings [Baud Rate] */ + else if (!_strnicmp(p2, "BAUDRATE=", 9)) + { + /* Get the Baud Rate */ + p2 += 9; + Value = (ULONG)atol(p2); + + /* Check if it's valid and Set it */ + if (0 < Value) PortInfo.BaudRate = SerialPortInfo.BaudRate = Value; + } + /* Check Serial Port Settings [IRQ] */ + else if (!_strnicmp(p2, "IRQ=", 4)) + { + /* Get the IRQ */ + p2 += 3; + Value = (ULONG)atol(p2); + + /* Check if it's valid and set it */ + if (0 < Value) KdpPortIrq = Value; + } + + /* Move to next */ + p1 = p2; + } + + /* Call Providers at Phase 0 */ + for (i = 0; i < KdMax; i++) + { + InitRoutines[i](&DispatchTable[i], 0); + } + + /* Call Wrapper at Phase 0 */ + if (WrapperInitRoutine) WrapperInitRoutine(&WrapperTable, 0); + + return; + } + + /* Call the Initialization Routines of the Registered Providers */ + KdpCallInitRoutine(BootPhase); +} + + /* EOF */ diff --git a/reactos/ntoskrnl/kd/kdio.c b/reactos/ntoskrnl/kd/kdio.c new file mode 100644 index 00000000000..d53473bfd07 --- /dev/null +++ b/reactos/ntoskrnl/kd/kdio.c @@ -0,0 +1,272 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/kd/kdio.c + * PURPOSE: NT Kernel Debugger Input/Output Functions + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +/* GLOBALS *******************************************************************/ + +#define BufferSize 32*1024 + +HANDLE KdbLogFileHandle; +BOOLEAN KdpLogInitialized; +CHAR DebugBuffer[BufferSize]; +ULONG CurrentPosition; +WORK_QUEUE_ITEM KdpDebugLogQueue; +BOOLEAN ItemQueued; +KD_PORT_INFORMATION SerialPortInfo = {DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0}; + +/* Current Port in use. FIXME: Do we support more then one? */ +ULONG KdpPort; + +/* DEBUG LOG FUNCTIONS *******************************************************/ + +VOID +STDCALL +KdpPrintToLogInternal(PVOID Context) +{ + IO_STATUS_BLOCK Iosb; + + /* Write to the Debug Log */ + NtWriteFile(KdbLogFileHandle, + NULL, + NULL, + NULL, + &Iosb, + DebugBuffer, + CurrentPosition, + NULL, + NULL); + + /* Clear the Current Position */ + CurrentPosition = 0; + + /* A new item can be queued now */ + ItemQueued = FALSE; +} + +VOID +STDCALL +KdpPrintToLog(PCH String) +{ + ULONG StringLength = strlen(String); + + /* Don't overflow */ + if ((CurrentPosition + StringLength) > BufferSize) return; + + /* Add the string to the buffer */ + RtlMoveMemory(&DebugBuffer[CurrentPosition], String, StringLength); + + /* Update the Current Position */ + CurrentPosition += StringLength; + + /* Make sure we are initialized and can queue */ + if (!KdpLogInitialized || (ItemQueued)) return; + + /* Queue the work item */ + ExQueueWorkItem(&KdpDebugLogQueue, HyperCriticalWorkQueue); + ItemQueued = TRUE; +} + +VOID +STDCALL +KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable, + ULONG BootPhase) +{ + if (!KdpDebugMode.File) return; + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING FileName; + IO_STATUS_BLOCK Iosb; + + if (BootPhase == 0) + { + /* Write out the functions that we support for now */ + DispatchTable->KdpInitRoutine = KdpInitDebugLog; + DispatchTable->KdpPrintRoutine = KdpPrintToLog; + + /* Register as a Provider */ + InsertTailList(&KdProviders, &DispatchTable->KdProvidersList); + } + else if (BootPhase == 2) + { + HalDisplayString("\n File log debugging enabled\n\n"); + } + else if (BootPhase == 3) + { + /* Setup the Log Name */ + RtlInitUnicodeString(&FileName, L"\\SystemRoot\\debug.log"); + InitializeObjectAttributes(&ObjectAttributes, + &FileName, + 0, + NULL, + NULL); + + /* Create the Log File */ + Status = NtCreateFile(&KdbLogFileHandle, + FILE_ALL_ACCESS, + &ObjectAttributes, + &Iosb, + NULL, + FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ, + FILE_SUPERSEDE, + FILE_WRITE_THROUGH | FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0); + + /* Allow it to be used */ + ExInitializeWorkItem(&KdpDebugLogQueue, &KdpPrintToLogInternal, NULL); + KdpLogInitialized = TRUE; + } +} + +/* SERIAL FUNCTIONS **********************************************************/ + +VOID +STDCALL +KdpSerialDebugPrint(LPSTR Message) +{ + PCHAR pch = (PCHAR) Message; + + while (*pch != 0) + { + if (*pch == '\n') + { + KdPortPutByteEx(&SerialPortInfo, '\r'); + } + KdPortPutByteEx(&SerialPortInfo, *pch); + pch++; + } +} + +VOID +STDCALL +KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, + ULONG BootPhase) +{ + if (!KdpDebugMode.Serial) return; + + if (BootPhase == 0) + { + /* Write out the functions that we support for now */ + DispatchTable->KdpInitRoutine = KdpSerialInit; + DispatchTable->KdpPrintRoutine = KdpSerialDebugPrint; + + /* Initialize the Port */ + KdPortInitializeEx(&SerialPortInfo, 0, 0); + + /* Register as a Provider */ + InsertTailList(&KdProviders, &DispatchTable->KdProvidersList); + } + else if (BootPhase == 2) + { + HalDisplayString("\n Serial debugging enabled\n\n"); + } +} + +/* SCREEN FUNCTIONS **********************************************************/ + +VOID +STDCALL +KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, + ULONG BootPhase) +{ + if (!KdpDebugMode.Screen) return; + + if (BootPhase == 0) + { + /* Write out the functions that we support for now */ + DispatchTable->KdpInitRoutine = KdpScreenInit; + DispatchTable->KdpPrintRoutine = HalDisplayString; + + /* Register as a Provider */ + InsertTailList(&KdProviders, &DispatchTable->KdProvidersList); + } + else if (BootPhase == 2) + { + HalDisplayString("\n Screen debugging enabled\n\n"); + } +} + +/* GENERAL FUNCTIONS *********************************************************/ + +BOOLEAN +STDCALL +KdpDetectConflicts(PCM_RESOURCE_LIST DriverList) +{ + ULONG ComPortBase = 0; + ULONG i; + PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; + + /* Select the COM Port Base */ + switch (KdpPort) + { + case 1: ComPortBase = 0x3f8; break; + case 2: ComPortBase = 0x2f8; break; + case 3: ComPortBase = 0x3e8; break; + case 4: ComPortBase = 0x2e8; break; + } + + /* search for this port address in DriverList */ + for (i = 0; i < DriverList->List[0].PartialResourceList.Count; i++) + { + ResourceDescriptor = &DriverList->List[0].PartialResourceList.PartialDescriptors[i]; + if (ResourceDescriptor->Type == CmResourceTypePort) + { + if ((ResourceDescriptor->u.Port.Start.u.LowPart <= ComPortBase) && + (ResourceDescriptor->u.Port.Start.u.LowPart + + ResourceDescriptor->u.Port.Length > ComPortBase)) + { + /* Conflict found */ + return TRUE; + } + } + } + + /* No Conflicts */ + return FALSE; +} + +ULONG +STDCALL +KdpPrintString(PANSI_STRING String) +{ + if (!KdpDebugMode.Value) return 0; + PCH pch = String->Buffer; + PLIST_ENTRY CurrentEntry; + PKD_DISPATCH_TABLE CurrentTable; + + /* Call the registered handlers */ + CurrentEntry = KdProviders.Flink; + while (CurrentEntry != &KdProviders) + { + /* Get the current table */ + CurrentTable = CONTAINING_RECORD(CurrentEntry, + KD_DISPATCH_TABLE, + KdProvidersList); + + /* Call it */ + CurrentTable->KdpPrintRoutine(pch); + + /* Next Table */ + CurrentEntry = CurrentEntry->Flink; + } + + /* Call the Wrapper Routine */ + if (WrapperInitRoutine) WrapperTable.KdpPrintRoutine(pch); + + /* Return the Length */ + return((ULONG)String->Length); +} + +/* EOF */ + diff --git a/reactos/ntoskrnl/kd/kdmain.c b/reactos/ntoskrnl/kd/kdmain.c new file mode 100644 index 00000000000..b8135000154 --- /dev/null +++ b/reactos/ntoskrnl/kd/kdmain.c @@ -0,0 +1,205 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/kd/kdinit.c + * PURPOSE: Kernel Debugger Initializtion + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +#include +#define NDEBUG +#include + +/* VARIABLES ***************************************************************/ + +BOOLEAN EXPORTED KdDebuggerEnabled = FALSE; +BOOLEAN EXPORTED KdEnteredDebugger = FALSE; +BOOLEAN EXPORTED KdDebuggerNotPresent = TRUE; +BOOLEAN EXPORTED KiEnableTimerWatchdog = FALSE; +ULONG EXPORTED KiBugCheckData; +BOOLEAN KdpBreakPending; +VOID STDCALL PspDumpThreads(BOOLEAN SystemThreads); + +/* PRIVATE FUNCTIONS *********************************************************/ + +ULONG +STDCALL +KdpServiceDispatcher(ULONG Service, + PVOID Context1, + PVOID Context2) +{ + ULONG Result = 0; + + switch (Service) + { + case 1: /* DbgPrint */ + Result = KdpPrintString ((PANSI_STRING)Context1); + break; + + case TAG('R', 'o', 's', ' '): /* ROS-INTERNAL */ + { + switch ((ULONG)Context1) + { + case DumpNonPagedPool: + MiDebugDumpNonPagedPool(FALSE); + break; + + case ManualBugCheck: + KEBUGCHECK(MANUALLY_INITIATED_CRASH); + break; + + case DumpNonPagedPoolStats: + MiDebugDumpNonPagedPoolStats(FALSE); + break; + + case DumpNewNonPagedPool: + MiDebugDumpNonPagedPool(TRUE); + break; + + case DumpNewNonPagedPoolStats: + MiDebugDumpNonPagedPoolStats(TRUE); + break; + + case DumpAllThreads: + PspDumpThreads(TRUE); + break; + + case DumpUserThreads: + PspDumpThreads(FALSE); + break; + + case EnterDebugger: + DbgBreakPoint(); + break; + + default: + break; + } + } + + default: + HalDisplayString ("Invalid debug service call!\n"); + break; + } + + return Result; +} + +KD_CONTINUE_TYPE +STDCALL +KdpEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, + KPROCESSOR_MODE PreviousMode, + PCONTEXT Context, + PKTRAP_FRAME TrapFrame, + BOOLEAN FirstChance, + BOOLEAN Gdb) +{ + /* Get out of here if the Debugger isn't enabled */ + if (!KdDebuggerEnabled) return kdHandleException; + + /* FIXME: + * Right now, the GDB wrapper seems to handle exceptions differntly + * from KDGB and both are called at different times, while the GDB + * one is only called once and that's it. I don't really have the knowledge + * to fix the GDB stub, so until then, we'll be using this hack + */ + if (Gdb) + { + /* Call the registered wrapper */ + if (WrapperInitRoutine) return WrapperTable. + KdpExceptionRoutine(ExceptionRecord, + Context, + TrapFrame); + } + + /* Call KDBG if available */ + return KdbEnterDebuggerException(ExceptionRecord, + PreviousMode, + Context, + TrapFrame, + FirstChance); +} + +/* PUBLIC FUNCTIONS *********************************************************/ + +/* + * @implemented + */ +VOID +STDCALL +KdDisableDebugger(VOID) +{ + KIRQL OldIrql; + + /* Raise IRQL */ + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + + /* TODO: Disable any breakpoints */ + + /* Disable the Debugger */ + KdDebuggerEnabled = FALSE; + + /* Lower the IRQL */ + KeLowerIrql(OldIrql); +} + +/* + * @implemented + */ +VOID +STDCALL +KdEnableDebugger(VOID) +{ + KIRQL OldIrql; + + /* Raise IRQL */ + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + + /* TODO: Re-enable any breakpoints */ + + /* Enable the Debugger */ + KdDebuggerEnabled = TRUE; + + /* Lower the IRQL */ + KeLowerIrql(OldIrql); +} + +/* + * @implemented + */ +BOOLEAN +STDCALL +KdPollBreakIn(VOID) +{ + return KdpBreakPending; +} + +/* + * @implemented + */ +VOID +STDCALL +KeEnterKernelDebugger(VOID) +{ + HalDisplayString("\n\n *** Entered kernel debugger ***\n"); + + /* Set the Variable */ + KdEnteredDebugger = TRUE; + + /* Halt the CPU */ + for (;;) Ke386HaltProcessor(); +} + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +KdPowerTransition(ULONG PowerState) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + + /* EOF */ diff --git a/reactos/ntoskrnl/kd/mda.c b/reactos/ntoskrnl/kd/mda.c deleted file mode 100644 index cd6887ac3c3..00000000000 --- a/reactos/ntoskrnl/kd/mda.c +++ /dev/null @@ -1,131 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/kd/mda.c - * PURPOSE: Support for debugging using an MDA card. - * - * PROGRAMMERS: David Welch - */ - -/* INCLUDES ******************************************************************/ - -#include -#include "../dbg/kdb.h" - -/* VARIABLES ***************************************************************/ - -STATIC ULONG MdaIndexPort; -STATIC ULONG MdaValuePort; -STATIC ULONG MdaStatusPort; -STATIC ULONG MdaGfxPort; -STATIC ULONG MdaModePort; -STATIC PUSHORT VideoBuffer; - -#define MDA_COLUMNS (80) -#define MDA_LINES (25) - -STATIC ULONG MdaCursorX, MdaCursorY; - -/* PRIVATE FUNCTIONS ********************************************************/ - -#if 0 -VOID STATIC -KdWriteByteMDA(ULONG Reg, ULONG Value) -{ - WRITE_PORT_UCHAR((PUCHAR)MdaIndexPort, (CHAR)Reg); - WRITE_PORT_UCHAR((PUCHAR)MdaValuePort, (CHAR)Value); -} - -VOID STATIC -KdWriteWordMDA(ULONG Reg, ULONG Value) -{ - WRITE_PORT_UCHAR((PUCHAR)MdaIndexPort, (CHAR)Reg); - WRITE_PORT_UCHAR((PUCHAR)MdaValuePort, (CHAR)(Value >> 8)); - WRITE_PORT_UCHAR((PUCHAR)MdaIndexPort, (CHAR)(Reg + 1)); - WRITE_PORT_UCHAR((PUCHAR)MdaValuePort, (CHAR)(Value & 0xFF)); -} -#endif - -VOID -KdInitializeMda(VOID) -{ - /* Setup the variables for the various port addresses. */ - MdaIndexPort = 0x3b4; - MdaValuePort = 0x3b5; - MdaModePort = 0x3b8; - MdaStatusPort = 0x3ba; - MdaGfxPort = 0x3bf; - - VideoBuffer = (PUSHORT)(0xff3b0000); - - MdaCursorX = MdaCursorY = 0; -} - -VOID STATIC -KdScrollMda(VOID) -{ - memmove(&VideoBuffer[(MDA_COLUMNS * 0) + 0], - &VideoBuffer[(MDA_COLUMNS * 1) + 0], - MDA_COLUMNS * (MDA_LINES - 1) * 2); - memset(&VideoBuffer[(MDA_COLUMNS * (MDA_LINES - 1)) + 0], 0, - MDA_COLUMNS * 2); -} - -VOID STATIC -KdPutCharMda(CHAR Ch) -{ - if (Ch == '\n') - { - if (MdaCursorY == (MDA_LINES - 1)) - { - KdScrollMda(); - } - else - { - MdaCursorY++; - } - MdaCursorX = 0; - return; - } - VideoBuffer[(MdaCursorY * MDA_COLUMNS) + MdaCursorX] = (Ch & 0xFF) | 0x0700; - MdaCursorX++; - if (MdaCursorX == (MDA_COLUMNS - 1)) - { - if (MdaCursorY == (MDA_LINES - 1)) - { - KdScrollMda(); - } - else - { - MdaCursorY++; - } - MdaCursorX = 0; - } -} - -VOID -KdPrintMda(PCH pch) -{ - while((*pch) != 0) - { - if ((*pch) == '\t') - { - KdPutCharMda(' '); - KdPutCharMda(' '); - KdPutCharMda(' '); - KdPutCharMda(' '); - } - if ((*pch) == '\r') - { - /* Nothing. */ - } - else - { - KdPutCharMda(*pch); - } - pch++; - } -} - -/* EOF */ diff --git a/reactos/ntoskrnl/kd/service.c b/reactos/ntoskrnl/kd/service.c deleted file mode 100644 index f37f9206e56..00000000000 --- a/reactos/ntoskrnl/kd/service.c +++ /dev/null @@ -1,201 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/kd/service.c - * PURPOSE: Debug service dispatcher - * - * PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de) - */ - -#include - - -/* FUNCTIONS ***************************************************************/ - -/* - * Note: DON'T CHANGE THIS FUNCTION!!! - * DON'T CALL HalDisplayString OR SOMETING ELSE!!! - * You'll only break the serial/bochs debugging feature!!! - */ - -ULONG -KdpServiceDispatcher ( - ULONG Service, - PVOID Context1, - PVOID Context2) -{ - ULONG Result = 0; - - switch (Service) - { - case 1: /* DbgPrint */ - Result = KdpPrintString ((PANSI_STRING)Context1); - break; - - default: - HalDisplayString ("Invalid debug service call!\n"); - break; - } - - return Result; -} - - -#define _STR(x) #x -#define STR(x) _STR(x) - -#if defined(__GNUC__) - -void interrupt_handler2d(void); - __asm__("\n\t.global _interrupt_handler2d\n\t" - "_interrupt_handler2d:\n\t" - - /* Save the user context */ - "pushl %ebp\n\t" /* Ebp */ - - "pushl %eax\n\t" /* Eax */ - "pushl %ecx\n\t" /* Ecx */ - "pushl %edx\n\t" /* Edx */ - "pushl %ebx\n\t" /* Ebx */ - "pushl %esi\n\t" /* Esi */ - "pushl %edi\n\t" /* Edi */ - - "pushl %ds\n\t" /* SegDs */ - "pushl %es\n\t" /* SegEs */ - "pushl %fs\n\t" /* SegFs */ - "pushl %gs\n\t" /* SegGs */ - - "subl $112,%esp\n\t" /* FloatSave */ - - "pushl $0\n\t" /* Dr7 */ - "pushl $0\n\t" /* Dr6 */ - "pushl $0\n\t" /* Dr3 */ - "pushl $0\n\t" /* Dr2 */ - "pushl $0\n\t" /* Dr1 */ - "pushl $0\n\t" /* Dr0 */ - - "pushl $0\n\t" /* ContextFlags */ - - /* Set ES to kernel segment */ - "movw $"STR(KERNEL_DS)",%bx\n\t" - "movw %bx,%es\n\t" - - /* FIXME: check to see if SS is valid/inrange */ - - /* DS and GS are now also kernel segments */ - "movw %bx,%ds\n\t" - "movw %bx,%gs\n\t" - - /* Set FS to the PCR */ - "movw $"STR(PCR_SELECTOR)",%bx\n\t" - "movw %bx,%fs\n\t" - - /* Call debug service dispatcher */ - "pushl %edx\n\t" - "pushl %ecx\n\t" - "pushl %eax\n\t" - "call _KdpServiceDispatcher\n\t" - "addl $12,%esp\n\t" /* restore stack pointer */ - - /* Restore the user context */ - "addl $4,%esp\n\t" /* UserContext */ - "addl $24,%esp\n\t" /* Dr[0-3,6-7] */ - "addl $112,%esp\n\t" /* FloatingSave */ - "popl %gs\n\t" /* SegGs */ - "popl %fs\n\t" /* SegFs */ - "popl %es\n\t" /* SegEs */ - "popl %ds\n\t" /* SegDs */ - - "popl %edi\n\t" /* Edi */ - "popl %esi\n\t" /* Esi */ - "popl %ebx\n\t" /* Ebx */ - "popl %edx\n\t" /* Edx */ - "popl %ecx\n\t" /* Ecx */ - "addl $4,%esp\n\t" /* Eax (Not restored) */ - - "popl %ebp\n\t" /* Ebp */ - - "iret\n\t"); - -#elif defined(_MSC_VER) - -__declspec(naked) -void interrupt_handler2d() -{ - __asm - { - /* Save the user context */ - push ebp - push eax - push ecx - push edx - push ebx - push esi - push edi - - push ds - push es - push fs - push gs - - sub esp, 112 /* FloatSave */ - - mov ebx, eax - mov eax, dr7 __asm push eax - mov eax, dr6 __asm push eax - mov eax, dr3 __asm push eax - mov eax, dr2 __asm push eax - mov eax, dr1 __asm push eax - mov eax, dr0 __asm push eax - mov eax, ebx - - push 0 /* ContextFlags */ - - /* Set ES to kernel segment */ - mov bx, KERNEL_DS - mov es, bx - - /* FIXME: check to see if SS is valid/inrange */ - - mov ds, bx /* DS is now also kernel segment */ - - /* Call debug service dispatcher */ - push edx - push ecx - push eax - call KdpServiceDispatcher - add esp, 12 /* restore stack pointer */ - - /* Restore the user context */ - add esp, 4 /* UserContext */ - pop eax __asm mov dr0, eax - pop eax __asm mov dr1, eax - pop eax __asm mov dr2, eax - pop eax __asm mov dr3, eax - pop eax __asm mov dr6, eax - pop eax __asm mov dr7, eax - add esp, 112 /* FloatingSave */ - pop gs - pop fs - pop es - pop ds - - pop edi - pop esi - pop ebx - pop edx - pop ecx - add esp, 4 /* Eax Not restored */ - - pop ebp - - iretd - } -} - -#else -#error Unknown compiler for inline assembler -#endif - -/* EOF */ diff --git a/reactos/ntoskrnl/kd/wrappers/bochs.c b/reactos/ntoskrnl/kd/wrappers/bochs.c new file mode 100644 index 00000000000..e0c5cca9025 --- /dev/null +++ b/reactos/ntoskrnl/kd/wrappers/bochs.c @@ -0,0 +1,55 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/kd/wrappers/bochs.c + * PURPOSE: BOCHS Wrapper for Kd + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +#include +#define NDEBUG +#include + +/* bochs debug output */ +#define BOCHS_LOGGER_PORT (0xe9) + +/* FUNCTIONS *****************************************************************/ + +VOID +STDCALL +KdpBochsDebugPrint(IN PCH Message) +{ + while (*Message != 0) + { + if (*Message == '\n') + { + WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r'); + } + WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *Message); + Message++; + } +} + + + +VOID +STDCALL +KdpBochsInit(PKD_DISPATCH_TABLE WrapperTable, + ULONG BootPhase) +{ + if (!KdpDebugMode.Bochs) return; + + if (BootPhase == 0) + { + /* Write out the functions that we support for now */ + WrapperTable->KdpInitRoutine = KdpBochsInit; + WrapperTable->KdpPrintRoutine = KdpBochsDebugPrint; + } + else if (BootPhase == 2) + { + HalDisplayString("\n Bochs debugging enabled\n\n"); + } +} + +/* EOF */ diff --git a/reactos/ntoskrnl/kd/gdbstub.c b/reactos/ntoskrnl/kd/wrappers/gdbstub.c similarity index 92% rename from reactos/ntoskrnl/kd/gdbstub.c rename to reactos/ntoskrnl/kd/wrappers/gdbstub.c index 498ddb03636..b74e401f063 100644 --- a/reactos/ntoskrnl/kd/gdbstub.c +++ b/reactos/ntoskrnl/kd/wrappers/gdbstub.c @@ -107,6 +107,7 @@ static PETHREAD GspDbgThread; static PETHREAD GspEnumThread; extern LIST_ENTRY PsActiveProcessHead; +KD_PORT_INFORMATION GdbPortInfo = { 2, 115200, 0 }; /* FIXME hardcoded for COM2, 115200 baud */ /* Number of Registers. */ #define NUMREGS 16 @@ -131,6 +132,20 @@ typedef struct _CPU_REGISTER #define EIP_REGNO 8 +typedef +VOID +STDCALL_FUNC +(*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, + PVOID StartContext); + +VOID +STDCALL +KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + BOOLEAN UserThread, + KTRAP_FRAME TrapFrame); + static CPU_REGISTER GspRegisters[NUMREGS] = { { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eax), FIELD_OFFSET (CONTEXT, Eax), TRUE }, @@ -150,19 +165,19 @@ static CPU_REGISTER GspRegisters[NUMREGS] = { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Fs), FIELD_OFFSET (CONTEXT, SegFs), TRUE }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Gs), FIELD_OFFSET (CONTEXT, SegGs), TRUE } }; - -static PCHAR GspThreadStates[THREAD_STATE_MAX] = -{ - "Initialized", /* THREAD_STATE_INITIALIZED */ - "Ready", /* THREAD_STATE_READY */ - "Running", /* THREAD_STATE_RUNNING */ - "Suspended", /* THREAD_STATE_SUSPENDED */ - "Frozen", /* THREAD_STATE_FROZEN */ - "Terminated 1", /* THREAD_STATE_TERMINATED_1 */ - "Terminated 2", /* THREAD_STATE_TERMINATED_2 */ - "Blocked" /* THREAD_STATE_BLOCKED */ + +static PCHAR GspThreadStates[DeferredReady+1] = +{ "Initialized", + "Ready", + "Running", + "Standby", + "Terminated", + "Waiting", + "Transition", + "DeferredReady" }; + LONG HexValue (CHAR ch) { @@ -175,6 +190,22 @@ HexValue (CHAR ch) static CHAR GspInBuffer[BUFMAX]; static CHAR GspOutBuffer[BUFMAX]; +VOID +GdbPutChar(UCHAR Value) +{ + KdPortPutByteEx (&GdbPortInfo, Value); +} + +UCHAR +GdbGetChar(VOID) +{ + UCHAR Value; + + while (!KdPortGetByteEx (&GdbPortInfo, &Value)); + + return Value; +} + /* scan for the sequence $# */ PCHAR @@ -189,7 +220,7 @@ GspGetPacket() while (TRUE) { /* wait around for the start character, ignore all other characters */ - while ((ch = KdGetChar ()) != '$'); + while ((ch = GdbGetChar ()) != '$'); retry: Checksum = 0; @@ -199,7 +230,7 @@ GspGetPacket() /* now, read until a # or end of Buffer is found */ while (Count < BUFMAX) { - ch = KdGetChar (); + ch = GdbGetChar (); if (ch == '$') goto retry; if (ch == '#') @@ -212,24 +243,24 @@ GspGetPacket() if (ch == '#') { - ch = KdGetChar (); + ch = GdbGetChar (); XmitChecksum = (CHAR)(HexValue (ch) << 4); - ch = KdGetChar (); + ch = GdbGetChar (); XmitChecksum += (CHAR)(HexValue (ch)); if (Checksum != XmitChecksum) { - KdPutChar ('-'); /* failed checksum */ + GdbPutChar ('-'); /* failed checksum */ } else { - KdPutChar ('+'); /* successful transfer */ + GdbPutChar ('+'); /* successful transfer */ /* if a sequence char is present, reply the sequence ID */ if (Buffer[2] == ':') { - KdPutChar (Buffer[0]); - KdPutChar (Buffer[1]); + GdbPutChar (Buffer[0]); + GdbPutChar (Buffer[1]); return &Buffer[3]; } @@ -252,22 +283,22 @@ GspPutPacket (PCHAR Buffer) /* $#. */ do { - KdPutChar ('$'); + GdbPutChar ('$'); Checksum = 0; Count = 0; while ((ch = Buffer[Count])) { - KdPutChar (ch); + GdbPutChar (ch); Checksum += ch; Count += 1; } - KdPutChar ('#'); - KdPutChar (HexChars[(Checksum >> 4) & 0xf]); - KdPutChar (HexChars[Checksum & 0xf]); + GdbPutChar ('#'); + GdbPutChar (HexChars[(Checksum >> 4) & 0xf]); + GdbPutChar (HexChars[Checksum & 0xf]); } - while (KdGetChar () != '+'); + while (GdbGetChar () != '+'); } @@ -279,20 +310,20 @@ GspPutPacketNoWait (PCHAR Buffer) CHAR ch; /* $#. */ - KdPutChar ('$'); + GdbPutChar ('$'); Checksum = 0; Count = 0; while ((ch = Buffer[Count])) { - KdPutChar (ch); + GdbPutChar (ch); Checksum += ch; Count += 1; } - KdPutChar ('#'); - KdPutChar (HexChars[(Checksum >> 4) & 0xf]); - KdPutChar (HexChars[Checksum & 0xf]); + GdbPutChar ('#'); + GdbPutChar (HexChars[(Checksum >> 4) & 0xf]); + GdbPutChar (HexChars[Checksum & 0xf]); } /* Indicate to caller of GspMem2Hex or GspHex2Mem that there has been an @@ -533,7 +564,7 @@ GspGetRegistersFromTrapFrame(PCHAR Address, * This thread has not been sheduled yet so assume it * is still in PsBeginThreadWithContextInternal(). */ - Value = (ULONG) PsBeginThreadWithContextInternal; + Value = (ULONG)KiThreadStartup; } else { @@ -634,19 +665,24 @@ GspSetThread(PCHAR Request) { case 'c': /* Run thread */ if (GspFindThread (ptr, &ThreadInfo)) - { - GspOutBuffer[0] = 'O'; - GspOutBuffer[1] = 'K'; + { + GspOutBuffer[0] = 'O'; + GspOutBuffer[1] = 'K'; - if(GspRunThread) ObDereferenceObject(GspRunThread); - - GspRunThread = ThreadInfo; - if (GspRunThread) ObReferenceObject(GspRunThread); - } - else - { - GspOutBuffer[0] = 'E'; - } + if (NULL != GspRunThread) + { + ObDereferenceObject(GspRunThread); + } + GspRunThread = ThreadInfo; + if (NULL != GspRunThread) + { + ObReferenceObject(GspRunThread); + } + } + else + { + GspOutBuffer[0] = 'E'; + } break; case 'g': /* Debug thread */ if (GspFindThread (ptr, &ThreadInfo)) @@ -1046,9 +1082,10 @@ GspSetHwBreakpoint(ULONG BreakpointNumber, * This function does all command procesing for interfacing to gdb. */ KD_CONTINUE_TYPE -KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, - PCONTEXT Context, - PKTRAP_FRAME TrapFrame) +STDCALL +KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, + PCONTEXT Context, + PKTRAP_FRAME TrapFrame) { BOOLEAN Stepping; LONG Address; @@ -1394,7 +1431,7 @@ GspBreakIn(PKINTERRUPT Interrupt, KeTrapFrameToContext (TrapFrame, &Context); - KdEnterDebuggerException (NULL, &Context, TrapFrame); + KdpGdbEnterDebuggerException (NULL, &Context, TrapFrame); KeContextToTrapFrame (&Context, TrapFrame); @@ -1406,72 +1443,10 @@ GspBreakIn(PKINTERRUPT Interrupt, extern ULONG KdpPortIrq; -/* Initialize the GDB stub */ -VOID INIT_FUNCTION -KdGdbStubInit(ULONG Phase) -{ -#if 0 - KAFFINITY Affinity; - NTSTATUS Status; - ULONG MappedIrq; - KIRQL Dirql; -#endif - - if (Phase == 0) - { - GspInitialized = TRUE; - GspRunThread = PsGetCurrentThread(); - - ObReferenceObject(GspRunThread); - -/* GspDbgThread = PsGetCurrentThread(); */ - GspDbgThread = NULL; - GspEnumThread = NULL; - - HalDisplayString("Waiting for GDB to attach\n"); - DbgPrint("Module 'hal.dll' loaded at 0x%.08x.\n", LdrHalBase); - DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); - } - else if (Phase == 1) - { -#if 0 - /* Hook an interrupt handler to allow the debugger to break into - the system */ - MappedIrq = HalGetInterruptVector (Internal, - 0, - 0, - KdpPortIrq, - &Dirql, - &Affinity); - - Status = IoConnectInterrupt(&GspInterrupt, - GspBreakIn, - NULL, - NULL, - MappedIrq, - Dirql, - Dirql, - 0, - FALSE, - Affinity, - FALSE); - if (!NT_SUCCESS (Status)) - { - DPRINT1("Could not connect to IRQ line %d (0x%x)\n", - KdpPortIrq, Status); - return; - } - - KdPortEnableInterrupts(); - - DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); -#endif - } -} - VOID -KdGdbDebugPrint(LPSTR Message) +STDCALL +KdpGdbDebugPrint(PCH Message) { #if 0 /* This can be quite annoying! */ @@ -1518,3 +1493,41 @@ KdGdbListModules() DbgPrint ("%d modules listed\n", ModuleCount); } + +/* Initialize the GDB stub */ +VOID +STDCALL +KdpGdbStubInit(PKD_DISPATCH_TABLE WrapperTable, + ULONG BootPhase) +{ + if (!KdDebuggerEnabled || !KdpDebugMode.Gdb) return; + + if (BootPhase == 0) + { + /* Write out the functions that we support for now */ + WrapperTable->KdpInitRoutine = KdpGdbStubInit; + WrapperTable->KdpPrintRoutine = KdpGdbDebugPrint; + WrapperTable->KdpExceptionRoutine = KdpGdbEnterDebuggerException; + + /* Initialize the Port */ + KdPortInitializeEx(&GdbPortInfo, 0, 0); + } + else if (BootPhase == 1) + { + GspInitialized = TRUE; + + GspRunThread = NULL; + GspDbgThread = NULL; + GspEnumThread = NULL; + + HalDisplayString("Waiting for GDB to attach\n"); + DbgPrint("Module 'hal.dll' loaded at 0x%.08x.\n", LdrHalBase); + DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); + } + else if (BootPhase == 2) + { + HalDisplayString("\n GDB debugging enabled\n\n"); + } +} + +/* EOF */ diff --git a/reactos/ntoskrnl/dbg/i386/dis-asm.h b/reactos/ntoskrnl/kdbg/i386/dis-asm.h similarity index 100% rename from reactos/ntoskrnl/dbg/i386/dis-asm.h rename to reactos/ntoskrnl/kdbg/i386/dis-asm.h diff --git a/reactos/ntoskrnl/dbg/i386/i386-dis.c b/reactos/ntoskrnl/kdbg/i386/i386-dis.c similarity index 100% rename from reactos/ntoskrnl/dbg/i386/i386-dis.c rename to reactos/ntoskrnl/kdbg/i386/i386-dis.c diff --git a/reactos/ntoskrnl/dbg/i386/kdb_help.S b/reactos/ntoskrnl/kdbg/i386/kdb_help.S similarity index 100% rename from reactos/ntoskrnl/dbg/i386/kdb_help.S rename to reactos/ntoskrnl/kdbg/i386/kdb_help.S diff --git a/reactos/ntoskrnl/dbg/i386/longjmp.S b/reactos/ntoskrnl/kdbg/i386/longjmp.S similarity index 96% rename from reactos/ntoskrnl/dbg/i386/longjmp.S rename to reactos/ntoskrnl/kdbg/i386/longjmp.S index 1edbaaf2ebb..ab82f116684 100644 --- a/reactos/ntoskrnl/dbg/i386/longjmp.S +++ b/reactos/ntoskrnl/kdbg/i386/longjmp.S @@ -1,70 +1,70 @@ - .file "longjmp.S" -/* - * Copyright (C) 1998, 1999, Jonathan S. Shapiro. - * - * This file is part of the EROS Operating System. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2, - * or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - /* - * typedef struct { - * unsigned long ebx, esi, edi; - * unsigned long ebp; - * unsigned long sp; - * unsigned long pc; - * } jmp_buf[1]; - */ - - /* - * On entry, the stack to longjmp looks like: - * - * value - * ptr to jmp_buf - * return PC - */ - -.globl _longjmp -_longjmp: - pushl %ebp - movl %esp,%ebp - - movl 8(%ebp),%ecx /* address of jmp_buf to ecx */ - movl 12(%ebp),%eax /* return value to %eax */ - testl %eax,%eax - jne 1f - incl %eax /* return 1 if handed 0 */ - -1: - movl (%ecx),%ebx /* restore %ebx */ - movl 4(%ecx),%esi /* restore %esi */ - movl 8(%ecx),%edi /* restore %edi */ - - /* - * From this instant on we are not running in a valid frame - */ - - movl 12(%ecx),%ebp /* restore %ebp */ - movl 16(%ecx),%esp /* restore %esp */ - /* movl 20(%ecx),%eax return PC */ - - /* - * Since we are abandoning the stack in any case, - * there isn't much point in doing the usual return - * discipline. - */ - - jmpl *20(%ecx) - + .file "longjmp.S" +/* + * Copyright (C) 1998, 1999, Jonathan S. Shapiro. + * + * This file is part of the EROS Operating System. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2, + * or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + /* + * typedef struct { + * unsigned long ebx, esi, edi; + * unsigned long ebp; + * unsigned long sp; + * unsigned long pc; + * } jmp_buf[1]; + */ + + /* + * On entry, the stack to longjmp looks like: + * + * value + * ptr to jmp_buf + * return PC + */ + +.globl _longjmp +_longjmp: + pushl %ebp + movl %esp,%ebp + + movl 8(%ebp),%ecx /* address of jmp_buf to ecx */ + movl 12(%ebp),%eax /* return value to %eax */ + testl %eax,%eax + jne 1f + incl %eax /* return 1 if handed 0 */ + +1: + movl (%ecx),%ebx /* restore %ebx */ + movl 4(%ecx),%esi /* restore %esi */ + movl 8(%ecx),%edi /* restore %edi */ + + /* + * From this instant on we are not running in a valid frame + */ + + movl 12(%ecx),%ebp /* restore %ebp */ + movl 16(%ecx),%esp /* restore %esp */ + /* movl 20(%ecx),%eax return PC */ + + /* + * Since we are abandoning the stack in any case, + * there isn't much point in doing the usual return + * discipline. + */ + + jmpl *20(%ecx) + diff --git a/reactos/ntoskrnl/dbg/i386/setjmp.S b/reactos/ntoskrnl/kdbg/i386/setjmp.S similarity index 97% rename from reactos/ntoskrnl/dbg/i386/setjmp.S rename to reactos/ntoskrnl/kdbg/i386/setjmp.S index d53e0592f38..7a596b91cda 100644 --- a/reactos/ntoskrnl/dbg/i386/setjmp.S +++ b/reactos/ntoskrnl/kdbg/i386/setjmp.S @@ -1,59 +1,59 @@ - .file "setjmp.S" -/* - * Copyright (C) 1998, 1999, Jonathan S. Shapiro. - * - * This file is part of the EROS Operating System. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2, - * or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* #include */ - - - /* - * typedef struct { - * unsigned long ebx, esi, edi; - * unsigned long ebp; - * unsigned long sp; - * unsigned long pc; - * } jmp_buf[1]; - */ - - /* - * On entry, the stack to setjmp looks like: - * - * ptr to jmp_buf - * return PC - */ -.globl _setjmp -_setjmp: - pushl %ebp - movl %esp,%ebp - - movl 0x8(%ebp),%eax /* address of jmp_buf to eax */ - movl %ebx,(%eax) /* save %ebx */ - movl %esi,4(%eax) /* save %esi */ - movl %edi,8(%eax) /* save %edi */ - leal 8(%ebp),%edx /* calling proc's esp, not ours! */ - movl %edx,16(%eax) - movl 4(%ebp), %edx /* save return PC */ - movl %edx,20(%eax) - movl 0(%ebp),%edx /* calling proc's ebp, not ours! */ - movl %edx,12(%eax) - - xorl %eax,%eax /* return 0 the first time */ - leave - ret $4 - + .file "setjmp.S" +/* + * Copyright (C) 1998, 1999, Jonathan S. Shapiro. + * + * This file is part of the EROS Operating System. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2, + * or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* #include */ + + + /* + * typedef struct { + * unsigned long ebx, esi, edi; + * unsigned long ebp; + * unsigned long sp; + * unsigned long pc; + * } jmp_buf[1]; + */ + + /* + * On entry, the stack to setjmp looks like: + * + * ptr to jmp_buf + * return PC + */ +.globl _setjmp +_setjmp: + pushl %ebp + movl %esp,%ebp + + movl 0x8(%ebp),%eax /* address of jmp_buf to eax */ + movl %ebx,(%eax) /* save %ebx */ + movl %esi,4(%eax) /* save %esi */ + movl %edi,8(%eax) /* save %edi */ + leal 8(%ebp),%edx /* calling proc's esp, not ours! */ + movl %edx,16(%eax) + movl 4(%ebp), %edx /* save return PC */ + movl %edx,20(%eax) + movl 0(%ebp),%edx /* calling proc's ebp, not ours! */ + movl %edx,12(%eax) + + xorl %eax,%eax /* return 0 the first time */ + leave + ret $4 + diff --git a/reactos/ntoskrnl/dbg/kdb.c b/reactos/ntoskrnl/kdbg/kdb.c similarity index 98% rename from reactos/ntoskrnl/dbg/kdb.c rename to reactos/ntoskrnl/kdbg/kdb.c index f6a08630398..95b94f16c99 100644 --- a/reactos/ntoskrnl/dbg/kdb.c +++ b/reactos/ntoskrnl/kdbg/kdb.c @@ -1,17 +1,15 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/kdb.c - * PURPOSE: Kernel debugger + * FILE: ntoskrnl/kdbg/kdb.c + * PURPOSE: Kernel Debugger * - * PROGRAMMERS: David Welch (welch@mcmail.com) + * PROGRAMMERS: Gregor Anich */ /* INCLUDES ******************************************************************/ #include -#include "kdb.h" #define NDEBUG #include @@ -43,7 +41,7 @@ STATIC PKDB_BREAKPOINT KdbBreakPointToReenable = NULL; /* Set to a breakpoint st LONG KdbLastBreakPointNr = -1; /* Index of the breakpoint which cause KDB to be entered */ ULONG KdbNumSingleSteps = 0; /* How many single steps to do */ BOOLEAN KdbSingleStepOver = FALSE; /* Whether to step over calls/reps. */ - +ULONG KdbDebugState = 0; /* KDBG Settings (NOECHO, KDSERIAL) */ STATIC BOOLEAN KdbEnteredOnSingleStep = FALSE; /* Set to true when KDB was entered because of single step */ PEPROCESS KdbCurrentProcess = NULL; /* The current process context in which KDB runs */ PEPROCESS KdbOriginalProcess = NULL; /* The process in whichs context KDB was intered */ @@ -1084,7 +1082,7 @@ KdbpInternalEnter() ULONG SavedStackLimit; KbdDisableMouse(); - if (KdDebugState & KD_DEBUG_SCREEN) + if (KdpDebugMode.Screen) { HalReleaseDisplayOwnership(); } @@ -1483,12 +1481,6 @@ continue_execution: return ContinueType; } -VOID -KdbInit() -{ - KdbpCliInit(); -} - VOID KdbDeleteProcessHook(IN PEPROCESS Process) { @@ -1498,9 +1490,27 @@ KdbDeleteProcessHook(IN PEPROCESS Process) } VOID -KdbModuleLoaded(IN PUNICODE_STRING Name) +STDCALL +KdbpGetCommandLineSettings(PCHAR p1) { - KdbpCliModuleLoaded(Name); + PCHAR p2; + + while (p1 && (p2 = strchr(p1, '/'))) + { + p2++; + + if (!_strnicmp(p2, "KDSERIAL", 8)) + { + p2 += 8; + KdbDebugState |= KD_DEBUG_KDSERIAL; + KdpDebugMode.Serial = TRUE; + } + else if (!_strnicmp(p2, "KDNOECHO", 8)) + { + p2 += 8; + KdbDebugState |= KD_DEBUG_KDNOECHO; + } + + p1 = p2; + } } - - diff --git a/reactos/ntoskrnl/dbg/kdb.h b/reactos/ntoskrnl/kdbg/kdb.h similarity index 100% rename from reactos/ntoskrnl/dbg/kdb.h rename to reactos/ntoskrnl/kdbg/kdb.h diff --git a/reactos/ntoskrnl/dbg/kdb_cli.c b/reactos/ntoskrnl/kdbg/kdb_cli.c similarity index 98% rename from reactos/ntoskrnl/dbg/kdb_cli.c rename to reactos/ntoskrnl/kdbg/kdb_cli.c index 75f2c78c75c..0d8342aa533 100644 --- a/reactos/ntoskrnl/dbg/kdb_cli.c +++ b/reactos/ntoskrnl/kdbg/kdb_cli.c @@ -30,7 +30,7 @@ #include #include -#include "kdb.h" +#include #define NDEBUG #include @@ -374,6 +374,19 @@ KdbpCmdRegs(ULONG Argc, PCHAR Argv[]) if (Argv[0][0] == 'r') /* regs */ { + ULONG Esp; + USHORT Ss; + + if (!(Tf->Cs & 1)) + { + Esp = (ULONG)Tf->TempEsp; + Ss = (USHORT)((ULONG)Tf->TempSegSs & 0xFFFF); + } + else + { + Esp = Tf->Esp; + Ss = Tf->Ss; + } KdbpPrint("CS:EIP 0x%04x:0x%08x\n" "SS:ESP 0x%04x:0x%08x\n" " EAX 0x%08x EBX 0x%08x\n" @@ -381,7 +394,7 @@ KdbpCmdRegs(ULONG Argc, PCHAR Argv[]) " ESI 0x%08x EDI 0x%08x\n" " EBP 0x%08x\n", Tf->Cs & 0xFFFF, Tf->Eip, - Tf->Ss, Tf->Esp, + Ss, Esp, Tf->Eax, Tf->Ebx, Tf->Ecx, Tf->Edx, Tf->Esi, Tf->Edi, @@ -556,6 +569,15 @@ KdbpCmdBackTrace(ULONG Argc, PCHAR Argv[]) return TRUE; } } + else + { + KdbpPrint("Eip:\n"); + /* Try printing the function at EIP */ + if (!KdbSymPrintAddress((PVOID)KdbCurrentTrapFrame->Tf.Eip)) + KdbpPrint("<%08x>\n", KdbCurrentTrapFrame->Tf.Eip); + else + KdbpPrint("\n"); + } KdbpPrint("Frames:\n"); while (Frame != 0) @@ -878,10 +900,10 @@ KdbpCmdThread(ULONG Argc, PCHAR Argv[]) ULONG Eip; ULONG ul = 0; PCHAR State, pend, str1, str2; - STATIC CONST PCHAR ThreadStateToString[THREAD_STATE_MAX] = + STATIC CONST PCHAR ThreadStateToString[DeferredReady+1] = { "Initialized", "Ready", "Running", - "Suspended", "Frozen", "Terminated1", - "Terminated2", "Blocked" }; + "Standby", "Terminated", "Waiting", + "Transition", "DeferredReady" }; ASSERT(KdbCurrentProcess != NULL); if (Argc >= 2 && _stricmp(Argv[1], "list") == 0) @@ -943,7 +965,7 @@ KdbpCmdThread(ULONG Argc, PCHAR Argv[]) if (Ebp != NULL) /* FIXME: Should we attach to the process to read Ebp[1]? */ KdbpSafeReadMemory(&Eip, Ebp + 1, sizeof (Eip));; } - if (Thread->Tcb.State < THREAD_STATE_MAX) + if (Thread->Tcb.State < (DeferredReady + 1)) State = ThreadStateToString[Thread->Tcb.State]; else State = "Unknown"; @@ -1001,7 +1023,7 @@ KdbpCmdThread(ULONG Argc, PCHAR Argv[]) } } - if (Thread->Tcb.State < THREAD_STATE_MAX) + if (Thread->Tcb.State < (DeferredReady + 1)) State = ThreadStateToString[Thread->Tcb.State]; else State = "Unknown"; @@ -1721,7 +1743,7 @@ KdbpPrint( if ((KdbNumberOfRowsTerminal < 0) || (KdbNumberOfColsTerminal < 0) || (KdbNumberOfRowsPrinted) == 0) /* Refresh terminal size each time when number of rows printed is 0 */ { - if ((KdDebugState & KD_DEBUG_KDSERIAL) && TerminalReportsSize) + if ((KdbDebugState & KD_DEBUG_KDSERIAL) && TerminalReportsSize) { /* Try to query number of rows from terminal. A reply looks like "\x1b[8;24;80t" */ TerminalReportsSize = FALSE; @@ -1800,7 +1822,7 @@ KdbpPrint( if (KdbNumberOfColsPrinted > 0) DbgPrint("\n"); DbgPrint("--- Press q to abort, any other key to continue ---"); - if (KdDebugState & KD_DEBUG_KDSERIAL) + if (KdbDebugState & KD_DEBUG_KDSERIAL) c = KdbpGetCharSerial(); else c = KdbpGetCharKeyboard(&ScanCode); @@ -1809,7 +1831,7 @@ KdbpPrint( /* Try to read '\n' which might follow '\r' - if \n is not received here * it will be interpreted as "return" when the next command should be read. */ - if (KdDebugState & KD_DEBUG_KDSERIAL) + if (KdbDebugState & KD_DEBUG_KDSERIAL) c = KdbpTryGetCharSerial(5); else c = KdbpTryGetCharKeyboard(&ScanCode, 5); @@ -1962,13 +1984,14 @@ KdbpReadCommand( INT CmdHistIndex = -1; INT i; - EchoOn = !((KdDebugState & KD_DEBUG_KDNOECHO) != 0); + EchoOn = !((KdbDebugState & KD_DEBUG_KDNOECHO) != 0); for (;;) { - if (KdDebugState & KD_DEBUG_KDSERIAL) + if (KdbDebugState & KD_DEBUG_KDSERIAL) { Key = (NextKey == '\0') ? KdbpGetCharSerial() : NextKey; + NextKey = '\0'; ScanCode = 0; if (Key == KEY_ESC) /* ESC */ { @@ -1996,6 +2019,7 @@ KdbpReadCommand( { ScanCode = 0; Key = (NextKey == '\0') ? KdbpGetCharKeyboard(&ScanCode) : NextKey; + NextKey = '\0'; } if ((Buffer - Orig) >= (Size - 1)) @@ -2010,11 +2034,11 @@ KdbpReadCommand( /* Read the next char - this is to throw away a \n which most clients should * send after \r. */ - if (KdDebugState & KD_DEBUG_KDSERIAL) + if (KdbDebugState & KD_DEBUG_KDSERIAL) NextKey = KdbpTryGetCharSerial(5); else NextKey = KdbpTryGetCharKeyboard(&ScanCode, 5); - if (NextKey == '\n') + if (NextKey == '\n' || NextKey == -1) /* \n or no response at all */ NextKey = '\0'; DbgPrint("\n"); /* @@ -2198,7 +2222,7 @@ KdbpCliMainLoop( } /* Flush the input buffer */ - if (KdDebugState & KD_DEBUG_KDSERIAL) + if (KdbDebugState & KD_DEBUG_KDSERIAL) { while (KdbpTryGetCharSerial(1) != -1); } diff --git a/reactos/ntoskrnl/dbg/kdb_expr.c b/reactos/ntoskrnl/kdbg/kdb_expr.c similarity index 96% rename from reactos/ntoskrnl/dbg/kdb_expr.c rename to reactos/ntoskrnl/kdbg/kdb_expr.c index fb36fedf77c..e3d2680a6a1 100644 --- a/reactos/ntoskrnl/dbg/kdb_expr.c +++ b/reactos/ntoskrnl/kdbg/kdb_expr.c @@ -1,1081 +1,1081 @@ -/* - * ReactOS kernel - * Copyright (C) 2005 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ - * - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/kdb_expr.c - * PURPOSE: Kernel debugger expression evaluation - * PROGRAMMER: Gregor Anich (blight@blight.eu.org) - * UPDATE HISTORY: - * Created 15/01/2005 - */ - -/* Note: - * - * The given expression is parsed and stored in reverse polish notation, - * then it is evaluated and the result is returned. - */ - -/* INCLUDES ******************************************************************/ - -#include -#include "kdb.h" -#define NDEBUG -#include - -/* TYPES *********************************************************************/ -typedef enum _RPN_OP_TYPE -{ - RpnOpNop, - RpnOpBinaryOperator, - RpnOpUnaryOperator, - RpnOpImmediate, - RpnOpRegister, - RpnOpDereference -} RPN_OP_TYPE; - -typedef ULONGLONG (*RPN_BINARY_OPERATOR)(ULONGLONG a, ULONGLONG b); - -typedef struct _RPN_OP -{ - RPN_OP_TYPE Type; - ULONG CharacterOffset; - union { - /* RpnOpBinaryOperator */ - RPN_BINARY_OPERATOR BinaryOperator; - /* RpnOpImmediate */ - ULONGLONG Immediate; - /* RpnOpRegister */ - UCHAR Register; - /* RpnOpDereference */ - UCHAR DerefMemorySize; - } Data; -} RPN_OP, *PRPN_OP; - -typedef struct _RPN_STACK -{ - ULONG Size; /* Number of RPN_OPs on Ops */ - ULONG Sp; /* Stack pointer */ - RPN_OP Ops[1]; /* Array of RPN_OPs */ -} RPN_STACK, *PRPN_STACK; - -/* DEFINES *******************************************************************/ -#define stricmp _stricmp - -#ifndef RTL_FIELD_SIZE -# define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) -#endif - -#define CONST_STRCPY(dst, src) \ - do { if ((dst) != NULL) { memcpy(dst, src, sizeof(src)); } } while (0); - -#define RPN_OP_STACK_SIZE 256 -#define RPN_VALUE_STACK_SIZE 256 - -/* GLOBALS *******************************************************************/ -STATIC struct { ULONG Size; ULONG Sp; RPN_OP Ops[RPN_OP_STACK_SIZE]; } RpnStack = { RPN_OP_STACK_SIZE, 0 }; - -STATIC CONST struct { PCHAR Name; UCHAR Offset; UCHAR Size; } RegisterToTrapFrame[] = -{ - {"eip", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Eip), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Eip)}, - {"eflags", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Eflags), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Eflags)}, - {"eax", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Eax), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Eax)}, - {"ebx", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ebx), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ebx)}, - {"ecx", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ecx), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ecx)}, - {"edx", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Edx), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Edx)}, - {"esi", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Esi), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Esi)}, - {"edi", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Edi), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Edi)}, - {"esp", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Esp), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Esp)}, - {"ebp", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ebp), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ebp)}, - {"cs", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Cs), 2 }, /* Use only the lower 2 bytes */ - {"ds", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ds), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ds)}, - {"es", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Es), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Es)}, - {"fs", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Fs), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Fs)}, - {"gs", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Gs), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Gs)}, - {"ss", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ss), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ss)}, - {"dr0", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr0), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr0)}, - {"dr1", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr1), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr1)}, - {"dr2", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr2), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr2)}, - {"dr3", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr3), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr3)}, - {"dr6", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr6), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr6)}, - {"dr7", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr7), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr7)}, - {"cr0", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr0), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr0)}, - {"cr2", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr2), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr2)}, - {"cr3", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr3), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr3)}, - {"cr4", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr4), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr4)} -}; -STATIC CONST INT RegisterToTrapFrameCount = - sizeof (RegisterToTrapFrame) / sizeof (RegisterToTrapFrame[0]); - -/* FUNCTIONS *****************************************************************/ - -ULONGLONG -RpnBinaryOperatorAdd(ULONGLONG a, ULONGLONG b) -{ - return a + b; -} - -ULONGLONG -RpnBinaryOperatorSub(ULONGLONG a, ULONGLONG b) -{ - return a - b; -} - -ULONGLONG -RpnBinaryOperatorMul(ULONGLONG a, ULONGLONG b) -{ - return a * b; -} - -ULONGLONG -RpnBinaryOperatorDiv(ULONGLONG a, ULONGLONG b) -{ - - return a / b; -} - -ULONGLONG -RpnBinaryOperatorMod(ULONGLONG a, ULONGLONG b) -{ - return a % b; -} - -ULONGLONG -RpnBinaryOperatorEquals(ULONGLONG a, ULONGLONG b) -{ - return (a == b); -} - -ULONGLONG -RpnBinaryOperatorNotEquals(ULONGLONG a, ULONGLONG b) -{ - return (a != b); -} - -ULONGLONG -RpnBinaryOperatorLessThan(ULONGLONG a, ULONGLONG b) -{ - return (a < b); -} - -ULONGLONG -RpnBinaryOperatorLessThanOrEquals(ULONGLONG a, ULONGLONG b) -{ - return (a <= b); -} - -ULONGLONG -RpnBinaryOperatorGreaterThan(ULONGLONG a, ULONGLONG b) -{ - return (a > b); -} - -ULONGLONG -RpnBinaryOperatorGreaterThanOrEquals(ULONGLONG a, ULONGLONG b) -{ - return (a >= b); -} - -/*!\brief Dumps the given RPN stack content - * - * \param Stack Pointer to a RPN_STACK structure. - */ -VOID -RpnpDumpStack( - IN PRPN_STACK Stack) -{ - ULONG ul; - - ASSERT(Stack != NULL); - DbgPrint("\nStack size: %ld\n", Stack->Sp); - for (ul = 0; ul < Stack->Sp; ul++) - { - PRPN_OP Op = Stack->Ops + ul; - switch (Op->Type) - { - case RpnOpNop: - DbgPrint("NOP,"); - break; - - case RpnOpImmediate: - DbgPrint("0x%I64x,", Op->Data.Immediate); - break; - - case RpnOpBinaryOperator: - if (Op->Data.BinaryOperator == RpnBinaryOperatorAdd) - DbgPrint("+,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorSub) - DbgPrint("-,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorMul) - DbgPrint("*,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorDiv) - DbgPrint("/,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorMod) - DbgPrint("%%,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorEquals) - DbgPrint("==,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorNotEquals) - DbgPrint("!=,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorLessThan) - DbgPrint("<,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorLessThanOrEquals) - DbgPrint("<=,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorGreaterThan) - DbgPrint(">,"); - else if (Op->Data.BinaryOperator == RpnBinaryOperatorGreaterThanOrEquals) - DbgPrint(">=,"); - else - DbgPrint("UNKNOWN OP,"); - break; - - case RpnOpRegister: - DbgPrint("%s,", RegisterToTrapFrame[Op->Data.Register].Name); - break; - - case RpnOpDereference: - DbgPrint("[%s],", - (Op->Data.DerefMemorySize == 1) ? ("byte") : - ((Op->Data.DerefMemorySize == 2) ? ("word") : - ((Op->Data.DerefMemorySize == 4) ? ("dword") : ("qword")) - ) - ); - break; - - default: - DbgPrint("\nUnsupported Type: %d\n", Op->Type); - ul = Stack->Sp; - break; - } - } - DbgPrint("\n"); -} - -/*!\brief Clears the given RPN stack. - * - * \param Stack Pointer to a RPN_STACK structure. - */ -STATIC VOID -RpnpClearStack( - OUT PRPN_STACK Stack) -{ - ASSERT(Stack != NULL); - Stack->Sp = 0; -} - -/*!\brief Pushes an RPN_OP onto the stack. - * - * \param Stack Pointer to a RPN_STACK structure. - * \param Op RPN_OP to be copied onto the stack. - */ -STATIC BOOLEAN -RpnpPushStack( - IN OUT PRPN_STACK Stack, - IN PRPN_OP Op) -{ - ASSERT(Stack != NULL); - ASSERT(Op != NULL); - - if (Stack->Sp >= Stack->Size) - return FALSE; - - memcpy(Stack->Ops + Stack->Sp, Op, sizeof (RPN_OP)); - Stack->Sp++; - return TRUE; -} - -/*!\brief Pops the top op from the stack. - * - * \param Stack Pointer to a RPN_STACK structure. - * \param Op Pointer to an RPN_OP to store the popped op into (can be NULL). - * - * \retval TRUE Success. - * \retval FALSE Failure (stack empty) - */ -STATIC BOOLEAN -RpnpPopStack( - IN OUT PRPN_STACK Stack, - OUT PRPN_OP Op OPTIONAL) -{ - ASSERT(Stack != NULL); - - if (Stack->Sp == 0) - return FALSE; - - Stack->Sp--; - if (Op != NULL) - memcpy(Op, Stack->Ops + Stack->Sp, sizeof (RPN_OP)); - return TRUE; -} - -/*!\brief Gets the top op from the stack (not popping it) - * - * \param Stack Pointer to a RPN_STACK structure. - * \param Op Pointer to an RPN_OP to copy the top op into. - * - * \retval TRUE Success. - * \retval FALSE Failure (stack empty) - */ -STATIC BOOLEAN -RpnpTopStack( - IN PRPN_STACK Stack, - OUT PRPN_OP Op) -{ - ASSERT(Stack != NULL); - ASSERT(Op != NULL); - - if (Stack->Sp == 0) - return FALSE; - - memcpy(Op, Stack->Ops + Stack->Sp - 1, sizeof (RPN_OP)); - return TRUE; -} - -/*!\brief Parses an expression. - * - * This functions parses the given expression until the end of string or a closing - * brace is found. As the function parses the string it pushes RPN_OPs onto the - * stack. - * - * Examples: 1+2*3 ; eax+10 ; (eax+16) * (ebx+4) ; dword[eax] - * - * \param Stack Pointer to a RPN_STACK structure. - * \param Expression String to parse. - * \param CharacterOffset Character offset of the subexpression from the beginning of the expression. - * \param End On success End is set to the character at which parsing stopped. - * \param ErrOffset On failure this is set to the character offset at which the error occoured. - * \param ErrMsg On failure a message describing the problem is copied into this buffer (128 bytes) - * - * \retval TRUE Success. - * \retval FALSE Failure. - */ -STATIC BOOLEAN -RpnpParseExpression( - IN PRPN_STACK Stack, - IN PCHAR Expression, - OUT PCHAR *End OPTIONAL, - IN ULONG CharacterOffset, - OUT PLONG ErrOffset OPTIONAL, - OUT PCHAR ErrMsg OPTIONAL) -{ - PCHAR p = Expression; - PCHAR pend; - PCHAR Operator = NULL; - LONG OperatorOffset = -1; - RPN_OP RpnOp; - RPN_OP PoppedOperator; - BOOLEAN HavePoppedOperator = FALSE; - RPN_OP ComparativeOp; - BOOLEAN ComparativeOpFilled = FALSE; - BOOLEAN IsComparativeOp; - INT i, i2; - ULONG ul; - UCHAR MemorySize; - CHAR Buffer[16]; - BOOLEAN First; - - ASSERT(Stack != NULL); - ASSERT(Expression != NULL); - - First = TRUE; - for (;;) - { - /* Skip whitespace */ - while (isspace(*p)) - { - p++; - CharacterOffset++; - } - - /* Check for end of expression */ - if (p[0] == '\0' || p[0] == ')' || p[0] == ']') - break; - - if (!First) - { - /* Remember operator */ - Operator = p++; - OperatorOffset = CharacterOffset++;; - - /* Pop operator (to get the right operator precedence) */ - HavePoppedOperator = FALSE; - if (*Operator == '*' || *Operator == '/' || *Operator == '%') - { - if (RpnpTopStack(Stack, &PoppedOperator) && - PoppedOperator.Type == RpnOpBinaryOperator && - (PoppedOperator.Data.BinaryOperator == RpnBinaryOperatorAdd || - PoppedOperator.Data.BinaryOperator == RpnBinaryOperatorSub)) - { - RpnpPopStack(Stack, NULL); - HavePoppedOperator = TRUE; - } - else if (PoppedOperator.Type == RpnOpNop) - { - RpnpPopStack(Stack, NULL); - /* Discard the NOP - it was only pushed to indicate there was a - * closing brace, so the previous operator shouldn't be popped. - */ - } - } - else if ((Operator[0] == '=' && Operator[1] == '=') || - (Operator[0] == '!' && Operator[1] == '=') || - Operator[0] == '<' || Operator[0] == '>') - { - if (Operator[0] == '=' || Operator[0] == '!' || - (Operator[0] == '<' && Operator[1] == '=') || - (Operator[0] == '>' && Operator[1] == '=')) - { - p++; - CharacterOffset++; - } -#if 0 - /* Parse rest of expression */ - if (!RpnpParseExpression(Stack, p + 1, &pend, CharacterOffset + 1, - ErrOffset, ErrMsg)) - { - return FALSE; - } - else if (pend == p + 1) - { - CONST_STRCPY(ErrMsg, "Expression expected"); - if (ErrOffset != NULL) - *ErrOffset = CharacterOffset + 1; - return FALSE; - } - goto end_of_expression; /* return */ -#endif - } - else if (Operator[0] != '+' && Operator[0] != '-') - { - CONST_STRCPY(ErrMsg, "Operator expected"); - if (ErrOffset != NULL) - *ErrOffset = OperatorOffset; - return FALSE; - } - - /* Skip whitespace */ - while (isspace(*p)) - { - p++; - CharacterOffset++; - } - } - - /* Get operand */ - MemorySize = sizeof(ULONG_PTR); /* default to pointer size */ -get_operand: - i = strcspn(p, "+-*/%()[]<>!="); - if (i > 0) - { - i2 = i; - - /* Copy register name/memory size */ - while (isspace(p[--i2])); - i2 = min(i2 + 1, sizeof (Buffer) - 1); - strncpy(Buffer, p, i2); - Buffer[i2] = '\0'; - - /* Memory size prefix */ - if (p[i] == '[') - { - if (stricmp(Buffer, "byte") == 0) - MemorySize = 1; - else if (stricmp(Buffer, "word") == 0) - MemorySize = 2; - else if (stricmp(Buffer, "dword") == 0) - MemorySize = 4; - else if (stricmp(Buffer, "qword") == 0) - MemorySize = 8; - else - { - CONST_STRCPY(ErrMsg, "Invalid memory size prefix"); - if (ErrOffset != NULL) - *ErrOffset = CharacterOffset; - return FALSE; - } - - p += i; - CharacterOffset += i; - goto get_operand; - } - - /* Try to find register */ - for (i = 0; i < RegisterToTrapFrameCount; i++) - { - if (stricmp(RegisterToTrapFrame[i].Name, Buffer) == 0) - break; - } - if (i < RegisterToTrapFrameCount) - { - RpnOp.Type = RpnOpRegister; - RpnOp.CharacterOffset = CharacterOffset; - RpnOp.Data.Register = i; - i = strlen(RegisterToTrapFrame[i].Name); - CharacterOffset += i; - p += i; - } - else - { - /* Immediate value */ - /* FIXME: Need string to ULONGLONG function */ - ul = strtoul(p, &pend, 0); - if (p != pend) - { - RpnOp.Type = RpnOpImmediate; - RpnOp.CharacterOffset = CharacterOffset; - RpnOp.Data.Immediate = (ULONGLONG)ul; - CharacterOffset += pend - p; - p = pend; - } - else - { - CONST_STRCPY(ErrMsg, "Operand expected"); - if (ErrOffset != NULL) - *ErrOffset = CharacterOffset; - return FALSE; - } - } - - /* Push operand */ - if (!RpnpPushStack(Stack, &RpnOp)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - } - else if (i == 0) - { - if (p[0] == '(' || p[0] == '[') /* subexpression */ - { - if (!RpnpParseExpression(Stack, p + 1, &pend, CharacterOffset + 1, - ErrOffset, ErrMsg)) - { - return FALSE; - } - else if (pend == p + 1) - { - CONST_STRCPY(ErrMsg, "Expression expected"); - if (ErrOffset != NULL) - *ErrOffset = CharacterOffset + 1; - return FALSE; - } - - if (p[0] == '[') /* dereference */ - { - ASSERT(MemorySize == 1 || MemorySize == 2 || - MemorySize == 4 || MemorySize == 8); - if (pend[0] != ']') - { - CONST_STRCPY(ErrMsg, "']' expected"); - if (ErrOffset != NULL) - *ErrOffset = CharacterOffset + (pend - p); - return FALSE; - } - RpnOp.Type = RpnOpDereference; - RpnOp.CharacterOffset = CharacterOffset; - RpnOp.Data.DerefMemorySize = MemorySize; - if (!RpnpPushStack(Stack, &RpnOp)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - } - else /* p[0] == '(' */ - { - if (pend[0] != ')') - { - CONST_STRCPY(ErrMsg, "')' expected"); - if (ErrOffset != NULL) - *ErrOffset = CharacterOffset + (pend - p); - return FALSE; - } - } - - /* Push a "nop" to prevent popping of the + operator (which would - * result in (10+10)/2 beeing evaluated as 15) - */ - RpnOp.Type = RpnOpNop; - if (!RpnpPushStack(Stack, &RpnOp)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - - /* Skip closing brace/bracket */ - pend++; - - CharacterOffset += pend - p; - p = pend; - } - else if (First && p[0] == '-') /* Allow expressions like "- eax" */ - { - RpnOp.Type = RpnOpImmediate; - RpnOp.CharacterOffset = CharacterOffset; - RpnOp.Data.Immediate = 0; - if (!RpnpPushStack(Stack, &RpnOp)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - } - else - { - CONST_STRCPY(ErrMsg, "Operand expected"); - if (ErrOffset != NULL) - *ErrOffset = CharacterOffset; - return FALSE; - } - } - else - { - CONST_STRCPY(ErrMsg, "strcspn() failed"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - - if (!First) - { - /* Push operator */ - RpnOp.CharacterOffset = OperatorOffset; - RpnOp.Type = RpnOpBinaryOperator; - IsComparativeOp = FALSE; - switch (*Operator) - { - case '+': - RpnOp.Data.BinaryOperator = RpnBinaryOperatorAdd; - break; - - case '-': - RpnOp.Data.BinaryOperator = RpnBinaryOperatorSub; - break; - - case '*': - RpnOp.Data.BinaryOperator = RpnBinaryOperatorMul; - break; - - case '/': - RpnOp.Data.BinaryOperator = RpnBinaryOperatorDiv; - break; - - case '%': - RpnOp.Data.BinaryOperator = RpnBinaryOperatorMod; - break; - - case '=': - ASSERT(Operator[1] == '='); - IsComparativeOp = TRUE; - RpnOp.Data.BinaryOperator = RpnBinaryOperatorEquals; - break; - - case '!': - ASSERT(Operator[1] == '='); - IsComparativeOp = TRUE; - RpnOp.Data.BinaryOperator = RpnBinaryOperatorNotEquals; - break; - - case '<': - IsComparativeOp = TRUE; - if (Operator[1] == '=') - RpnOp.Data.BinaryOperator = RpnBinaryOperatorLessThanOrEquals; - else - RpnOp.Data.BinaryOperator = RpnBinaryOperatorLessThan; - break; - - case '>': - IsComparativeOp = TRUE; - if (Operator[1] == '=') - RpnOp.Data.BinaryOperator = RpnBinaryOperatorGreaterThanOrEquals; - else - RpnOp.Data.BinaryOperator = RpnBinaryOperatorGreaterThan; - break; - - default: - ASSERT(0); - break; - } - if (IsComparativeOp) - { - if (ComparativeOpFilled && !RpnpPushStack(Stack, &ComparativeOp)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - memcpy(&ComparativeOp, &RpnOp, sizeof(RPN_OP)); - ComparativeOpFilled = TRUE; - } - else if (!RpnpPushStack(Stack, &RpnOp)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - - /* Push popped operator */ - if (HavePoppedOperator) - { - if (!RpnpPushStack(Stack, &PoppedOperator)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - } - } - - First = FALSE; - } - -//end_of_expression: - - if (ComparativeOpFilled && !RpnpPushStack(Stack, &ComparativeOp)) - { - CONST_STRCPY(ErrMsg, "RPN op stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - - /* Skip whitespace */ - while (isspace(*p)) - { - p++; - CharacterOffset++; - } - - if (End != NULL) - *End = p; - - return TRUE; -} - -/*!\brief Evaluates the RPN op stack and returns the result. - * - * \param Stack Pointer to a RPN_STACK structure. - * \param TrapFrame Register values. - * \param Result Pointer to an ULONG to store the result into. - * \param ErrOffset On failure this is set to the character offset at which the error occoured. - * \param ErrMsg Buffer which receives an error message on failure (128 bytes) - * - * \retval TRUE Success. - * \retval FALSE Failure. - */ -STATIC BOOLEAN -RpnpEvaluateStack( - IN PRPN_STACK Stack, - IN PKDB_KTRAP_FRAME TrapFrame, - OUT PULONGLONG Result, - OUT PLONG ErrOffset OPTIONAL, - OUT PCHAR ErrMsg OPTIONAL) -{ - ULONGLONG ValueStack[RPN_VALUE_STACK_SIZE]; - ULONG ValueStackPointer = 0; - ULONG index; - ULONGLONG ull; - ULONG ul; - USHORT us; - UCHAR uc; - PVOID p; - BOOLEAN Ok; -#ifdef DEBUG_RPN - ULONG ValueStackPointerMax = 0; -#endif - - ASSERT(Stack != NULL); - ASSERT(TrapFrame != NULL); - ASSERT(Result != NULL); - - for (index = 0; index < Stack->Sp; index++) - { - PRPN_OP Op = Stack->Ops + index; - -#ifdef DEBUG_RPN - ValueStackPointerMax = max(ValueStackPointerMax, ValueStackPointer); -#endif - - switch (Op->Type) - { - case RpnOpNop: - /* No operation */ - break; - - case RpnOpImmediate: - if (ValueStackPointer == RPN_VALUE_STACK_SIZE) - { - CONST_STRCPY(ErrMsg, "Value stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - ValueStack[ValueStackPointer++] = Op->Data.Immediate; - break; - - case RpnOpRegister: - if (ValueStackPointer == RPN_VALUE_STACK_SIZE) - { - CONST_STRCPY(ErrMsg, "Value stack overflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - ul = Op->Data.Register; - p = (PVOID)((ULONG_PTR)TrapFrame + RegisterToTrapFrame[ul].Offset); - switch (RegisterToTrapFrame[ul].Size) - { - case 1: ull = (ULONGLONG)(*(PUCHAR)p); break; - case 2: ull = (ULONGLONG)(*(PUSHORT)p); break; - case 4: ull = (ULONGLONG)(*(PULONG)p); break; - case 8: ull = (ULONGLONG)(*(PULONGLONG)p); break; - default: ASSERT(0); return FALSE; break; - } - ValueStack[ValueStackPointer++] = ull; - break; - - case RpnOpDereference: - if (ValueStackPointer < 1) - { - CONST_STRCPY(ErrMsg, "Value stack underflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - - /* FIXME: Print a warning when address is out of range */ - p = (PVOID)(ULONG_PTR)ValueStack[ValueStackPointer - 1]; - Ok = FALSE; - switch (Op->Data.DerefMemorySize) - { - case 1: - if (NT_SUCCESS(KdbpSafeReadMemory(&uc, p, sizeof (uc)))) - { - Ok = TRUE; - ull = (ULONGLONG)uc; - } - break; - case 2: - if (NT_SUCCESS(KdbpSafeReadMemory(&us, p, sizeof (us)))) - { - Ok = TRUE; - ull = (ULONGLONG)us; - } - break; - case 4: - if (NT_SUCCESS(KdbpSafeReadMemory(&ul, p, sizeof (ul)))) - { - Ok = TRUE; - ull = (ULONGLONG)ul; - } - break; - case 8: - if (NT_SUCCESS(KdbpSafeReadMemory(&ull, p, sizeof (ull)))) - { - Ok = TRUE; - } - break; - default: - ASSERT(0); - return FALSE; - break; - } - if (!Ok) - { - _snprintf(ErrMsg, 128, "Couldn't access memory at 0x%lx", (ULONG)p); - if (ErrOffset != NULL) - *ErrOffset = Op->CharacterOffset; - return FALSE; - } - ValueStack[ValueStackPointer - 1] = ull; - break; - - case RpnOpBinaryOperator: - if (ValueStackPointer < 2) - { - CONST_STRCPY(ErrMsg, "Value stack underflow"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - ValueStackPointer--; - ull = ValueStack[ValueStackPointer]; - if (ull == 0 && (Op->Data.BinaryOperator == RpnBinaryOperatorDiv || - Op->Data.BinaryOperator == RpnBinaryOperatorDiv)) - { - CONST_STRCPY(ErrMsg, "Devision by zero"); - if (ErrOffset != NULL) - *ErrOffset = Op->CharacterOffset; - return FALSE; - } - ull = Op->Data.BinaryOperator(ValueStack[ValueStackPointer - 1], ull); - ValueStack[ValueStackPointer - 1] = ull; - break; - - default: - ASSERT(0); - return FALSE; - } - } -#ifdef DEBUG_RPN - DPRINT1("Max value stack pointer: %d\n", ValueStackPointerMax); -#endif - if (ValueStackPointer != 1) - { - CONST_STRCPY(ErrMsg, "Stack not empty after evaluation"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return FALSE; - } - - *Result = ValueStack[0]; - return TRUE; -} - -/*!\brief Evaluates the given expression - * - * \param Expression Expression to evaluate. - * \param TrapFrame Register values. - * \param Result Variable which receives the result on success. - * \param ErrOffset Variable which receives character offset on parse error (-1 on other errors) - * \param ErrMsg Buffer which receives an error message on failure (128 bytes) - * - * \retval TRUE Success. - * \retval FALSE Failure. - */ -BOOLEAN -KdbpRpnEvaluateExpression( - IN PCHAR Expression, - IN PKDB_KTRAP_FRAME TrapFrame, - OUT PULONGLONG Result, - OUT PLONG ErrOffset OPTIONAL, - OUT PCHAR ErrMsg OPTIONAL) -{ - PRPN_STACK Stack = (PRPN_STACK)&RpnStack; - - ASSERT(Expression != NULL); - ASSERT(TrapFrame != NULL); - ASSERT(Result != NULL); - - /* Clear the stack and parse the expression */ - RpnpClearStack(Stack); - if (!RpnpParseExpression(Stack, Expression, NULL, 0, ErrOffset, ErrMsg)) - { - return FALSE; - } -#ifdef DEBUG_RPN - RpnpDumpStack(Stack); -#endif - - /* Evaluate the stack */ - if (!RpnpEvaluateStack(Stack, TrapFrame, Result, ErrOffset, ErrMsg)) - { - return FALSE; - } - - return TRUE; -} - -/*!\brief Parses the given expression and returns a "handle" to it. - * - * \param Expression Expression to evaluate. - * \param ErrOffset Variable which receives character offset on parse error (-1 on other errors) - * \param ErrMsg Buffer which receives an error message on failure (128 bytes) - * - * \returns "Handle" for the expression, NULL on failure. - * - * \sa KdbpRpnEvaluateExpression - */ -PVOID -KdbpRpnParseExpression( - IN PCHAR Expression, - OUT PLONG ErrOffset OPTIONAL, - OUT PCHAR ErrMsg OPTIONAL) -{ - LONG Size; - PRPN_STACK Stack = (PRPN_STACK)&RpnStack; - PRPN_STACK NewStack; - - ASSERT(Expression != NULL); - - /* Clear the stack and parse the expression */ - RpnpClearStack(Stack); - if (!RpnpParseExpression(Stack, Expression, NULL, 0, ErrOffset, ErrMsg)) - { - return FALSE; - } -#ifdef DEBUG_RPN - RpnpDumpStack(Stack); -#endif - - /* Duplicate the stack and return a pointer/handle to it */ - ASSERT(Stack->Sp >= 1); - Size = sizeof (RPN_STACK) + (RTL_FIELD_SIZE(RPN_STACK, Ops[0]) * (Stack->Sp - 1)); - NewStack = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_KDBG); - if (NewStack == NULL) - { - CONST_STRCPY(ErrMsg, "Out of memory"); - if (ErrOffset != NULL) - *ErrOffset = -1; - return NULL; - } - memcpy(NewStack, Stack, Size); - NewStack->Size = NewStack->Sp; - - return NewStack; -} - -/*!\brief Evaluates the given expression and returns the result. - * - * \param Expression Expression "handle" returned by KdbpRpnParseExpression. - * \param TrapFrame Register values. - * \param Result Variable which receives the result on success. - * \param ErrOffset Variable which receives character offset on parse error (-1 on other errors) - * \param ErrMsg Buffer which receives an error message on failure (128 bytes) - * - * \returns "Handle" for the expression, NULL on failure. - * - * \sa KdbpRpnParseExpression - */ -BOOLEAN -KdbpRpnEvaluateParsedExpression( - IN PVOID Expression, - IN PKDB_KTRAP_FRAME TrapFrame, - OUT PULONGLONG Result, - OUT PLONG ErrOffset OPTIONAL, - OUT PCHAR ErrMsg OPTIONAL) -{ - PRPN_STACK Stack = (PRPN_STACK)Expression; - - ASSERT(Expression != NULL); - ASSERT(TrapFrame != NULL); - ASSERT(Result != NULL); - - /* Evaluate the stack */ - return RpnpEvaluateStack(Stack, TrapFrame, Result, ErrOffset, ErrMsg); -} - +/* + * ReactOS kernel + * Copyright (C) 2005 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id$ + * + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/dbg/kdb_expr.c + * PURPOSE: Kernel debugger expression evaluation + * PROGRAMMER: Gregor Anich (blight@blight.eu.org) + * UPDATE HISTORY: + * Created 15/01/2005 + */ + +/* Note: + * + * The given expression is parsed and stored in reverse polish notation, + * then it is evaluated and the result is returned. + */ + +/* INCLUDES ******************************************************************/ + +#include +#include +#define NDEBUG +#include + +/* TYPES *********************************************************************/ +typedef enum _RPN_OP_TYPE +{ + RpnOpNop, + RpnOpBinaryOperator, + RpnOpUnaryOperator, + RpnOpImmediate, + RpnOpRegister, + RpnOpDereference +} RPN_OP_TYPE; + +typedef ULONGLONG (*RPN_BINARY_OPERATOR)(ULONGLONG a, ULONGLONG b); + +typedef struct _RPN_OP +{ + RPN_OP_TYPE Type; + ULONG CharacterOffset; + union { + /* RpnOpBinaryOperator */ + RPN_BINARY_OPERATOR BinaryOperator; + /* RpnOpImmediate */ + ULONGLONG Immediate; + /* RpnOpRegister */ + UCHAR Register; + /* RpnOpDereference */ + UCHAR DerefMemorySize; + } Data; +} RPN_OP, *PRPN_OP; + +typedef struct _RPN_STACK +{ + ULONG Size; /* Number of RPN_OPs on Ops */ + ULONG Sp; /* Stack pointer */ + RPN_OP Ops[1]; /* Array of RPN_OPs */ +} RPN_STACK, *PRPN_STACK; + +/* DEFINES *******************************************************************/ +#define stricmp _stricmp + +#ifndef RTL_FIELD_SIZE +# define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) +#endif + +#define CONST_STRCPY(dst, src) \ + do { if ((dst) != NULL) { memcpy(dst, src, sizeof(src)); } } while (0); + +#define RPN_OP_STACK_SIZE 256 +#define RPN_VALUE_STACK_SIZE 256 + +/* GLOBALS *******************************************************************/ +STATIC struct { ULONG Size; ULONG Sp; RPN_OP Ops[RPN_OP_STACK_SIZE]; } RpnStack = { RPN_OP_STACK_SIZE, 0 }; + +STATIC CONST struct { PCHAR Name; UCHAR Offset; UCHAR Size; } RegisterToTrapFrame[] = +{ + {"eip", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Eip), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Eip)}, + {"eflags", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Eflags), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Eflags)}, + {"eax", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Eax), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Eax)}, + {"ebx", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ebx), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ebx)}, + {"ecx", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ecx), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ecx)}, + {"edx", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Edx), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Edx)}, + {"esi", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Esi), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Esi)}, + {"edi", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Edi), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Edi)}, + {"esp", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Esp), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Esp)}, + {"ebp", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ebp), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ebp)}, + {"cs", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Cs), 2 }, /* Use only the lower 2 bytes */ + {"ds", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ds), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ds)}, + {"es", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Es), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Es)}, + {"fs", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Fs), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Fs)}, + {"gs", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Gs), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Gs)}, + {"ss", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Ss), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Ss)}, + {"dr0", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr0), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr0)}, + {"dr1", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr1), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr1)}, + {"dr2", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr2), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr2)}, + {"dr3", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr3), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr3)}, + {"dr6", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr6), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr6)}, + {"dr7", FIELD_OFFSET(KDB_KTRAP_FRAME, Tf.Dr7), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Tf.Dr7)}, + {"cr0", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr0), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr0)}, + {"cr2", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr2), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr2)}, + {"cr3", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr3), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr3)}, + {"cr4", FIELD_OFFSET(KDB_KTRAP_FRAME, Cr4), RTL_FIELD_SIZE(KDB_KTRAP_FRAME, Cr4)} +}; +STATIC CONST INT RegisterToTrapFrameCount = + sizeof (RegisterToTrapFrame) / sizeof (RegisterToTrapFrame[0]); + +/* FUNCTIONS *****************************************************************/ + +ULONGLONG +RpnBinaryOperatorAdd(ULONGLONG a, ULONGLONG b) +{ + return a + b; +} + +ULONGLONG +RpnBinaryOperatorSub(ULONGLONG a, ULONGLONG b) +{ + return a - b; +} + +ULONGLONG +RpnBinaryOperatorMul(ULONGLONG a, ULONGLONG b) +{ + return a * b; +} + +ULONGLONG +RpnBinaryOperatorDiv(ULONGLONG a, ULONGLONG b) +{ + + return a / b; +} + +ULONGLONG +RpnBinaryOperatorMod(ULONGLONG a, ULONGLONG b) +{ + return a % b; +} + +ULONGLONG +RpnBinaryOperatorEquals(ULONGLONG a, ULONGLONG b) +{ + return (a == b); +} + +ULONGLONG +RpnBinaryOperatorNotEquals(ULONGLONG a, ULONGLONG b) +{ + return (a != b); +} + +ULONGLONG +RpnBinaryOperatorLessThan(ULONGLONG a, ULONGLONG b) +{ + return (a < b); +} + +ULONGLONG +RpnBinaryOperatorLessThanOrEquals(ULONGLONG a, ULONGLONG b) +{ + return (a <= b); +} + +ULONGLONG +RpnBinaryOperatorGreaterThan(ULONGLONG a, ULONGLONG b) +{ + return (a > b); +} + +ULONGLONG +RpnBinaryOperatorGreaterThanOrEquals(ULONGLONG a, ULONGLONG b) +{ + return (a >= b); +} + +/*!\brief Dumps the given RPN stack content + * + * \param Stack Pointer to a RPN_STACK structure. + */ +VOID +RpnpDumpStack( + IN PRPN_STACK Stack) +{ + ULONG ul; + + ASSERT(Stack != NULL); + DbgPrint("\nStack size: %ld\n", Stack->Sp); + for (ul = 0; ul < Stack->Sp; ul++) + { + PRPN_OP Op = Stack->Ops + ul; + switch (Op->Type) + { + case RpnOpNop: + DbgPrint("NOP,"); + break; + + case RpnOpImmediate: + DbgPrint("0x%I64x,", Op->Data.Immediate); + break; + + case RpnOpBinaryOperator: + if (Op->Data.BinaryOperator == RpnBinaryOperatorAdd) + DbgPrint("+,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorSub) + DbgPrint("-,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorMul) + DbgPrint("*,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorDiv) + DbgPrint("/,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorMod) + DbgPrint("%%,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorEquals) + DbgPrint("==,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorNotEquals) + DbgPrint("!=,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorLessThan) + DbgPrint("<,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorLessThanOrEquals) + DbgPrint("<=,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorGreaterThan) + DbgPrint(">,"); + else if (Op->Data.BinaryOperator == RpnBinaryOperatorGreaterThanOrEquals) + DbgPrint(">=,"); + else + DbgPrint("UNKNOWN OP,"); + break; + + case RpnOpRegister: + DbgPrint("%s,", RegisterToTrapFrame[Op->Data.Register].Name); + break; + + case RpnOpDereference: + DbgPrint("[%s],", + (Op->Data.DerefMemorySize == 1) ? ("byte") : + ((Op->Data.DerefMemorySize == 2) ? ("word") : + ((Op->Data.DerefMemorySize == 4) ? ("dword") : ("qword")) + ) + ); + break; + + default: + DbgPrint("\nUnsupported Type: %d\n", Op->Type); + ul = Stack->Sp; + break; + } + } + DbgPrint("\n"); +} + +/*!\brief Clears the given RPN stack. + * + * \param Stack Pointer to a RPN_STACK structure. + */ +STATIC VOID +RpnpClearStack( + OUT PRPN_STACK Stack) +{ + ASSERT(Stack != NULL); + Stack->Sp = 0; +} + +/*!\brief Pushes an RPN_OP onto the stack. + * + * \param Stack Pointer to a RPN_STACK structure. + * \param Op RPN_OP to be copied onto the stack. + */ +STATIC BOOLEAN +RpnpPushStack( + IN OUT PRPN_STACK Stack, + IN PRPN_OP Op) +{ + ASSERT(Stack != NULL); + ASSERT(Op != NULL); + + if (Stack->Sp >= Stack->Size) + return FALSE; + + memcpy(Stack->Ops + Stack->Sp, Op, sizeof (RPN_OP)); + Stack->Sp++; + return TRUE; +} + +/*!\brief Pops the top op from the stack. + * + * \param Stack Pointer to a RPN_STACK structure. + * \param Op Pointer to an RPN_OP to store the popped op into (can be NULL). + * + * \retval TRUE Success. + * \retval FALSE Failure (stack empty) + */ +STATIC BOOLEAN +RpnpPopStack( + IN OUT PRPN_STACK Stack, + OUT PRPN_OP Op OPTIONAL) +{ + ASSERT(Stack != NULL); + + if (Stack->Sp == 0) + return FALSE; + + Stack->Sp--; + if (Op != NULL) + memcpy(Op, Stack->Ops + Stack->Sp, sizeof (RPN_OP)); + return TRUE; +} + +/*!\brief Gets the top op from the stack (not popping it) + * + * \param Stack Pointer to a RPN_STACK structure. + * \param Op Pointer to an RPN_OP to copy the top op into. + * + * \retval TRUE Success. + * \retval FALSE Failure (stack empty) + */ +STATIC BOOLEAN +RpnpTopStack( + IN PRPN_STACK Stack, + OUT PRPN_OP Op) +{ + ASSERT(Stack != NULL); + ASSERT(Op != NULL); + + if (Stack->Sp == 0) + return FALSE; + + memcpy(Op, Stack->Ops + Stack->Sp - 1, sizeof (RPN_OP)); + return TRUE; +} + +/*!\brief Parses an expression. + * + * This functions parses the given expression until the end of string or a closing + * brace is found. As the function parses the string it pushes RPN_OPs onto the + * stack. + * + * Examples: 1+2*3 ; eax+10 ; (eax+16) * (ebx+4) ; dword[eax] + * + * \param Stack Pointer to a RPN_STACK structure. + * \param Expression String to parse. + * \param CharacterOffset Character offset of the subexpression from the beginning of the expression. + * \param End On success End is set to the character at which parsing stopped. + * \param ErrOffset On failure this is set to the character offset at which the error occoured. + * \param ErrMsg On failure a message describing the problem is copied into this buffer (128 bytes) + * + * \retval TRUE Success. + * \retval FALSE Failure. + */ +STATIC BOOLEAN +RpnpParseExpression( + IN PRPN_STACK Stack, + IN PCHAR Expression, + OUT PCHAR *End OPTIONAL, + IN ULONG CharacterOffset, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL) +{ + PCHAR p = Expression; + PCHAR pend; + PCHAR Operator = NULL; + LONG OperatorOffset = -1; + RPN_OP RpnOp; + RPN_OP PoppedOperator; + BOOLEAN HavePoppedOperator = FALSE; + RPN_OP ComparativeOp; + BOOLEAN ComparativeOpFilled = FALSE; + BOOLEAN IsComparativeOp; + INT i, i2; + ULONG ul; + UCHAR MemorySize; + CHAR Buffer[16]; + BOOLEAN First; + + ASSERT(Stack != NULL); + ASSERT(Expression != NULL); + + First = TRUE; + for (;;) + { + /* Skip whitespace */ + while (isspace(*p)) + { + p++; + CharacterOffset++; + } + + /* Check for end of expression */ + if (p[0] == '\0' || p[0] == ')' || p[0] == ']') + break; + + if (!First) + { + /* Remember operator */ + Operator = p++; + OperatorOffset = CharacterOffset++;; + + /* Pop operator (to get the right operator precedence) */ + HavePoppedOperator = FALSE; + if (*Operator == '*' || *Operator == '/' || *Operator == '%') + { + if (RpnpTopStack(Stack, &PoppedOperator) && + PoppedOperator.Type == RpnOpBinaryOperator && + (PoppedOperator.Data.BinaryOperator == RpnBinaryOperatorAdd || + PoppedOperator.Data.BinaryOperator == RpnBinaryOperatorSub)) + { + RpnpPopStack(Stack, NULL); + HavePoppedOperator = TRUE; + } + else if (PoppedOperator.Type == RpnOpNop) + { + RpnpPopStack(Stack, NULL); + /* Discard the NOP - it was only pushed to indicate there was a + * closing brace, so the previous operator shouldn't be popped. + */ + } + } + else if ((Operator[0] == '=' && Operator[1] == '=') || + (Operator[0] == '!' && Operator[1] == '=') || + Operator[0] == '<' || Operator[0] == '>') + { + if (Operator[0] == '=' || Operator[0] == '!' || + (Operator[0] == '<' && Operator[1] == '=') || + (Operator[0] == '>' && Operator[1] == '=')) + { + p++; + CharacterOffset++; + } +#if 0 + /* Parse rest of expression */ + if (!RpnpParseExpression(Stack, p + 1, &pend, CharacterOffset + 1, + ErrOffset, ErrMsg)) + { + return FALSE; + } + else if (pend == p + 1) + { + CONST_STRCPY(ErrMsg, "Expression expected"); + if (ErrOffset != NULL) + *ErrOffset = CharacterOffset + 1; + return FALSE; + } + goto end_of_expression; /* return */ +#endif + } + else if (Operator[0] != '+' && Operator[0] != '-') + { + CONST_STRCPY(ErrMsg, "Operator expected"); + if (ErrOffset != NULL) + *ErrOffset = OperatorOffset; + return FALSE; + } + + /* Skip whitespace */ + while (isspace(*p)) + { + p++; + CharacterOffset++; + } + } + + /* Get operand */ + MemorySize = sizeof(ULONG_PTR); /* default to pointer size */ +get_operand: + i = strcspn(p, "+-*/%()[]<>!="); + if (i > 0) + { + i2 = i; + + /* Copy register name/memory size */ + while (isspace(p[--i2])); + i2 = min(i2 + 1, sizeof (Buffer) - 1); + strncpy(Buffer, p, i2); + Buffer[i2] = '\0'; + + /* Memory size prefix */ + if (p[i] == '[') + { + if (stricmp(Buffer, "byte") == 0) + MemorySize = 1; + else if (stricmp(Buffer, "word") == 0) + MemorySize = 2; + else if (stricmp(Buffer, "dword") == 0) + MemorySize = 4; + else if (stricmp(Buffer, "qword") == 0) + MemorySize = 8; + else + { + CONST_STRCPY(ErrMsg, "Invalid memory size prefix"); + if (ErrOffset != NULL) + *ErrOffset = CharacterOffset; + return FALSE; + } + + p += i; + CharacterOffset += i; + goto get_operand; + } + + /* Try to find register */ + for (i = 0; i < RegisterToTrapFrameCount; i++) + { + if (stricmp(RegisterToTrapFrame[i].Name, Buffer) == 0) + break; + } + if (i < RegisterToTrapFrameCount) + { + RpnOp.Type = RpnOpRegister; + RpnOp.CharacterOffset = CharacterOffset; + RpnOp.Data.Register = i; + i = strlen(RegisterToTrapFrame[i].Name); + CharacterOffset += i; + p += i; + } + else + { + /* Immediate value */ + /* FIXME: Need string to ULONGLONG function */ + ul = strtoul(p, &pend, 0); + if (p != pend) + { + RpnOp.Type = RpnOpImmediate; + RpnOp.CharacterOffset = CharacterOffset; + RpnOp.Data.Immediate = (ULONGLONG)ul; + CharacterOffset += pend - p; + p = pend; + } + else + { + CONST_STRCPY(ErrMsg, "Operand expected"); + if (ErrOffset != NULL) + *ErrOffset = CharacterOffset; + return FALSE; + } + } + + /* Push operand */ + if (!RpnpPushStack(Stack, &RpnOp)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + } + else if (i == 0) + { + if (p[0] == '(' || p[0] == '[') /* subexpression */ + { + if (!RpnpParseExpression(Stack, p + 1, &pend, CharacterOffset + 1, + ErrOffset, ErrMsg)) + { + return FALSE; + } + else if (pend == p + 1) + { + CONST_STRCPY(ErrMsg, "Expression expected"); + if (ErrOffset != NULL) + *ErrOffset = CharacterOffset + 1; + return FALSE; + } + + if (p[0] == '[') /* dereference */ + { + ASSERT(MemorySize == 1 || MemorySize == 2 || + MemorySize == 4 || MemorySize == 8); + if (pend[0] != ']') + { + CONST_STRCPY(ErrMsg, "']' expected"); + if (ErrOffset != NULL) + *ErrOffset = CharacterOffset + (pend - p); + return FALSE; + } + RpnOp.Type = RpnOpDereference; + RpnOp.CharacterOffset = CharacterOffset; + RpnOp.Data.DerefMemorySize = MemorySize; + if (!RpnpPushStack(Stack, &RpnOp)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + } + else /* p[0] == '(' */ + { + if (pend[0] != ')') + { + CONST_STRCPY(ErrMsg, "')' expected"); + if (ErrOffset != NULL) + *ErrOffset = CharacterOffset + (pend - p); + return FALSE; + } + } + + /* Push a "nop" to prevent popping of the + operator (which would + * result in (10+10)/2 beeing evaluated as 15) + */ + RpnOp.Type = RpnOpNop; + if (!RpnpPushStack(Stack, &RpnOp)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + + /* Skip closing brace/bracket */ + pend++; + + CharacterOffset += pend - p; + p = pend; + } + else if (First && p[0] == '-') /* Allow expressions like "- eax" */ + { + RpnOp.Type = RpnOpImmediate; + RpnOp.CharacterOffset = CharacterOffset; + RpnOp.Data.Immediate = 0; + if (!RpnpPushStack(Stack, &RpnOp)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + } + else + { + CONST_STRCPY(ErrMsg, "Operand expected"); + if (ErrOffset != NULL) + *ErrOffset = CharacterOffset; + return FALSE; + } + } + else + { + CONST_STRCPY(ErrMsg, "strcspn() failed"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + + if (!First) + { + /* Push operator */ + RpnOp.CharacterOffset = OperatorOffset; + RpnOp.Type = RpnOpBinaryOperator; + IsComparativeOp = FALSE; + switch (*Operator) + { + case '+': + RpnOp.Data.BinaryOperator = RpnBinaryOperatorAdd; + break; + + case '-': + RpnOp.Data.BinaryOperator = RpnBinaryOperatorSub; + break; + + case '*': + RpnOp.Data.BinaryOperator = RpnBinaryOperatorMul; + break; + + case '/': + RpnOp.Data.BinaryOperator = RpnBinaryOperatorDiv; + break; + + case '%': + RpnOp.Data.BinaryOperator = RpnBinaryOperatorMod; + break; + + case '=': + ASSERT(Operator[1] == '='); + IsComparativeOp = TRUE; + RpnOp.Data.BinaryOperator = RpnBinaryOperatorEquals; + break; + + case '!': + ASSERT(Operator[1] == '='); + IsComparativeOp = TRUE; + RpnOp.Data.BinaryOperator = RpnBinaryOperatorNotEquals; + break; + + case '<': + IsComparativeOp = TRUE; + if (Operator[1] == '=') + RpnOp.Data.BinaryOperator = RpnBinaryOperatorLessThanOrEquals; + else + RpnOp.Data.BinaryOperator = RpnBinaryOperatorLessThan; + break; + + case '>': + IsComparativeOp = TRUE; + if (Operator[1] == '=') + RpnOp.Data.BinaryOperator = RpnBinaryOperatorGreaterThanOrEquals; + else + RpnOp.Data.BinaryOperator = RpnBinaryOperatorGreaterThan; + break; + + default: + ASSERT(0); + break; + } + if (IsComparativeOp) + { + if (ComparativeOpFilled && !RpnpPushStack(Stack, &ComparativeOp)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + memcpy(&ComparativeOp, &RpnOp, sizeof(RPN_OP)); + ComparativeOpFilled = TRUE; + } + else if (!RpnpPushStack(Stack, &RpnOp)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + + /* Push popped operator */ + if (HavePoppedOperator) + { + if (!RpnpPushStack(Stack, &PoppedOperator)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + } + } + + First = FALSE; + } + +//end_of_expression: + + if (ComparativeOpFilled && !RpnpPushStack(Stack, &ComparativeOp)) + { + CONST_STRCPY(ErrMsg, "RPN op stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + + /* Skip whitespace */ + while (isspace(*p)) + { + p++; + CharacterOffset++; + } + + if (End != NULL) + *End = p; + + return TRUE; +} + +/*!\brief Evaluates the RPN op stack and returns the result. + * + * \param Stack Pointer to a RPN_STACK structure. + * \param TrapFrame Register values. + * \param Result Pointer to an ULONG to store the result into. + * \param ErrOffset On failure this is set to the character offset at which the error occoured. + * \param ErrMsg Buffer which receives an error message on failure (128 bytes) + * + * \retval TRUE Success. + * \retval FALSE Failure. + */ +STATIC BOOLEAN +RpnpEvaluateStack( + IN PRPN_STACK Stack, + IN PKDB_KTRAP_FRAME TrapFrame, + OUT PULONGLONG Result, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL) +{ + ULONGLONG ValueStack[RPN_VALUE_STACK_SIZE]; + ULONG ValueStackPointer = 0; + ULONG index; + ULONGLONG ull; + ULONG ul; + USHORT us; + UCHAR uc; + PVOID p; + BOOLEAN Ok; +#ifdef DEBUG_RPN + ULONG ValueStackPointerMax = 0; +#endif + + ASSERT(Stack != NULL); + ASSERT(TrapFrame != NULL); + ASSERT(Result != NULL); + + for (index = 0; index < Stack->Sp; index++) + { + PRPN_OP Op = Stack->Ops + index; + +#ifdef DEBUG_RPN + ValueStackPointerMax = max(ValueStackPointerMax, ValueStackPointer); +#endif + + switch (Op->Type) + { + case RpnOpNop: + /* No operation */ + break; + + case RpnOpImmediate: + if (ValueStackPointer == RPN_VALUE_STACK_SIZE) + { + CONST_STRCPY(ErrMsg, "Value stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + ValueStack[ValueStackPointer++] = Op->Data.Immediate; + break; + + case RpnOpRegister: + if (ValueStackPointer == RPN_VALUE_STACK_SIZE) + { + CONST_STRCPY(ErrMsg, "Value stack overflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + ul = Op->Data.Register; + p = (PVOID)((ULONG_PTR)TrapFrame + RegisterToTrapFrame[ul].Offset); + switch (RegisterToTrapFrame[ul].Size) + { + case 1: ull = (ULONGLONG)(*(PUCHAR)p); break; + case 2: ull = (ULONGLONG)(*(PUSHORT)p); break; + case 4: ull = (ULONGLONG)(*(PULONG)p); break; + case 8: ull = (ULONGLONG)(*(PULONGLONG)p); break; + default: ASSERT(0); return FALSE; break; + } + ValueStack[ValueStackPointer++] = ull; + break; + + case RpnOpDereference: + if (ValueStackPointer < 1) + { + CONST_STRCPY(ErrMsg, "Value stack underflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + + /* FIXME: Print a warning when address is out of range */ + p = (PVOID)(ULONG_PTR)ValueStack[ValueStackPointer - 1]; + Ok = FALSE; + switch (Op->Data.DerefMemorySize) + { + case 1: + if (NT_SUCCESS(KdbpSafeReadMemory(&uc, p, sizeof (uc)))) + { + Ok = TRUE; + ull = (ULONGLONG)uc; + } + break; + case 2: + if (NT_SUCCESS(KdbpSafeReadMemory(&us, p, sizeof (us)))) + { + Ok = TRUE; + ull = (ULONGLONG)us; + } + break; + case 4: + if (NT_SUCCESS(KdbpSafeReadMemory(&ul, p, sizeof (ul)))) + { + Ok = TRUE; + ull = (ULONGLONG)ul; + } + break; + case 8: + if (NT_SUCCESS(KdbpSafeReadMemory(&ull, p, sizeof (ull)))) + { + Ok = TRUE; + } + break; + default: + ASSERT(0); + return FALSE; + break; + } + if (!Ok) + { + _snprintf(ErrMsg, 128, "Couldn't access memory at 0x%lx", (ULONG)p); + if (ErrOffset != NULL) + *ErrOffset = Op->CharacterOffset; + return FALSE; + } + ValueStack[ValueStackPointer - 1] = ull; + break; + + case RpnOpBinaryOperator: + if (ValueStackPointer < 2) + { + CONST_STRCPY(ErrMsg, "Value stack underflow"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + ValueStackPointer--; + ull = ValueStack[ValueStackPointer]; + if (ull == 0 && (Op->Data.BinaryOperator == RpnBinaryOperatorDiv || + Op->Data.BinaryOperator == RpnBinaryOperatorDiv)) + { + CONST_STRCPY(ErrMsg, "Devision by zero"); + if (ErrOffset != NULL) + *ErrOffset = Op->CharacterOffset; + return FALSE; + } + ull = Op->Data.BinaryOperator(ValueStack[ValueStackPointer - 1], ull); + ValueStack[ValueStackPointer - 1] = ull; + break; + + default: + ASSERT(0); + return FALSE; + } + } +#ifdef DEBUG_RPN + DPRINT1("Max value stack pointer: %d\n", ValueStackPointerMax); +#endif + if (ValueStackPointer != 1) + { + CONST_STRCPY(ErrMsg, "Stack not empty after evaluation"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return FALSE; + } + + *Result = ValueStack[0]; + return TRUE; +} + +/*!\brief Evaluates the given expression + * + * \param Expression Expression to evaluate. + * \param TrapFrame Register values. + * \param Result Variable which receives the result on success. + * \param ErrOffset Variable which receives character offset on parse error (-1 on other errors) + * \param ErrMsg Buffer which receives an error message on failure (128 bytes) + * + * \retval TRUE Success. + * \retval FALSE Failure. + */ +BOOLEAN +KdbpRpnEvaluateExpression( + IN PCHAR Expression, + IN PKDB_KTRAP_FRAME TrapFrame, + OUT PULONGLONG Result, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL) +{ + PRPN_STACK Stack = (PRPN_STACK)&RpnStack; + + ASSERT(Expression != NULL); + ASSERT(TrapFrame != NULL); + ASSERT(Result != NULL); + + /* Clear the stack and parse the expression */ + RpnpClearStack(Stack); + if (!RpnpParseExpression(Stack, Expression, NULL, 0, ErrOffset, ErrMsg)) + { + return FALSE; + } +#ifdef DEBUG_RPN + RpnpDumpStack(Stack); +#endif + + /* Evaluate the stack */ + if (!RpnpEvaluateStack(Stack, TrapFrame, Result, ErrOffset, ErrMsg)) + { + return FALSE; + } + + return TRUE; +} + +/*!\brief Parses the given expression and returns a "handle" to it. + * + * \param Expression Expression to evaluate. + * \param ErrOffset Variable which receives character offset on parse error (-1 on other errors) + * \param ErrMsg Buffer which receives an error message on failure (128 bytes) + * + * \returns "Handle" for the expression, NULL on failure. + * + * \sa KdbpRpnEvaluateExpression + */ +PVOID +KdbpRpnParseExpression( + IN PCHAR Expression, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL) +{ + LONG Size; + PRPN_STACK Stack = (PRPN_STACK)&RpnStack; + PRPN_STACK NewStack; + + ASSERT(Expression != NULL); + + /* Clear the stack and parse the expression */ + RpnpClearStack(Stack); + if (!RpnpParseExpression(Stack, Expression, NULL, 0, ErrOffset, ErrMsg)) + { + return FALSE; + } +#ifdef DEBUG_RPN + RpnpDumpStack(Stack); +#endif + + /* Duplicate the stack and return a pointer/handle to it */ + ASSERT(Stack->Sp >= 1); + Size = sizeof (RPN_STACK) + (RTL_FIELD_SIZE(RPN_STACK, Ops[0]) * (Stack->Sp - 1)); + NewStack = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_KDBG); + if (NewStack == NULL) + { + CONST_STRCPY(ErrMsg, "Out of memory"); + if (ErrOffset != NULL) + *ErrOffset = -1; + return NULL; + } + memcpy(NewStack, Stack, Size); + NewStack->Size = NewStack->Sp; + + return NewStack; +} + +/*!\brief Evaluates the given expression and returns the result. + * + * \param Expression Expression "handle" returned by KdbpRpnParseExpression. + * \param TrapFrame Register values. + * \param Result Variable which receives the result on success. + * \param ErrOffset Variable which receives character offset on parse error (-1 on other errors) + * \param ErrMsg Buffer which receives an error message on failure (128 bytes) + * + * \returns "Handle" for the expression, NULL on failure. + * + * \sa KdbpRpnParseExpression + */ +BOOLEAN +KdbpRpnEvaluateParsedExpression( + IN PVOID Expression, + IN PKDB_KTRAP_FRAME TrapFrame, + OUT PULONGLONG Result, + OUT PLONG ErrOffset OPTIONAL, + OUT PCHAR ErrMsg OPTIONAL) +{ + PRPN_STACK Stack = (PRPN_STACK)Expression; + + ASSERT(Expression != NULL); + ASSERT(TrapFrame != NULL); + ASSERT(Result != NULL); + + /* Evaluate the stack */ + return RpnpEvaluateStack(Stack, TrapFrame, Result, ErrOffset, ErrMsg); +} + diff --git a/reactos/ntoskrnl/dbg/kdb_keyboard.c b/reactos/ntoskrnl/kdbg/kdb_keyboard.c similarity index 100% rename from reactos/ntoskrnl/dbg/kdb_keyboard.c rename to reactos/ntoskrnl/kdbg/kdb_keyboard.c diff --git a/reactos/ntoskrnl/dbg/kdb_serial.c b/reactos/ntoskrnl/kdbg/kdb_serial.c similarity index 76% rename from reactos/ntoskrnl/dbg/kdb_serial.c rename to reactos/ntoskrnl/kdbg/kdb_serial.c index 519e3eca108..5ab846a9689 100644 --- a/reactos/ntoskrnl/dbg/kdb_serial.c +++ b/reactos/ntoskrnl/kdbg/kdb_serial.c @@ -16,18 +16,15 @@ #define NDEBUG #include -extern KD_PORT_INFORMATION LogPortInfo; - - CHAR KdbpTryGetCharSerial(UINT Retry) { CHAR Result = -1; if (Retry == 0) - while (!KdPortGetByteEx(&LogPortInfo, (PUCHAR)&Result)); + while (!KdPortGetByteEx(&SerialPortInfo, (PUCHAR)&Result)); else - while (!KdPortGetByteEx(&LogPortInfo, (PUCHAR)&Result) && Retry-- > 0); + while (!KdPortGetByteEx(&SerialPortInfo, (PUCHAR)&Result) && Retry-- > 0); return Result; } diff --git a/reactos/ntoskrnl/dbg/kdb_string.c b/reactos/ntoskrnl/kdbg/kdb_string.c similarity index 95% rename from reactos/ntoskrnl/dbg/kdb_string.c rename to reactos/ntoskrnl/kdbg/kdb_string.c index 52f3ed47770..60c07e95232 100644 --- a/reactos/ntoskrnl/dbg/kdb_string.c +++ b/reactos/ntoskrnl/kdbg/kdb_string.c @@ -1,124 +1,124 @@ -/* - * ReactOS kernel - * Copyright (C) 2005 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ - * - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/kdb_string.c - * PURPOSE: Kernel debugger string functions - * PROGRAMMER: Gregor Anich (blight@blight.eu.org) - * UPDATE HISTORY: - * Created 17/01/2005 - */ - -/* INCLUDES ******************************************************************/ -#include -#include - -/* FUNCTIONS *****************************************************************/ - -#if 0 -int -_stricmp( - const char *s1, - const char *s2) -{ - char c1, c2; - for (;;) - { - c1 = tolower(*s1++); - c2 = tolower(*s2++); - if (c1 < c2) - return -1; - else if (c1 > c2) - return 1; - if (c1 == '\0') - break; - } - return 0; -} -#endif /* unused */ - -/* - * Convert a string to an unsigned long integer. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -unsigned long -strtoul(const char *nptr, char **endptr, int base) -{ - const char *s = nptr; - unsigned long acc; - int c; - unsigned long cutoff; - int neg = 0, any, cutlim; - - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') - { - neg = 1; - c = *s++; - } - else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) - { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) - { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) - { - acc = ULONG_MAX; - } - else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = any ? (char *)s - 1 : (char *)nptr; - return acc; -} - +/* + * ReactOS kernel + * Copyright (C) 2005 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id$ + * + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/dbg/kdb_string.c + * PURPOSE: Kernel debugger string functions + * PROGRAMMER: Gregor Anich (blight@blight.eu.org) + * UPDATE HISTORY: + * Created 17/01/2005 + */ + +/* INCLUDES ******************************************************************/ +#include +#include + +/* FUNCTIONS *****************************************************************/ + +#if 0 +int +_stricmp( + const char *s1, + const char *s2) +{ + char c1, c2; + for (;;) + { + c1 = tolower(*s1++); + c2 = tolower(*s2++); + if (c1 < c2) + return -1; + else if (c1 > c2) + return 1; + if (c1 == '\0') + break; + } + return 0; +} +#endif /* unused */ + +/* + * Convert a string to an unsigned long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +unsigned long +strtoul(const char *nptr, char **endptr, int base) +{ + const char *s = nptr; + unsigned long acc; + int c; + unsigned long cutoff; + int neg = 0, any, cutlim; + + /* + * See strtol for comments as to the logic used. + */ + do { + c = *s++; + } while (isspace(c)); + if (c == '-') + { + neg = 1; + c = *s++; + } + else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) + { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; + cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) + { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) + { + acc = ULONG_MAX; + } + else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? (char *)s - 1 : (char *)nptr; + return acc; +} + diff --git a/reactos/ntoskrnl/dbg/kdb_symbols.c b/reactos/ntoskrnl/kdbg/kdb_symbols.c similarity index 98% rename from reactos/ntoskrnl/dbg/kdb_symbols.c rename to reactos/ntoskrnl/kdbg/kdb_symbols.c index c95259ef4bc..b0098c25a57 100644 --- a/reactos/ntoskrnl/dbg/kdb_symbols.c +++ b/reactos/ntoskrnl/kdbg/kdb_symbols.c @@ -11,25 +11,12 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #define NDEBUG #include -#include "kdb.h" - /* GLOBALS ******************************************************************/ #define TAG_KDBS TAG('K', 'D', 'B', 'S') @@ -427,10 +414,8 @@ KdbpSymLoadModuleSymbols(IN PUNICODE_STRING FileName, NTSTATUS Status; IO_STATUS_BLOCK IoStatusBlock; -#ifdef KDBG /* Allow KDB to break on module load */ KdbModuleLoaded(FileName); -#endif /* Try to find cached (already loaded) symbol file */ *RosSymInfo = KdbpSymFindCachedFile(FileName); diff --git a/reactos/ntoskrnl/ke/apc.c b/reactos/ntoskrnl/ke/apc.c index b2f06266117..81feb42d15b 100644 --- a/reactos/ntoskrnl/ke/apc.c +++ b/reactos/ntoskrnl/ke/apc.c @@ -16,6 +16,51 @@ /* FUNCTIONS *****************************************************************/ +/*++ + * KiKernelApcDeliveryCheck + * @implemented NT 5.2 + * + * The KiKernelApcDeliveryCheck routine is called whenever APCs have just + * been re-enabled in Kernel Mode, such as after leaving a Critical or + * Guarded Region. It delivers APCs if the environment is right. + * + * Params: + * None. + * + * Returns: + * None. + * + * Remarks: + * This routine allows KeLeave/EnterCritical/GuardedRegion to be used as a + * macro from inside WIN32K or other Drivers, which will then only have to + * do an Import API call in the case where APCs are enabled again. + * + *--*/ +VOID +STDCALL +KiKernelApcDeliveryCheck(VOID) +{ + /* We should only deliver at passive */ + if (KeGetCurrentIrql() == PASSIVE_LEVEL) + { + /* Raise to APC and Deliver APCs, then lower back to Passive */ + KfRaiseIrql(APC_LEVEL); + KiDeliverApc(KernelMode, 0, 0); + KfLowerIrql(PASSIVE_LEVEL); + } + else + { + /* + * If we're not at passive level it means someone raised IRQL + * to APC level before the a critical or guarded section was entered + * (e.g) by a fast mutex). This implies that the APCs shouldn't + * be delivered now, but after the IRQL is lowered to passive + * level again. + */ + HalRequestSoftwareInterrupt(APC_LEVEL); + } +} + /*++ * KeEnterCriticalRegion * @implemented NT4 @@ -37,6 +82,7 @@ * Callers of KeEnterCriticalRegion must be running at IRQL <= APC_LEVEL. * *--*/ +#undef KeEnterCriticalRegion VOID STDCALL KeEnterCriticalRegion(VOID) @@ -46,6 +92,45 @@ KeEnterCriticalRegion(VOID) if (Thread) Thread->KernelApcDisable--; } +/*++ + * KeLeaveCriticalRegion + * @implemented NT4 + * + * The KeLeaveCriticalRegion routine reenables the delivery of normal + * kernel-mode APCs that were disabled by a call to KeEnterCriticalRegion. + * + * Params: + * None. + * + * Returns: + * None. + * + * Remarks: + * Highest-level drivers can call this routine while running in the context + * of the thread that requested the current I/O operation. + * + * Callers of KeLeaveCriticalRegion must be running at IRQL <= DISPATCH_LEVEL. + * + *--*/ +#undef KeLeaveCriticalRegion +VOID +STDCALL +KeLeaveCriticalRegion (VOID) +{ + PKTHREAD Thread = KeGetCurrentThread(); + + /* Check if Kernel APCs are now enabled */ + if((Thread) && (++Thread->KernelApcDisable == 0)) + { + /* Check if we need to request an APC Delivery */ + if (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) + { + /* Check for the right environment */ + KiKernelApcDeliveryCheck(); + } + } +} + /*++ * KeInitializeApc * @implemented NT4 @@ -228,13 +313,13 @@ KiInsertQueueApc(PKAPC Apc, Thread->ApcState.KernelApcPending = TRUE; /* Check the Thread State */ - if (Thread->State == THREAD_STATE_RUNNING) { + if (Thread->State == Running) { /* FIXME: Use IPI */ DPRINT ("Requesting APC Interrupt for Running Thread \n"); HalRequestSoftwareInterrupt(APC_LEVEL); - } else if ((Thread->State == THREAD_STATE_BLOCKED) && (Thread->WaitIrql == PASSIVE_LEVEL) && + } else if ((Thread->State == Waiting) && (Thread->WaitIrql == PASSIVE_LEVEL) && ((Apc->NormalRoutine == NULL) || ((!Thread->KernelApcDisable) && (!Thread->ApcState.KernelApcInProgress)))) { @@ -242,7 +327,7 @@ KiInsertQueueApc(PKAPC Apc, KiAbortWaitThread(Thread, STATUS_KERNEL_APC, PriorityBoost); } - } else if ((Thread->State == THREAD_STATE_BLOCKED) && + } else if ((Thread->State == Waiting) && (Thread->WaitMode == UserMode) && (Thread->Alertable)) { @@ -325,45 +410,6 @@ KeInsertQueueApc(PKAPC Apc, return Inserted; } -/*++ - * KeLeaveCriticalRegion - * @implemented NT4 - * - * The KeLeaveCriticalRegion routine reenables the delivery of normal - * kernel-mode APCs that were disabled by a call to KeEnterCriticalRegion. - * - * Params: - * None. - * - * Returns: - * None. - * - * Remarks: - * Highest-level drivers can call this routine while running in the context - * of the thread that requested the current I/O operation. - * - * Callers of KeLeaveCriticalRegion must be running at IRQL <= DISPATCH_LEVEL. - * - *--*/ -VOID -STDCALL -KeLeaveCriticalRegion (VOID) -{ - PKTHREAD Thread = KeGetCurrentThread(); - - /* Check if Kernel APCs are now enabled */ - if((Thread) && (++Thread->KernelApcDisable == 0)) { - - /* Check if we need to request an APC Delivery */ - if (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) { - - /* Set APC Pending */ - Thread->ApcState.KernelApcPending = TRUE; - HalRequestSoftwareInterrupt(APC_LEVEL); - } - } -} - /*++ * KeRemoveQueueApc * @@ -710,6 +756,7 @@ KiInitializeUserApc(IN PVOID Reserved, Esp[4] = (ULONG)SystemArgument2; Esp[5] = (ULONG)Context; TrapFrame->Eip = (ULONG)LdrpGetSystemDllApcDispatcher(); + DPRINT("TrapFrame->Eip: %x\n", TrapFrame->Eip); TrapFrame->Esp = (ULONG)Esp; } diff --git a/reactos/ntoskrnl/ke/bug.c b/reactos/ntoskrnl/ke/bug.c index 2604b47c020..a22b8a04f0d 100644 --- a/reactos/ntoskrnl/ke/bug.c +++ b/reactos/ntoskrnl/ke/bug.c @@ -300,7 +300,7 @@ KeBugCheckWithTf(ULONG BugCheckCode, /* Make sure we're switching back to the blue screen and print messages on it */ HalReleaseDisplayOwnership(); - if (0 == (KdDebugState & KD_DEBUG_GDB)) KdDebugState |= KD_DEBUG_SCREEN; + if (KdpDebugMode.Gdb) KdpDebugMode.Screen = TRUE; /* Try to find out who did this. For this, we need a Trap Frame. * Note: Some special BSODs pass the Frame/EIP as a Param. MSDN has the @@ -338,9 +338,6 @@ KeBugCheckWithTf(ULONG BugCheckCode, Ke386DisableInterrupts(); KeRaiseIrql(HIGH_LEVEL, &OldIrql); - /* Disable Interrupts, Dump Debug Messages */ - DebugLogDumpMessages(); - /* Unload the Kernel Adress Space if we own it */ if (MmGetKernelAddressSpace()->Lock.Owner == KeGetCurrentThread()) MmUnlockAddressSpace(MmGetKernelAddressSpace()); @@ -379,7 +376,7 @@ KeBugCheckWithTf(ULONG BugCheckCode, } /* There can only be one Bugcheck per Bootup */ - if (!InterlockedDecrement(&KeBugCheckCount)) { + if (!InterlockedDecrement((PLONG)&KeBugCheckCount)) { #ifdef CONFIG_SMP ULONG i; diff --git a/reactos/ntoskrnl/ke/catch.c b/reactos/ntoskrnl/ke/catch.c index 50bf4c70df3..ac3a9df3681 100644 --- a/reactos/ntoskrnl/ke/catch.c +++ b/reactos/ntoskrnl/ke/catch.c @@ -59,14 +59,12 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, if (!Context) { - /* Assume Full context */ TContext.ContextFlags = CONTEXT_FULL; /* Check the mode */ if (PreviousMode == UserMode) { - /* Add Debugger Registers if this is User Mode */ TContext.ContextFlags = TContext.ContextFlags | CONTEXT_DEBUGGER; } @@ -78,53 +76,42 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, Context = &TContext; } -#if 0 /* FIXME: Isn't this right? With a break after? */ - if (ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) - { - Context->Eip--; - } -#endif + /* Break into Debugger */ + Action = KdpEnterDebuggerException(ExceptionRecord, + PreviousMode, + Context, + Tf, + TRUE, + TRUE); - /* Check if a Debugger is enabled */ - if (KdDebuggerEnabled && KdDebugState & KD_DEBUG_GDB) - { - - /* Break into it */ - Action = KdEnterDebuggerException (ExceptionRecord, Context, Tf); - } - /* If the debugger said continue, then continue */ if (Action == kdContinue) return; /* If the Debugger couldn't handle it... */ if (Action != kdDoNotHandleException) - { - + { /* See what kind of Exception this is */ if (PreviousMode == UserMode) - { - + { /* User mode exception, search the frames if we have to */ if (SearchFrames) { - PULONG Stack; ULONG CDest; char temp_space[12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT)]; /* FIXME: HACKHACK */ PULONG pNewUserStack = (PULONG)(Tf->Esp - (12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT))); NTSTATUS StatusOfCopy; -#ifdef KDBG - /* Enter KDB if available */ - Action = KdbEnterDebuggerException(ExceptionRecord, + /* Enter Debugger if available */ + Action = KdpEnterDebuggerException(ExceptionRecord, PreviousMode, Context, Tf, - TRUE); + TRUE, + FALSE); /* Exit if we're continuing */ if (Action == kdContinue) return; -#endif /* FIXME: Forward exception to user mode debugger */ @@ -150,14 +137,11 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, /* Check for success */ if (NT_SUCCESS(StatusOfCopy)) { - /* Set new Stack Pointer */ Tf->Esp = (ULONG)pNewUserStack; - } else - { - + { /* * Now it really hit the ventilation device. Sorry, * can do nothing but kill the sucker. @@ -165,7 +149,6 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); DPRINT1("User-mode stack was invalid. Terminating target thread\n"); } - /* Set EIP to the User-mode Dispathcer */ Tf->Eip = (ULONG)LdrpGetSystemDllExceptionDispatcher(); return; @@ -175,38 +158,35 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, /* FIXME: Forward the exception to the process exception port */ -#ifdef KDBG /* Enter KDB if available */ - Action = KdbEnterDebuggerException(ExceptionRecord, + Action = KdpEnterDebuggerException(ExceptionRecord, PreviousMode, Context, Tf, + FALSE, FALSE); /* Exit if we're continuing */ if (Action == kdContinue) return; -#endif /* Terminate the offending thread */ DPRINT1("Unhandled UserMode exception, terminating thread\n"); ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); - } else { - /* This is Kernel Mode */ -#ifdef KDBG + /* Enter KDB if available */ - Action = KdbEnterDebuggerException(ExceptionRecord, + Action = KdpEnterDebuggerException(ExceptionRecord, PreviousMode, Context, Tf, - TRUE); + TRUE, + FALSE); /* Exit if we're continuing */ if (Action == kdContinue) return; -#endif /* Dispatch the Exception */ Value = RtlpDispatchException (ExceptionRecord, Context); @@ -216,19 +196,19 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, if (Value != ExceptionContinueExecution || 0 != (ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)) { - DPRINT("ExceptionRecord->ExceptionAddress = 0x%x\n", ExceptionRecord->ExceptionAddress); -#ifdef KDBG + /* Enter KDB if available */ - Action = KdbEnterDebuggerException(ExceptionRecord, + Action = KdpEnterDebuggerException(ExceptionRecord, PreviousMode, Context, Tf, + FALSE, FALSE); /* Exit if we're continuing */ if (Action == kdContinue) return; -#endif + KEBUGCHECKWITHTF(KMODE_EXCEPTION_NOT_HANDLED, ExceptionRecord->ExceptionCode, (ULONG)ExceptionRecord->ExceptionAddress, diff --git a/reactos/ntoskrnl/ke/device.c b/reactos/ntoskrnl/ke/device.c index 31c95551f8e..8fd2915adf5 100644 --- a/reactos/ntoskrnl/ke/device.c +++ b/reactos/ntoskrnl/ke/device.c @@ -106,20 +106,6 @@ KeSetDmaIoCoherency( KiDmaIoCoherency = Coherency; } -/* - * @unimplemented - */ -STDCALL -PKDEVICE_QUEUE_ENTRY -KeRemoveByKeyDeviceQueueIfBusy ( - IN PKDEVICE_QUEUE DeviceQueue, - IN ULONG SortKey - ) -{ - UNIMPLEMENTED; - return 0; -} - /* * @implemented */ diff --git a/reactos/ntoskrnl/ke/dpc.c b/reactos/ntoskrnl/ke/dpc.c index b65e96133db..2d0619a44b1 100644 --- a/reactos/ntoskrnl/ke/dpc.c +++ b/reactos/ntoskrnl/ke/dpc.c @@ -491,7 +491,7 @@ KiQuantumEnd(VOID) /* Dispatch the Thread */ KeLowerIrql(DISPATCH_LEVEL); - KiDispatchThread(THREAD_STATE_READY); + KiDispatchThread(Ready); } /* diff --git a/reactos/ntoskrnl/ke/gate.c b/reactos/ntoskrnl/ke/gate.c new file mode 100644 index 00000000000..34cbb0c20ba --- /dev/null +++ b/reactos/ntoskrnl/ke/gate.c @@ -0,0 +1,149 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/ke/gate.c + * PURPOSE: Implements the Gate Dispatcher Object + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *****************************************************************/ + +#include +#define NDEBUG +#include + +/* FUNCTIONS ****************************************************************/ + +VOID +FASTCALL +KeInitializeGate(PKGATE Gate) +{ + DPRINT1("KeInitializeGate(Gate %x)\n", Gate); + + /* Initialize the Dispatcher Header */ + KeInitializeDispatcherHeader(&Gate->Header, + GateObject, + sizeof(Gate) / sizeof(ULONG), + 0); +} + +VOID +FASTCALL +KeWaitForGate(PKGATE Gate, + KWAIT_REASON WaitReason, + KPROCESSOR_MODE WaitMode) +{ + KIRQL OldIrql; + PKTHREAD CurrentThread = KeGetCurrentThread(); + PKWAIT_BLOCK GateWaitBlock; + NTSTATUS Status; + + DPRINT1("KeWaitForGate(Gate %x)\n", Gate); + + do + { + /* Lock the APC Queue */ + KeAcquireSpinLock(&CurrentThread->ApcQueueLock, &OldIrql); + + /* Check if it's already signaled */ + if (!Gate->Header.SignalState) + { + /* Unsignal it */ + Gate->Header.SignalState = 0; + + /* Unlock the Queue and return */ + KeReleaseSpinLock(&CurrentThread->ApcQueueLock, OldIrql); + return; + } + + /* Setup a Wait Block */ + GateWaitBlock = &CurrentThread->WaitBlock[0]; + GateWaitBlock->Object = (PVOID)Gate; + GateWaitBlock->Thread = CurrentThread; + + /* Set the Thread Wait Data */ + CurrentThread->WaitReason = WaitReason; + CurrentThread->WaitMode = WaitMode; + CurrentThread->WaitIrql = OldIrql; + CurrentThread->GateObject = Gate; + + /* Insert into the Wait List */ + InsertTailList(&Gate->Header.WaitListHead, &GateWaitBlock->WaitListEntry); + + /* Handle Kernel Queues */ + if (CurrentThread->Queue) + { + DPRINT1("Waking Queue\n"); + KiWakeQueue(CurrentThread->Queue); + } + + /* Unlock the Queue*/ + KeReleaseSpinLock(&CurrentThread->ApcQueueLock, OldIrql); + + /* Block the Thread */ + DPRINT1("Blocking the Thread: %x\n", CurrentThread); + KiBlockThread(&Status, + CurrentThread->Alertable, + WaitMode, + WaitReason); + + /* Check if we were executing an APC */ + if (Status != STATUS_KERNEL_APC) return; + + DPRINT1("Looping Again\n"); + } while (TRUE); +} + +VOID +FASTCALL +KeSignalGateBoostPriority(PKGATE Gate) +{ + PKTHREAD WaitThread; + PKWAIT_BLOCK WaitBlock; + KIRQL OldIrql; + NTSTATUS WaitStatus = STATUS_SUCCESS; + + DPRINT1("KeSignalGateBoostPriority(EveGate %x)\n", Gate); + + /* Acquire Dispatcher Database Lock */ + OldIrql = KeAcquireDispatcherDatabaseLock(); + + /* Make sure we're not already signaled or that the list is empty */ + if (Gate->Header.SignalState) goto quit; + + /* If our wait list is empty, then signal the event and return */ + if (IsListEmpty(&Gate->Header.WaitListHead)) + { + Gate->Header.SignalState = 1; + goto quit; + } + + /* Get WaitBlock */ + WaitBlock = CONTAINING_RECORD(Gate->Header.WaitListHead.Flink, + KWAIT_BLOCK, + WaitListEntry); + /* Remove it */ + RemoveEntryList(&WaitBlock->WaitListEntry); + + /* Get the Associated thread */ + WaitThread = WaitBlock->Thread; + + /* Increment the Queue's active threads */ + if (WaitThread->Queue) + { + DPRINT1("Incrementing Queue's active threads\n"); + WaitThread->Queue->CurrentCount++; + } + + /* Reschedule the Thread */ + DPRINT1("Unblocking the Thread\n"); + KiUnblockThread(WaitThread, &WaitStatus, EVENT_INCREMENT); + return; + +quit: + /* Release the Dispatcher Database Lock */ + KeReleaseDispatcherDatabaseLock(OldIrql); +} + +/* EOF */ diff --git a/reactos/ntoskrnl/ke/gmutex.c b/reactos/ntoskrnl/ke/gmutex.c index 35d1d436276..f0df282ca85 100644 --- a/reactos/ntoskrnl/ke/gmutex.c +++ b/reactos/ntoskrnl/ke/gmutex.c @@ -1,11 +1,11 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel * FILE: ntoskrnl/ke/gmutex.c - * PURPOSE: Implements guarded mutex (w2k3+/64) + * PURPOSE: Implements Guarded Mutex * - * PROGRAMMERS: No programmer listed. + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) and + * Filip Navara (xnavara@volny.cz) */ /* INCLUDES *****************************************************************/ @@ -13,17 +13,209 @@ #include #include +UCHAR +FASTCALL +InterlockedClearBit(PLONG Destination, + LONG Bit); + +typedef enum _KGUARDED_MUTEX_BITS +{ + GM_LOCK_BIT = 1, + GM_LOCK_WAITER_WOKEN = 2, + GM_LOCK_WAITER_INC = 4 +} KGUARDED_MUTEX_BITS; + /* FUNCTIONS *****************************************************************/ -/* -KeAcquireGuardedMutex -KeAcquireGuardedMutexUnsafe -KeEnterGuardedRegion -KeInitializeGuardedMutex -KeReleaseGuardedMutexUnsafe -KeTryToAcquireGuardedMutex -KeReleaseGuardedMutex -KeLeaveGuardedRegion -*/ +/** + * @name KeEnterGuardedRegion + * + * Enters a guarded region. This causes all (incl. special kernel) APCs + * to be disabled. + */ +VOID +STDCALL +KeEnterGuardedRegion(VOID) +{ + /* Disable Special APCs */ + KeGetCurrentThread()->SpecialApcDisable--; +} + +/** + * @name KeLeaveGuardedRegion + * + * Leaves a guarded region and delivers pending APCs if possible. + */ +VOID +STDCALL +KeLeaveGuardedRegion(VOID) +{ + PKTHREAD Thread = KeGetCurrentThread(); + + /* Boost the enable count and check if Special APCs are enabled */ + if (++Thread->SpecialApcDisable == 0) + { + /* Check if there are Kernel APCs on the list */ + if (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) + { + /* Check for APC Delivery */ + KiKernelApcDeliveryCheck(); + } + } +} + +VOID +FASTCALL +KeInitializeGuardedMutex(PKGUARDED_MUTEX GuardedMutex) +{ + /* Setup the Initial Data */ + GuardedMutex->Count = GM_LOCK_BIT; + GuardedMutex->Owner = NULL; + GuardedMutex->Contention = 0; + + /* Initialize the Wait Gate */ + KeInitializeGate(&GuardedMutex->Gate); +} + +VOID +FASTCALL +KiAcquireGuardedMutexContented(PKGUARDED_MUTEX GuardedMutex) +{ + ULONG BitsToRemove; + ULONG BitsToAdd; + LONG OldValue; + + /* Increase the contention count */ + InterlockedIncrement((PLONG)&GuardedMutex->Contention); + + /* Start by unlocking the Guarded Mutex */ + BitsToRemove = GM_LOCK_BIT; + BitsToAdd = GM_LOCK_WAITER_INC; + + while (1) + { + /* Get the Count Bits */ + OldValue = (volatile LONG)GuardedMutex->Count; + + /* Check if the Guarded Mutex is locked */ + if (OldValue & GM_LOCK_BIT) + { + /* Unlock it by removing the Lock Bit */ + if (InterlockedCompareExchange(&GuardedMutex->Count, + OldValue &~ BitsToRemove, + OldValue) == OldValue) + { + /* The Guarded Mutex is now unlocked */ + break; + } + } + else + { + /* The Guarded Mutex isn't locked, so simply set the bits */ + if (InterlockedCompareExchange(&GuardedMutex->Count, + OldValue | BitsToAdd, + OldValue) != OldValue) + { + /* The Guarded Mutex value changed behind our back, start over */ + continue; + } + + /* Now we have to wait for it */ + KeWaitForGate(&GuardedMutex->Gate, WrGuardedMutex, KernelMode); + + /* Ok, the wait is done, so set the new bits */ + BitsToRemove = GM_LOCK_BIT | GM_LOCK_WAITER_WOKEN; + BitsToAdd = GM_LOCK_WAITER_WOKEN; + } + } +} + +VOID +FASTCALL +KeAcquireGuardedMutex(PKGUARDED_MUTEX GuardedMutex) +{ + /* Disable Special APCs */ + KeEnterGuardedRegion(); + + /* Do the Unsafe Acquire */ + KeAcquireGuardedMutexUnsafe(GuardedMutex); +} + +VOID +FASTCALL +KeAcquireGuardedMutexUnsafe(PKGUARDED_MUTEX GuardedMutex) +{ + /* Remove the lock */ + if (!InterlockedClearBit(&GuardedMutex->Count, 0)) + { + /* The Guarded Mutex was already locked, enter contented case */ + KiAcquireGuardedMutexContented(GuardedMutex); + } + + /* Set the Owner */ + GuardedMutex->Owner = KeGetCurrentThread(); +} + +VOID +FASTCALL +KeReleaseGuardedMutexUnsafe(PKGUARDED_MUTEX GuardedMutex) +{ + LONG OldValue; + + /* Destroy the Owner */ + GuardedMutex->Owner = NULL; + + /* Add the Lock Bit */ + OldValue = InterlockedExchangeAdd(&GuardedMutex->Count, 1); + + /* Check if it was already locked, but not woken */ + if (OldValue && !(OldValue & GM_LOCK_WAITER_WOKEN)) + { + /* Update the Oldvalue to what it should be now */ + OldValue |= GM_LOCK_BIT; + + /* Remove the Woken bit */ + if (InterlockedCompareExchange(&GuardedMutex->Count, + OldValue &~ GM_LOCK_WAITER_WOKEN, + OldValue) == OldValue) + { + /* Signal the Gate */ + KeSignalGateBoostPriority(&GuardedMutex->Gate); + } + } +} + +VOID +FASTCALL +KeReleaseGuardedMutex(PKGUARDED_MUTEX GuardedMutex) +{ + /* Do the actual release */ + KeReleaseGuardedMutexUnsafe(GuardedMutex); + + /* Re-enable APCs */ + KeLeaveGuardedRegion(); +} + +BOOL +FASTCALL +KeTryToAcquireGuardedMutex(PKGUARDED_MUTEX GuardedMutex) +{ + /* Block APCs */ + KeEnterGuardedRegion(); + + /* Remove the lock */ + if (InterlockedClearBit(&GuardedMutex->Count, 0)) + { + /* Re-enable APCs */ + KeLeaveGuardedRegion(); + + /* Return failure */ + return FALSE; + } + + /* Set the Owner */ + GuardedMutex->Owner = KeGetCurrentThread(); + return TRUE; +} /* EOF */ diff --git a/reactos/ntoskrnl/ke/i386/bthread.S b/reactos/ntoskrnl/ke/i386/bthread.S deleted file mode 100644 index b0139e9e491..00000000000 --- a/reactos/ntoskrnl/ke/i386/bthread.S +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ReactOS kernel - * Copyright (C) 2000 David Welch - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ke/i386/bthread.S - * PURPOSE: Trap handlers - * PROGRAMMER: David Welch (david.welch@seh.ox.ac.uk) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include -#include -#include - -/* Values for contextflags */ -#define CONTEXT_i386 0x10000 -#ifndef CONTEXT_CONTROL -#define CONTEXT_CONTROL (CONTEXT_i386 | 1) -#endif -#ifndef CONTEXT_INTEGER -#define CONTEXT_INTEGER (CONTEXT_i386 | 2) -#endif -#ifndef CONTEXT_SEGMENTS -#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4) -#endif -#ifndef CONTEXT_FLOATING_POINT -#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8) -#endif -#ifndef CONTEXT_DEBUG_REGISTERS -#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10) -#endif -#ifndef CONTEXT_FULL -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) -#endif - -/* FUNCTIONS *****************************************************************/ - -/* - * - */ - -.globl _PsBeginThreadWithContextInternal -.globl _PsBeginThread - -_PsBeginThread: - /* - * This isn't really a function, we are called as the return address - * of the context switch function - */ - - /* - * Do the necessary prolog after a context switch - */ - call _PiBeforeBeginThread - - /* - * Call the actual start of the thread - */ - movl 4(%esp), %ebx /* Start routine */ - movl 8(%esp), %eax /* Start context */ - pushl %eax - call *%ebx /* Call the start routine */ - addl $4, %esp - - /* - * Terminate the thread - */ - pushl %eax - call _PsTerminateSystemThread@4 - addl $4, %esp - - /* - * If that fails then bug check - */ - pushl $0 - call _KeBugCheck@4 - addl $4, %esp - - /* - * And if that fails then loop - */ -.1: - jmp .1 - - -_PsBeginThreadWithContextInternal: - /* - * This isn't really a function, we are called as the return - * address of a context switch - */ - - /* - * Do the necessary prolog before the context switch - */ - call _PiBeforeBeginThread - - /* - * Load the context flags. - */ - popl %ebx - - /* - * Load the debugging registers - */ - testl $(CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386), %ebx - jz .L1 - popl %eax /* Dr0 */ - movl %eax, %dr0 - popl %eax /* Dr1 */ - movl %eax, %dr1 - popl %eax /* Dr2 */ - movl %eax, %dr2 - popl %eax /* Dr3 */ - movl %eax, %dr3 - popl %eax /* Dr6 */ - movl %eax, %dr6 - popl %eax /* Dr7 */ - movl %eax, %dr7 - jmp .L3 -.L1: - addl $24, %esp -.L3: - - /* Load the rest of the thread's user mode context. */ - movl $0, %eax - jmp _KiServiceExit diff --git a/reactos/ntoskrnl/ke/i386/ctxswitch.S b/reactos/ntoskrnl/ke/i386/ctxswitch.S new file mode 100644 index 00000000000..c81d95c4b69 --- /dev/null +++ b/reactos/ntoskrnl/ke/i386/ctxswitch.S @@ -0,0 +1,378 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ke/i386/ctxswitch.S + * PURPOSE: Thread Context Switching + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +.intel_syntax noprefix + +#define Running 2 +#define SIZEOF_TRAP_FRAME 0x8c +#define APC_LEVEL 1 + +/* GLOBALS ****************************************************************/ + +/* FUNCTIONS ****************************************************************/ + +/*++ + * KiThreadStartup + * + * The KiThreadStartup routine is the beginning of any thread. + * + * Params: + * SystemRoutine - Pointer to the System Startup Routine. Either + * PspUserThreadStartup or PspSystemThreadStartup + * + * StartRoutine - For Kernel Threads only, specifies the starting execution + * point of the new thread. + * + * StartContext - For Kernel Threads only, specifies a pointer to variable + * context data to be sent to the StartRoutine above. + * + * UserThread - Indicates whether or not this is a user thread. This tells + * us if the thread has a context or not. + * + * TrapFrame - Pointer to the KTHREAD to which the caller wishes to + * switch from. + * + * Returns: + * Should never return for a system thread. Returns through the System Call + * Exit Dispatcher for a user thread. + * + * Remarks: + * If a return from a system thread is detected, a bug check will occur. + * + *--*/ +.globl _KiThreadStartup@156 +_KiThreadStartup@156: + + /* + * Clear all the non-volatile registers, so the thread won't be tempted to + * expect any static data (like some badly coded usermode/win9x apps do) + */ + xor ebx, ebx + xor esi, edi + xor edi, edi + xor ebp, ebp + + /* It's now safe to go to APC */ + mov ecx, APC_LEVEL + call @KfLowerIrql@4 + + /* + * Call the System Routine which is right on our stack now. + * After we pop the pointer, the Start Routine/Context will be on the + * stack, as parameters to the System Routine + */ + pop eax + call eax + + /* The thread returned... was it a user-thread? */ + pop ecx + or ecx, ecx + jz BadThread + + /* Yes it was, set our trapframe for the System Call Exit Dispatcher */ + mov ebp, esp + + /* Exit back to user-mode */ + jmp _KiServiceExit2 + +BadThread: + + /* A system thread returned...this is very bad! */ + int 3 + +/*++ + * KiSwapContextInternal + * + * The KiSwapContextInternal routine switches context to another thread. + * + * Params: + * ESI - Pointer to the KTHREAD to which the caller wishes to + * switch to. + * EDI - Pointer to the KTHREAD to which the caller wishes to + * switch from. + * + * Returns: + * None. + * + * Remarks: + * Absolutely all registers except ESP can be trampled here for maximum code flexibility. + * + *--*/ +.globl @KiSwapContextInternal@0 +@KiSwapContextInternal@0: +#ifdef KDBG + //jmp SaveTrapFrameForKDB +SaveTrapFrameForKDB_Return: +#endif + + /* Get the PCR. It's faster to use ebx+offset then fs:offset */ + mov ebx, [fs:KPCR_SELF] + + /* Set the Thread to running */ + mov byte ptr [esi+KTHREAD_STATE], Running + + /* Save the Exception list */ + push [ebx+KPCR_EXCEPTION_LIST] + + /* Switching, disable interrupts now */ + cli + +#ifdef CONFIG_SMP + /* Save FPU state if the thread has used it. */ + mov dword ptr [ebx+KPCR_NPX_THREAD], 0 + test byte ptr [edi+KTHREAD_NPX_STATE], NPX_STATE_DIRTY + jz 3f + mov eax, [edi+KTHREAD_INITIAL_STACK] + cmp dword ptr _FxsrSupport, 0 + je 1f + fxsave [eax-SIZEOF_FX_SAVE_AREA] + jmp 2f +1: + fnsave [eax-SIZEOF_FX_SAVE_AREA] +2: + mov byte ptr [edi+KTHREAD_NPX_STATE], NPX_STATE_VALID +3: +#endif /* CONFIG_SMP */ + + /* Save the stack pointer in this processors TSS */ + mov ebp, [ebx+KPCR_TSS] + push ss:[ebp+KTSS_ESP0] + + /* Switch stacks */ + mov [edi+KTHREAD_KERNEL_STACK], esp + mov esp, [esi+KTHREAD_KERNEL_STACK] + + /* Stack is OK, safe to enable interrupts now */ + sti + + /* Check if address space switch is needed */ + mov eax, [edi+KTHREAD_APCSTATE_PROCESS] + cmp eax, [esi+KTHREAD_APCSTATE_PROCESS] + + /* If they match, then use the fast-path and skip all this */ + jz SameProcess + + /* Get the new Process. */ + mov edi, [esi+KTHREAD_APCSTATE_PROCESS] + + /* Check if we need an LDT */ + xor eax, eax + cmp [edi+KPROCESS_LDT_DESCRIPTOR0], eax + jz NoLdt + + /* Write the LDT Selector */ + mov ebp, [ebx+KPCR_GDT] + mov eax, [edi+KPROCESS_LDT_DESCRIPTOR0] + mov [ebp+LDT_SELECTOR], eax + mov eax, [edi+KPROCESS_LDT_DESCRIPTOR1] + mov [ebp+LDT_SELECTOR+4], eax + + /* Save LDT Selector */ + mov eax, LDT_SELECTOR + +NoLdt: + + /* Load LDT */ + lldt ax + + /* Get the IOPM */ + mov ecx, [edi+KPROCESS_IOPM_OFFSET] + + /* Set current IOPM offset in the TSS */ + mov [ebp+KTSS_IOMAPBASE], cx + + /* Change the address space */ + mov eax, [edi+KPROCESS_DIRECTORY_TABLE_BASE] + mov cr3, eax + +SameProcess: + + /* Set the TEB */ + mov eax, [esi+KTHREAD_TEB] + mov ecx, [ebx+KPCR_GDT] + mov [ecx+0x3A], ax + shr eax, 16 + mov [ecx+0x3C], al + mov [ecx+0x3F], ah + + /* Increase context switches */ + inc dword ptr [esi+KTHREAD_CONTEXT_SWITCHES] + + /* Set TS in cr0 to catch FPU code and load the FPU state when needed */ +#ifndef CONFIG_SMP + cmp [ebx+KPCR_NPX_THREAD], esi + je 4f +#endif /* !CONFIG_SMP */ + mov eax, cr0 + or eax, X86_CR0_TS + mov cr0, eax +4: + + /* Restore the stack pointer in this processors TSS */ + pop ss:[ebp+KTSS_ESP0] + + /* Restore exception list */ + pop [ebx+KPCR_EXCEPTION_LIST] + + /* Return */ + call @KeReleaseDispatcherDatabaseLockFromDpcLevel@0 + ret + +/*++ + * KiSwapContext + * + * The KiSwapContext routine switches context to another thread. + * + * Params: + * TargetThread - Pointer to the KTHREAD to which the caller wishes to + * switch to. + * + * Returns: + * The WaitStatus of the Target Thread. NOT YET SUPPORTED. + * + * Remarks: + * This is a wrapper around KiSwapContextInternal which will save all the + * non-volatile registers so that the Internal function can use all of + * them. It will also save the old current thread and set the new one. + * + * The calling thread does not return after KiSwapContextInternal until + * another thread switches to IT. + * + *--*/ +.globl @KiSwapContext@4 +@KiSwapContext@4: + /* Note, we CANNOT touch ebp */ + + /* Save 4 registers */ + sub esp, 4 * 4 + + /* Save all the non-volatile ones */ + mov [esp+12], ebx + mov [esp+8], esi + mov [esp+4], edi + mov [esp+0], ebp + + /* Get the Current Thread */ + mov edi, fs:[KPCR_CURRENT_THREAD] + + /* Get the New Thread */ + mov esi, ecx + + /* Save it as Current thread */ + mov fs:[KPCR_CURRENT_THREAD], esi + + /* Do the swap with the registers correctly setup */ + call @KiSwapContextInternal@0 + + /* Return the registers */ + mov ebp, [esp+0] + mov edi, [esp+4] + mov esi, [esp+8] + mov ebx, [esp+12] + + /* Clean stack */ + add esp, 4 * 4 + ret + +#ifdef KDBG + +SaveTrapFrameForKDB: + /* Set up a trap frame */ + + /* Fake Interrupt Stack */ + push esp // 0x74 + pushf // 0x70 + push cs // 0x6C + push [esp+12] /* EIP */ // 0x68 + mov [esp+16], ss // 0x78 + + /* Trap Frame */ + push 0 /* Error Code */ // 0x64 + push ebp // 0x60 + push ebx + push esi + push edi + push fs + push -1 /* Exception List */ // 0x4C + push 0 /* Previous Mode */ // 0x48 + push eax + push ecx + push edx + push ds + push es + push gs // 0x30 + sub esp, 0x28 /* Debug Registers */ // 0x8 + push [esp+60] /* Debug EIP */ // 0x4 + push ebp /* Debug EBP */ // 0x0 + + /* Set Stack */ + mov ebp, esp + + /* Push old Trap Frame */ + push [edi+KTHREAD_TRAP_FRAME] + + /* Save new one */ + mov [edi+KTHREAD_TRAP_FRAME], ebp + + /* Return EIP */ + push offset RestoreTrapFrameForKDB + + /* Restore EBP */ + mov ebp, [ebp+KTRAP_FRAME_EBP] + + /* Jump to normal code */ + jmp SaveTrapFrameForKDB_Return + +RestoreTrapFrameForKDB: + + /* Restore the old trapframe */ + pop [edi+KTHREAD_TRAP_FRAME] + + /* Pop unused portions of the trap frame */ + add esp, 0x30 + + /* Restore registers from Trap frame */ + pop gs + pop es + pop ds + pop edx + pop ecx + pop eax + add esp, 8 + pop fs + pop edi + pop esi + pop ebx + + /* Remove SS:ESP from the stack */ + mov ebp, [esp+16] + mov [esp+24], ebp + mov ebp, [esp+12] + mov [esp+20], ebp + mov ebp, [esp+8] + mov [esp+16], ebp + + /* Restore Fake INT Stack */ + pop ebp + add esp, 12 + + /* Return to the caller. */ + iret +#endif /* KDBG */ + + diff --git a/reactos/ntoskrnl/ke/i386/exp.c b/reactos/ntoskrnl/ke/i386/exp.c index e907280ba75..e923f53fed7 100644 --- a/reactos/ntoskrnl/ke/i386/exp.c +++ b/reactos/ntoskrnl/ke/i386/exp.c @@ -27,7 +27,7 @@ #endif extern void KiSystemService(void); -extern void interrupt_handler2d(void); +extern void KiDebugService(void); extern VOID KiTrap0(VOID); extern VOID KiTrap1(VOID); @@ -106,15 +106,8 @@ NTSTATUS ExceptionToNtStatus[] = /* FUNCTIONS ****************************************************************/ -#if defined(DBG) || defined(KDBG) BOOLEAN STDCALL -KeRosPrintAddress(PVOID address) -{ - return KdbSymPrintAddress(address); -} -#else /* KDBG */ -BOOLEAN STDCALL -KeRosPrintAddress(PVOID address) +KiRosPrintAddress(PVOID address) { PLIST_ENTRY current_entry; MODULE_TEXT_SECTION* current; @@ -147,7 +140,6 @@ KeRosPrintAddress(PVOID address) return(FALSE); } -#endif /* KDBG */ ULONG KiKernelTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2) @@ -502,6 +494,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr) */ if (Tf->Eflags & (1 << 17)) { + DPRINT("Tf->Eflags, %x, Tf->Eip %x, ExceptionNr: %d\n", Tf->Eflags, Tf->Eip, ExceptionNr); return(KeV86Exception(ExceptionNr, Tf, cr2)); } @@ -511,7 +504,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr) if (PsGetCurrentThread() != NULL && Esp0 < (ULONG)PsGetCurrentThread()->Tcb.StackLimit) { - DbgPrint("Stack underflow (tf->esp %x Limit %x)\n", + DPRINT1("Stack underflow (tf->esp %x Limit %x)\n", Esp0, (ULONG)PsGetCurrentThread()->Tcb.StackLimit); ExceptionNr = 12; } @@ -588,50 +581,55 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr) } } -VOID +BOOLEAN +STDCALL KeContextToTrapFrame(PCONTEXT Context, - PKTRAP_FRAME TrapFrame) + PKTRAP_FRAME TrapFrame) { - if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) - { - TrapFrame->Esp = Context->Esp; - TrapFrame->Ss = Context->SegSs; - TrapFrame->Cs = Context->SegCs; - TrapFrame->Eip = Context->Eip; - TrapFrame->Eflags = Context->EFlags; - TrapFrame->Ebp = Context->Ebp; - } - if ((Context->ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER) - { - TrapFrame->Eax = Context->Eax; - TrapFrame->Ebx = Context->Ebx; - TrapFrame->Ecx = Context->Ecx; - TrapFrame->Edx = Context->Edx; - TrapFrame->Esi = Context->Esi; - TrapFrame->Edi = Context->Edi; - } - if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) - { - TrapFrame->Ds = Context->SegDs; - TrapFrame->Es = Context->SegEs; - TrapFrame->Fs = Context->SegFs; - TrapFrame->Gs = Context->SegGs; - } - if ((Context->ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT) - { - /* - * Not handled - * - * This should be handled separately I think. - * - blight - */ - } - if ((Context->ContextFlags & CONTEXT_DEBUG_REGISTERS) == CONTEXT_DEBUG_REGISTERS) - { - /* - * Not handled - */ - } + /* Start with the basic Registers */ + if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) + { + TrapFrame->Esp = Context->Esp; + TrapFrame->Ss = Context->SegSs; + TrapFrame->Cs = Context->SegCs; + TrapFrame->Eip = Context->Eip; + TrapFrame->Eflags = Context->EFlags; + TrapFrame->Ebp = Context->Ebp; + } + + /* Process the Integer Registers */ + if ((Context->ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER) + { + TrapFrame->Eax = Context->Eax; + TrapFrame->Ebx = Context->Ebx; + TrapFrame->Ecx = Context->Ecx; + TrapFrame->Edx = Context->Edx; + TrapFrame->Esi = Context->Esi; + TrapFrame->Edi = Context->Edi; + } + + /* Process the Context Segments */ + if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) + { + TrapFrame->Ds = Context->SegDs; + TrapFrame->Es = Context->SegEs; + TrapFrame->Fs = Context->SegFs; + TrapFrame->Gs = Context->SegGs; + } + + /* Handle the Debug Registers */ + if ((Context->ContextFlags & CONTEXT_DEBUG_REGISTERS) == CONTEXT_DEBUG_REGISTERS) + { + TrapFrame->Dr0 = Context->Dr0; + TrapFrame->Dr1 = Context->Dr1; + TrapFrame->Dr2 = Context->Dr2; + TrapFrame->Dr3 = Context->Dr3; + TrapFrame->Dr6 = Context->Dr6; + TrapFrame->Dr7 = Context->Dr7; + } + + /* Handle FPU and Extended Registers */ + return KiContextToFxSaveArea((PFX_SAVE_AREA)(TrapFrame + 1), Context); } VOID @@ -930,7 +928,7 @@ KeInitExceptions(VOID) set_trap_gate(i,(int)KiTrapUnknown, 0); } - set_system_call_gate(0x2d,(int)interrupt_handler2d); + set_system_call_gate(0x2d,(int)KiDebugService); set_system_call_gate(0x2e,(int)KiSystemService); } diff --git a/reactos/ntoskrnl/ke/i386/i386-mcount.S b/reactos/ntoskrnl/ke/i386/i386-mcount.S deleted file mode 100644 index f2f9eb9bdb4..00000000000 --- a/reactos/ntoskrnl/ke/i386/i386-mcount.S +++ /dev/null @@ -1,52 +0,0 @@ -/* i386-specific implemetation of profiling support. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* We need a special version of the `mcount' function since for ix86 it - must not clobber any register. This has several reasons: - - there is a bug in gcc as of version 2.7.2.2 which prohibits the - use of profiling together with nested functions - - the ELF `fixup' function uses GCC's regparm feature - - some (future) systems might want to pass parameters in registers. */ -/* dwelch: Altered for ReactOS to output the files to port 0xe9 for processing - by bochs. */ - - -.globl _mcount -_mcount: - /* Save the caller-clobbered registers. */ - pushl %eax - pushl %ecx - pushl %edx - - movw $0xe9, %dx - movl 4(%ebp), %eax - outl %eax, %dx - movl 12(%esp), %eax - outl %eax, %dx - - /* Pop the saved registers. Please note that `mcount' has no - return value. */ - popl %edx - popl %ecx - popl %eax - ret - - - diff --git a/reactos/ntoskrnl/ke/i386/irq.c b/reactos/ntoskrnl/ke/i386/irq.c index 22d269b69ac..60a0f76bbdf 100644 --- a/reactos/ntoskrnl/ke/i386/irq.c +++ b/reactos/ntoskrnl/ke/i386/irq.c @@ -19,10 +19,6 @@ /* INCLUDES ****************************************************************/ #include -#if defined(KDBG) || defined(DBG) -#include <../dbg/kdb.h> -#endif /* KDBG */ - #include <../hal/halx86/include/halirq.h> #define NDEBUG diff --git a/reactos/ntoskrnl/ke/i386/kernel.c b/reactos/ntoskrnl/ke/i386/kernel.c index 1d07b534158..a18306511d9 100644 --- a/reactos/ntoskrnl/ke/i386/kernel.c +++ b/reactos/ntoskrnl/ke/i386/kernel.c @@ -26,6 +26,8 @@ BOOLEAN Ke386NoExecute = FALSE; BOOLEAN Ke386Pae = FALSE; BOOLEAN Ke386GlobalPagesEnabled = FALSE; ULONG KiFastSystemCallDisable = 1; +extern PVOID Ki386InitialStackArray[MAXIMUM_PROCESSORS]; +extern ULONG IdleProcessorMask; /* FUNCTIONS *****************************************************************/ @@ -123,6 +125,42 @@ Ki386GetCpuId(VOID) } } +VOID +KeApplicationProcessorInitDispatcher(VOID) +{ + KIRQL oldIrql; + oldIrql = KeAcquireDispatcherDatabaseLock(); + IdleProcessorMask |= (1 << KeGetCurrentProcessorNumber()); + KeReleaseDispatcherDatabaseLock(oldIrql); +} + +VOID +INIT_FUNCTION +KeCreateApplicationProcessorIdleThread(ULONG Id) +{ + PETHREAD IdleThread; + PKPRCB Prcb = ((PKPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE))->Prcb; + + PsInitializeIdleOrFirstThread(PsIdleProcess, + &IdleThread, + NULL, + KernelMode, + FALSE); + IdleThread->Tcb.State = Running; + IdleThread->Tcb.FreezeCount = 0; + IdleThread->Tcb.Affinity = 1 << Id; + IdleThread->Tcb.UserAffinity = 1 << Id; + IdleThread->Tcb.Priority = LOW_PRIORITY; + IdleThread->Tcb.BasePriority = LOW_PRIORITY; + Prcb->IdleThread = &IdleThread->Tcb; + Prcb->CurrentThread = &IdleThread->Tcb; + + Ki386InitialStackArray[Id] = (PVOID)IdleThread->Tcb.StackLimit; + + DPRINT("IdleThread for Processor %d has PID %d\n", + Id, IdleThread->Cid.UniqueThread); +} + VOID INIT_FUNCTION KePrepareForApplicationProcessorInit(ULONG Id) { diff --git a/reactos/ntoskrnl/ke/i386/multiboot.S b/reactos/ntoskrnl/ke/i386/multiboot.S deleted file mode 100644 index 455cce90607..00000000000 --- a/reactos/ntoskrnl/ke/i386/multiboot.S +++ /dev/null @@ -1,382 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#define MULTIBOOT_HEADER_MAGIC (0x1BADB002) - -#define MULTIBOOT_HEADER_FLAGS (0x00010003) - -#define V2P(x) (x - KERNEL_BASE + 0x200000) - -#ifdef CONFIG_SMP - -#define AP_MAGIC (0x12481020) - -#endif /* CONFIG_SMP */ - -.globl _NtProcessStartup -.globl _start -.globl _init_stack -.globl _init_stack_top -.globl _trap_stack -.globl _trap_stack_top -.globl _unmap_me -.globl _unmap_me2 -.globl _unmap_me3 -.globl _unmap_me4 -.globl _pagetable_start -.globl _pagetable_end -.globl _pae_pagedirtable - - /* - * This is called by the realmode loader, with protected mode - * enabled, paging disabled and the segment registers pointing - * a 4Gb, 32-bit segment starting at zero. - * - * EAX = Multiboot magic or application processor magic - * - * EBX = Points to a structure in lowmem with data from the - * loader - */ - -_NtProcessStartup: -_start: - jmp _multiboot_entry - - /* Align 32 bits boundary */ - .align 4 - - /* Multiboot header */ -multiboot_header: - /* magic */ - .long MULTIBOOT_HEADER_MAGIC - /* flags */ - .long MULTIBOOT_HEADER_FLAGS - /* checksum */ - .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) - /* header_addr */ - .long (0x200000 + multiboot_header - KERNEL_BASE) - /* load_addr */ - .long 0x200000 - /* load_end_addr */ - .long (__bss_start__ + 0x200000 - KERNEL_BASE) - /* bss_end_addr */ - .long (__bss_end__ + 0x200000 - KERNEL_BASE) - /* entry_addr */ - .long (0x200000 + _start - KERNEL_BASE) - -_multiboot_entry: - /* - * This must be PIC because we haven't set up paging yet - */ - - /* - * Gcc expects this at all times - */ - cld - -#ifdef CONFIG_SMP - - /* - * Save the multiboot or application processor magic - */ - movl %eax, %edx - - cmpl $AP_MAGIC, %edx - je .m1 - -#endif /* CONFIG_SMP */ - - /* - * Zero the BSS - */ - movl %eax, %edx - movl $0, %eax - movl $__bss_end__, %ecx - subl $__bss_start__, %ecx - shr $2, %ecx - movl $__bss_start__, %edi - subl $KERNEL_BASE, %edi - addl $0x200000, %edi - rep - stosl - - /* - * Initialize the page directory - */ - movl $V2P(startup_pagedirectory), %esi - movl $(V2P(lowmem_pagetable) + 0x3), 0x0(%esi) - movl $(V2P(kernel_pagetable) + 0x3), (KERNEL_BASE >> 20)(%esi) - movl $(V2P(kernel_pagetable+4096) + 0x3), ((KERNEL_BASE >> 20) + 4)(%esi) - - movl $(V2P(startup_pagedirectory) + 0x3), 0xF00(%esi) - movl $(V2P(hyperspace_pagetable) + 0x3), 0xF08(%esi) -#ifdef CONFIG_SMP - movl $(V2P(apic_pagetable) + 0x3), 0xFEC(%esi) -#endif /* CONFIG_SMP */ - movl $(V2P(kpcr_pagetable) + 0x3), 0xFF0(%esi) - - /* - * Initialize the page table that maps low memory - */ - movl $V2P(lowmem_pagetable), %esi - movl $0x7, %eax - movl $0, %edi -.l3: - movl %eax, (%esi, %edi) - addl $0x1000, %eax - addl $4, %edi - cmpl $4096, %edi - jl .l3 - - /* - * Initialize the page table that maps kernel memory - */ - movl $V2P(kernel_pagetable), %esi - movl $0x200003, %eax - movl $0, %edi -.l4: - movl %eax, (%esi, %edi) - addl $0x1000, %eax - addl $4, %edi - cmpl $6144, %edi - jl .l4 - -#ifdef CONFIG_SMP - - /* - * Initialize the page table that maps the APIC register address space - */ - - /* - * FIXME: APIC register address space can be non-standard so do the - * mapping later - */ - movl $V2P(apic_pagetable), %esi - movl $0, %edi - movl $0xFEC0001B, %eax - movl %eax, (%esi, %edi) - movl $0x800, %edi - movl $0xFEE0001B, %eax - movl %eax, (%esi, %edi) - -#endif /* CONFIG_SMP */ - - /* - * Initialize the page table that maps the initial KPCR (at FF000000) - */ - movl $V2P(kpcr_pagetable), %esi - movl $0, %edi - movl $0x1003, %eax - movl %eax, (%esi, %edi) - - -#ifdef CONFIG_SMP - -.m1: - /* - * Check for pae mode (only possible for an application processor) - */ - - movl $(V2P(_Ke386Pae)), %eax - cmpb $0, (%eax) - je .m3 - - /* - * Set up the PDBR - */ - movl $(V2P(_pae_pagedirtable)), %eax - movl %eax, %cr3 - - /* - * Enable pae mode - */ - movl %cr4, %eax - orl $X86_CR4_PAE, %eax - movl %eax, %cr4 - - jmp .m4 - -.m3: - -#endif /* CONFIG_SMP */ - - /* - * Set up the PDBR - */ - movl $(V2P(startup_pagedirectory)), %eax - movl %eax, %cr3 - -#ifdef CONFIG_SMP -.m4: -#endif - - /* - * Enable paging and set write protect - */ - movl %cr0, %eax - orl $0x80010000, %eax - movl %eax, %cr0 - - /* - * Do an absolute jump because we now want to execute above 0xc0000000 - */ - movl $.l2, %eax - jmp *%eax -.l2: - - /* - * Load the GDTR and IDTR with new tables located above - * 0xc0000000 - */ - - /* FIXME: Application processors should have their own GDT/IDT */ - lgdt _KiGdtDescriptor - lidt _KiIdtDescriptor - - /* - * Reload the data segment registers - */ - movl $KERNEL_DS, %eax - movl %eax, %ds - movl %eax, %es - movl %eax, %gs - movl %eax, %ss - movl $0, %eax - movl %eax, %fs - -#ifdef CONFIG_SMP - - cmpl $AP_MAGIC, %edx - jne .m2 - - /* - * This is an application processor executing - */ - - /* - * Initialize EFLAGS - */ - pushl $0 - popfl - - /* - * Reserve space for the floating point save area. - */ - subl $SIZEOF_FX_SAVE_AREA, %esp - - /* - * Call the application processor initialization code - */ - pushl $0 - pushl $.l7 - pushl $KERNEL_CS - pushl $_KiSystemStartup - lret - - /* - * Catch illegal returns from KiSystemStartup - */ -.l7: - popl %eax - pushl $0 - call _KeBugCheck@4 - popl %eax -.l8: - jmp .l8 - - -.m2: - -#endif /* CONFIG_SMP */ - - /* - * Load the PCR selector - */ - movl $PCR_SELECTOR, %eax - movl %eax, %fs - - /* - * Load the initial kernel stack - */ - movl $(_init_stack_top - SIZEOF_FX_SAVE_AREA), %esp - - /* - * Initialize EFLAGS - */ - pushl $0 - popfl - - /* - * Call the main kernel initialization - */ - movl $0, %ebp - pushl %ebx - pushl %edx - pushl $.l5 - pushl $KERNEL_CS - pushl $__main - lret - - /* - * Catch illegal returns from main, try bug checking the system, - * if that fails then loop forever. - */ -.l5: - popl %eax - popl %eax - pushl $0 - call _KeBugCheck@4 - popl %eax -.l6: - jmp .l6 - - - /* - * This needs to be page aligned so put it at the beginning of the bss - * segment - */ -.bss -_pagetable_start: -startup_pagedirectory: - .fill 4096, 1, 0 - -lowmem_pagetable: - .fill 4096, 1, 0 - -kernel_pagetable: - .fill 2*4096, 1, 0 - -hyperspace_pagetable: - .fill 4096, 1, 0 - -_pae_pagedirtable: - .fill 4096, 1, 0 -#ifdef CONFIG_SMP -apic_pagetable: - .fill 4096, 1, 0 -#endif /* CONFIG_SMP */ - -kpcr_pagetable: - .fill 4096, 1, 0 -_pagetable_end: -_unmap_me: - .fill 4096, 1, 0 - -_init_stack: - .fill 3*4096, 1, 0 -_init_stack_top: - -_unmap_me2: - .fill 4096, 1, 0 - -_trap_stack: - .fill 3*4096, 1, 0 -_trap_stack_top: - -_unmap_me3: - .fill 4096, 1, 0 diff --git a/reactos/ntoskrnl/ke/i386/syscall.S b/reactos/ntoskrnl/ke/i386/syscall.S index 2cc6ca34287..06e04e064dd 100644 --- a/reactos/ntoskrnl/ke/i386/syscall.S +++ b/reactos/ntoskrnl/ke/i386/syscall.S @@ -22,8 +22,10 @@ .globl KeReturnFromSystemCallWithHook .globl _KiServiceExit +.globl _KiServiceExit2 .globl _KiFastCallEntry .globl _KiSystemService +.globl _KiDebugService _KiFastCallEntry: @@ -317,3 +319,145 @@ InvalidCall: movl $STATUS_INVALID_SYSTEM_SERVICE, %eax movl %eax, KTRAP_FRAME_EAX(%ebp) jmp _KiServiceExit + +_KiServiceExit2: + + /* Get the Current Thread */ + cli + movl %fs:KPCR_CURRENT_THREAD, %esi + + /* Deliver APCs only if we were called from user mode */ + testb $1, KTRAP_FRAME_CS(%esp) + je KiRosTrapReturn + + /* And only if any are actually pending */ + cmpb $0, KTHREAD_PENDING_USER_APC(%esi) + je KiRosTrapReturn + + /* Save pointer to Trap Frame */ + movl %esp, %ebx + + /* Raise IRQL to APC_LEVEL */ + movl $1, %ecx + call @KfRaiseIrql@4 + + /* Save old IRQL */ + pushl %eax + + /* Deliver APCs */ + sti + pushl %ebx + pushl $0 + pushl $UserMode + call _KiDeliverApc@12 + cli + + /* Return to old IRQL */ + popl %ecx + call @KfLowerIrql@4 + + /* Skip useless Debug Data */ + addl $0x18, %esp // + 0x74 + + /* Restore Debug Registers */ + popl %eax // + 0x5C + movl %eax, %dr0 + popl %eax // + 0x58 + movl %eax, %dr1 + popl %eax // + 0x54 + movl %eax, %dr2 + popl %eax // + 0x50 + movl %eax, %dr3 + popl %eax // + 0x4C + movl %eax, %dr6 + popl %eax // + 0x48 + movl %eax, %dr7 + + /* Restore Registers */ + popl %gs // + 0x44 + popl %es // + 0x40 + popl %ds // + 0x3C + popl %edx // + 0x38 + popl %ecx // + 0x34 + popl %eax // + 0x30 + + /* Restore the old previous mode */ + popl %ebx // + 0x2C + movb %bl, %ss:KTHREAD_PREVIOUS_MODE(%esi) + + /* Restore the old exception handler list */ + popl %fs:KPCR_EXCEPTION_LIST // + 0x28 + + /* Restore final registers from trap frame */ + popl %fs // + 0x24 + popl %edi // + 0x20 + popl %esi // + 0x1C + popl %ebx // + 0x18 + popl %ebp // + 0x14 + add $4, %esp // + 0x10 + + /* Return to user-mode */ + iret + +.intel_syntax noprefix +_KiDebugService: + + /* Create the Trap Frame */ + push 0 + push ebp + push ebx + push esi + push edi + push fs + + /* Switch to correct FS */ + mov bx, PCR_SELECTOR + mov fs, bx + + /* Save Exception List */ + push fs:[KPCR_EXCEPTION_LIST] + + /* Use Old Previous Mode */ + mov ebx, fs:[KPCR_CURRENT_THREAD] + push [ebx+KTHREAD_PREVIOUS_MODE] + + /* Continue building the Trap Frame */ + push eax + push ecx + push edx + push ds + push es + push gs + + /* Switch Segments to Kernel */ + mov bx, KERNEL_DS + mov ds, bx + mov es, bx + + /* Save Debug Registers */ + mov ebx, eax + mov eax, dr7 + push eax + mov eax, dr6 + push eax + mov eax, dr3 + push eax + mov eax, dr2 + push eax + mov eax, dr1 + push eax + mov eax, dr0 + push eax + mov eax, ebx + + /* Skip useless debug data */ + sub esp, 0x18 + + /* Call debug service dispatcher */ + push edx + push ecx + push eax + call _KdpServiceDispatcher@12 + + /* Exit through common routine */ + jmp _KiServiceExit2 diff --git a/reactos/ntoskrnl/ke/i386/thread.c b/reactos/ntoskrnl/ke/i386/thread.c index 6eb7c67b1b1..6737e6258b8 100644 --- a/reactos/ntoskrnl/ke/i386/thread.c +++ b/reactos/ntoskrnl/ke/i386/thread.c @@ -1,11 +1,10 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ke/i386/thread.c - * PURPOSE: Architecture multitasking functions + * PURPOSE: i386 Thread Context Creation * - * PROGRAMMERS: David Welch (welch@cwcom.net) + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) */ /* INCLUDES ****************************************************************/ @@ -13,171 +12,147 @@ #include #define NDEBUG #include + +typedef struct _KSHARED_CTXSWITCH_FRAME { + ULONG Esp0; + PVOID ExceptionList; + PVOID RetEip; +} KSHARED_CTXSWITCH_FRAME, *PKSHARED_CTXSWITCH_FRAME; + +typedef struct _KSTART_FRAME { + PKSYSTEM_ROUTINE SystemRoutine; + PKSTART_ROUTINE StartRoutine; + PVOID StartContext; + BOOLEAN UserThread; +} KSTART_FRAME, *PKSTART_FRAME; + +/* + * This is the Initial Thread Stack Frame on i386. + * + * It is composed of : + * + * - A shared Thread Switching frame so that we can use + * the context-switching code when initializing the thread. + * + * - The Stack Frame for KiThreadStartup, which are the parameters + * that it will receive (System/Start Routines & Context) + * + * - A Trap Frame with the Initial Context *IF AND ONLY IF THE THREAD IS USER* + * + * - The FPU Save Area, theoretically part of the Trap Frame's "ExtendedRegisters" + * + * This Initial Thread Stack Frame starts at Thread->InitialStack and it spans + * a total size of 0x2B8 bytes. + */ +typedef struct _KUINIT_FRAME { + KSHARED_CTXSWITCH_FRAME CtxSwitchFrame; /* -0x2B8 */ + KSTART_FRAME StartFrame; /* -0x2AC */ + KTRAP_FRAME TrapFrame; /* -0x29C */ + FX_SAVE_AREA FxSaveArea; /* -0x210 */ +} KUINIT_FRAME, *PKUINIT_FRAME; + +typedef struct _KKINIT_FRAME { + KSHARED_CTXSWITCH_FRAME CtxSwitchFrame; /* -0x22C */ + KSTART_FRAME StartFrame; /* -0x220 */ + FX_SAVE_AREA FxSaveArea; /* -0x210 */ +} KKINIT_FRAME, *PKKINIT_FRAME; /* FUNCTIONS *****************************************************************/ -NTSTATUS -Ki386ValidateUserContext(PCONTEXT Context) -/* - * FUNCTION: Validates a processor context - * ARGUMENTS: - * Context = Context to validate - * RETURNS: Status - * NOTE: This only validates the context as not violating system security, it - * doesn't guararantee the thread won't crash at some point - * NOTE2: This relies on there only being two selectors which can access - * system space - */ +VOID +STDCALL +Ke386InitThreadWithContext(PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context) { - if (Context->Eip >= KERNEL_BASE) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegCs == KERNEL_CS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegDs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegEs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegFs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegGs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if ((Context->EFlags & X86_EFLAGS_IOPL) != 0 || - (Context->EFlags & X86_EFLAGS_NT) || - (Context->EFlags & X86_EFLAGS_VM) || - (!(Context->EFlags & X86_EFLAGS_IF))) - { - return(STATUS_UNSUCCESSFUL); - } - return(STATUS_SUCCESS); -} - -NTSTATUS -Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context) -{ - PULONG KernelStack; - ULONG InitSize; - PKTRAP_FRAME TrapFrame; - PFX_SAVE_AREA FxSaveArea; - - /* - * Setup a stack frame for exit from the task switching routine - */ - - InitSize = 6 * sizeof(DWORD) + sizeof(DWORD) + 6 * sizeof(DWORD) + - + sizeof(KTRAP_FRAME) + sizeof (FX_SAVE_AREA); - KernelStack = (PULONG)((char*)Thread->KernelStack - InitSize); - - /* Set up the initial frame for the return from the dispatcher. */ - KernelStack[0] = (ULONG)Thread->InitialStack - sizeof(FX_SAVE_AREA); /* TSS->Esp0 */ - KernelStack[1] = 0; /* EDI */ - KernelStack[2] = 0; /* ESI */ - KernelStack[3] = 0; /* EBX */ - KernelStack[4] = 0; /* EBP */ - KernelStack[5] = (ULONG)&PsBeginThreadWithContextInternal; /* EIP */ - - /* Save the context flags. */ - KernelStack[6] = Context->ContextFlags; - - /* Set up the initial values of the debugging registers. */ - KernelStack[7] = Context->Dr0; - KernelStack[8] = Context->Dr1; - KernelStack[9] = Context->Dr2; - KernelStack[10] = Context->Dr3; - KernelStack[11] = Context->Dr6; - KernelStack[12] = Context->Dr7; - - /* Set up a trap frame from the context. */ - TrapFrame = (PKTRAP_FRAME)(&KernelStack[13]); - TrapFrame->DebugEbp = (PVOID)Context->Ebp; - TrapFrame->DebugEip = (PVOID)Context->Eip; - TrapFrame->DebugArgMark = 0; - TrapFrame->DebugPointer = 0; - TrapFrame->TempCs = 0; - TrapFrame->TempEip = 0; - TrapFrame->Gs = (USHORT)Context->SegGs; - TrapFrame->Es = (USHORT)Context->SegEs; - TrapFrame->Ds = (USHORT)Context->SegDs; - TrapFrame->Edx = Context->Edx; - TrapFrame->Ecx = Context->Ecx; - TrapFrame->Eax = Context->Eax; - TrapFrame->PreviousMode = UserMode; - TrapFrame->ExceptionList = (PVOID)0xFFFFFFFF; - TrapFrame->Fs = TEB_SELECTOR; - TrapFrame->Edi = Context->Edi; - TrapFrame->Esi = Context->Esi; - TrapFrame->Ebx = Context->Ebx; - TrapFrame->Ebp = Context->Ebp; - TrapFrame->ErrorCode = 0; - TrapFrame->Cs = Context->SegCs; - TrapFrame->Eip = Context->Eip; - TrapFrame->Eflags = Context->EFlags | X86_EFLAGS_IF; - TrapFrame->Eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_NT | X86_EFLAGS_IOPL); - TrapFrame->Esp = Context->Esp; - TrapFrame->Ss = (USHORT)Context->SegSs; - /* FIXME: Should check for a v86 mode context here. */ - - /* Set up the initial floating point state. */ - /* FIXME: Do we have to zero the FxSaveArea or is it already? */ - FxSaveArea = (PFX_SAVE_AREA)((ULONG_PTR)KernelStack + InitSize - sizeof(FX_SAVE_AREA)); - if (KiContextToFxSaveArea(FxSaveArea, Context)) + PFX_SAVE_AREA FxSaveArea; + PKSTART_FRAME StartFrame; + PKSHARED_CTXSWITCH_FRAME CtxSwitchFrame; + PKTRAP_FRAME TrapFrame = NULL; + + /* Check if this is a With-Context Thread */ + DPRINT("Ke386InitThreadContext\n"); + if (Context) { - Thread->NpxState = NPX_STATE_VALID; - } - else + /* Set up the Initial Frame */ + PKUINIT_FRAME InitFrame; + InitFrame = (PKUINIT_FRAME)((ULONG_PTR)Thread->InitialStack - sizeof(KUINIT_FRAME)); + DPRINT("Setting up a user-mode thread with the Frame at: %x\n", InitFrame); + + /* Setup the Trap Frame */ + TrapFrame = &InitFrame->TrapFrame; + + /* Set up a trap frame from the context. */ + if (KeContextToTrapFrame(Context, TrapFrame)) + { + Thread->NpxState = NPX_STATE_VALID; + } + else + { + Thread->NpxState = NPX_STATE_INVALID; + } + + /* Enable Interrupts and disable some unsupported flags right now */ + TrapFrame->Eflags = Context->EFlags | X86_EFLAGS_IF; + TrapFrame->Eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_NT | X86_EFLAGS_IOPL); + + /* Set the previous mode as user */ + TrapFrame->PreviousMode = UserMode; + + /* Terminate the Exception Handler List */ + TrapFrame->ExceptionList = (PVOID)0xFFFFFFFF; + + /* Setup the Stack for KiThreadStartup and Context Switching */ + StartFrame = &InitFrame->StartFrame; + CtxSwitchFrame = &InitFrame->CtxSwitchFrame; + + /* Tell the thread it will run in User Mode */ + Thread->PreviousMode = UserMode; + + /* Tell KiThreadStartup of that too */ + StartFrame->UserThread = TRUE; + } + else { - Thread->NpxState = NPX_STATE_INVALID; + /* No context Thread, meaning System Thread */ + + /* Set up the Initial Frame */ + PKKINIT_FRAME InitFrame; + InitFrame = (PKKINIT_FRAME)((ULONG_PTR)Thread->InitialStack - sizeof(KKINIT_FRAME)); + DPRINT("Setting up a kernel thread with the Frame at: %x\n", InitFrame); + + /* Setup the Fx Area */ + FxSaveArea = &InitFrame->FxSaveArea; + RtlZeroMemory(FxSaveArea, sizeof(FX_SAVE_AREA)); + Thread->NpxState = NPX_STATE_INVALID; + + /* Setup the Stack for KiThreadStartup and Context Switching */ + StartFrame = &InitFrame->StartFrame; + CtxSwitchFrame = &InitFrame->CtxSwitchFrame; + + /* Tell the thread it will run in Kernel Mode */ + Thread->PreviousMode = KernelMode; + + /* Tell KiThreadStartup of that too */ + StartFrame->UserThread = FALSE; } - - /* Save back the new value of the kernel stack. */ - Thread->KernelStack = (PVOID)KernelStack; - - return(STATUS_SUCCESS); -} - -NTSTATUS -Ke386InitThread(PKTHREAD Thread, - PKSTART_ROUTINE StartRoutine, - PVOID StartContext) - /* - * Initialize a thread - */ -{ - PULONG KernelStack; - - /* - * Setup a stack frame for exit from the task switching routine - */ - - KernelStack = (PULONG)((char*)Thread->KernelStack - (9 * sizeof(DWORD)) - sizeof(FX_SAVE_AREA)); - KernelStack[0] = (ULONG)Thread->InitialStack - sizeof(FX_SAVE_AREA); /* TSS->Esp0 */ - KernelStack[1] = 0; /* EDI */ - KernelStack[2] = 0; /* ESI */ - KernelStack[3] = 0; /* EBX */ - KernelStack[4] = 0; /* EBP */ - KernelStack[5] = (ULONG)&PsBeginThread; /* EIP */ - KernelStack[6] = 0; /* Return EIP */ - KernelStack[7] = (ULONG)StartRoutine; /* First argument to PsBeginThread */ - KernelStack[8] = (ULONG)StartContext; /* Second argument to PsBeginThread */ - Thread->KernelStack = (VOID*)KernelStack; - - /* - * Setup FPU state - */ - Thread->NpxState = NPX_STATE_INVALID; - - return(STATUS_SUCCESS); + + /* Now setup the remaining data for KiThreadStartup */ + StartFrame->StartContext = StartContext; + StartFrame->StartRoutine = StartRoutine; + StartFrame->SystemRoutine = SystemRoutine; + + /* And set up the Context Switch Frame */ + CtxSwitchFrame->RetEip = KiThreadStartup; + CtxSwitchFrame->Esp0 = (ULONG)Thread->InitialStack - sizeof(FX_SAVE_AREA); + CtxSwitchFrame->ExceptionList = (PVOID)0xFFFFFFFF; + + /* Save back the new value of the kernel stack. */ + DPRINT("Final Kernel Stack: %x \n", CtxSwitchFrame); + Thread->KernelStack = (PVOID)CtxSwitchFrame; + return; } /* EOF */ diff --git a/reactos/ntoskrnl/ke/i386/trap.s b/reactos/ntoskrnl/ke/i386/trap.s index 5e24374e060..3a3e6cbb3e4 100644 --- a/reactos/ntoskrnl/ke/i386/trap.s +++ b/reactos/ntoskrnl/ke/i386/trap.s @@ -76,29 +76,6 @@ _KiTrapRet: popl %edi popl %esi popl %ebx - -#ifdef DBG - /* - * Cleanup the stack which was used to setup a trapframe with SS:ESP when called - * from kmode. - */ - movw 0xC(%esp), %bp /* Get CS from trapframe */ - cmpw $KERNEL_CS, %bp - jne 0f - - /* Copy EBP, CS:EIP and EFLAGS from the trapframe back onto the top of our stack. */ - movl 0x00(%esp), %ebp /* EBP */ - movl %ebp, 0x24(%esp) - movl 0x08(%esp), %ebp /* EIP */ - movl %ebp, 0x2C(%esp) - movl 0x0C(%esp), %ebp /* CS */ - movl %ebp, 0x30(%esp) - movl 0x10(%esp), %ebp /* EFLAGS */ - movl %ebp, 0x34(%esp) - - addl $0x24, %esp -0: -#endif /* DBG */ popl %ebp addl $0x4, %esp /* Ignore error code */ @@ -106,27 +83,6 @@ _KiTrapRet: .globl _KiTrapProlog _KiTrapProlog: -#ifdef DBG - /* - * If we were called from kmode we start setting up a new trapframe (with SS:ESP at the end) - */ - movw 0x14(%esp), %bx /* Get old CS */ - cmpw $KERNEL_CS, %bx - - jne 0f - - leal 0x1C(%esp), %ebp - pushl %ss /* Old SS */ - pushl %ebp /* Old ESP */ - pushl 0x20(%esp) /* Old EFLAGS */ - pushl 0x20(%esp) /* Old CS */ - pushl 0x20(%esp) /* Old EIP */ - pushl 0x20(%esp) /* ErrorCode */ - pushl 0x20(%esp) /* Ebp */ - pushl 0x20(%esp) /* Ebx */ - pushl 0x20(%esp) /* Esi */ -0: -#endif /* DBG */ pushl %edi pushl %fs @@ -191,8 +147,9 @@ _KiTrapProlog: pushl %eax /* Dr1 */ movl %dr0, %eax pushl %eax /* Dr0 */ - pushl $0 /* XXX: TempESP */ - pushl $0 /* XXX: TempCS */ + leal 0x64(%esp), %eax + pushl %eax /* XXX: TempESP */ + pushl %ss /* XXX: TempSS */ pushl $0 /* XXX: DebugPointer */ pushl $0 /* XXX: DebugArgMark */ movl 0x60(%esp), %ebx diff --git a/reactos/ntoskrnl/ke/i386/tskswitch.S b/reactos/ntoskrnl/ke/i386/tskswitch.S deleted file mode 100644 index 4084b18e163..00000000000 --- a/reactos/ntoskrnl/ke/i386/tskswitch.S +++ /dev/null @@ -1,344 +0,0 @@ -/* - * ReactOS kernel - * Copyright (C) 2000 David Welch - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* - * FILE: ntoskrnl/ke/i386/tskswitch.S - * PURPOSE: Microkernel thread support - * PROGRAMMER: David Welch (welch@cwcom.net) - * UPDATE HISTORY: - * Created 09/10/00 - */ - -/* INCLUDES ******************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -/* FUNCTIONS ****************************************************************/ - -.globl _Ki386ContextSwitch -.func Ki386ContextSwitch -_Ki386ContextSwitch: -/* - * FUNCTIONS: Switches to another thread's context - * ARGUMENTS: - * Thread = Thread to switch to - * OldThread = Thread to switch from - */ -#ifdef KDBG - jmp SaveTrapFrameForKDB -SaveTrapFrameForKDB_Return: -#endif - pushl %ebp - movl %esp, %ebp - - /* - * Save callee save registers. - */ - pushl %ebx - pushl %esi - pushl %edi - - /* - * This is a critical section for this processor. - */ - cli - -#ifdef CONFIG_SMP - /* - * Get the pointer to the old thread. - */ - movl 12(%ebp), %ebx - /* - * Save FPU state if the thread has used it. - */ - movl $0, %fs:KPCR_NPX_THREAD - testb $NPX_STATE_DIRTY, KTHREAD_NPX_STATE(%ebx) - jz 3f - movl KTHREAD_INITIAL_STACK(%ebx), %eax - cmpl $0, _FxsrSupport - je 1f - fxsave -SIZEOF_FX_SAVE_AREA(%eax) - jmp 2f -1: - fnsave -SIZEOF_FX_SAVE_AREA(%eax) -2: - movb $NPX_STATE_VALID, KTHREAD_NPX_STATE(%ebx) -3: -#endif /* CONFIG_SMP */ - - - /* - * Get the pointer to the new thread. - */ - movl 8(%ebp), %ebx - - /* - * Set the base of the TEB selector to the base of the TEB for - * this thread. - */ - pushl %ebx - pushl KTHREAD_TEB(%ebx) - pushl $TEB_SELECTOR - call _KeSetBaseGdtSelector - addl $8, %esp - popl %ebx - - /* - * Load the PCR selector. - */ - movl $PCR_SELECTOR, %eax - movl %eax, %fs - - /* - * Set the current thread information in the PCR. - */ - movl %ebx, %fs:KPCR_CURRENT_THREAD - - /* - * Set the current LDT - */ - xorl %eax, %eax - movl KTHREAD_APCSTATE_PROCESS(%ebx), %edi - testw $0xFFFF, KPROCESS_LDT_DESCRIPTOR0(%edi) - jz 0f - - pushl KPROCESS_LDT_DESCRIPTOR1(%edi) - pushl KPROCESS_LDT_DESCRIPTOR0(%edi) - pushl $LDT_SELECTOR - call _KeSetGdtSelector - addl $12, %esp - - movl $LDT_SELECTOR, %eax - -0: - lldtw %ax - - /* - * Get the pointer to the old thread. - */ - movl 12(%ebp), %ebx - - /* - * FIXME: Save debugging state. - */ - - /* - * Load up the iomap offset for this thread in - * preparation for setting it below. - */ - movl KPROCESS_IOPM_OFFSET(%edi), %eax - - /* - * Save the stack pointer in this processors TSS - */ - movl %fs:KPCR_TSS, %esi - pushl KTSS_ESP0(%esi) - - /* - * Switch stacks - */ - movl %esp, KTHREAD_KERNEL_STACK(%ebx) - movl 8(%ebp), %ebx - movl KTHREAD_KERNEL_STACK(%ebx), %esp - movl KTHREAD_STACK_LIMIT(%ebx), %edi - - movl %fs:KPCR_TSS, %esi - - /* - * Set current IOPM offset in the TSS - */ - movw %ax, KTSS_IOMAPBASE(%esi) - - /* - * Change the address space - */ - movl KTHREAD_APCSTATE_PROCESS(%ebx), %eax - movl KPROCESS_DIRECTORY_TABLE_BASE(%eax), %eax - movl %eax, %cr3 - - /* - * Restore the stack pointer in this processors TSS - */ - popl KTSS_ESP0(%esi) - - /* - * Set TS in cr0 to catch FPU code and load the FPU state when needed - * For uni-processor we do this only if NewThread != KPCR->NpxThread - */ -#ifndef CONFIG_SMP - cmpl %ebx, %fs:KPCR_NPX_THREAD - je 4f -#endif /* !CONFIG_SMP */ - movl %cr0, %eax - orl $X86_CR0_TS, %eax - movl %eax, %cr0 -4: - - /* - * FIXME: Restore debugging state - */ - - /* - * Exit the critical section - */ - sti - - call @KeReleaseDispatcherDatabaseLockFromDpcLevel@0 - - /* - * Restore the saved register and exit - */ - popl %edi - popl %esi - popl %ebx - - popl %ebp - ret -.endfunc - - - -#ifdef KDBG - -SaveTrapFrameForKDB: - /* - * Set up a trap frame. - */ - /* Ss - space already reserved by return EIP */ - pushl %esp /* Esp */ - pushfl /* Eflags */ - pushl %cs /* Cs */ - pushl 12(%esp) /* Eip */ - movl %ss, 16(%esp) /* Save Ss */ - pushl $0 /* ErrorCode */ - pushl %ebp /* Ebp */ - pushl %ebx /* Ebx */ - pushl %esi /* Esi */ - pushl %edi /* Edi */ - pushl %fs /* Fs */ - pushl $0 /* ExceptionList */ - pushl $0 /* PreviousMode */ - pushl %eax /* Eax */ - pushl %ecx /* Ecx */ - pushl %edx /* Edx */ - pushl %ds /* Ds */ - pushl %es /* Es */ - pushl %gs /* Gs */ - movl %dr7, %eax - pushl %eax /* Dr7 */ - /* Clear breakpoint enables in dr7. */ - andl $~0xffff, %eax - movl %eax, %dr7 - movl %dr6, %eax - pushl %eax /* Dr6 */ - movl %dr3, %eax - pushl %eax /* Dr3 */ - movl %dr2, %eax - pushl %eax /* Dr2 */ - movl %dr1, %eax - pushl %eax /* Dr1 */ - movl %dr0, %eax - pushl %eax /* Dr0 */ - pushl $0 /* TempEip */ - pushl $0 /* TempCs */ - pushl $0 /* DebugPointer */ - pushl $0xffffffff /* DebugArgMark (Exception number) */ - pushl 0x60(%esp) /* DebugEip */ - pushl %ebp /* DebugEbp */ - - movl %esp, %ebp /* Save pointer to new TrapFrame */ - - /* Save the old trapframe and set pointer to the new one */ - movl 0x80(%esp), %ebx /* Get pointer to OldThread */ - pushl KTHREAD_TRAP_FRAME(%ebx) - movl %ebp, KTHREAD_TRAP_FRAME(%ebx) - - /* Copy the arguments which were passed to Ki386ContextSwitch */ - pushl 0x80(%ebp) /* OldThread */ - pushl 0x7c(%ebp) /* NewThread */ - pushl $RestoreTrapFrameForKDB /* Return address */ - - /* Restore clobbered registers */ - movl KTRAP_FRAME_EBX(%ebp), %ebx - movl KTRAP_FRAME_EBP(%ebp), %ebp - - /* Return */ - jmp SaveTrapFrameForKDB_Return - - -RestoreTrapFrameForKDB: - addl $8, %esp /* Remove NewThread and OldThread arguments from the stack */ - movl 0x84(%esp), %ebx /* Get pointer to OldThread */ - - /* Restore the old trapframe */ - popl KTHREAD_TRAP_FRAME(%ebx) - - /* - * Pop unused portions of the trap frame: - * DebugEbp - * DebugEip - * DebugArgMark - * DebugPointer - * TempCs - * TempEip - * Dr0-3 - * Dr6-7 - */ - addl $(12*4), %esp - - /* - * Restore registers including any that might have been changed - * inside the debugger. - */ - popl %gs /* Gs */ - popl %es /* Es */ - popl %ds /* Ds */ - popl %edx /* Edx */ - popl %ecx /* Ecx */ - popl %eax /* Eax */ - addl $4, %esp /* PreviousMode */ - addl $4, %esp /* ExceptionList */ - popl %fs /* Fs */ - popl %edi /* Edi */ - popl %esi /* Esi */ - popl %ebx /* Ebx */ - - /* Remove SS:ESP from the stack */ - movl 16(%esp), %ebp - movl %ebp, 24(%esp) - movl 12(%esp), %ebp - movl %ebp, 20(%esp) - movl 8(%esp), %ebp - movl %ebp, 16(%esp) - - popl %ebp /* Ebp */ - addl $12, %esp /* ErrorCode and SS:ESP */ - - /* - * Return to the caller. - */ - iret - -#endif /* KDBG */ - diff --git a/reactos/ntoskrnl/ke/kqueue.c b/reactos/ntoskrnl/ke/kqueue.c index ebd1b743006..441d238a1db 100644 --- a/reactos/ntoskrnl/ke/kqueue.c +++ b/reactos/ntoskrnl/ke/kqueue.c @@ -242,6 +242,18 @@ KeRemoveByKeyDeviceQueue (IN PKDEVICE_QUEUE DeviceQueue, return ReturnEntry; } +/* + * @unimplemented + */ +STDCALL +PKDEVICE_QUEUE_ENTRY +KeRemoveByKeyDeviceQueueIfBusy(IN PKDEVICE_QUEUE DeviceQueue, + IN ULONG SortKey) +{ + UNIMPLEMENTED; + return 0; +} + /* * @implemented */ diff --git a/reactos/ntoskrnl/ke/kthread.c b/reactos/ntoskrnl/ke/kthread.c index dbfd3b50062..41a40c622eb 100644 --- a/reactos/ntoskrnl/ke/kthread.c +++ b/reactos/ntoskrnl/ke/kthread.c @@ -45,7 +45,7 @@ VOID KiInsertIntoThreadList(KPRIORITY Priority, PKTHREAD Thread) { - ASSERT(THREAD_STATE_READY == Thread->State); + ASSERT(Ready == Thread->State); ASSERT(Thread->Priority == Priority); if (Priority >= MAXIMUM_PRIORITY || Priority < LOW_PRIORITY) { @@ -54,7 +54,7 @@ KiInsertIntoThreadList(KPRIORITY Priority, KEBUGCHECK(0); } - InsertTailList(&PriorityListHead[Priority], &Thread->QueueListEntry); + InsertTailList(&PriorityListHead[Priority], &Thread->WaitListEntry); PriorityListMask |= (1 << Priority); } @@ -62,8 +62,8 @@ STATIC VOID KiRemoveFromThreadList(PKTHREAD Thread) { - ASSERT(THREAD_STATE_READY == Thread->State); - RemoveEntryList(&Thread->QueueListEntry); + ASSERT(Ready == Thread->State); + RemoveEntryList(&Thread->WaitListEntry); if (IsListEmpty(&PriorityListHead[(ULONG)Thread->Priority])) { PriorityListMask &= ~(1 << Thread->Priority); @@ -87,14 +87,14 @@ KiScanThreadList(KPRIORITY Priority, while (current_entry != &PriorityListHead[Priority]) { - current = CONTAINING_RECORD(current_entry, KTHREAD, QueueListEntry); + current = CONTAINING_RECORD(current_entry, KTHREAD, WaitListEntry); - if (current->State != THREAD_STATE_READY) { + if (current->State != Ready) { DPRINT1("%d/%d\n", ¤t, current->State); } - ASSERT(current->State == THREAD_STATE_READY); + ASSERT(current->State == Ready); if (current->Affinity & Affinity) { @@ -123,7 +123,7 @@ KiDispatchThreadNoLock(ULONG NewThreadStatus) CurrentThread->State = (UCHAR)NewThreadStatus; - if (NewThreadStatus == THREAD_STATE_READY) { + if (NewThreadStatus == Ready) { KiInsertIntoThreadList(CurrentThread->Priority, CurrentThread); @@ -137,7 +137,7 @@ KiDispatchThreadNoLock(ULONG NewThreadStatus) if (Candidate == CurrentThread) { - Candidate->State = THREAD_STATE_RUNNING; + Candidate->State = Running; KeReleaseDispatcherDatabaseLockFromDpcLevel(); return; } @@ -149,7 +149,7 @@ KiDispatchThreadNoLock(ULONG NewThreadStatus) DPRINT("Scheduling %x(%d)\n",Candidate, CurrentPriority); - Candidate->State = THREAD_STATE_RUNNING; + Candidate->State = Running; OldThread = CurrentThread; CurrentThread = Candidate; @@ -167,7 +167,9 @@ KiDispatchThreadNoLock(ULONG NewThreadStatus) MmUpdatePageDir(PsGetCurrentProcess(),((PETHREAD)CurrentThread)->ThreadsProcess, sizeof(EPROCESS)); /* Special note for Filip: This will release the Dispatcher DB Lock ;-) -- Alex */ - KiArchContextSwitch(CurrentThread, OldThread); + DPRINT("You are : %x, swapping to: %x\n", OldThread, CurrentThread); + KiArchContextSwitch(CurrentThread); + DPRINT("You are : %x, swapped from: %x\n", OldThread, CurrentThread); return; } } @@ -192,26 +194,27 @@ KiBlockThread(PNTSTATUS Status, /* Remove Waits */ WaitBlock = Thread->WaitBlockList; - while (WaitBlock) { + do { RemoveEntryList (&WaitBlock->WaitListEntry); WaitBlock = WaitBlock->NextWaitBlock; - } + } while (WaitBlock != Thread->WaitBlockList); Thread->WaitBlockList = NULL; /* Dispatch it and return status */ - KiDispatchThreadNoLock (THREAD_STATE_READY); + KiDispatchThreadNoLock (Ready); if (Status != NULL) *Status = STATUS_KERNEL_APC; } else { /* Set the Thread Data as Requested */ - DPRINT("Dispatching Thread as blocked\n"); + DPRINT("Dispatching Thread as blocked: %d\n", Thread->WaitStatus); Thread->Alertable = Alertable; Thread->WaitMode = (UCHAR)WaitMode; Thread->WaitReason = WaitReason; /* Dispatch it and return status */ - KiDispatchThreadNoLock(THREAD_STATE_BLOCKED); + KiDispatchThreadNoLock(Waiting); + DPRINT("Dispatching Thread as blocked: %d\n", Thread->WaitStatus); if (Status != NULL) *Status = Thread->WaitStatus; } @@ -240,17 +243,16 @@ KiUnblockThread(PKTHREAD Thread, PNTSTATUS WaitStatus, KPRIORITY Increment) { - if (THREAD_STATE_TERMINATED_1 == Thread->State || - THREAD_STATE_TERMINATED_2 == Thread->State) { + if (Terminated == Thread->State) { DPRINT("Can't unblock thread 0x%x because it's terminating\n", Thread); - } else if (THREAD_STATE_READY == Thread->State || - THREAD_STATE_RUNNING == Thread->State) { + } else if (Ready == Thread->State || + Running == Thread->State) { DPRINT("Can't unblock thread 0x%x because it's %s\n", - Thread, (Thread->State == THREAD_STATE_READY ? "ready" : "running")); + Thread, (Thread->State == Ready ? "ready" : "running")); } else { @@ -278,7 +280,7 @@ KiUnblockThread(PKTHREAD Thread, Thread->WaitStatus = *WaitStatus; } - Thread->State = THREAD_STATE_READY; + Thread->State = Ready; KiInsertIntoThreadList(Thread->Priority, Thread); Processor = KeGetCurrentProcessorNumber(); Affinity = Thread->Affinity; @@ -341,6 +343,46 @@ KiSuspendThreadNormalRoutine(PVOID NormalContext, DPRINT("Done Waiting\n"); } +#ifdef KeGetCurrentThread +#undef KeGetCurrentThread +#endif +/* + * @implemented + */ +PKTHREAD +STDCALL +KeGetCurrentThread(VOID) +{ +#ifdef CONFIG_SMP + ULONG Flags; + PKTHREAD Thread; + Ke386SaveFlags(Flags); + Ke386DisableInterrupts(); + Thread = KeGetCurrentPrcb()->CurrentThread; + Ke386RestoreFlags(Flags); + return Thread; +#else + return(KeGetCurrentPrcb()->CurrentThread); +#endif +} + +VOID +STDCALL +KeSetPreviousMode(ULONG Mode) +{ + PsGetCurrentThread()->Tcb.PreviousMode = (UCHAR)Mode; +} + +/* + * @implemented + */ +KPROCESSOR_MODE +STDCALL +KeGetPreviousMode(VOID) +{ + return (ULONG)PsGetCurrentThread()->Tcb.PreviousMode; +} + VOID STDCALL KeRundownThread(VOID) @@ -421,7 +463,51 @@ BOOLEAN STDCALL KiInsertQueueApc(PKAPC Apc, KPRIORITY PriorityBoost); - + +/* + * Used by the debugging code to freeze all the process's threads + * while the debugger is examining their state. + */ +VOID +STDCALL +KeFreezeAllThreads(PKPROCESS Process) +{ + KIRQL OldIrql; + PLIST_ENTRY CurrentEntry; + PKTHREAD Current; + PKTHREAD CurrentThread = KeGetCurrentThread(); + + /* Acquire Lock */ + OldIrql = KeAcquireDispatcherDatabaseLock(); + + /* Loop the Process's Threads */ + CurrentEntry = Process->ThreadListHead.Flink; + while (CurrentEntry != &Process->ThreadListHead) + { + /* Get the Thread */ + Current = CONTAINING_RECORD(CurrentEntry, KTHREAD, ThreadListEntry); + + /* Make sure it's not ours */ + if (Current == CurrentThread) continue; + + /* Make sure it wasn't already frozen, and that it's not suspended */ + if (!(++Current->FreezeCount) && !(Current->SuspendCount)) + { + /* Insert the APC */ + if (!KiInsertQueueApc(&Current->SuspendApc, IO_NO_INCREMENT)) + { + /* Unsignal the Semaphore, the APC already got inserted */ + Current->SuspendSemaphore.Header.SignalState--; + } + } + + CurrentEntry = CurrentEntry->Flink; + } + + /* Release the lock */ + KeReleaseDispatcherDatabaseLock(OldIrql); +} + NTSTATUS STDCALL KeSuspendThread(PKTHREAD Thread) @@ -503,7 +589,7 @@ KeAlertResumeThread(IN PKTHREAD Thread) if (Thread->Alerted[KernelMode] == FALSE) { /* If it's Blocked, unblock if it we should */ - if (Thread->State == THREAD_STATE_BLOCKED && Thread->Alertable) { + if (Thread->State == Waiting && Thread->Alertable) { DPRINT("Aborting Wait\n"); KiAbortWaitThread(Thread, STATUS_ALERTED, THREAD_ALERT_INCREMENT); @@ -554,7 +640,7 @@ KeAlertThread(PKTHREAD Thread, if (PreviousState == FALSE) { /* If it's Blocked, unblock if it we should */ - if (Thread->State == THREAD_STATE_BLOCKED && + if (Thread->State == Waiting && (AlertMode == KernelMode || Thread->WaitMode == AlertMode) && Thread->Alertable) { @@ -598,192 +684,39 @@ VOID STDCALL KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, - BOOLEAN First) -{ - PVOID KernelStack; - NTSTATUS Status; - extern unsigned int init_stack_top; - extern unsigned int init_stack; - PMEMORY_AREA StackArea; - ULONG i; - PHYSICAL_ADDRESS BoundaryAddressMultiple; - - /* Initialize the Boundary Address */ - BoundaryAddressMultiple.QuadPart = 0; - + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context, + PVOID Teb, + PVOID KernelStack) +{ /* Initalize the Dispatcher Header */ + DPRINT("Initializing Dispatcher Header for New Thread: %x in Process: %x\n", Thread, Process); KeInitializeDispatcherHeader(&Thread->DispatcherHeader, ThreadObject, sizeof(KTHREAD), FALSE); + + DPRINT("Thread Header Created. SystemRoutine: %x, StartRoutine: %x with Context: %x\n", + SystemRoutine, StartRoutine, StartContext); + DPRINT("UserMode Information. Context: %x, Teb: %x\n", Context, Teb); + + /* Initialize the Mutant List */ InitializeListHead(&Thread->MutantListHead); - /* If this is isn't the first thread, allocate the Kernel Stack */ - if (!First) { - - PFN_TYPE Page[MM_STACK_SIZE / PAGE_SIZE]; - KernelStack = NULL; - - MmLockAddressSpace(MmGetKernelAddressSpace()); - Status = MmCreateMemoryArea(NULL, - MmGetKernelAddressSpace(), - MEMORY_AREA_KERNEL_STACK, - &KernelStack, - MM_STACK_SIZE, - 0, - &StackArea, - FALSE, - FALSE, - BoundaryAddressMultiple); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - - /* Check for Success */ - if (!NT_SUCCESS(Status)) { - - DPRINT1("Failed to create thread stack\n"); - KEBUGCHECK(0); - } - - /* Mark the Stack */ - for (i = 0; i < (MM_STACK_SIZE / PAGE_SIZE); i++) { - - Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Page[i]); - - /* Check for success */ - if (!NT_SUCCESS(Status)) { - - KEBUGCHECK(0); - } - } - - /* Create a Virtual Mapping for it */ - Status = MmCreateVirtualMapping(NULL, - KernelStack, - PAGE_READWRITE, - Page, - MM_STACK_SIZE / PAGE_SIZE); - - /* Check for success */ - if (!NT_SUCCESS(Status)) { - - KEBUGCHECK(0); - } - - /* Set the Kernel Stack */ - Thread->InitialStack = (PCHAR)KernelStack + MM_STACK_SIZE; - Thread->StackBase = (PCHAR)KernelStack + MM_STACK_SIZE; - Thread->StackLimit = (ULONG_PTR)KernelStack; - Thread->KernelStack = (PCHAR)KernelStack + MM_STACK_SIZE; - - } else { - - /* Use the Initial Stack */ - Thread->InitialStack = (PCHAR)init_stack_top; - Thread->StackBase = (PCHAR)init_stack_top; - Thread->StackLimit = (ULONG_PTR)init_stack; - Thread->KernelStack = (PCHAR)init_stack_top; - } - - /* - * Establish the pde's for the new stack and the thread structure within the - * address space of the new process. They are accessed while taskswitching or - * while handling page faults. At this point it isn't possible to call the - * page fault handler for the missing pde's. - */ - MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread->StackLimit, MM_STACK_SIZE); - MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD)); - - /* Set the Thread to initalized */ - Thread->State = THREAD_STATE_INITIALIZED; + /* Setup the Service Descriptor Table for Native Calls */ + Thread->ServiceTable = KeServiceDescriptorTable; - /* The Native API function will initialize the TEB field later */ - Thread->Teb = NULL; - - /* Initialize stuff to zero */ - Thread->TlsArray = NULL; - Thread->DebugActive = 0; - Thread->Alerted[0] = 0; - Thread->Alerted[1] = 0; - Thread->Iopl = 0; - - /* Set up FPU/NPX Stuff */ - Thread->NpxState = NPX_STATE_INVALID; - Thread->NpxIrql = 0; - /* Setup APC Fields */ InitializeListHead(&Thread->ApcState.ApcListHead[0]); InitializeListHead(&Thread->ApcState.ApcListHead[1]); Thread->ApcState.Process = Process; - Thread->ApcState.KernelApcInProgress = 0; - Thread->ApcState.KernelApcPending = 0; - Thread->ApcState.UserApcPending = 0; Thread->ApcStatePointer[OriginalApcEnvironment] = &Thread->ApcState; Thread->ApcStatePointer[AttachedApcEnvironment] = &Thread->SavedApcState; Thread->ApcStateIndex = OriginalApcEnvironment; - Thread->ApcQueueable = TRUE; - RtlZeroMemory(&Thread->SavedApcState, sizeof(KAPC_STATE)); KeInitializeSpinLock(&Thread->ApcQueueLock); - /* Setup Wait Fields */ - Thread->WaitStatus = STATUS_SUCCESS; - Thread->WaitIrql = PASSIVE_LEVEL; - Thread->WaitMode = 0; - Thread->WaitNext = FALSE; - Thread->WaitListEntry.Flink = NULL; - Thread->WaitListEntry.Blink = NULL; - Thread->WaitTime = 0; - Thread->WaitBlockList = NULL; - RtlZeroMemory(Thread->WaitBlock, sizeof(KWAIT_BLOCK) * 4); - RtlZeroMemory(&Thread->Timer, sizeof(KTIMER)); - KeInitializeTimer(&Thread->Timer); - - /* Setup scheduler Fields */ - Thread->BasePriority = Process->BasePriority; - Thread->DecrementCount = 0; - Thread->PriorityDecrement = 0; - Thread->Quantum = Process->ThreadQuantum; - Thread->Saturation = 0; - Thread->Priority = Process->BasePriority; - Thread->UserAffinity = Process->Affinity; - Thread->SystemAffinityActive = 0; - Thread->Affinity = Process->Affinity; - Thread->Preempted = 0; - Thread->ProcessReadyQueue = 0; - Thread->KernelStackResident = 1; - Thread->NextProcessor = 0; - Thread->ContextSwitches = 0; - - /* Setup Queue Fields */ - Thread->Queue = NULL; - Thread->QueueListEntry.Flink = NULL; - Thread->QueueListEntry.Blink = NULL; - - /* Setup Misc Fields */ - Thread->LegoData = 0; - Thread->PowerState = 0; - Thread->ServiceTable = KeServiceDescriptorTable; - Thread->CallbackStack = NULL; - Thread->Win32Thread = NULL; - Thread->TrapFrame = NULL; - Thread->EnableStackSwap = 0; - Thread->LargeStack = 0; - Thread->ResourceIndex = 0; - Thread->PreviousMode = KernelMode; - Thread->KernelTime = 0; - Thread->UserTime = 0; - Thread->AutoAlignment = Process->AutoAlignment; - - /* FIXME OPTIMIZATION OF DOOM. DO NOT ENABLE FIXME */ -#if 0 - Thread->WaitBlock[3].Object = (PVOID)&Thread->Timer; - Thread->WaitBlock[3].Thread = Thread; - Thread->WaitBlock[3].WaitKey = STATUS_TIMEOUT; - Thread->WaitBlock[3].WaitType = WaitAny; - Thread->WaitBlock[3].NextWaitBlock = NULL; - InsertTailList(&Thread->Timer.Header.WaitListHead, - &Thread->WaitBlock[3].WaitListEntry); -#endif - /* Initialize the Suspend APC */ KeInitializeApc(&Thread->SuspendApc, Thread, @@ -795,19 +728,70 @@ KeInitializeThread(PKPROCESS Process, NULL); /* Initialize the Suspend Semaphore */ - KeInitializeSemaphore(&Thread->SuspendSemaphore, 0, 128); + KeInitializeSemaphore(&Thread->SuspendSemaphore, 0, 128); - /* Insert the Thread into the Process's Thread List */ + /* FIXME OPTIMIZATION OF DOOM. DO NOT ENABLE FIXME */ +#if 0 + Thread->WaitBlock[3].Object = (PVOID)&Thread->Timer; + Thread->WaitBlock[3].Thread = Thread; + Thread->WaitBlock[3].WaitKey = STATUS_TIMEOUT; + Thread->WaitBlock[3].WaitType = WaitAny; + Thread->WaitBlock[3].NextWaitBlock = NULL; + InsertTailList(&Thread->Timer.Header.WaitListHead, + &Thread->WaitBlock[3].WaitListEntry); +#endif + KeInitializeTimer(&Thread->Timer); + + /* Set the TEB */ + Thread->Teb = Teb; + + /* Set the Thread Stacks */ + Thread->InitialStack = (PCHAR)KernelStack + MM_STACK_SIZE; + Thread->StackBase = (PCHAR)KernelStack + MM_STACK_SIZE; + Thread->StackLimit = (ULONG_PTR)KernelStack; + Thread->KernelStackResident = TRUE; + + /* + * Establish the pde's for the new stack and the thread structure within the + * address space of the new process. They are accessed while taskswitching or + * while handling page faults. At this point it isn't possible to call the + * page fault handler for the missing pde's. + */ + MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread->StackLimit, MM_STACK_SIZE); + MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD)); + + /* Initalize the Thread Context */ + DPRINT("Initializing the Context for the thread: %x\n", Thread); + KiArchInitThreadWithContext(Thread, + SystemRoutine, + StartRoutine, + StartContext, + Context); + + /* Setup scheduler Fields based on Parent */ + DPRINT("Thread context created, setting Scheduler Data\n"); + Thread->BasePriority = Process->BasePriority; + Thread->Quantum = Process->ThreadQuantum; + Thread->Affinity = Process->Affinity; + Thread->Priority = Process->BasePriority; + Thread->UserAffinity = Process->Affinity; + Thread->DisableBoost = Process->DisableBoost; + Thread->AutoAlignment = Process->AutoAlignment; + Thread->Iopl = Process->Iopl; + + /* Set the Thread to initalized */ + Thread->State = Initialized; + + /* + * Insert the Thread into the Process's Thread List + * Note, this is the KTHREAD Thread List. It is removed in + * ke/kthread.c!KeTerminateThread. + */ InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry); - - /* Set up the Suspend Counts */ - Thread->FreezeCount = 0; - Thread->SuspendCount = 0; - ((PETHREAD)Thread)->ReaperLink = NULL; /* Union. Will also clear termination port */ - - /* Do x86 specific part */ + DPRINT("Thread initalized\n"); } + /* * @implemented */ @@ -833,47 +817,6 @@ KeQueryRuntimeThread(IN PKTHREAD Thread, return Thread->KernelTime; } -VOID -KeFreeStackPage(PVOID Context, - MEMORY_AREA* MemoryArea, - PVOID Address, - PFN_TYPE Page, - SWAPENTRY SwapEntry, - BOOLEAN Dirty) -{ - ASSERT(SwapEntry == 0); - if (Page) MmReleasePageMemoryConsumer(MC_NPPOOL, Page); -} - -NTSTATUS -KeReleaseThread(PKTHREAD Thread) -/* - * FUNCTION: Releases the resource allocated for a thread by - * KeInitializeThread - * NOTE: The thread had better not be running when this is called - */ -{ - extern unsigned int init_stack; - - /* FIXME - lock the process */ - RemoveEntryList(&Thread->ThreadListEntry); - - if (Thread->StackLimit != (ULONG_PTR)init_stack) - { - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), - (PVOID)Thread->StackLimit, - KeFreeStackPage, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - } - Thread->StackLimit = 0; - Thread->InitialStack = NULL; - Thread->StackBase = NULL; - Thread->KernelStack = NULL; - return(STATUS_SUCCESS); -} - /* * @implemented */ @@ -932,7 +875,7 @@ KeRevertToUserAffinityThread(VOID) /* We need to dispatch a new thread */ CurrentThread->WaitIrql = OldIrql; - KiDispatchThreadNoLock(THREAD_STATE_READY); + KiDispatchThreadNoLock(Ready); KeLowerIrql(OldIrql); } } @@ -995,7 +938,7 @@ KeSetSystemAffinityThread(IN KAFFINITY Affinity) /* We need to dispatch a new thread */ CurrentThread->WaitIrql = OldIrql; - KiDispatchThreadNoLock(THREAD_STATE_READY); + KiDispatchThreadNoLock(Ready); KeLowerIrql(OldIrql); } } @@ -1061,7 +1004,7 @@ KeSetPriorityThread(PKTHREAD Thread, CurrentThread = KeGetCurrentThread(); - if (Thread->State == THREAD_STATE_READY) { + if (Thread->State == Ready) { KiRemoveFromThreadList(Thread); Thread->BasePriority = Thread->Priority = (CHAR)Priority; @@ -1069,12 +1012,12 @@ KeSetPriorityThread(PKTHREAD Thread, if (CurrentThread->Priority < Priority) { - KiDispatchThreadNoLock(THREAD_STATE_READY); + KiDispatchThreadNoLock(Ready); KeLowerIrql(OldIrql); return (OldPriority); } - } else if (Thread->State == THREAD_STATE_RUNNING) { + } else if (Thread->State == Running) { Thread->BasePriority = Thread->Priority = (CHAR)Priority; @@ -1086,7 +1029,7 @@ KeSetPriorityThread(PKTHREAD Thread, if (Thread == CurrentThread) { - KiDispatchThreadNoLock(THREAD_STATE_READY); + KiDispatchThreadNoLock(Ready); KeLowerIrql(OldIrql); return (OldPriority); @@ -1144,14 +1087,14 @@ KeSetAffinityThread(PKTHREAD Thread, Thread->Affinity = Affinity; - if (Thread->State == THREAD_STATE_RUNNING) { + if (Thread->State == Running) { ProcessorMask = 1 << KeGetCurrentKPCR()->ProcessorNumber; if (Thread == KeGetCurrentThread()) { if (!(Affinity & ProcessorMask)) { - KiDispatchThreadNoLock(THREAD_STATE_READY); + KiDispatchThreadNoLock(Ready); KeLowerIrql(OldIrql); return STATUS_SUCCESS; } @@ -1198,6 +1141,9 @@ KeTerminateThread(IN KPRIORITY Increment) /* Lock the Dispatcher Database and the APC Queue */ DPRINT("Terminating\n"); OldIrql = KeAcquireDispatcherDatabaseLock(); + + /* Remove the thread from the list */ + RemoveEntryList(&Thread->ThreadListEntry); /* Insert into the Reaper List */ DPRINT("List: %p\n", PspReaperList); @@ -1233,7 +1179,7 @@ KeTerminateThread(IN KPRIORITY Increment) } /* Find a new Thread */ - KiDispatchThreadNoLock(THREAD_STATE_TERMINATED_1); + KiDispatchThreadNoLock(Terminated); } /* diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index 0efcd836158..1a88704240d 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -19,7 +19,7 @@ #define BUILD_OSCSDVERSION(major, minor) (((major & 0xFF) << 8) | (minor & 0xFF)) -ULONG NtMajorVersion = 4; +ULONG NtMajorVersion = 5; ULONG NtMinorVersion = 0; ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(6, 0); #ifdef __GNUC__ @@ -53,7 +53,6 @@ ULONG KeMemoryMapRangeCount; ULONG_PTR FirstKrnlPhysAddr; ULONG_PTR LastKrnlPhysAddr; ULONG_PTR LastKernelAddress; -volatile BOOLEAN Initialized = FALSE; ULONG KeLargestCacheLine = 0x40; /* FIXME: Arch-specific */ @@ -104,12 +103,22 @@ KiSystemStartup(BOOLEAN BootProcessor) MiFreeInitMemory(); /* Never returns */ - PspExitThread(STATUS_SUCCESS); - +#if 0 + /* FIXME: + * The initial thread isn't a real ETHREAD object, we cannot call PspExitThread. + */ + PspExitThread(STATUS_SUCCESS); +#else + while (1) { + LARGE_INTEGER Timeout; + Timeout.QuadPart = 0x7fffffffffffffffLL; + KeDelayExecutionThread(KernelMode, FALSE, &Timeout); + } +#endif } else { /* Do application processor initialization */ - PsApplicationProcessorInit(); + KeApplicationProcessorInitDispatcher(); /* Lower IRQL and go to Idle Thread */ KeLowerIrql(PASSIVE_LEVEL); diff --git a/reactos/ntoskrnl/ke/process.c b/reactos/ntoskrnl/ke/process.c index 49b1aca222d..23f1d72db28 100644 --- a/reactos/ntoskrnl/ke/process.c +++ b/reactos/ntoskrnl/ke/process.c @@ -53,6 +53,45 @@ UpdatePageDirs(PKTHREAD Thread, PKPROCESS Process) MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD)); } +/* + * FUNCTION: Returns a pointer to the current process + */ +PKPROCESS +STDCALL +KeGetCurrentProcess(VOID) +{ + return(&(PsGetCurrentProcess()->Pcb)); +} + +VOID +STDCALL +KeInitializeProcess(PKPROCESS Process, + KPRIORITY Priority, + KAFFINITY Affinity, + LARGE_INTEGER DirectoryTableBase) +{ + DPRINT("KeInitializeProcess. Process: %x, DirectoryTableBase: %x\n", Process, DirectoryTableBase); + + /* Initialize the Dispatcher Header */ + KeInitializeDispatcherHeader(&Process->DispatcherHeader, + ProcessObject, + sizeof(KPROCESS), + FALSE); + + /* Initialize Scheduler Data, Disable Alignment Faults and Set the PDE */ + Process->Affinity = Affinity; + Process->BasePriority = Priority; + Process->ThreadQuantum = 6; + Process->DirectoryTableBase = DirectoryTableBase; + Process->AutoAlignment = TRUE; + Process->IopmOffset = 0xFFFF; + Process->State = PROCESS_STATE_ACTIVE; + + /* Initialize the Thread List */ + InitializeListHead(&Process->ThreadListHead); + DPRINT("The Process has now been initalized with the Kernel\n"); +} + ULONG STDCALL KeSetProcess(PKPROCESS Process, @@ -148,6 +187,7 @@ KiAttachProcess(PKTHREAD Thread, PKPROCESS Process, KIRQL ApcLock, PRKAPC_STATE } /* Swap the Processes */ + DPRINT("Swapping\n"); KiSwapProcess(Process, SavedApcState->Process); /* Return to old IRQL*/ diff --git a/reactos/ntoskrnl/ke/queue.c b/reactos/ntoskrnl/ke/queue.c index 5f2983d71b5..fc663b734f1 100644 --- a/reactos/ntoskrnl/ke/queue.c +++ b/reactos/ntoskrnl/ke/queue.c @@ -239,7 +239,7 @@ KeRemoveQueue(IN PKQUEUE Queue, WaitBlock->WaitKey = STATUS_SUCCESS; WaitBlock->WaitType = WaitAny; WaitBlock->Thread = Thread; - WaitBlock->NextWaitBlock = NULL; + WaitBlock->NextWaitBlock = WaitBlock; Thread->WaitStatus = STATUS_SUCCESS; @@ -270,7 +270,7 @@ KeRemoveQueue(IN PKQUEUE Queue, TimerWaitBlock->Thread = Thread; TimerWaitBlock->WaitKey = STATUS_TIMEOUT; TimerWaitBlock->WaitType = WaitAny; - TimerWaitBlock->NextWaitBlock = NULL; + TimerWaitBlock->NextWaitBlock = TimerWaitBlock; /* Link the timer to this Wait Block */ InitializeListHead(&Timer->Header.WaitListHead); diff --git a/reactos/ntoskrnl/ke/wait.c b/reactos/ntoskrnl/ke/wait.c index a4b51d47cde..4c74388c471 100644 --- a/reactos/ntoskrnl/ke/wait.c +++ b/reactos/ntoskrnl/ke/wait.c @@ -117,7 +117,7 @@ KeDelayExecutionThread(KPROCESSOR_MODE WaitMode, TimerWaitBlock->Thread = CurrentThread; TimerWaitBlock->WaitKey = (USHORT)STATUS_TIMEOUT; TimerWaitBlock->WaitType = WaitAny; - TimerWaitBlock->NextWaitBlock = NULL; + TimerWaitBlock->NextWaitBlock = TimerWaitBlock; /* Link the timer to this Wait Block */ InitializeListHead(&ThreadTimer->Header.WaitListHead); @@ -269,7 +269,7 @@ KeWaitForSingleObject(PVOID Object, WaitBlock->Thread = CurrentThread; WaitBlock->WaitKey = (USHORT)(STATUS_WAIT_0); WaitBlock->WaitType = WaitAny; - WaitBlock->NextWaitBlock = NULL; + WaitBlock->NextWaitBlock = WaitBlock; /* Make sure we can satisfy the Alertable request */ KiCheckAlertability(Alertable, CurrentThread, WaitMode, &Status); @@ -300,7 +300,7 @@ KeWaitForSingleObject(PVOID Object, TimerWaitBlock->Thread = CurrentThread; TimerWaitBlock->WaitKey = STATUS_TIMEOUT; TimerWaitBlock->WaitType = WaitAny; - TimerWaitBlock->NextWaitBlock = NULL; + TimerWaitBlock->NextWaitBlock = WaitBlock; /* Link the timer to this Wait Block */ InitializeListHead(&ThreadTimer->Header.WaitListHead); @@ -400,7 +400,6 @@ KeWaitForMultipleObjects(ULONG Count, /* Check in regards to the Thread Object Limit */ if (Count > THREAD_WAIT_OBJECTS) { - DPRINT1("(%s:%d) Too many objects!\n", __FILE__, __LINE__); KEBUGCHECK(MAXIMUM_WAIT_OBJECTS_EXCEEDED); } @@ -412,7 +411,6 @@ KeWaitForMultipleObjects(ULONG Count, /* Using our own Block Array. Check in regards to System Object Limit */ if (Count > MAXIMUM_WAIT_OBJECTS) { - DPRINT1("(%s:%d) Too many objects!\n", __FILE__, __LINE__); KEBUGCHECK(MAXIMUM_WAIT_OBJECTS_EXCEEDED); } } @@ -447,7 +445,6 @@ KeWaitForMultipleObjects(ULONG Count, */ if (CurrentObject->Type == IO_TYPE_FILE) { - DPRINT1("Hack used: %x\n", &((PFILE_OBJECT)CurrentObject)->Event); CurrentObject = (PDISPATCHER_HEADER)(&((PFILE_OBJECT)CurrentObject)->Event); } @@ -496,7 +493,7 @@ KeWaitForMultipleObjects(ULONG Count, /* Return to the Root Wait Block */ WaitBlock--; - WaitBlock->NextWaitBlock = NULL; + WaitBlock->NextWaitBlock = WaitBlockArray; /* Check if this is a Wait All and all the objects are signaled */ if ((WaitType == WaitAll) && (AllObjectsSignaled)) { @@ -539,7 +536,7 @@ KeWaitForMultipleObjects(ULONG Count, TimerWaitBlock->Thread = CurrentThread; TimerWaitBlock->WaitKey = STATUS_TIMEOUT; TimerWaitBlock->WaitType = WaitAny; - TimerWaitBlock->NextWaitBlock = NULL; + TimerWaitBlock->NextWaitBlock = WaitBlockArray; /* Link the timer to this Wait Block */ InitializeListHead(&ThreadTimer->Header.WaitListHead); @@ -555,7 +552,7 @@ KeWaitForMultipleObjects(ULONG Count, /* Insert into Object's Wait List*/ WaitBlock = CurrentThread->WaitBlockList; - while (WaitBlock) { + do { /* Get the Current Object */ CurrentObject = WaitBlock->Object; @@ -565,7 +562,7 @@ KeWaitForMultipleObjects(ULONG Count, /* Move to the next Wait Block */ WaitBlock = WaitBlock->NextWaitBlock; - } + } while (WaitBlock != WaitBlockArray); /* Handle Kernel Queues */ if (CurrentThread->Queue) { @@ -573,7 +570,7 @@ KeWaitForMultipleObjects(ULONG Count, DPRINT("Waking Queue\n"); KiWakeQueue(CurrentThread->Queue); } - + /* Block the Thread */ DPRINT("Blocking the Thread: %d, %d, %d, %x\n", Alertable, WaitMode, WaitReason, KeGetCurrentThread()); KiBlockThread(&Status, @@ -656,6 +653,7 @@ KiWaitTest(PDISPATCHER_HEADER Object, PLIST_ENTRY WaitList; PKWAIT_BLOCK CurrentWaitBlock; PKWAIT_BLOCK NextWaitBlock; + PKTHREAD WaitThread; /* Loop the Wait Entries */ DPRINT("KiWaitTest for Object: %x\n", Object); @@ -665,6 +663,7 @@ KiWaitTest(PDISPATCHER_HEADER Object, /* Get the current wait block */ CurrentWaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry); + WaitThread = CurrentWaitBlock->Thread; /* Check the current Wait Mode */ if (CurrentWaitBlock->WaitType == WaitAny) { @@ -672,7 +671,7 @@ KiWaitTest(PDISPATCHER_HEADER Object, /* Easy case, satisfy only this wait */ DPRINT("Satisfiying a Wait any\n"); WaitEntry = WaitEntry->Blink; - KiSatisfyObjectWait(Object, CurrentWaitBlock->Thread); + KiSatisfyObjectWait(Object, WaitThread); } else { @@ -681,13 +680,14 @@ KiWaitTest(PDISPATCHER_HEADER Object, NextWaitBlock = CurrentWaitBlock->NextWaitBlock; /* Loop first to make sure they are valid */ - while (NextWaitBlock) { + while (NextWaitBlock != CurrentWaitBlock) { /* Check if the object is signaled */ - if (!KiIsObjectSignaled(Object, CurrentWaitBlock->Thread)) { + DPRINT("Checking: %x %d\n", NextWaitBlock->Object, Object->SignalState); + if (!KiIsObjectSignaled(NextWaitBlock->Object, WaitThread)) { /* It's not, move to the next one */ - DPRINT1("One of the object is non-signaled, sorry.\n"); + DPRINT("One of the object is non-signaled, sorry.\n"); goto SkipUnwait; } @@ -703,7 +703,7 @@ KiWaitTest(PDISPATCHER_HEADER Object, /* All waits satisfied, unwait the thread */ DPRINT("Unwaiting the Thread\n"); - KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey, Increment); + KiAbortWaitThread(WaitThread, CurrentWaitBlock->WaitKey, Increment); SkipUnwait: /* Next entry */ @@ -724,12 +724,12 @@ KiAbortWaitThread(PKTHREAD Thread, /* If we are blocked, we must be waiting on something also */ DPRINT("KiAbortWaitThread: %x, Status: %x, %x \n", Thread, WaitStatus, Thread->WaitBlockList); - ASSERT((Thread->State == THREAD_STATE_BLOCKED) == (Thread->WaitBlockList != NULL)); + ASSERT((Thread->State == Waiting) == (Thread->WaitBlockList != NULL)); /* Remove the Wait Blocks from the list */ DPRINT("Removing waits\n"); WaitBlock = Thread->WaitBlockList; - while (WaitBlock) { + do { /* Remove it */ DPRINT("Removing Waitblock: %x, %x\n", WaitBlock, WaitBlock->NextWaitBlock); @@ -737,7 +737,7 @@ KiAbortWaitThread(PKTHREAD Thread, /* Go to the next one */ WaitBlock = WaitBlock->NextWaitBlock; - }; + } while (WaitBlock != Thread->WaitBlockList); /* Check if there's a Thread Timer */ if (Thread->Timer.Header.Inserted) { @@ -821,15 +821,16 @@ inline FASTCALL KiSatisifyMultipleObjectWaits(PKWAIT_BLOCK WaitBlock) { + PKWAIT_BLOCK FirstBlock = WaitBlock; PKTHREAD WaitThread = WaitBlock->Thread; /* Loop through all the Wait Blocks, and wake each Object */ - while (WaitBlock) { + do { /* Wake the Object */ KiSatisfyObjectWait(WaitBlock->Object, WaitThread); WaitBlock = WaitBlock->NextWaitBlock; - } + } while (WaitBlock != FirstBlock); } VOID @@ -885,7 +886,7 @@ KeReleaseDispatcherDatabaseLock(KIRQL OldIrql) if (!KeIsExecutingDpc() && OldIrql < DISPATCH_LEVEL && KeGetCurrentThread() != NULL && KeGetCurrentThread() == KeGetCurrentPrcb()->IdleThread) { - KiDispatchThreadNoLock(THREAD_STATE_READY); + KiDispatchThreadNoLock(Ready); KeLowerIrql(OldIrql); } else { diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 61ce65a03ed..cb692bc3bff 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -979,11 +979,8 @@ LdrPEProcessModule( DPRINT("Loading Module %wZ...\n", FileName); - if (KdDebuggerEnabled && (KdDebugState & KD_DEBUG_GDB)) - { - DPRINT("Module %wZ loaded at 0x%.08x.\n", + DPRINT("Module %wZ loaded at 0x%.08x.\n", FileName, CreatedModuleObject->Base); - } return STATUS_SUCCESS; } diff --git a/reactos/ntoskrnl/ldr/sysdll.c b/reactos/ntoskrnl/ldr/sysdll.c index 7e20b6b892b..497754910f9 100644 --- a/reactos/ntoskrnl/ldr/sysdll.c +++ b/reactos/ntoskrnl/ldr/sysdll.c @@ -24,6 +24,9 @@ PVOID SystemDllCallbackDispatcher = NULL; PVOID SystemDllExceptionDispatcher = NULL; PVOID SystemDllRaiseExceptionDispatcher = NULL; +PVOID LdrpSystemDllBase = NULL; +PVOID LdrpSystemDllSection = NULL; + /* FUNCTIONS *****************************************************************/ PVOID LdrpGetSystemDllExceptionDispatcher(VOID) @@ -51,282 +54,223 @@ PVOID LdrpGetSystemDllRaiseExceptionDispatcher(VOID) return(SystemDllRaiseExceptionDispatcher); } -NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle, - PVOID* LdrStartupAddr) -/* - * FUNCTION: LdrpMapSystemDll maps the system dll into the specified process - * address space and returns its startup address. - * PARAMETERS: - * ProcessHandle - * Points to the process to map the system dll into - * - * LdrStartupAddress - * Receives the startup address of the system dll on function - * completion - * - * RETURNS: Status - */ +NTSTATUS +STDCALL +LdrpGetSystemDllEntryPoints(VOID) { - CHAR BlockBuffer [1024]; - DWORD ImageBase; - ULONG ImageSize; - NTSTATUS Status; - OBJECT_ATTRIBUTES FileObjectAttributes; - HANDLE FileHandle; - HANDLE NTDllSectionHandle; - UNICODE_STRING DllPathname = ROS_STRING_INITIALIZER(L"\\SystemRoot\\system32\\ntdll.dll"); - PIMAGE_DOS_HEADER DosHeader; - PIMAGE_NT_HEADERS NTHeaders; - PEPROCESS Process, CurrentProcess; - ANSI_STRING ProcedureName; - ULONG ViewSize; - IO_STATUS_BLOCK Iosb; + ANSI_STRING ProcedureName; + NTSTATUS Status; + + /* Retrieve ntdll's startup address */ + DPRINT("Getting Entrypoint: %p\n", LdrpSystemDllBase); + RtlInitAnsiString(&ProcedureName, "LdrInitializeThunk"); + Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, + &ProcedureName, + 0, + &SystemDllEntryPoint); + + if (!NT_SUCCESS(Status)) { + + DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); + return (Status); + } - /* - * Locate and open NTDLL to determine ImageBase - * and LdrStartup - */ - InitializeObjectAttributes(&FileObjectAttributes, - &DllPathname, - 0, - NULL, - NULL); - DPRINT("Opening NTDLL\n"); - Status = ZwOpenFile(&FileHandle, - FILE_READ_ACCESS, - &FileObjectAttributes, - &Iosb, - FILE_SHARE_READ, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NTDLL open failed (Status %x)\n", Status); - return Status; - } - Status = ZwReadFile(FileHandle, - 0, - 0, - 0, - &Iosb, - BlockBuffer, - sizeof(BlockBuffer), - 0, - 0); - if (!NT_SUCCESS(Status) || Iosb.Information != sizeof(BlockBuffer)) - { - DPRINT1("NTDLL header read failed (Status %x)\n", Status); - ZwClose(FileHandle); - return Status; - } + /* Get User APC Dispatcher */ + DPRINT("Getting Entrypoint\n"); + RtlInitAnsiString(&ProcedureName, "KiUserApcDispatcher"); + Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, + &ProcedureName, + 0, + &SystemDllApcDispatcher); + + if (!NT_SUCCESS(Status)) { + + DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); + return (Status); + } + + /* Get Exception Dispatcher */ + DPRINT("Getting Entrypoint\n"); + RtlInitAnsiString(&ProcedureName, "KiUserExceptionDispatcher"); + Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, + &ProcedureName, + 0, + &SystemDllExceptionDispatcher); + + if (!NT_SUCCESS(Status)) { + + DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); + return (Status); + } + + /* Get Callback Dispatcher */ + DPRINT("Getting Entrypoint\n"); + RtlInitAnsiString(&ProcedureName, "KiUserCallbackDispatcher"); + Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, + &ProcedureName, + 0, + &SystemDllCallbackDispatcher); + + if (!NT_SUCCESS(Status)) { + + DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); + return (Status); + } + + /* Get Raise Exception Dispatcher */ + DPRINT("Getting Entrypoint\n"); + RtlInitAnsiString(&ProcedureName, "KiRaiseUserExceptionDispatcher"); + Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, + &ProcedureName, + 0, + &SystemDllRaiseExceptionDispatcher); + + if (!NT_SUCCESS(Status)) { + + DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); + return (Status); + } - /* - * FIXME: this will fail if the NT headers are - * more than 1024 bytes from start. - */ - DosHeader = (PIMAGE_DOS_HEADER) BlockBuffer; - NTHeaders = (PIMAGE_NT_HEADERS) (BlockBuffer + DosHeader->e_lfanew); - if ((DosHeader->e_magic != IMAGE_DOS_SIGNATURE) - || (DosHeader->e_lfanew == 0L) - || (*(PULONG) NTHeaders != IMAGE_NT_SIGNATURE)) - { - DPRINT1("NTDLL format invalid\n"); - ZwClose(FileHandle); - return(STATUS_UNSUCCESSFUL); - } - ImageBase = NTHeaders->OptionalHeader.ImageBase; - ImageSize = NTHeaders->OptionalHeader.SizeOfImage; - - /* - * Create a section for NTDLL - */ - DPRINT("Creating section\n"); - Status = ZwCreateSection(&NTDllSectionHandle, - SECTION_ALL_ACCESS, - NULL, - NULL, - PAGE_READONLY, - SEC_IMAGE | SEC_COMMIT, - FileHandle); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NTDLL create section failed (Status %x)\n", Status); - ZwClose(FileHandle); - return(Status); - } - ZwClose(FileHandle); - - /* - * Map the NTDLL into the process - */ - ViewSize = 0; - ImageBase = 0; - Status = ZwMapViewOfSection(NTDllSectionHandle, - ProcessHandle, - (PVOID*)&ImageBase, - 0, - ViewSize, - NULL, - &ViewSize, - 0, - MEM_COMMIT, - PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NTDLL map view of secion failed (Status %x)", Status); - ZwClose(NTDllSectionHandle); - return(Status); - } + /* Return success */ + return(STATUS_SUCCESS); +} - DPRINT("Referencing process\n"); - Status = ObReferenceObjectByHandle(ProcessHandle, - PROCESS_ALL_ACCESS, - PsProcessType, - KernelMode, - (PVOID*)&Process, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("ObReferenceObjectByProcess() failed (Status %x)\n", Status); - return(Status); - } +NTSTATUS +STDCALL +LdrpMapSystemDll(PEPROCESS Process, + PVOID *DllBase) +{ + NTSTATUS Status; + ULONG ViewSize = 0; + PVOID ImageBase = 0; + + /* Map the System DLL */ + DPRINT("Mapping System DLL\n"); + Status = MmMapViewOfSection(LdrpSystemDllSection, + Process, + (PVOID*)&ImageBase, + 0, + 0, + NULL, + &ViewSize, + 0, + MEM_COMMIT, + PAGE_READWRITE); + + if (!NT_SUCCESS(Status)) { + + DPRINT1("Failed to map System DLL Into Process\n"); + } + + if (DllBase) *DllBase = ImageBase; + + return Status; +} - CurrentProcess = PsGetCurrentProcess(); - if (Process != CurrentProcess) - { - DPRINT("Attaching to Process\n"); - KeAttachProcess(&Process->Pcb); +NTSTATUS +STDCALL +LdrpInitializeSystemDll(VOID) +{ + UNICODE_STRING DllPathname = ROS_STRING_INITIALIZER(L"\\SystemRoot\\system32\\ntdll.dll"); + OBJECT_ATTRIBUTES FileObjectAttributes; + IO_STATUS_BLOCK Iosb; + HANDLE FileHandle; + HANDLE NTDllSectionHandle; + NTSTATUS Status; + CHAR BlockBuffer[1024]; + PIMAGE_DOS_HEADER DosHeader; + PIMAGE_NT_HEADERS NTHeaders; + + /* Locate and open NTDLL to determine ImageBase and LdrStartup */ + InitializeObjectAttributes(&FileObjectAttributes, + &DllPathname, + 0, + NULL, + NULL); + + DPRINT("Opening NTDLL\n"); + Status = ZwOpenFile(&FileHandle, + FILE_READ_ACCESS, + &FileObjectAttributes, + &Iosb, + FILE_SHARE_READ, + FILE_SYNCHRONOUS_IO_NONALERT); + + if (!NT_SUCCESS(Status)) { + DPRINT1("NTDLL open failed (Status %x)\n", Status); + return Status; } - - /* - * retrieve ntdll's startup address - */ - if (SystemDllEntryPoint == NULL) - { - RtlInitAnsiString (&ProcedureName, - "LdrInitializeThunk"); - Status = LdrGetProcedureAddress ((PVOID)ImageBase, - &ProcedureName, - 0, - &SystemDllEntryPoint); - if (!NT_SUCCESS(Status)) - { - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - if (Process != CurrentProcess) - { - KeDetachProcess(); - } - ObDereferenceObject(Process); - ZwClose(NTDllSectionHandle); - return (Status); - } - *LdrStartupAddr = SystemDllEntryPoint; - } - - /* - * Retrieve the offset of the APC dispatcher from NTDLL - */ - if (SystemDllApcDispatcher == NULL) - { - RtlInitAnsiString (&ProcedureName, - "KiUserApcDispatcher"); - Status = LdrGetProcedureAddress ((PVOID)ImageBase, - &ProcedureName, - 0, - &SystemDllApcDispatcher); - if (!NT_SUCCESS(Status)) - { - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - if (Process != CurrentProcess) - { - KeDetachProcess(); - } - ObDereferenceObject(Process); - ZwClose(NTDllSectionHandle); - return (Status); - } - } - - /* - * Retrieve the offset of the exception dispatcher from NTDLL - */ - if (SystemDllExceptionDispatcher == NULL) - { - RtlInitAnsiString (&ProcedureName, - "KiUserExceptionDispatcher"); - Status = LdrGetProcedureAddress ((PVOID)ImageBase, - &ProcedureName, - 0, - &SystemDllExceptionDispatcher); - if (!NT_SUCCESS(Status)) - { - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - if (Process != CurrentProcess) - { - KeDetachProcess(); - } - ObDereferenceObject(Process); - ZwClose(NTDllSectionHandle); - return (Status); - } - } - - /* - * Retrieve the offset of the callback dispatcher from NTDLL - */ - if (SystemDllCallbackDispatcher == NULL) - { - RtlInitAnsiString (&ProcedureName, - "KiUserCallbackDispatcher"); - Status = LdrGetProcedureAddress ((PVOID)ImageBase, - &ProcedureName, - 0, - &SystemDllCallbackDispatcher); - if (!NT_SUCCESS(Status)) - { - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - if (Process != CurrentProcess) - { - KeDetachProcess(); - } - ObDereferenceObject(Process); - ZwClose(NTDllSectionHandle); - return (Status); - } - } - - /* - * Retrieve the offset of the raise exception dispatcher from NTDLL - */ - if (SystemDllRaiseExceptionDispatcher == NULL) - { - RtlInitAnsiString (&ProcedureName, - "KiRaiseUserExceptionDispatcher"); - Status = LdrGetProcedureAddress ((PVOID)ImageBase, - &ProcedureName, - 0, - &SystemDllRaiseExceptionDispatcher); - if (!NT_SUCCESS(Status)) - { - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - if (Process != CurrentProcess) - { - KeDetachProcess(); - } - ObDereferenceObject(Process); - ZwClose(NTDllSectionHandle); - return (Status); - } - } - - if (Process != CurrentProcess) - { - KeDetachProcess(); - } - ObDereferenceObject(Process); - - ZwClose(NTDllSectionHandle); - - return(STATUS_SUCCESS); + + /* Load NTDLL is valid */ + DPRINT("Reading NTDLL\n"); + Status = ZwReadFile(FileHandle, + 0, + 0, + 0, + &Iosb, + BlockBuffer, + sizeof(BlockBuffer), + 0, + 0); + if (!NT_SUCCESS(Status) || Iosb.Information != sizeof(BlockBuffer)) { + + DPRINT1("NTDLL header read failed (Status %x)\n", Status); + ZwClose(FileHandle); + return Status; + } + + /* Check if it's valid */ + DosHeader = (PIMAGE_DOS_HEADER)BlockBuffer; + NTHeaders = (PIMAGE_NT_HEADERS)(BlockBuffer + DosHeader->e_lfanew); + + if ((DosHeader->e_magic != IMAGE_DOS_SIGNATURE) || + (DosHeader->e_lfanew == 0L) || + (*(PULONG) NTHeaders != IMAGE_NT_SIGNATURE)) { + + DPRINT1("NTDLL format invalid\n"); + ZwClose(FileHandle); + return(STATUS_UNSUCCESSFUL); + } + + /* Create a section for NTDLL */ + DPRINT("Creating section\n"); + Status = ZwCreateSection(&NTDllSectionHandle, + SECTION_ALL_ACCESS, + NULL, + NULL, + PAGE_READONLY, + SEC_IMAGE | SEC_COMMIT, + FileHandle); + if (!NT_SUCCESS(Status)) { + + DPRINT1("NTDLL create section failed (Status %x)\n", Status); + ZwClose(FileHandle); + return(Status); + } + ZwClose(FileHandle); + + /* Reference the Section */ + DPRINT("ObReferenceObjectByHandle section: %d\n", NTDllSectionHandle); + Status = ObReferenceObjectByHandle(NTDllSectionHandle, + SECTION_ALL_ACCESS, + MmSectionObjectType, + KernelMode, + (PVOID*)&LdrpSystemDllSection, + NULL); + if (!NT_SUCCESS(Status)) { + + DPRINT1("NTDLL section reference failed (Status %x)\n", Status); + return(Status); + } + + /* Map it */ + LdrpMapSystemDll(PsGetCurrentProcess(), &LdrpSystemDllBase); + DPRINT("LdrpSystemDllBase: %x\n", LdrpSystemDllBase); + + /* Now get the Entrypoints */ + LdrpGetSystemDllEntryPoints(); + + return STATUS_SUCCESS; } /* EOF */ diff --git a/reactos/ntoskrnl/lpc/send.c b/reactos/ntoskrnl/lpc/send.c index 1f790c8609e..1179f1280d9 100644 --- a/reactos/ntoskrnl/lpc/send.c +++ b/reactos/ntoskrnl/lpc/send.c @@ -11,6 +11,7 @@ /* INCLUDES *****************************************************************/ #include + #define NDEBUG #include diff --git a/reactos/ntoskrnl/mm/RPoolMgr.h b/reactos/ntoskrnl/mm/RPoolMgr.h index 6d3a90535a1..85094913235 100644 --- a/reactos/ntoskrnl/mm/RPoolMgr.h +++ b/reactos/ntoskrnl/mm/RPoolMgr.h @@ -244,9 +244,9 @@ RPoolRemoveFree ( PR_POOL pool, PR_FREE Item ) ASSERT ( pool->FirstFree == Item ); pool->FirstFree = Item->NextFree; } -#if defined(DBG) || defined(KDBG) +#ifdef DBG Item->NextFree = Item->PrevFree = (PR_FREE)(ULONG_PTR)0xDEADBEEF; -#endif//DBG || KDBG +#endif//DBG } static void @@ -280,9 +280,9 @@ RFreeInit ( void* memory ) #endif//R_FREEMAGIC block->Status = 0; RFreeFillStack ( block ); -#if defined(DBG) || defined(KDBG) +#ifdef DBG block->PrevFree = block->NextFree = (PR_FREE)(ULONG_PTR)0xDEADBEEF; -#endif//DBG || KDBG +#endif//DBG return block; } @@ -643,7 +643,7 @@ RiUsedInit ( PR_USED Block, rulong Tag ) //ASSERT_SIZE ( Block->Size ); // now add the block to the used block list -#if defined(DBG) || defined(KDBG) +#ifdef DBG Block->NextUsed = (PR_USED)(ULONG_PTR)0xDEADBEEF; #endif//R_USED_LIST @@ -661,9 +661,9 @@ RiUsedInitRedZone ( PR_USED Block, rulong UserSize ) Block->UserSize = UserSize; memset ( Addr - R_RZ, R_RZ_LOVALUE, R_RZ ); memset ( Addr + Block->UserSize, R_RZ_HIVALUE, R_RZ ); -#if defined(DBG) || defined(KDBG) +#ifdef DBG memset ( Addr, 0xCD, UserSize ); -#endif//DBG || KDBG +#endif//DBG } #endif//R_RZ diff --git a/reactos/ntoskrnl/mm/drvlck.c b/reactos/ntoskrnl/mm/drvlck.c index ec3e43c44cb..8da058c2b9a 100644 --- a/reactos/ntoskrnl/mm/drvlck.c +++ b/reactos/ntoskrnl/mm/drvlck.c @@ -40,7 +40,7 @@ VOID STDCALL MmLockPagableSectionByHandle(IN PVOID ImageSectionHandle) { // MmLockMemoryArea((MEMORY_AREA *)ImageSectionHandle); - UNIMPLEMENTED; + DPRINT1("MmLockPagableSectionByHandle is unimplemented\n"); } @@ -63,7 +63,8 @@ PVOID STDCALL MmLockPagableDataSection(IN PVOID AddressWithinSection) { PVOID Handle; - Handle = MmLocateMemoryAreaByAddress(NULL, AddressWithinSection); + Handle = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), + AddressWithinSection); MmLockPagableSectionByHandle(Handle); return(Handle); } diff --git a/reactos/ntoskrnl/mm/elf.inc.h b/reactos/ntoskrnl/mm/elf.inc.h index 70e3e9763ce..03ef00ced7a 100644 --- a/reactos/ntoskrnl/mm/elf.inc.h +++ b/reactos/ntoskrnl/mm/elf.inc.h @@ -367,7 +367,7 @@ Elf64FmtCreateSection PMM_SECTION_SEGMENT pssSegments; Elf_Addr nImageBase = 0; Elf_Addr nEntryPoint; - ULONG32 nPrevVirtualEndOfSegment; + ULONG32 nPrevVirtualEndOfSegment = 0; ULONG i; ULONG j; diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index 8f21c8b8463..25dc1ca4553 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -319,9 +319,12 @@ NTSTATUS Mmi386ReleaseMmInfo(PEPROCESS Process) return(STATUS_SUCCESS); } -NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest) +NTSTATUS +STDCALL +MmCopyMmInfo(PEPROCESS Src, + PEPROCESS Dest, + PPHYSICAL_ADDRESS DirectoryTableBase) { - PKPROCESS KProcess = &Dest->Pcb; NTSTATUS Status; ULONG i, j; PFN_TYPE Pfn[7]; @@ -389,8 +392,9 @@ NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest) MmDeleteHyperspaceMapping(PageDirectory); } - KProcess->DirectoryTableBase.QuadPart = PFN_TO_PTE(Pfn[0]); - DPRINT("Finished MmCopyMmInfo()\n"); + + DirectoryTableBase->QuadPart = PFN_TO_PTE(Pfn[0]); + DPRINT("Finished MmCopyMmInfo(): %I64x\n", DirectoryTableBase->QuadPart); return(STATUS_SUCCESS); } @@ -2007,7 +2011,7 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect) { KEBUGCHECK(0); } - InterlockedExchange(Pt, PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY))); + InterlockedExchange((PLONG)Pt, PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY))); MiFlushTlb(Pt, Address); } } @@ -2197,7 +2201,7 @@ MmChangeHyperspaceMapping(PVOID Address, PFN_TYPE NewPage) else { ULONG Entry; - Entry = InterlockedExchange(ADDR_TO_PTE(Address), PFN_TO_PTE(NewPage) | PA_PRESENT | PA_READWRITE); + Entry = InterlockedExchange((PLONG)ADDR_TO_PTE(Address), PFN_TO_PTE(NewPage) | PA_PRESENT | PA_READWRITE); Pfn = PTE_TO_PFN(Entry); } FLUSH_TLB_ONE(Address); @@ -2218,7 +2222,7 @@ MmDeleteHyperspaceMapping(PVOID Address) else { ULONG Entry; - Entry = InterlockedExchange(ADDR_TO_PTE(Address), 0); + Entry = InterlockedExchange((PLONG)ADDR_TO_PTE(Address), 0); Pfn = PTE_TO_PFN(Entry); } FLUSH_TLB_ONE(Address); diff --git a/reactos/ntoskrnl/mm/marea.c b/reactos/ntoskrnl/mm/marea.c index 65b3c9a3e26..c56f4878526 100644 --- a/reactos/ntoskrnl/mm/marea.c +++ b/reactos/ntoskrnl/mm/marea.c @@ -189,8 +189,7 @@ MmLocateMemoryAreaByAddress( DPRINT("MmLocateMemoryAreaByAddress(AddressSpace %p, Address %p)\n", AddressSpace, Address); - if (!(KdDebugState & KD_DEBUG_SCREEN)) - MmVerifyMemoryAreas(AddressSpace); + MmVerifyMemoryAreas(AddressSpace); while (Node != NULL) { diff --git a/reactos/ntoskrnl/mm/mm.c b/reactos/ntoskrnl/mm/mm.c index 033c5c5fd3e..91f7c533795 100644 --- a/reactos/ntoskrnl/mm/mm.c +++ b/reactos/ntoskrnl/mm/mm.c @@ -90,6 +90,7 @@ NTSTATUS MmReleaseMemoryArea(PEPROCESS Process, PMEMORY_AREA Marea) return(STATUS_SUCCESS); case MEMORY_AREA_VIRTUAL_MEMORY: + case MEMORY_AREA_PEB_OR_TEB: MmFreeVirtualMemory(Process, Marea); break; @@ -384,6 +385,7 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode, break; case MEMORY_AREA_VIRTUAL_MEMORY: + case MEMORY_AREA_PEB_OR_TEB: Status = MmNotPresentFaultVirtualMemory(AddressSpace, MemoryArea, (PVOID)Address, diff --git a/reactos/ntoskrnl/mm/pagefile.c b/reactos/ntoskrnl/mm/pagefile.c index e5727fe0b9b..16aa331c0b8 100644 --- a/reactos/ntoskrnl/mm/pagefile.c +++ b/reactos/ntoskrnl/mm/pagefile.c @@ -224,11 +224,11 @@ NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_TYPE Page) file_offset = MmGetOffsetPageFile(PagingFileList[i]->RetrievalPointers, file_offset); KeInitializeEvent(&Event, NotificationEvent, FALSE); - Status = IoPageWrite(PagingFileList[i]->FileObject, - Mdl, - &file_offset, - &Event, - &Iosb); + Status = IoSynchronousPageWrite(PagingFileList[i]->FileObject, + Mdl, + &file_offset, + &Event, + &Iosb); if (Status == STATUS_PENDING) { KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); diff --git a/reactos/ntoskrnl/mm/process.c b/reactos/ntoskrnl/mm/process.c new file mode 100644 index 00000000000..f5ddc7a9abb --- /dev/null +++ b/reactos/ntoskrnl/mm/process.c @@ -0,0 +1,483 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/mm/process.c + * PURPOSE: Memory functions related to Processes + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *****************************************************************/ + +#include +#define NDEBUG +#include + +extern ULONG NtMajorVersion; +extern ULONG NtMinorVersion; +extern ULONG NtOSCSDVersion; + +/* FUNCTIONS *****************************************************************/ + +PVOID +STDCALL +MiCreatePebOrTeb(PEPROCESS Process, + PVOID BaseAddress) +{ + NTSTATUS Status; + PMADDRESS_SPACE ProcessAddressSpace = &Process->AddressSpace; + PMEMORY_AREA MemoryArea; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + BoundaryAddressMultiple.QuadPart = 0; + PVOID AllocatedBase = BaseAddress; + + /* Acquire the Lock */ + MmLockAddressSpace(ProcessAddressSpace); + + /* + * Create a Peb or Teb. + * Loop until it works, decreasing by PAGE_SIZE each time. The logic here + * is that a PEB allocation should never fail since the address is free, + * while TEB allocation can fail, and we should simply try the address + * below. Is there a nicer way of doing this automagically? (ie: findning) + * a gap region? -- Alex + */ + do { + DPRINT("Trying to allocate: %x\n", AllocatedBase); + Status = MmCreateMemoryArea(Process, + ProcessAddressSpace, + MEMORY_AREA_PEB_OR_TEB, + &AllocatedBase, + PAGE_SIZE, + PAGE_READWRITE, + &MemoryArea, + TRUE, + FALSE, + BoundaryAddressMultiple); + AllocatedBase = AllocatedBase - PAGE_SIZE; + } while (Status != STATUS_SUCCESS); + + /* Initialize the Region */ + MmInitialiseRegion(&MemoryArea->Data.VirtualMemoryData.RegionListHead, + PAGE_SIZE, + MEM_COMMIT, + PAGE_READWRITE); + + /* Reserve the pages */ + MmReserveSwapPages(PAGE_SIZE); + + /* Unlock Address Space */ + DPRINT("Returning\n"); + MmUnlockAddressSpace(ProcessAddressSpace); + return AllocatedBase + PAGE_SIZE; +} + +VOID +MiFreeStackPage(PVOID Context, + MEMORY_AREA* MemoryArea, + PVOID Address, + PFN_TYPE Page, + SWAPENTRY SwapEntry, + BOOLEAN Dirty) +{ + ASSERT(SwapEntry == 0); + if (Page) MmReleasePageMemoryConsumer(MC_NPPOOL, Page); +} + +VOID +STDCALL +MmDeleteKernelStack(PVOID Stack, + BOOLEAN GuiStack) +{ + /* Lock the Address Space */ + MmLockAddressSpace(MmGetKernelAddressSpace()); + + /* Delete the Stack */ + MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), + Stack, + MiFreeStackPage, + NULL); + + /* Unlock the Address Space */ + MmUnlockAddressSpace(MmGetKernelAddressSpace()); +} + +VOID +MiFreePebPage(PVOID Context, + MEMORY_AREA* MemoryArea, + PVOID Address, + PFN_TYPE Page, + SWAPENTRY SwapEntry, + BOOLEAN Dirty) +{ + PEPROCESS Process = (PEPROCESS)Context; + + if (Page != 0) + { + SWAPENTRY SavedSwapEntry; + SavedSwapEntry = MmGetSavedSwapEntryPage(Page); + if (SavedSwapEntry != 0) + { + MmFreeSwapPage(SavedSwapEntry); + MmSetSavedSwapEntryPage(Page, 0); + } + MmDeleteRmap(Page, Process, Address); + MmReleasePageMemoryConsumer(MC_USER, Page); + } + else if (SwapEntry != 0) + { + MmFreeSwapPage(SwapEntry); + } +} + +VOID +STDCALL +MmDeleteTeb(PEPROCESS Process, + PTEB Teb) +{ + PMADDRESS_SPACE ProcessAddressSpace = &Process->AddressSpace; + + /* Lock the Address Space */ + MmLockAddressSpace(ProcessAddressSpace); + + /* Delete the Stack */ + MmFreeMemoryAreaByPtr(ProcessAddressSpace, + Teb, + MiFreePebPage, + Process); + + /* Unlock the Address Space */ + MmUnlockAddressSpace(ProcessAddressSpace); +} + +PVOID +STDCALL +MmCreateKernelStack(BOOLEAN GuiStack) +{ + PMEMORY_AREA StackArea; + ULONG i; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + PFN_TYPE Page[MM_STACK_SIZE / PAGE_SIZE]; + PVOID KernelStack = NULL; + NTSTATUS Status; + + /* Initialize the Boundary Address */ + BoundaryAddressMultiple.QuadPart = 0; + + /* Lock the Kernel Address Space */ + MmLockAddressSpace(MmGetKernelAddressSpace()); + + /* Create a MAREA for the Kernel Stack */ + Status = MmCreateMemoryArea(NULL, + MmGetKernelAddressSpace(), + MEMORY_AREA_KERNEL_STACK, + &KernelStack, + MM_STACK_SIZE, + 0, + &StackArea, + FALSE, + FALSE, + BoundaryAddressMultiple); + + /* Unlock the Address Space */ + MmUnlockAddressSpace(MmGetKernelAddressSpace()); + + /* Check for Success */ + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create thread stack\n"); + KEBUGCHECK(0); + } + + /* Mark the Stack in use */ + for (i = 0; i < (MM_STACK_SIZE / PAGE_SIZE); i++) + { + Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Page[i]); + } + + /* Create a Virtual Mapping for it */ + Status = MmCreateVirtualMapping(NULL, + KernelStack, + PAGE_READWRITE, + Page, + MM_STACK_SIZE / PAGE_SIZE); + + /* Check for success */ + if (!NT_SUCCESS(Status)) + { + DPRINT1("Could not create Virtual Mapping for Kernel Stack\n"); + KEBUGCHECK(0); + } + + return KernelStack; +} + +NTSTATUS +STDCALL +MmCreatePeb(PEPROCESS Process) +{ + PPEB Peb = NULL; + LARGE_INTEGER SectionOffset; + ULONG ViewSize = 0; + PVOID TableBase = NULL; + NTSTATUS Status; + SectionOffset.QuadPart = (ULONGLONG)0; + + DPRINT("MmCreatePeb\n"); + + /* Map NLS Tables */ + DPRINT("Mapping NLS\n"); + Status = MmMapViewOfSection(NlsSectionObject, + Process, + &TableBase, + 0, + 0, + &SectionOffset, + &ViewSize, + ViewShare, + MEM_TOP_DOWN, + PAGE_READONLY); + if (!NT_SUCCESS(Status)) + { + DPRINT1("MmMapViewOfSection() failed (Status %lx)\n", Status); + return(Status); + } + DPRINT("TableBase %p ViewSize %lx\n", TableBase, ViewSize); + + /* Attach to Process */ + KeAttachProcess(&Process->Pcb); + + /* Allocate the PEB */ + Peb = MiCreatePebOrTeb(Process, (PVOID)PEB_BASE); + + /* Initialize the PEB */ + DPRINT("Allocated: %x\n", Peb); + RtlZeroMemory(Peb, sizeof(PEB)); + + /* Set up data */ + DPRINT("Setting up PEB\n"); + Peb->ImageBaseAddress = Process->SectionBaseAddress; + Peb->OSMajorVersion = NtMajorVersion; + Peb->OSMinorVersion = NtMinorVersion; + Peb->OSBuildNumber = 2195; + Peb->OSPlatformId = 2; //VER_PLATFORM_WIN32_NT; + Peb->OSCSDVersion = NtOSCSDVersion; + Peb->AnsiCodePageData = (char*)TableBase + NlsAnsiTableOffset; + Peb->OemCodePageData = (char*)TableBase + NlsOemTableOffset; + Peb->UnicodeCaseTableData = (char*)TableBase + NlsUnicodeTableOffset; + Peb->NumberOfProcessors = KeNumberProcessors; + Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL ? TRUE : FALSE); + + Process->Peb = Peb; + KeDetachProcess(); + + DPRINT("MmCreatePeb: Peb created at %p\n", Peb); + return STATUS_SUCCESS; +} + +PTEB +STDCALL +MmCreateTeb(PEPROCESS Process, + PCLIENT_ID ClientId, + PINITIAL_TEB InitialTeb) +{ + PTEB Teb; + BOOLEAN Attached = FALSE; + + /* Attach to the process */ + DPRINT("MmCreateTeb\n"); + if (Process != PsGetCurrentProcess()) + { + /* Attach to Target */ + KeAttachProcess(&Process->Pcb); + Attached = TRUE; + } + + /* Allocate the TEB */ + Teb = MiCreatePebOrTeb(Process, (PVOID)TEB_BASE); + + /* Initialize the PEB */ + RtlZeroMemory(Teb, sizeof(TEB)); + + /* Set TIB Data */ + Teb->Tib.ExceptionList = (PVOID)0xFFFFFFFF; + Teb->Tib.Version = 1; + Teb->Tib.Self = (PNT_TIB)Teb; + + /* Set TEB Data */ + Teb->Cid = *ClientId; + Teb->RealClientId = *ClientId; + Teb->Peb = Process->Peb; + Teb->CurrentLocale = PsDefaultThreadLocaleId; + + /* Store stack information from InitialTeb */ + if(InitialTeb != NULL) + { + /* fixed-size stack */ + if(InitialTeb->StackBase && InitialTeb->StackLimit) + { + Teb->Tib.StackBase = InitialTeb->StackBase; + Teb->Tib.StackLimit = InitialTeb->StackLimit; + Teb->DeallocationStack = InitialTeb->StackLimit; + } + /* expandable stack */ + else + { + Teb->Tib.StackBase = InitialTeb->StackCommit; + Teb->Tib.StackLimit = InitialTeb->StackCommitMax; + Teb->DeallocationStack = InitialTeb->StackReserved; + } + } + + /* Return TEB Address */ + DPRINT("Allocated: %x\n", Teb); + if (Attached) KeDetachProcess(); + return Teb; +} + +NTSTATUS +STDCALL +MmCreateProcessAddressSpace(IN PEPROCESS Process, + IN PSECTION_OBJECT Section OPTIONAL) +{ + NTSTATUS Status; + PMADDRESS_SPACE ProcessAddressSpace = &Process->AddressSpace; + PVOID BaseAddress; + PMEMORY_AREA MemoryArea; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + BoundaryAddressMultiple.QuadPart = 0; + ULONG ViewSize = 0; + PVOID ImageBase = 0; + + /* Initialize the Addresss Space */ + MmInitializeAddressSpace(Process, ProcessAddressSpace); + + /* Acquire the Lock */ + MmLockAddressSpace(ProcessAddressSpace); + + /* Protect the highest 64KB of the process address space */ + BaseAddress = (PVOID)MmUserProbeAddress; + Status = MmCreateMemoryArea(Process, + ProcessAddressSpace, + MEMORY_AREA_NO_ACCESS, + &BaseAddress, + 0x10000, + PAGE_NOACCESS, + &MemoryArea, + FALSE, + FALSE, + BoundaryAddressMultiple); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to protect last 64KB\n"); + goto exit; + } + + /* Protect the 60KB above the shared user page */ + BaseAddress = (char*)USER_SHARED_DATA + PAGE_SIZE; + Status = MmCreateMemoryArea(Process, + ProcessAddressSpace, + MEMORY_AREA_NO_ACCESS, + &BaseAddress, + 0x10000 - PAGE_SIZE, + PAGE_NOACCESS, + &MemoryArea, + FALSE, + FALSE, + BoundaryAddressMultiple); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to protect the memory above the shared user page\n"); + goto exit; + } + + /* Create the shared data page */ + BaseAddress = (PVOID)USER_SHARED_DATA; + Status = MmCreateMemoryArea(Process, + ProcessAddressSpace, + MEMORY_AREA_SHARED_DATA, + &BaseAddress, + PAGE_SIZE, + PAGE_READONLY, + &MemoryArea, + FALSE, + FALSE, + BoundaryAddressMultiple); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create Shared User Data\n"); + goto exit; + } + + /* Check if there's a Section Object */ + if (Section) + { + UNICODE_STRING FileName; + PWCHAR szSrc; + PCHAR szDest; + USHORT lnFName = 0; + + /* Unlock the Address Space */ + DPRINT("Unlocking\n"); + MmUnlockAddressSpace(ProcessAddressSpace); + + DPRINT("Mapping process image. Section: %p, Process: %p, ImageBase: %p\n", + Section, Process, &ImageBase); + Status = MmMapViewOfSection(Section, + Process, + (PVOID*)&ImageBase, + 0, + 0, + NULL, + &ViewSize, + 0, + MEM_COMMIT, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to map process Image\n"); + ObDereferenceObject(Section); + goto exit; + } + ObDereferenceObject(Section); + + /* Save the pointer */ + Process->SectionBaseAddress = ImageBase; + + /* Determine the image file name and save it to EPROCESS */ + DPRINT("Getting Image name\n"); + FileName = Section->FileObject->FileName; + szSrc = (PWCHAR)(FileName.Buffer + (FileName.Length / sizeof(WCHAR)) - 1); + + while(szSrc >= FileName.Buffer) + { + if(*szSrc == L'\\') + { + szSrc++; + break; + } + else + { + szSrc--; + lnFName++; + } + } + + /* Copy the to the process and truncate it to 15 characters if necessary */ + DPRINT("Copying and truncating\n"); + szDest = Process->ImageFileName; + lnFName = min(lnFName, sizeof(Process->ImageFileName) - 1); + while(lnFName-- > 0) *(szDest++) = (UCHAR)*(szSrc++); + + /* Return status to caller */ + return Status; + } + +exit: + /* Unlock the Address Space */ + DPRINT("Unlocking\n"); + MmUnlockAddressSpace(ProcessAddressSpace); + + /* Return status to caller */ + return Status; +} diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 2a6a35fd882..931a65950d3 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -2104,7 +2104,7 @@ MmCreatePhysicalMemorySection(VOID) SectionSize.QuadPart = 0xFFFFFFFF; InitializeObjectAttributes(&Obj, &Name, - 0, + OBJ_PERMANENT, NULL, NULL); Status = MmCreateSection(&PhysSection, diff --git a/reactos/ntoskrnl/mm/virtual.c b/reactos/ntoskrnl/mm/virtual.c index 7398a8f599f..0f9be5620e3 100644 --- a/reactos/ntoskrnl/mm/virtual.c +++ b/reactos/ntoskrnl/mm/virtual.c @@ -504,7 +504,7 @@ NtReadVirtualMemory(IN HANDLE ProcessHandle, Buffer,NumberOfBytesToRead); Status = ObReferenceObjectByHandle(ProcessHandle, - PROCESS_VM_WRITE, + PROCESS_VM_READ, NULL, PreviousMode, (PVOID*)(&Process), diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index f7159dee818..95e96a15483 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -403,13 +403,11 @@ IoIsSystemThread@4 IoIsValidNameGraftingBuffer@8 IoIsOperationSynchronous@4 IoMakeAssociatedIrp@8 -IoOpenDeviceInstanceKey@20 IoOpenDeviceInterfaceRegistryKey@12 IoOpenDeviceRegistryKey@16 IoPageRead@20 IoPnPDeliverServicePowerNotification@16 IoQueryDeviceDescription@32 -IoQueryDeviceEnumInfo@8 IoQueryFileDosDeviceName@8 IoQueryFileInformation@20 IoQueryVolumeInformation@20 @@ -505,7 +503,7 @@ KdEnableDebugger@0 KdEnteredDebugger KdPollBreakIn@0 KdPowerTransition@4 -KdSystemDebugControl@4 +KdpServiceDispatcher@12 Ke386CallBios@8 Ke386IoSetAccessProcess@8 Ke386QueryIoAccessMap@8 @@ -649,6 +647,7 @@ KeWaitForSingleObject@20 ;KiBugCheckData DATA KiCoprocessorError@0 KiDeliverApc@12 +KiKernelApcDeliveryCheck@0 KiDispatchInterrupt@0 KiEnableTimerWatchdog KiInterruptDispatch2@8 @@ -945,7 +944,7 @@ READ_REGISTER_USHORT@4 READ_REGISTER_BUFFER_UCHAR@12 READ_REGISTER_BUFFER_ULONG@12 READ_REGISTER_BUFFER_USHORT@12 -KeRosPrintAddress@4 +KiRosPrintAddress@4 KeRosDumpStackFrames@8 KeRosGetStackFrames@8 RtlAbsoluteToSelfRelativeSD@12 diff --git a/reactos/ntoskrnl/ntoskrnl.xml b/reactos/ntoskrnl/ntoskrnl.xml index d9aa91760bb..50a97cb71c8 100644 --- a/reactos/ntoskrnl/ntoskrnl.xml +++ b/reactos/ntoskrnl/ntoskrnl.xml @@ -24,11 +24,10 @@ main.S bios.c brkpoint.c - bthread.S + ctxswitch.S exp.c fpu.c gdt.c - i386-mcount.S idt.c irq.c irqhand.s @@ -39,7 +38,6 @@ thread.c tlbflush.S trap.s - tskswitch.S tss.c usercall.S usertrap.c @@ -55,6 +53,7 @@ device.c dpc.c event.c + gate.c gmutex.c ipi.c kqueue.c @@ -85,31 +84,34 @@ registry.c regobj.c - + i386-dis.c kdb_help.S + longjmp.S + setjmp.S kdb.c + kdb_cli.c + kdb_expr.c kdb_keyboard.c kdb_serial.c - rdebug.c + kdb_string.c kdb_symbols.c - profile.c - dbgctrl.c - errinfo.c - print.c - user.c + + + dbgkutil.c + debug.c @@ -118,6 +120,7 @@ callback.c + dbgctrl.c error.c event.c evtpair.c @@ -164,62 +167,45 @@ adapter.c arcname.c bootlog.c - buildirp.c - cancel.c - cleanup.c - cntrller.c - create.c + controller.c device.c deviface.c - dir.c + disk.c driver.c efi.c - errlog.c error.c event.c file.c - flush.c fs.c iocomp.c - ioctrl.c iomgr.c iowork.c irp.c irq.c - lock.c - mailslot.c mdl.c - npipe.c - page.c - parttab.c plugplay.c pnpdma.c pnpmgr.c pnpnotify.c pnpreport.c pnproot.c - process.c - queue.c rawfs.c remlock.c resource.c - rw.c share.c - shutdown.c symlink.c timer.c vpb.c - wdm.c wmi.c - xhaldisp.c - xhaldrv.c - dlog.c - gdbstub.c - kdebug.c - mda.c - service.c + + bochs.c + gdbstub.c + + kdinit.c + kdio.c + kdmain.c init.c @@ -263,6 +249,7 @@ marea.c mdl.c mm.c + process.c mminit.c mpw.c ncache.c @@ -304,15 +291,16 @@ cid.c - create.c debug.c idle.c job.c kill.c locale.c + notify.c process.c psmgr.c query.c + quota.c security.c suspend.c thread.c @@ -321,14 +309,6 @@ - alldiv.s - allmul.s - allrem.s - allshl.s - allshr.s - aulldiv.s - aullrem.s - aullshr.s exception.c seh.s @@ -336,6 +316,7 @@ atom.c capture.c ctype.c + debug.c handle.c libsupp.c message.c diff --git a/reactos/ntoskrnl/ob/dirobj.c b/reactos/ntoskrnl/ob/dirobj.c index 57bcc7ac748..de44ab0d7c8 100644 --- a/reactos/ntoskrnl/ob/dirobj.c +++ b/reactos/ntoskrnl/ob/dirobj.c @@ -169,6 +169,7 @@ NtQueryDirectoryObject (IN HANDLE DirectoryHandle, KPROCESSOR_MODE PreviousMode; ULONG SkipEntries = 0; ULONG NextEntry = 0; + ULONG CopyBytes = 0; NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); @@ -318,63 +319,66 @@ NtQueryDirectoryObject (IN HANDLE DirectoryHandle, Status = STATUS_MORE_ENTRIES; } - if(NT_SUCCESS(Status)) + if(NT_SUCCESS(Status) && nDirectories > 0) { - if(nDirectories > 0) + PWSTR strbuf = (PWSTR)((POBJECT_DIRECTORY_INFORMATION)TemporaryBuffer + nDirectories); + PWSTR deststrbuf = (PWSTR)((POBJECT_DIRECTORY_INFORMATION)Buffer + nDirectories); + + CopyBytes = nDirectories * sizeof(OBJECT_DIRECTORY_INFORMATION); + + /* copy the names from the objects and append them to the list of the + objects. copy to the temporary buffer only because the directory + lock can't be released and the buffer might be pagable memory! */ + for(DirInfo = (POBJECT_DIRECTORY_INFORMATION)TemporaryBuffer; + nDirectories > 0; + nDirectories--, DirInfo++) { - _SEH_TRY + ULONG NameLength; + + if(DirInfo->ObjectName.Length > 0) { - POBJECT_DIRECTORY_INFORMATION DestDirInfo = (POBJECT_DIRECTORY_INFORMATION)Buffer; - PWSTR strbuf = (PWSTR)((POBJECT_DIRECTORY_INFORMATION)Buffer + nDirectories); + RtlCopyMemory(strbuf, + DirInfo->ObjectName.Buffer, + DirInfo->ObjectName.Length); + /* change the buffer pointer to the buffer */ + DirInfo->ObjectName.Buffer = deststrbuf; + NameLength = DirInfo->ObjectName.Length / sizeof(WCHAR); + /* NULL-terminate the string */ + strbuf[NameLength] = L'\0'; + strbuf += NameLength + 1; + deststrbuf += NameLength + 1; - /* copy all OBJECT_DIRECTORY_INFORMATION structures to the buffer and - just append all strings (whose pointers are stored in the buffer!) - and replace the pointers */ - for(DirInfo = (POBJECT_DIRECTORY_INFORMATION)TemporaryBuffer; - nDirectories > 0; - nDirectories--, DirInfo++, DestDirInfo++) - { - if(DirInfo->ObjectName.Length > 0) - { - DestDirInfo->ObjectName.Length = DirInfo->ObjectName.Length; - DestDirInfo->ObjectName.MaximumLength = DirInfo->ObjectName.MaximumLength; - DestDirInfo->ObjectName.Buffer = strbuf; - RtlCopyMemory(strbuf, - DirInfo->ObjectName.Buffer, - DirInfo->ObjectName.Length); - /* NULL-terminate the string */ - strbuf[DirInfo->ObjectName.Length / sizeof(WCHAR)] = L'\0'; - strbuf += (DirInfo->ObjectName.Length / sizeof(WCHAR)) + 1; - } - - DestDirInfo->ObjectTypeName.Length = DirInfo->ObjectTypeName.Length; - DestDirInfo->ObjectTypeName.MaximumLength = DirInfo->ObjectTypeName.MaximumLength; - DestDirInfo->ObjectTypeName.Buffer = strbuf; - RtlCopyMemory(strbuf, - DirInfo->ObjectTypeName.Buffer, - DirInfo->ObjectTypeName.Length); - /* NULL-terminate the string */ - strbuf[DirInfo->ObjectTypeName.Length / sizeof(WCHAR)] = L'\0'; - strbuf += (DirInfo->ObjectTypeName.Length / sizeof(WCHAR)) + 1; - } + CopyBytes += (NameLength + 1) * sizeof(WCHAR); } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; + + RtlCopyMemory(strbuf, + DirInfo->ObjectTypeName.Buffer, + DirInfo->ObjectTypeName.Length); + /* change the buffer pointer to the buffer */ + DirInfo->ObjectTypeName.Buffer = deststrbuf; + NameLength = DirInfo->ObjectTypeName.Length / sizeof(WCHAR); + /* NULL-terminate the string */ + strbuf[NameLength] = L'\0'; + strbuf += NameLength + 1; + deststrbuf += NameLength + 1; + + CopyBytes += (NameLength + 1) * sizeof(WCHAR); } } KeReleaseSpinLock(&Directory->Lock, OldLevel); ObDereferenceObject(Directory); - - ExFreePool(TemporaryBuffer); if(NT_SUCCESS(Status) || ReturnSingleEntry) { _SEH_TRY { + if(CopyBytes != 0) + { + RtlCopyMemory(Buffer, + TemporaryBuffer, + CopyBytes); + } *Context = NextEntry; if(ReturnLength != NULL) { @@ -387,6 +391,8 @@ NtQueryDirectoryObject (IN HANDLE DirectoryHandle, } _SEH_END; } + + ExFreePool(TemporaryBuffer); } else { diff --git a/reactos/ntoskrnl/ob/handle.c b/reactos/ntoskrnl/ob/handle.c index bf59c501975..872237e7156 100644 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@ -42,16 +42,13 @@ #define GENERIC_ANY (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL) +/* GLOBALS *****************************************************************/ + +PHANDLE_TABLE ObpKernelHandleTable = NULL; + /* FUNCTIONS ***************************************************************/ -VOID -STDCALL -ObKillProcess(PEPROCESS Process) -{ - ObDeleteHandleTable(Process); -} - -VOID +static VOID ObpDecrementHandleCount(PVOID ObjectBody) { POBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody); @@ -67,6 +64,15 @@ ObpDecrementHandleCount(PVOID ObjectBody) if(NewHandleCount == 0) { + if(ObjectHeader->Parent != NULL && !ObjectHeader->Permanent) + { + /* delete the object from the namespace when the last handle got closed. + Only do this if it's actually been inserted into the namespace and + if it's not a permanent object. */ + ObpRemoveEntryDirectory(ObjectHeader); + } + + /* remove the keep-alive reference */ ObDereferenceObject(ObjectBody); } } @@ -76,19 +82,28 @@ NTSTATUS ObpQueryHandleAttributes(HANDLE Handle, POBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo) { - PEPROCESS Process; + PHANDLE_TABLE HandleTable; PHANDLE_TABLE_ENTRY HandleTableEntry; - LONG ExHandle = HANDLE_TO_EX_HANDLE(Handle); + LONG ExHandle; PAGED_CODE(); DPRINT("ObpQueryHandleAttributes(Handle %x)\n", Handle); + + if(ObIsKernelHandle(Handle, ExGetPreviousMode())) + { + HandleTable = ObpKernelHandleTable; + ExHandle = HANDLE_TO_EX_HANDLE(ObKernelHandleToHandle(Handle)); + } + else + { + HandleTable = PsGetCurrentProcess()->ObjectTable; + ExHandle = HANDLE_TO_EX_HANDLE(Handle); + } KeEnterCriticalRegion(); - Process = PsGetCurrentProcess(); - - HandleTableEntry = ExMapHandleToPointer(Process->ObjectTable, + HandleTableEntry = ExMapHandleToPointer(HandleTable, ExHandle); if (HandleTableEntry == NULL) { @@ -99,7 +114,7 @@ ObpQueryHandleAttributes(HANDLE Handle, HandleInfo->Inherit = (HandleTableEntry->u1.ObAttributes & EX_HANDLE_ENTRY_INHERITABLE) != 0; HandleInfo->ProtectFromClose = (HandleTableEntry->u1.ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE) != 0; - ExUnlockHandleTableEntry(Process->ObjectTable, + ExUnlockHandleTableEntry(HandleTable, HandleTableEntry); KeLeaveCriticalRegion(); @@ -112,19 +127,28 @@ NTSTATUS ObpSetHandleAttributes(HANDLE Handle, POBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo) { - PEPROCESS Process; + PHANDLE_TABLE HandleTable; PHANDLE_TABLE_ENTRY HandleTableEntry; - LONG ExHandle = HANDLE_TO_EX_HANDLE(Handle); + LONG ExHandle; PAGED_CODE(); DPRINT("ObpSetHandleAttributes(Handle %x)\n", Handle); - Process = PsGetCurrentProcess(); + if(ObIsKernelHandle(Handle, ExGetPreviousMode())) + { + HandleTable = ObpKernelHandleTable; + ExHandle = HANDLE_TO_EX_HANDLE(ObKernelHandleToHandle(Handle)); + } + else + { + HandleTable = PsGetCurrentProcess()->ObjectTable; + ExHandle = HANDLE_TO_EX_HANDLE(Handle); + } KeEnterCriticalRegion(); - HandleTableEntry = ExMapHandleToPointer(Process->ObjectTable, + HandleTableEntry = ExMapHandleToPointer(HandleTable, ExHandle); if (HandleTableEntry == NULL) { @@ -144,7 +168,7 @@ ObpSetHandleAttributes(HANDLE Handle, /* FIXME: Do we need to set anything in the object header??? */ - ExUnlockHandleTableEntry(Process->ObjectTable, + ExUnlockHandleTableEntry(HandleTable, HandleTableEntry); KeLeaveCriticalRegion(); @@ -153,6 +177,54 @@ ObpSetHandleAttributes(HANDLE Handle, } +static NTSTATUS +ObpDeleteHandle(PHANDLE_TABLE HandleTable, + HANDLE Handle) +{ + PHANDLE_TABLE_ENTRY HandleEntry; + PVOID Body; + POBJECT_HEADER ObjectHeader; + LONG ExHandle = HANDLE_TO_EX_HANDLE(Handle); + + PAGED_CODE(); + + DPRINT("ObpDeleteHandle(Handle %x)\n",Handle); + + KeEnterCriticalRegion(); + + HandleEntry = ExMapHandleToPointer(HandleTable, + ExHandle); + if(HandleEntry != NULL) + { + if(HandleEntry->u1.ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE) + { + ExUnlockHandleTableEntry(HandleTable, + HandleEntry); + + KeLeaveCriticalRegion(); + + return STATUS_HANDLE_NOT_CLOSABLE; + } + + ObjectHeader = EX_HTE_TO_HDR(HandleEntry); + Body = HEADER_TO_BODY(ObjectHeader); + + ObpDecrementHandleCount(Body); + + /* destroy and unlock the handle entry */ + ExDestroyHandleByEntry(HandleTable, + HandleEntry, + ExHandle); + + KeLeaveCriticalRegion(); + + return STATUS_SUCCESS; + } + KeLeaveCriticalRegion(); + return STATUS_INVALID_HANDLE; +} + + NTSTATUS ObDuplicateObject(PEPROCESS SourceProcess, PEPROCESS TargetProcess, @@ -162,19 +234,32 @@ ObDuplicateObject(PEPROCESS SourceProcess, BOOLEAN InheritHandle, ULONG Options) { + PHANDLE_TABLE SourceHandleTable; PHANDLE_TABLE_ENTRY SourceHandleEntry; HANDLE_TABLE_ENTRY NewHandleEntry; PVOID ObjectBody; POBJECT_HEADER ObjectHeader; LONG ExTargetHandle; - LONG ExSourceHandle = HANDLE_TO_EX_HANDLE(SourceHandle); + LONG ExSourceHandle; ULONG NewHandleCount; PAGED_CODE(); + if(ObIsKernelHandle(SourceHandle, ExGetPreviousMode())) + { + SourceHandleTable = ObpKernelHandleTable; + SourceHandle = ObKernelHandleToHandle(SourceHandle); + } + else + { + SourceHandleTable = SourceProcess->ObjectTable; + } + + ExSourceHandle = HANDLE_TO_EX_HANDLE(SourceHandle); + KeEnterCriticalRegion(); - SourceHandleEntry = ExMapHandleToPointer(SourceProcess->ObjectTable, + SourceHandleEntry = ExMapHandleToPointer(SourceHandleTable, ExSourceHandle); if (SourceHandleEntry == NULL) { @@ -219,7 +304,7 @@ ObDuplicateObject(PEPROCESS SourceProcess, NewHandleCount = InterlockedIncrement(&ObjectHeader->HandleCount); ASSERT(NewHandleCount >= 2); - ExUnlockHandleTableEntry(SourceProcess->ObjectTable, + ExUnlockHandleTableEntry(SourceHandleTable, SourceHandleEntry); KeLeaveCriticalRegion(); @@ -231,8 +316,8 @@ ObDuplicateObject(PEPROCESS SourceProcess, { if (Options & DUPLICATE_CLOSE_SOURCE) { - ObDeleteHandle(SourceProcess, - SourceHandle); + ObpDeleteHandle(SourceHandleTable, + SourceHandle); } ObDereferenceObject(ObjectBody); @@ -262,7 +347,7 @@ NTSTATUS STDCALL NtDuplicateObject (IN HANDLE SourceProcessHandle, IN HANDLE SourceHandle, IN HANDLE TargetProcessHandle, - OUT PHANDLE TargetHandle, + OUT PHANDLE TargetHandle OPTIONAL, IN ACCESS_MASK DesiredAccess, IN BOOLEAN InheritHandle, ULONG Options) @@ -301,7 +386,7 @@ NtDuplicateObject (IN HANDLE SourceProcessHandle, PreviousMode = ExGetPreviousMode(); - if(PreviousMode != KernelMode) + if(TargetHandle != NULL && PreviousMode != KernelMode) { _SEH_TRY { @@ -384,8 +469,8 @@ NtDuplicateObject (IN HANDLE SourceProcessHandle, if (Options & DUPLICATE_CLOSE_SOURCE) { - ObDeleteHandle(SourceProcess, - SourceHandle); + ObpDeleteHandle(SourceProcess->ObjectTable, + SourceHandle); } } } @@ -403,7 +488,7 @@ NtDuplicateObject (IN HANDLE SourceProcessHandle, ObDereferenceObject(TargetProcess); ObDereferenceObject(SourceProcess); - if(NT_SUCCESS(Status)) + if(NT_SUCCESS(Status) && TargetHandle != NULL) { _SEH_TRY { @@ -436,18 +521,6 @@ DeleteHandleCallback(PHANDLE_TABLE HandleTable, ObpDecrementHandleCount(ObjectBody); } -VOID ObDeleteHandleTable(PEPROCESS Process) -/* - * FUNCTION: Deletes the handle table associated with a process - */ -{ - PAGED_CODE(); - - ExDestroyHandleTable(Process->ObjectTable, - DeleteHandleCallback, - Process); -} - static BOOLEAN STDCALL DuplicateHandleCallback(PHANDLE_TABLE HandleTable, PHANDLE_TABLE_ENTRY HandleTableEntry, @@ -464,10 +537,7 @@ DuplicateHandleCallback(PHANDLE_TABLE HandleTable, ObjectHeader = EX_HTE_TO_HDR(HandleTableEntry); if(InterlockedIncrement(&ObjectHeader->HandleCount) == 1) { - ObReferenceObjectByPointer(HEADER_TO_BODY(ObjectHeader), - 0, - NULL, - UserMode); + ObReferenceObject(HEADER_TO_BODY(ObjectHeader)); } } @@ -503,51 +573,15 @@ VOID ObCreateHandleTable(PEPROCESS Parent, } -NTSTATUS -ObDeleteHandle(PEPROCESS Process, - HANDLE Handle) +VOID +STDCALL +ObKillProcess(PEPROCESS Process) { - PHANDLE_TABLE_ENTRY HandleEntry; - PVOID Body; - POBJECT_HEADER ObjectHeader; - LONG ExHandle = HANDLE_TO_EX_HANDLE(Handle); - PAGED_CODE(); - DPRINT("ObDeleteHandle(Handle %x)\n",Handle); - - KeEnterCriticalRegion(); - - HandleEntry = ExMapHandleToPointer(Process->ObjectTable, - ExHandle); - if(HandleEntry != NULL) - { - if(HandleEntry->u1.ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE) - { - ExUnlockHandleTableEntry(Process->ObjectTable, - HandleEntry); - - KeLeaveCriticalRegion(); - - return STATUS_HANDLE_NOT_CLOSABLE; - } - - ObjectHeader = EX_HTE_TO_HDR(HandleEntry); - Body = HEADER_TO_BODY(ObjectHeader); - - ObpDecrementHandleCount(Body); - - /* destroy and unlock the handle entry */ - ExDestroyHandleByEntry(Process->ObjectTable, - HandleEntry, - ExHandle); - - KeLeaveCriticalRegion(); - - return STATUS_SUCCESS; - } - KeLeaveCriticalRegion(); - return STATUS_INVALID_HANDLE; + ExDestroyHandleTable(Process->ObjectTable, + DeleteHandleCallback, + Process); } @@ -685,11 +719,11 @@ ObReferenceObjectByHandle(HANDLE Handle, { PHANDLE_TABLE_ENTRY HandleEntry; POBJECT_HEADER ObjectHeader; + PHANDLE_TABLE HandleTable; PVOID ObjectBody; ACCESS_MASK GrantedAccess; ULONG Attributes; - NTSTATUS Status; - LONG ExHandle = HANDLE_TO_EX_HANDLE(Handle); + LONG ExHandle; PAGED_CODE(); @@ -703,14 +737,9 @@ ObReferenceObjectByHandle(HANDLE Handle, if (Handle == NtCurrentProcess() && (ObjectType == PsProcessType || ObjectType == NULL)) { - Status = ObReferenceObjectByPointer(PsGetCurrentProcess(), - PROCESS_ALL_ACCESS, - PsProcessType, - UserMode); - if (! NT_SUCCESS(Status)) - { - return Status; - } + PEPROCESS CurrentProcess = PsGetCurrentProcess(); + + ObReferenceObject(CurrentProcess); if (HandleInformation != NULL) { @@ -718,8 +747,8 @@ ObReferenceObjectByHandle(HANDLE Handle, HandleInformation->GrantedAccess = PROCESS_ALL_ACCESS; } - *Object = PsGetCurrentProcess(); - DPRINT("Referencing current process %x\n", PsGetCurrentProcess()); + *Object = CurrentProcess; + DPRINT("Referencing current process %x\n", CurrentProcess); return STATUS_SUCCESS; } else if (Handle == NtCurrentProcess()) @@ -731,14 +760,9 @@ ObReferenceObjectByHandle(HANDLE Handle, if (Handle == NtCurrentThread() && (ObjectType == PsThreadType || ObjectType == NULL)) { - Status = ObReferenceObjectByPointer(PsGetCurrentThread(), - THREAD_ALL_ACCESS, - PsThreadType, - UserMode); - if (! NT_SUCCESS(Status)) - { - return Status; - } + PETHREAD CurrentThread = PsGetCurrentThread(); + + ObReferenceObject(CurrentThread); if (HandleInformation != NULL) { @@ -746,7 +770,7 @@ ObReferenceObjectByHandle(HANDLE Handle, HandleInformation->GrantedAccess = THREAD_ALL_ACCESS; } - *Object = PsGetCurrentThread(); + *Object = CurrentThread; CHECKPOINT; return STATUS_SUCCESS; } @@ -763,9 +787,20 @@ ObReferenceObjectByHandle(HANDLE Handle, DesiredAccess |= GENERIC_ALL; } + if(ObIsKernelHandle(Handle, AccessMode)) + { + HandleTable = ObpKernelHandleTable; + ExHandle = HANDLE_TO_EX_HANDLE(ObKernelHandleToHandle(Handle)); + } + else + { + HandleTable = PsGetCurrentProcess()->ObjectTable; + ExHandle = HANDLE_TO_EX_HANDLE(Handle); + } + KeEnterCriticalRegion(); - HandleEntry = ExMapHandleToPointer(PsGetCurrentProcess()->ObjectTable, + HandleEntry = ExMapHandleToPointer(HandleTable, ExHandle); if (HandleEntry == NULL) { @@ -777,13 +812,13 @@ ObReferenceObjectByHandle(HANDLE Handle, ObjectHeader = EX_HTE_TO_HDR(HandleEntry); ObjectBody = HEADER_TO_BODY(ObjectHeader); - DPRINT("locked1: ObjectHeader: 0x%x [HT:0x%x]\n", ObjectHeader, PsGetCurrentProcess()->ObjectTable); + DPRINT("locked1: ObjectHeader: 0x%x [HT:0x%x]\n", ObjectHeader, HandleTable); if (ObjectType != NULL && ObjectType != ObjectHeader->ObjectType) { DPRINT("ObjectType mismatch: %wZ vs %wZ (handle 0x%x)\n", &ObjectType->TypeName, ObjectHeader->ObjectType ? &ObjectHeader->ObjectType->TypeName : NULL, Handle); - ExUnlockHandleTableEntry(PsGetCurrentProcess()->ObjectTable, + ExUnlockHandleTableEntry(HandleTable, HandleEntry); KeLeaveCriticalRegion(); @@ -804,7 +839,7 @@ ObReferenceObjectByHandle(HANDLE Handle, rights than the handle can grant */ if(AccessMode != KernelMode && (~GrantedAccess & DesiredAccess)) { - ExUnlockHandleTableEntry(PsGetCurrentProcess()->ObjectTable, + ExUnlockHandleTableEntry(HandleTable, HandleEntry); KeLeaveCriticalRegion(); @@ -814,15 +849,13 @@ ObReferenceObjectByHandle(HANDLE Handle, return(STATUS_ACCESS_DENIED); } - ObReferenceObjectByPointer(ObjectBody, - 0, - NULL, - UserMode); + ObReferenceObject(ObjectBody); + Attributes = HandleEntry->u1.ObAttributes & (EX_HANDLE_ENTRY_PROTECTFROMCLOSE | EX_HANDLE_ENTRY_INHERITABLE | EX_HANDLE_ENTRY_AUDITONCLOSE); - ExUnlockHandleTableEntry(PsGetCurrentProcess()->ObjectTable, + ExUnlockHandleTableEntry(HandleTable, HandleEntry); KeLeaveCriticalRegion(); @@ -858,16 +891,30 @@ ObReferenceObjectByHandle(HANDLE Handle, NTSTATUS STDCALL NtClose(IN HANDLE Handle) { + PHANDLE_TABLE HandleTable; NTSTATUS Status; PAGED_CODE(); - Status = ObDeleteHandle(PsGetCurrentProcess(), - Handle); + if(ObIsKernelHandle(Handle, ExGetPreviousMode())) + { + HandleTable = ObpKernelHandleTable; + Handle = ObKernelHandleToHandle(Handle); + } + else + { + HandleTable = PsGetCurrentProcess()->ObjectTable; + } + + Status = ObpDeleteHandle(HandleTable, + Handle); if (!NT_SUCCESS(Status)) { - if(((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->ExceptionPort) + if((ExGetPreviousMode() != KernelMode) && + (PsGetCurrentProcess()->ExceptionPort)) + { KeRaiseUserException(Status); + } return Status; } diff --git a/reactos/ntoskrnl/ob/namespc.c b/reactos/ntoskrnl/ob/namespc.c index f67794ad08c..2041cb89570 100644 --- a/reactos/ntoskrnl/ob/namespc.c +++ b/reactos/ntoskrnl/ob/namespc.c @@ -60,7 +60,7 @@ ObReferenceObjectByName(PUNICODE_STRING ObjectPath, InitializeObjectAttributes(&ObjectAttributes, ObjectPath, - Attributes, + Attributes | OBJ_OPENIF, NULL, NULL); Status = ObFindObject(&ObjectAttributes, @@ -143,12 +143,21 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, return Status; } - if (RemainingPath.Buffer != NULL || - Object == NULL) + if (Object == NULL) { - RtlFreeUnicodeString(&RemainingPath); - return STATUS_UNSUCCESSFUL; + RtlFreeUnicodeString(&RemainingPath); + return STATUS_UNSUCCESSFUL; } + if (RemainingPath.Buffer != NULL) + { + if (wcschr(RemainingPath.Buffer + 1, L'\\') == NULL) + Status = STATUS_OBJECT_NAME_NOT_FOUND; + else + Status =STATUS_OBJECT_PATH_NOT_FOUND; + RtlFreeUnicodeString(&RemainingPath); + ObDereferenceObject(Object); + return Status; + } Status = ObCreateHandle(PsGetCurrentProcess(), Object, @@ -221,7 +230,11 @@ ObpRemoveEntryDirectory(POBJECT_HEADER Header) DPRINT("ObpRemoveEntryDirectory(Header %x)\n",Header); KeAcquireSpinLock(&(Header->Parent->Lock),&oldlvl); - RemoveEntryList(&(Header->Entry)); + if (Header->Entry.Flink && Header->Entry.Blink) + { + RemoveEntryList(&(Header->Entry)); + Header->Entry.Flink = Header->Entry.Blink = NULL; + } KeReleaseSpinLock(&(Header->Parent->Lock),oldlvl); } diff --git a/reactos/ntoskrnl/ob/ntobj.c b/reactos/ntoskrnl/ob/ntobj.c index 048936ad52c..b6553f15f6b 100644 --- a/reactos/ntoskrnl/ob/ntobj.c +++ b/reactos/ntoskrnl/ob/ntobj.c @@ -224,6 +224,12 @@ ObpSetPermanentObject (IN PVOID ObjectBody, IN BOOLEAN Permanent) ObjectHeader = BODY_TO_HEADER(ObjectBody); ObjectHeader->Permanent = Permanent; + + if (ObjectHeader->HandleCount == 0 && !Permanent && ObjectHeader->Parent != NULL) + { + /* Remove the object from the namespace */ + ObpRemoveEntryDirectory(ObjectHeader); + } } /********************************************************************** diff --git a/reactos/ntoskrnl/ob/object.c b/reactos/ntoskrnl/ob/object.c index 44a69c141e9..99a6d5d32b4 100644 --- a/reactos/ntoskrnl/ob/object.c +++ b/reactos/ntoskrnl/ob/object.c @@ -47,6 +47,8 @@ ObpCaptureObjectAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, if(AccessMode != KernelMode) { + RtlZeroMemory(&AttributesCopy, sizeof(AttributesCopy)); + _SEH_TRY { ProbeForRead(ObjectAttributes, @@ -140,6 +142,8 @@ ObpCaptureObjectAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, if(AttributesCopy.SecurityQualityOfService != NULL) { SECURITY_QUALITY_OF_SERVICE SafeQoS; + + RtlZeroMemory(&SafeQoS, sizeof(SafeQoS)); _SEH_TRY { @@ -193,6 +197,8 @@ ObpCaptureObjectAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, if(AccessMode != KernelMode) { + RtlZeroMemory(&OriginalCopy, sizeof(OriginalCopy)); + _SEH_TRY { /* probe the ObjectName structure and make a local stack copy of it */ @@ -705,6 +711,22 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL, DPRINT1("ObFindObject() failed! (Status 0x%x)\n", Status); return Status; } + if (Parent != NULL) + { + ParentHeader = BODY_TO_HEADER(Parent); + } + if (ParentHeader && + RemainingPath.Buffer == NULL) + { + if (ParentHeader->ObjectType != Type + || !(ObjectAttributes->Attributes & OBJ_OPENIF)) + { + ObDereferenceObject(Parent); + return STATUS_OBJECT_NAME_COLLISION; + } + *Object = Parent; + return STATUS_OBJECT_EXISTS; + } } else { @@ -749,11 +771,6 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL, RtlInitUnicodeString(&(Header->Name),NULL); DPRINT("Getting Parent and adding entry\n"); - if (Parent != NULL) - { - ParentHeader = BODY_TO_HEADER(Parent); - } - if (ParentHeader != NULL && ParentHeader->ObjectType == ObDirectoryType && RemainingPath.Buffer != NULL) @@ -1010,6 +1027,7 @@ STATIC NTSTATUS ObpDeleteObjectDpcLevel(IN POBJECT_HEADER ObjectHeader, IN LONG OldRefCount) { +#if 0 if (ObjectHeader->RefCount < 0) { CPRINT("Object %p/%p has invalid reference count (%d)\n", @@ -1025,6 +1043,7 @@ ObpDeleteObjectDpcLevel(IN POBJECT_HEADER ObjectHeader, ObjectHeader->HandleCount); KEBUGCHECK(0); } +#endif switch (KeGetCurrentIrql ()) diff --git a/reactos/ntoskrnl/ob/wait.c b/reactos/ntoskrnl/ob/wait.c index 1b693c6ba6b..e74275368ab 100644 --- a/reactos/ntoskrnl/ob/wait.c +++ b/reactos/ntoskrnl/ob/wait.c @@ -111,7 +111,7 @@ NtWaitForMultipleObjects(IN ULONG ObjectCount, UserRequest, PreviousMode, Alertable, - TimeOut, + TimeOut, WaitBlockArray); /* dereference all objects */ diff --git a/reactos/ntoskrnl/ps/cid.c b/reactos/ntoskrnl/ps/cid.c index eece7f4a4cd..7a6ec8169e2 100644 --- a/reactos/ntoskrnl/ps/cid.c +++ b/reactos/ntoskrnl/ps/cid.c @@ -71,6 +71,8 @@ PsDeleteCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType) PAGED_CODE(); + KeEnterCriticalRegion(); + Entry = ExMapHandleToPointer(PspCidTable, ExHandle); if(Entry != NULL) @@ -81,16 +83,18 @@ PsDeleteCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType) ExDestroyHandleByEntry(PspCidTable, Entry, ExHandle); + KeLeaveCriticalRegion(); return STATUS_SUCCESS; } else { ExUnlockHandleTableEntry(PspCidTable, Entry); + KeLeaveCriticalRegion(); return STATUS_OBJECT_TYPE_MISMATCH; } } - + KeLeaveCriticalRegion(); return STATUS_INVALID_HANDLE; } diff --git a/reactos/ntoskrnl/ps/create.c b/reactos/ntoskrnl/ps/create.c deleted file mode 100644 index 957f6a4bd87..00000000000 --- a/reactos/ntoskrnl/ps/create.c +++ /dev/null @@ -1,643 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ps/create.c - * PURPOSE: Thread managment - * - * PROGRAMMERS: David Welch (welch@mcmail.com) - * Phillip Susi - * Skywing - */ - -/* - * NOTE: - * - * All of the routines that manipulate the thread queue synchronize on - * a single spinlock - * - */ - -/* INCLUDES ****************************************************************/ - -#include -#define NDEBUG -#include - -/* GLOBAL *******************************************************************/ - -#define MAX_THREAD_NOTIFY_ROUTINE_COUNT 8 -#define TAG_KAPC TAG('k','p','a','p') /* kpap - kernel ps apc */ - -static ULONG PiThreadNotifyRoutineCount = 0; -static PCREATE_THREAD_NOTIFY_ROUTINE -PiThreadNotifyRoutine[MAX_THREAD_NOTIFY_ROUTINE_COUNT]; - -ULONG -STDCALL -KeSuspendThread(PKTHREAD Thread); -/* FUNCTIONS ***************************************************************/ - -VOID -PiBeforeBeginThread(CONTEXT c) -{ - KeLowerIrql(PASSIVE_LEVEL); -} - -NTSTATUS -PsInitializeThread ( - PEPROCESS Process, - PETHREAD* ThreadPtr, - POBJECT_ATTRIBUTES ObjectAttributes, - KPROCESSOR_MODE AccessMode, - BOOLEAN First ) -{ - PETHREAD Thread; - NTSTATUS Status; - KIRQL oldIrql; - - PAGED_CODE(); - - if (Process == NULL) - { - Process = PsInitialSystemProcess; - } - - /* - * Create and initialize thread - */ - Status = ObCreateObject(AccessMode, - PsThreadType, - ObjectAttributes, - KernelMode, - NULL, - sizeof(ETHREAD), - 0, - 0, - (PVOID*)&Thread); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - /* - * Reference process - */ - ObReferenceObjectByPointer(Process, - PROCESS_CREATE_THREAD, - PsProcessType, - KernelMode); - - Thread->ThreadsProcess = Process; - Thread->Cid.UniqueThread = NULL; - Thread->Cid.UniqueProcess = (HANDLE)Thread->ThreadsProcess->UniqueProcessId; - - DPRINT("Thread = %x\n",Thread); - - KeInitializeThread(&Process->Pcb, &Thread->Tcb, First); - InitializeListHead(&Thread->ActiveTimerListHead); - KeInitializeSpinLock(&Thread->ActiveTimerListLock); - InitializeListHead(&Thread->IrpList); - Thread->DeadThread = FALSE; - Thread->HasTerminated = FALSE; - Thread->Tcb.Win32Thread = NULL; - DPRINT("Thread->Cid.UniqueThread %d\n",Thread->Cid.UniqueThread); - - - Thread->Tcb.BasePriority = (CHAR)Process->Pcb.BasePriority; - Thread->Tcb.Priority = Thread->Tcb.BasePriority; - - /* - * Local Procedure Call facility (LPC) - */ - KeInitializeSemaphore (& Thread->LpcReplySemaphore, 0, LONG_MAX); - Thread->LpcReplyMessage = NULL; - Thread->LpcReplyMessageId = 0; /* not valid */ - /* Thread->LpcReceiveMessageId = 0; */ - Thread->LpcExitThreadCalled = FALSE; - Thread->LpcReceivedMsgIdValid = FALSE; - - oldIrql = KeAcquireDispatcherDatabaseLock(); - InsertTailList(&Process->ThreadListHead, - &Thread->ThreadListEntry); - KeReleaseDispatcherDatabaseLock(oldIrql); - - *ThreadPtr = Thread; - - return STATUS_SUCCESS; -} - - -static NTSTATUS -PsCreateTeb ( - HANDLE ProcessHandle, - PTEB *TebPtr, - PETHREAD Thread, - PINITIAL_TEB InitialTeb ) -{ - PEPROCESS Process; - NTSTATUS Status; - ULONG ByteCount; - ULONG RegionSize; - ULONG TebSize; - PVOID TebBase; - TEB Teb; - - PAGED_CODE(); - - TebSize = PAGE_SIZE; - - if (NULL == Thread->ThreadsProcess) - { - /* We'll be allocating a 64k block here and only use 4k of it, but this - path should almost never be taken. Actually, I never saw it was taken, - so maybe we should just ASSERT(NULL != Thread->ThreadsProcess) and - move on */ - TebBase = NULL; - Status = ZwAllocateVirtualMemory(ProcessHandle, - &TebBase, - 0, - &TebSize, - MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, - PAGE_READWRITE); - if (! NT_SUCCESS(Status)) - { - DPRINT1("Failed to allocate virtual memory for TEB\n"); - return Status; - } - } - else - { - Process = Thread->ThreadsProcess; - PsLockProcess(Process, FALSE); - if (NULL == Process->TebBlock || - Process->TebBlock == Process->TebLastAllocated) - { - Process->TebBlock = NULL; - RegionSize = MM_VIRTMEM_GRANULARITY; - Status = ZwAllocateVirtualMemory(ProcessHandle, - &Process->TebBlock, - 0, - &RegionSize, - MEM_RESERVE | MEM_TOP_DOWN, - PAGE_READWRITE); - if (! NT_SUCCESS(Status)) - { - PsUnlockProcess(Process); - DPRINT1("Failed to reserve virtual memory for TEB\n"); - return Status; - } - Process->TebLastAllocated = (PVOID) ((char *) Process->TebBlock + RegionSize); - } - TebBase = (PVOID) ((char *) Process->TebLastAllocated - PAGE_SIZE); - Status = ZwAllocateVirtualMemory(ProcessHandle, - &TebBase, - 0, - &TebSize, - MEM_COMMIT, - PAGE_READWRITE); - if (! NT_SUCCESS(Status)) - { - DPRINT1("Failed to commit virtual memory for TEB\n"); - return Status; - } - Process->TebLastAllocated = TebBase; - PsUnlockProcess(Process); - } - - DPRINT ("TebBase %p TebSize %lu\n", TebBase, TebSize); - ASSERT(NULL != TebBase && PAGE_SIZE <= TebSize); - - RtlZeroMemory(&Teb, sizeof(TEB)); - /* set all pointers to and from the TEB */ - Teb.Tib.Self = TebBase; - if (Thread->ThreadsProcess) - { - Teb.Peb = Thread->ThreadsProcess->Peb; /* No PEB yet!! */ - } - DPRINT("Teb.Peb %x\n", Teb.Peb); - - /* store stack information from InitialTeb */ - if(InitialTeb != NULL) - { - /* fixed-size stack */ - if(InitialTeb->StackBase && InitialTeb->StackLimit) - { - Teb.Tib.StackBase = InitialTeb->StackBase; - Teb.Tib.StackLimit = InitialTeb->StackLimit; - Teb.DeallocationStack = InitialTeb->StackLimit; - } - /* expandable stack */ - else - { - Teb.Tib.StackBase = InitialTeb->StackCommit; - Teb.Tib.StackLimit = InitialTeb->StackCommitMax; - Teb.DeallocationStack = InitialTeb->StackReserved; - } - } - - /* more initialization */ - Teb.Cid.UniqueThread = Thread->Cid.UniqueThread; - Teb.Cid.UniqueProcess = Thread->Cid.UniqueProcess; - Teb.CurrentLocale = PsDefaultThreadLocaleId; - - /* Terminate the exception handler list */ - Teb.Tib.ExceptionList = (PVOID)-1; - - DPRINT("sizeof(TEB) %x\n", sizeof(TEB)); - - /* write TEB data into teb page */ - Status = NtWriteVirtualMemory(ProcessHandle, - TebBase, - &Teb, - sizeof(TEB), - &ByteCount); - - if (!NT_SUCCESS(Status)) - { - /* free TEB */ - DPRINT1 ("Writing TEB failed!\n"); - - RegionSize = 0; - NtFreeVirtualMemory(ProcessHandle, - TebBase, - &RegionSize, - MEM_RELEASE); - - return Status; - } - - if (TebPtr != NULL) - { - *TebPtr = (PTEB)TebBase; - } - - DPRINT("TEB allocated at %p\n", TebBase); - - return Status; -} - - -VOID STDCALL -LdrInitApcRundownRoutine ( PKAPC Apc ) -{ - ExFreePool(Apc); -} - - -VOID STDCALL -LdrInitApcKernelRoutine ( - PKAPC Apc, - PKNORMAL_ROUTINE* NormalRoutine, - PVOID* NormalContext, - PVOID* SystemArgument1, - PVOID* SystemArgument2) -{ - ExFreePool(Apc); -} - - -NTSTATUS STDCALL -NtCreateThread ( - OUT PHANDLE ThreadHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, - IN HANDLE ProcessHandle, - OUT PCLIENT_ID ClientId, - IN PCONTEXT ThreadContext, - IN PINITIAL_TEB InitialTeb, - IN BOOLEAN CreateSuspended ) -{ - HANDLE hThread; - CONTEXT SafeContext; - INITIAL_TEB SafeInitialTeb; - PEPROCESS Process; - PETHREAD Thread; - PTEB TebBase; - PKAPC LdrInitApc; - KIRQL oldIrql; - KPROCESSOR_MODE PreviousMode; - NTSTATUS Status = STATUS_SUCCESS; - - PAGED_CODE(); - - if(ThreadContext == NULL) - { - return STATUS_INVALID_PARAMETER; - } - - PreviousMode = ExGetPreviousMode(); - - if(PreviousMode != KernelMode) - { - _SEH_TRY - { - ProbeForWrite(ThreadHandle, - sizeof(HANDLE), - sizeof(ULONG)); - if(ClientId != NULL) - { - ProbeForWrite(ClientId, - sizeof(CLIENT_ID), - sizeof(ULONG)); - } - ProbeForRead(ThreadContext, - sizeof(CONTEXT), - sizeof(ULONG)); - SafeContext = *ThreadContext; - ThreadContext = &SafeContext; - ProbeForRead(InitialTeb, - sizeof(INITIAL_TEB), - sizeof(ULONG)); - SafeInitialTeb = *InitialTeb; - InitialTeb = &SafeInitialTeb; - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(!NT_SUCCESS(Status)) - { - return Status; - } - } - - DPRINT("NtCreateThread(ThreadHandle %x, PCONTEXT %x)\n", - ThreadHandle,ThreadContext); - - Status = ObReferenceObjectByHandle( - ProcessHandle, - PROCESS_CREATE_THREAD, - PsProcessType, - PreviousMode, - (PVOID*)&Process, - NULL); - if(!NT_SUCCESS(Status)) - { - return(Status); - } - - Status = PsLockProcess(Process, FALSE); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject(Process); - return(Status); - } - - if(Process->ExitTime.QuadPart != 0) - { - PsUnlockProcess(Process); - return STATUS_PROCESS_IS_TERMINATING; - } - - PsUnlockProcess(Process); - - Status = PsInitializeThread(Process, - &Thread, - ObjectAttributes, - PreviousMode, - FALSE); - - ObDereferenceObject(Process); - - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - /* create a client id handle */ - Status = PsCreateCidHandle ( - Thread, PsThreadType, &Thread->Cid.UniqueThread); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject(Thread); - return Status; - } - - Status = KiArchInitThreadWithContext(&Thread->Tcb, ThreadContext); - if (!NT_SUCCESS(Status)) - { - PsDeleteCidHandle(Thread->Cid.UniqueThread, PsThreadType); - ObDereferenceObject(Thread); - return(Status); - } - - Status = PsCreateTeb(ProcessHandle, - &TebBase, - Thread, - InitialTeb); - if (!NT_SUCCESS(Status)) - { - PsDeleteCidHandle(Thread->Cid.UniqueThread, PsThreadType); - ObDereferenceObject(Thread); - return(Status); - } - Thread->Tcb.Teb = TebBase; - - Thread->StartAddress = NULL; - - /* - * Maybe send a message to the process's debugger - */ - DbgkCreateThread((PVOID)ThreadContext->Eip); - - /* - * First, force the thread to be non-alertable for user-mode alerts. - */ - Thread->Tcb.Alertable = FALSE; - - /* - * If the thread is to be created suspended then queue an APC to - * do the suspend before we run any userspace code. - */ - if (CreateSuspended) - { - KeSuspendThread(&Thread->Tcb); - } - - /* - * Queue an APC to the thread that will execute the ntdll startup - * routine. - */ - LdrInitApc = ExAllocatePoolWithTag ( - NonPagedPool, sizeof(KAPC), TAG_KAPC ); - KeInitializeApc ( - LdrInitApc, - &Thread->Tcb, - OriginalApcEnvironment, - LdrInitApcKernelRoutine, - LdrInitApcRundownRoutine, - LdrpGetSystemDllEntryPoint(), - UserMode, - NULL ); - KeInsertQueueApc(LdrInitApc, NULL, NULL, IO_NO_INCREMENT); - - /* - * The thread is non-alertable, so the APC we added did not set UserApcPending to TRUE. - * We must do this manually. Do NOT attempt to set the Thread to Alertable before the call, - * doing so is a blatant and erronous hack. - */ - Thread->Tcb.ApcState.UserApcPending = TRUE; - Thread->Tcb.Alerted[KernelMode] = TRUE; - - oldIrql = KeAcquireDispatcherDatabaseLock (); - KiUnblockThread(&Thread->Tcb, NULL, 0); - KeReleaseDispatcherDatabaseLock(oldIrql); - - Status = ObInsertObject((PVOID)Thread, - NULL, - DesiredAccess, - 0, - NULL, - &hThread); - if(NT_SUCCESS(Status)) - { - _SEH_TRY - { - if(ClientId != NULL) - { - *ClientId = Thread->Cid; - } - *ThreadHandle = hThread; - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } - - return Status; -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -PsCreateSystemThread ( - PHANDLE ThreadHandle, - ACCESS_MASK DesiredAccess, - POBJECT_ATTRIBUTES ObjectAttributes, - HANDLE ProcessHandle, - PCLIENT_ID ClientId, - PKSTART_ROUTINE StartRoutine, - PVOID StartContext ) -/* - * FUNCTION: Creates a thread which executes in kernel mode - * ARGUMENTS: - * ThreadHandle (OUT) = Caller supplied storage for the returned thread - * handle - * DesiredAccess = Requested access to the thread - * ObjectAttributes = Object attributes (optional) - * ProcessHandle = Handle of process thread will run in - * NULL to use system process - * ClientId (OUT) = Caller supplied storage for the returned client id - * of the thread (optional) - * StartRoutine = Entry point for the thread - * StartContext = Argument supplied to the thread when it begins - * execution - * RETURNS: Success or failure status - */ -{ - PETHREAD Thread; - NTSTATUS Status; - KIRQL oldIrql; - - PAGED_CODE(); - - DPRINT("PsCreateSystemThread(ThreadHandle %x, ProcessHandle %x)\n", - ThreadHandle,ProcessHandle); - - Status = PsInitializeThread( - NULL, - &Thread, - ObjectAttributes, - KernelMode, - FALSE); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - /* Set the thread as a system thread */ - Thread->SystemThread = TRUE; - - Status = PsCreateCidHandle(Thread, - PsThreadType, - &Thread->Cid.UniqueThread); - if(!NT_SUCCESS(Status)) - { - ObDereferenceObject(Thread); - return Status; - } - - Thread->StartAddress = StartRoutine; - Status = KiArchInitThread ( - &Thread->Tcb, StartRoutine, StartContext); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject(Thread); - return(Status); - } - - if (ClientId != NULL) - { - *ClientId=Thread->Cid; - } - - oldIrql = KeAcquireDispatcherDatabaseLock (); - KiUnblockThread(&Thread->Tcb, NULL, 0); - KeReleaseDispatcherDatabaseLock(oldIrql); - - Status = ObInsertObject( - (PVOID)Thread, - NULL, - DesiredAccess, - 0, - NULL, - ThreadHandle); - - /* don't dereference the thread, the initial reference serves as the keep-alive - reference which will be removed by the thread reaper */ - - return Status; -} - - -VOID STDCALL -PspRunCreateThreadNotifyRoutines ( - PETHREAD CurrentThread, - BOOLEAN Create ) -{ - ULONG i; - CLIENT_ID Cid = CurrentThread->Cid; - - for (i = 0; i < PiThreadNotifyRoutineCount; i++) - { - PiThreadNotifyRoutine[i](Cid.UniqueProcess, Cid.UniqueThread, Create); - } -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -PsSetCreateThreadNotifyRoutine ( - IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine ) -{ - if (PiThreadNotifyRoutineCount >= MAX_THREAD_NOTIFY_ROUTINE_COUNT) - { - return(STATUS_INSUFFICIENT_RESOURCES); - } - - PiThreadNotifyRoutine[PiThreadNotifyRoutineCount] = NotifyRoutine; - PiThreadNotifyRoutineCount++; - - return(STATUS_SUCCESS); -} - -/* EOF */ diff --git a/reactos/ntoskrnl/ps/debug.c b/reactos/ntoskrnl/ps/debug.c index a9015623aa8..b4c0cb15c4e 100644 --- a/reactos/ntoskrnl/ps/debug.c +++ b/reactos/ntoskrnl/ps/debug.c @@ -267,4 +267,78 @@ NtSetContextThread(IN HANDLE ThreadHandle, return Status; } +VOID +STDCALL +PspDumpThreads(BOOLEAN IncludeSystem) +{ + PLIST_ENTRY CurrentThread, CurrentProcess; + PEPROCESS Process; + PETHREAD Thread; + ULONG nThreads = 0; + + /* Loop all Active Processes */ + CurrentProcess = PsActiveProcessHead.Flink; + while(CurrentProcess != &PsActiveProcessHead) + { + + /* Get the process */ + Process = CONTAINING_RECORD(CurrentProcess, EPROCESS, ProcessListEntry); + + /* Skip the Initial Process if requested */ + if((Process != PsInitialSystemProcess) || + (Process == PsInitialSystemProcess && IncludeSystem)) + { + /* Loop all its threads */ + CurrentThread = Process->ThreadListHead.Flink; + while(CurrentThread != &Process->ThreadListHead) + { + + /* Get teh Thread */ + Thread = CONTAINING_RECORD(CurrentThread, ETHREAD, ThreadListEntry); + nThreads++; + + /* Print the Info */ + DbgPrint("State %d Affinity %08x Priority %d PID.TID %d.%d Name %.8s Stack: \n", + Thread->Tcb.State, + Thread->Tcb.Affinity, + Thread->Tcb.Priority, + Thread->Cid.UniqueProcess, + Thread->Cid.UniqueThread, + Thread->ThreadsProcess->ImageFileName); + + /* Make sure it's not running */ + if(Thread->Tcb.State == Ready || + Thread->Tcb.State == Standby || + Thread->Tcb.State == Waiting) + { + ULONG i = 0; + PULONG Esp = (PULONG)Thread->Tcb.KernelStack; + PULONG Ebp = (PULONG)Esp[4]; + + /* Print EBP */ + DbgPrint("Ebp 0x%.8X\n", Ebp); + + /* Walk it */ + while(Ebp != 0 && Ebp >= (PULONG)Thread->Tcb.StackLimit) + { + /* Print what's on the stack */ + DbgPrint("%.8X %.8X%s", Ebp[0], Ebp[1], (i % 8) == 7 ? "\n" : " "); + Ebp = (PULONG)Ebp[0]; + i++; + } + + /* Print a new line if there's nothing */ + if((i % 8) != 0) DbgPrint("\n"); + } + } + + /* Move to the next Thread */ + CurrentThread = CurrentThread->Flink; + } + + /* Move to the next Process */ + CurrentProcess = CurrentProcess->Flink; + } +} + /* EOF */ diff --git a/reactos/ntoskrnl/ps/idle.c b/reactos/ntoskrnl/ps/idle.c index b8d2598c9b1..62b846f75da 100644 --- a/reactos/ntoskrnl/ps/idle.c +++ b/reactos/ntoskrnl/ps/idle.c @@ -1,11 +1,11 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ps/idle.c * PURPOSE: Using idle time * - * PROGRAMMERS: David Welch (welch@cwcom.net) + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * David Welch (welch@cwcom.net) */ /* INCLUDES *****************************************************************/ @@ -19,7 +19,7 @@ extern PEPROCESS PsIdleProcess; /* FUNCTIONS *****************************************************************/ - + /** System idle thread procedure * */ @@ -45,45 +45,70 @@ PsIdleThreadMain(PVOID Context) } } +/* + * HACK-O-RAMA + * Antique vestigial code left alive for the sole purpose of First/Idle Thread + * creation until I can merge my fix for properly creating them. + */ +NTSTATUS +PsInitializeIdleOrFirstThread(PEPROCESS Process, + PETHREAD* ThreadPtr, + PKSTART_ROUTINE StartRoutine, + KPROCESSOR_MODE AccessMode, + BOOLEAN First) +{ + PETHREAD Thread; + PVOID KernelStack; + extern unsigned int init_stack; -/** Initialization of system idle thread - * - */ -VOID INIT_FUNCTION + Thread = ExAllocatePool(NonPagedPool, sizeof(ETHREAD)); + RtlZeroMemory(Thread, sizeof(ETHREAD)); + Thread->ThreadsProcess = Process; + if (First) + { + KernelStack = (PVOID)init_stack; + } + else + { + KernelStack = MmCreateKernelStack(FALSE); + } + KeInitializeThread(&Process->Pcb, + &Thread->Tcb, + PspSystemThreadStartup, + StartRoutine, + NULL, + NULL, + NULL, + KernelStack); + Thread->Tcb.ApcQueueable = TRUE; + InitializeListHead(&Thread->IrpList); + *ThreadPtr = Thread; + return STATUS_SUCCESS; +} + +/* + * HACK-O-RAMA + * Antique vestigial code left alive for the sole purpose of First/Idle Thread + * creation until I can merge my fix for properly creating them. + */ +VOID +INIT_FUNCTION PsInitIdleThread(VOID) { - NTSTATUS Status; - PETHREAD IdleThread; - KIRQL oldIrql; + PETHREAD IdleThread; + KIRQL oldIrql; - Status = PsInitializeThread(PsIdleProcess, - &IdleThread, - NULL, - KernelMode, - FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Couldn't create idle system thread! Status: 0x%x\n", Status); - KEBUGCHECK(0); - return; - } - - IdleThread->StartAddress = PsIdleThreadMain; - Status = KiArchInitThread(&IdleThread->Tcb, PsIdleThreadMain, NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Couldn't initialize system idle thread! Status: 0x%x\n", Status); - ObDereferenceObject(IdleThread); - KEBUGCHECK(0); - return; - } + PsInitializeIdleOrFirstThread(PsIdleProcess, + &IdleThread, + PsIdleThreadMain, + KernelMode, + FALSE); - oldIrql = KeAcquireDispatcherDatabaseLock (); - KiUnblockThread(&IdleThread->Tcb, NULL, 0); - KeReleaseDispatcherDatabaseLock(oldIrql); - - KeGetCurrentPrcb()->IdleThread = &IdleThread->Tcb; - KeSetPriorityThread(&IdleThread->Tcb, LOW_PRIORITY); - KeSetAffinityThread(&IdleThread->Tcb, 1 << 0); + oldIrql = KeAcquireDispatcherDatabaseLock (); + KiUnblockThread(&IdleThread->Tcb, NULL, 0); + KeReleaseDispatcherDatabaseLock(oldIrql); + KeGetCurrentPrcb()->IdleThread = &IdleThread->Tcb; + KeSetPriorityThread(&IdleThread->Tcb, LOW_PRIORITY); + KeSetAffinityThread(&IdleThread->Tcb, 1 << 0); } diff --git a/reactos/ntoskrnl/ps/kill.c b/reactos/ntoskrnl/ps/kill.c index cda7b57c0ce..171374b8920 100644 --- a/reactos/ntoskrnl/ps/kill.c +++ b/reactos/ntoskrnl/ps/kill.c @@ -79,6 +79,35 @@ PspReapRoutine(PVOID Context) KeReleaseDispatcherDatabaseLock(OldIrql); } +VOID +STDCALL +PspKillMostProcesses(VOID) +{ + PLIST_ENTRY current_entry; + PEPROCESS current; + + /* Acquire the Active Process Lock */ + ExAcquireFastMutex(&PspActiveProcessMutex); + + /* Loop all processes on the list */ + current_entry = PsActiveProcessHead.Flink; + while (current_entry != &PsActiveProcessHead) + { + current = CONTAINING_RECORD(current_entry, EPROCESS, ProcessListEntry); + current_entry = current_entry->Flink; + + if (current->UniqueProcessId != PsInitialSystemProcess->UniqueProcessId && + current->UniqueProcessId != PsGetCurrentProcessId()) + { + /* Terminate all the Threads in this Process */ + PspTerminateProcessThreads(current, STATUS_SUCCESS); + } + } + + /* Release the lock */ + ExReleaseFastMutex(&PspActiveProcessMutex); +} + VOID STDCALL PspTerminateProcessThreads(PEPROCESS Process, @@ -117,8 +146,13 @@ PspDeleteProcess(PVOID ObjectBody) { PEPROCESS Process = (PEPROCESS)ObjectBody; - DPRINT("PiDeleteProcess(ObjectBody %x)\n",Process); + DPRINT("PiDeleteProcess(ObjectBody %x)\n", ObjectBody); + /* Remove it from the Active List */ + ExAcquireFastMutex(&PspActiveProcessMutex); + RemoveEntryList(&Process->ProcessListEntry); + ExReleaseFastMutex(&PspActiveProcessMutex); + /* Delete the CID Handle */ if(Process->UniqueProcessId != NULL) { @@ -157,8 +191,8 @@ PspDeleteThread(PVOID ObjectBody) /* Free the W32THREAD structure if present */ if(Thread->Tcb.Win32Thread != NULL) ExFreePool (Thread->Tcb.Win32Thread); - /* Release the Thread */ - KeReleaseThread(ETHREAD_TO_KTHREAD(Thread)); + /* Release the Kernel Stack */ + MmDeleteKernelStack((PVOID)Thread->Tcb.StackLimit, FALSE); /* Dereference the Process */ ObDereferenceObject(Process); @@ -175,9 +209,8 @@ PspExitThread(NTSTATUS ExitStatus) PETHREAD CurrentThread; BOOLEAN Last; PEPROCESS CurrentProcess; - SIZE_T Length = PAGE_SIZE; - PVOID TebBlock; PTERMINATION_PORT TerminationPort; + PTEB Teb; DPRINT("PspExitThread(ExitStatus %x), Current: 0x%x\n", ExitStatus, PsGetCurrentThread()); @@ -256,26 +289,10 @@ PspExitThread(NTSTATUS ExitStatus) //CmNotifyRunDown(CurrentThread); /* Free the TEB */ - if(CurrentThread->Tcb.Teb) { - - DPRINT("Decommit teb at %p\n", CurrentThread->Tcb.Teb); - TebBlock = MM_ROUND_DOWN(CurrentThread->Tcb.Teb, MM_VIRTMEM_GRANULARITY); - - ZwFreeVirtualMemory(NtCurrentProcess(), - (PVOID *)&CurrentThread->Tcb.Teb, - &Length, - MEM_DECOMMIT); - - DPRINT("teb %p, TebBlock %p\n", CurrentThread->Tcb.Teb, TebBlock); - - if (TebBlock != CurrentProcess->TebBlock || - CurrentProcess->TebBlock == CurrentProcess->TebLastAllocated) { - - MmLockAddressSpace(&CurrentProcess->AddressSpace); - MmReleaseMemoryAreaIfDecommitted(CurrentProcess, &CurrentProcess->AddressSpace, TebBlock); - MmUnlockAddressSpace(&CurrentProcess->AddressSpace); - } + if((Teb = CurrentThread->Tcb.Teb)) { + DPRINT("Decommit teb at %p\n", Teb); + MmDeleteTeb(CurrentProcess, Teb); CurrentThread->Tcb.Teb = NULL; } @@ -399,12 +416,7 @@ PspExitProcess(PEPROCESS Process) DPRINT("PspExitProcess 0x%x\n", Process); PspRunCreateProcessNotifyRoutines(Process, FALSE); - - /* Remove it from the Active List */ - ExAcquireFastMutex(&PspActiveProcessMutex); - RemoveEntryList(&Process->ProcessListEntry); - ExReleaseFastMutex(&PspActiveProcessMutex); - + /* close all handles associated with our process, this needs to be done when the last thread still runs */ ObKillProcess(Process); diff --git a/reactos/ntoskrnl/ps/notify.c b/reactos/ntoskrnl/ps/notify.c new file mode 100644 index 00000000000..2622610be0a --- /dev/null +++ b/reactos/ntoskrnl/ps/notify.c @@ -0,0 +1,235 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ps/notify.c + * PURPOSE: Notifications + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES ****************************************************************/ + +#include +#define NDEBUG +#include + +/* GLOBAL *******************************************************************/ + +#define MAX_THREAD_NOTIFY_ROUTINE_COUNT 8 +#define TAG_KAPC TAG('k','p','a','p') /* kpap - kernel ps apc */ + +static ULONG PspThreadNotifyRoutineCount = 0; +static PCREATE_THREAD_NOTIFY_ROUTINE +PspThreadNotifyRoutine[MAX_THREAD_NOTIFY_ROUTINE_COUNT]; + +static PCREATE_PROCESS_NOTIFY_ROUTINE +PspProcessNotifyRoutine[MAX_PROCESS_NOTIFY_ROUTINE_COUNT]; + +static PLOAD_IMAGE_NOTIFY_ROUTINE +PspLoadImageNotifyRoutine[MAX_LOAD_IMAGE_NOTIFY_ROUTINE_COUNT]; + +static PVOID PspLegoNotifyRoutine; + +/* FUNCTIONS ***************************************************************/ + +/* + * @implemented + */ +NTSTATUS +STDCALL +PsSetCreateProcessNotifyRoutine(IN PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine, + IN BOOLEAN Remove) +{ + ULONG i; + + /* Check if it's a removal or addition */ + if (Remove) + { + /* Loop the routines */ + for(i=0;i= MAX_THREAD_NOTIFY_ROUTINE_COUNT) + { + return(STATUS_INSUFFICIENT_RESOURCES); + } + + PspThreadNotifyRoutine[PspThreadNotifyRoutineCount] = NotifyRoutine; + PspThreadNotifyRoutineCount++; + + return(STATUS_SUCCESS); +} + +VOID +STDCALL +PspRunCreateThreadNotifyRoutines(PETHREAD CurrentThread, + BOOLEAN Create) +{ + ULONG i; + CLIENT_ID Cid = CurrentThread->Cid; + + for (i = 0; i < PspThreadNotifyRoutineCount; i++) + { + PspThreadNotifyRoutine[i](Cid.UniqueProcess, Cid.UniqueThread, Create); + } +} + +VOID +STDCALL +PspRunCreateProcessNotifyRoutines(PEPROCESS CurrentProcess, + BOOLEAN Create) +{ + ULONG i; + HANDLE ProcessId = (HANDLE)CurrentProcess->UniqueProcessId; + HANDLE ParentId = CurrentProcess->InheritedFromUniqueProcessId; + + for(i = 0; i < MAX_PROCESS_NOTIFY_ROUTINE_COUNT; ++i) + { + if(PspProcessNotifyRoutine[i]) + { + PspProcessNotifyRoutine[i](ParentId, ProcessId, Create); + } + } +} + +VOID +STDCALL +PspRunLoadImageNotifyRoutines(PUNICODE_STRING FullImageName, + HANDLE ProcessId, + PIMAGE_INFO ImageInfo) +{ + ULONG i; + + for (i = 0; i < MAX_PROCESS_NOTIFY_ROUTINE_COUNT; ++ i) + { + if (PspLoadImageNotifyRoutine[i]) + { + PspLoadImageNotifyRoutine[i](FullImageName, ProcessId, ImageInfo); + } + } +} + +/* EOF */ diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 6211a6a2afc..1999b566876 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -1,11 +1,11 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ps/process.c * PURPOSE: Process managment * - * PROGRAMMERS: David Welch (welch@cwcom.net) + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * David Welch (welch@cwcom.net) */ /* INCLUDES ******************************************************************/ @@ -16,1632 +16,15 @@ /* GLOBALS ******************************************************************/ -VOID INIT_FUNCTION PsInitClientIDManagment(VOID); - PEPROCESS EXPORTED PsInitialSystemProcess = NULL; PEPROCESS PsIdleProcess = NULL; - POBJECT_TYPE EXPORTED PsProcessType = NULL; LIST_ENTRY PsActiveProcessHead; FAST_MUTEX PspActiveProcessMutex; -static LARGE_INTEGER ShortPsLockDelay, PsLockTimeout; - -static GENERIC_MAPPING PiProcessMapping = {STANDARD_RIGHTS_READ | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, - STANDARD_RIGHTS_WRITE | PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | - PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_DUP_HANDLE | - PROCESS_TERMINATE | PROCESS_SET_QUOTA | PROCESS_SET_INFORMATION | PROCESS_SET_PORT, - STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE, - PROCESS_ALL_ACCESS}; - -#define MAX_PROCESS_NOTIFY_ROUTINE_COUNT 8 -#define MAX_LOAD_IMAGE_NOTIFY_ROUTINE_COUNT 8 - -static PCREATE_PROCESS_NOTIFY_ROUTINE -PiProcessNotifyRoutine[MAX_PROCESS_NOTIFY_ROUTINE_COUNT]; -static PLOAD_IMAGE_NOTIFY_ROUTINE -PiLoadImageNotifyRoutine[MAX_LOAD_IMAGE_NOTIFY_ROUTINE_COUNT]; - - -/* FUNCTIONS *****************************************************************/ - -PEPROCESS -PsGetNextProcess(PEPROCESS OldProcess) -{ - PEPROCESS NextProcess; - NTSTATUS Status; - - if (OldProcess == NULL) - { - Status = ObReferenceObjectByPointer(PsIdleProcess, - PROCESS_ALL_ACCESS, - PsProcessType, - KernelMode); - if (!NT_SUCCESS(Status)) - { - CPRINT("PsGetNextProcess(): ObReferenceObjectByPointer failed for PsIdleProcess\n"); - KEBUGCHECK(0); - } - return PsIdleProcess; - } - - ExAcquireFastMutex(&PspActiveProcessMutex); - NextProcess = OldProcess; - while (1) - { - PLIST_ENTRY Flink = (NextProcess == PsIdleProcess ? PsActiveProcessHead.Flink : - NextProcess->ProcessListEntry.Flink); - if (Flink != &PsActiveProcessHead) - { - NextProcess = CONTAINING_RECORD(Flink, - EPROCESS, - ProcessListEntry); - } - else - { - NextProcess = NULL; - break; - } - - Status = ObReferenceObjectByPointer(NextProcess, - PROCESS_ALL_ACCESS, - PsProcessType, - KernelMode); - if (NT_SUCCESS(Status)) - { - break; - } - else if (Status == STATUS_PROCESS_IS_TERMINATING) - { - continue; - } - else if (!NT_SUCCESS(Status)) - { - continue; - } - } - - ExReleaseFastMutex(&PspActiveProcessMutex); - ObDereferenceObject(OldProcess); - - return(NextProcess); -} - -VOID -PiKillMostProcesses(VOID) -{ - PLIST_ENTRY current_entry; - PEPROCESS current; - - ExAcquireFastMutex(&PspActiveProcessMutex); - - current_entry = PsActiveProcessHead.Flink; - while (current_entry != &PsActiveProcessHead) - { - current = CONTAINING_RECORD(current_entry, EPROCESS, - ProcessListEntry); - current_entry = current_entry->Flink; - - if (current->UniqueProcessId != PsInitialSystemProcess->UniqueProcessId && - current->UniqueProcessId != PsGetCurrentProcessId()) - { - PspTerminateProcessThreads(current, STATUS_SUCCESS); - } - } - - ExReleaseFastMutex(&PspActiveProcessMutex); -} - -VOID INIT_FUNCTION -PsInitProcessManagment(VOID) -{ - PKPROCESS KProcess; - NTSTATUS Status; - - ShortPsLockDelay.QuadPart = -100LL; - PsLockTimeout.QuadPart = -10000000LL; /* one second */ - /* - * Register the process object type - */ - - PsProcessType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); - - PsProcessType->Tag = TAG('P', 'R', 'O', 'C'); - PsProcessType->TotalObjects = 0; - PsProcessType->TotalHandles = 0; - PsProcessType->PeakObjects = 0; - PsProcessType->PeakHandles = 0; - PsProcessType->PagedPoolCharge = 0; - PsProcessType->NonpagedPoolCharge = sizeof(EPROCESS); - PsProcessType->Mapping = &PiProcessMapping; - PsProcessType->Dump = NULL; - PsProcessType->Open = NULL; - PsProcessType->Close = NULL; - PsProcessType->Delete = PspDeleteProcess; - PsProcessType->Parse = NULL; - PsProcessType->Security = NULL; - PsProcessType->QueryName = NULL; - PsProcessType->OkayToClose = NULL; - PsProcessType->Create = NULL; - PsProcessType->DuplicationNotify = NULL; - - RtlInitUnicodeString(&PsProcessType->TypeName, L"Process"); - - ObpCreateTypeObject(PsProcessType); - - InitializeListHead(&PsActiveProcessHead); - ExInitializeFastMutex(&PspActiveProcessMutex); - - RtlZeroMemory(PiProcessNotifyRoutine, sizeof(PiProcessNotifyRoutine)); - RtlZeroMemory(PiLoadImageNotifyRoutine, sizeof(PiLoadImageNotifyRoutine)); - - /* - * Initialize the idle process - */ - Status = ObCreateObject(KernelMode, - PsProcessType, - NULL, - KernelMode, - NULL, - sizeof(EPROCESS), - 0, - 0, - (PVOID*)&PsIdleProcess); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create the idle process object, Status: 0x%x\n", Status); - KEBUGCHECK(0); - return; - } - - RtlZeroMemory(PsIdleProcess, sizeof(EPROCESS)); - - PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF; - PsIdleProcess->Pcb.IopmOffset = 0xffff; - PsIdleProcess->Pcb.LdtDescriptor[0] = 0; - PsIdleProcess->Pcb.LdtDescriptor[1] = 0; - PsIdleProcess->Pcb.BasePriority = PROCESS_PRIO_IDLE; - PsIdleProcess->Pcb.ThreadQuantum = 6; - InitializeListHead(&PsIdleProcess->Pcb.ThreadListHead); - InitializeListHead(&PsIdleProcess->ThreadListHead); - InitializeListHead(&PsIdleProcess->ProcessListEntry); - KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.DispatcherHeader, - ProcessObject, - sizeof(EPROCESS), - FALSE); - PsIdleProcess->Pcb.DirectoryTableBase = - (LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory(); - strcpy(PsIdleProcess->ImageFileName, "Idle"); - - /* - * Initialize the system process - */ - Status = ObCreateObject(KernelMode, - PsProcessType, - NULL, - KernelMode, - NULL, - sizeof(EPROCESS), - 0, - 0, - (PVOID*)&PsInitialSystemProcess); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create the system process object, Status: 0x%x\n", Status); - KEBUGCHECK(0); - return; - } - - /* System threads may run on any processor. */ - PsInitialSystemProcess->Pcb.Affinity = 0xFFFFFFFF; - PsInitialSystemProcess->Pcb.IopmOffset = 0xffff; - PsInitialSystemProcess->Pcb.LdtDescriptor[0] = 0; - PsInitialSystemProcess->Pcb.LdtDescriptor[1] = 0; - PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIO_NORMAL; - PsInitialSystemProcess->Pcb.ThreadQuantum = 6; - InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead); - KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.DispatcherHeader, - ProcessObject, - sizeof(EPROCESS), - FALSE); - KProcess = &PsInitialSystemProcess->Pcb; - - MmInitializeAddressSpace(PsInitialSystemProcess, - &PsInitialSystemProcess->AddressSpace); - - KeInitializeEvent(&PsInitialSystemProcess->LockEvent, SynchronizationEvent, FALSE); - PsInitialSystemProcess->LockCount = 0; - PsInitialSystemProcess->LockOwner = NULL; - -#if defined(__GNUC__) - KProcess->DirectoryTableBase = - (LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory(); -#else - { - LARGE_INTEGER dummy; - dummy.QuadPart = (LONGLONG)(ULONG)MmGetPageDirectory(); - KProcess->DirectoryTableBase = dummy; - } -#endif - - strcpy(PsInitialSystemProcess->ImageFileName, "System"); - - PsInitialSystemProcess->Win32WindowStation = (HANDLE)0; - - InsertHeadList(&PsActiveProcessHead, - &PsInitialSystemProcess->ProcessListEntry); - InitializeListHead(&PsInitialSystemProcess->ThreadListHead); - - SepCreateSystemProcessToken(PsInitialSystemProcess); -} - -VOID -PspPostInitSystemProcess(VOID) -{ - NTSTATUS Status; - - /* this routine is called directly after the exectuive handle tables were - initialized. We'll set up the Client ID handle table and assign the system - process a PID */ - PsInitClientIDManagment(); - - ObCreateHandleTable(NULL, FALSE, PsInitialSystemProcess); - - Status = PsCreateCidHandle(PsInitialSystemProcess, - PsProcessType, - &PsInitialSystemProcess->UniqueProcessId); - if(!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create CID handle (unique process id) for the system process!\n"); - KEBUGCHECK(0); - } -} - -static NTSTATUS -PsCreatePeb(HANDLE ProcessHandle, - PEPROCESS Process, - PVOID ImageBase) -{ - ULONG AllocSize; - ULONG PebSize; - PPEB Peb; - LARGE_INTEGER SectionOffset; - ULONG ViewSize; - PVOID TableBase; - NTSTATUS Status; - - PAGED_CODE(); - - /* Allocate the Process Environment Block (PEB) */ - Process->TebBlock = (PVOID) MM_ROUND_DOWN(PEB_BASE, MM_VIRTMEM_GRANULARITY); - AllocSize = MM_VIRTMEM_GRANULARITY; - Status = NtAllocateVirtualMemory(ProcessHandle, - &Process->TebBlock, - 0, - &AllocSize, - MEM_RESERVE, - PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtAllocateVirtualMemory() failed (Status %lx)\n", Status); - return(Status); - } - ASSERT((ULONG_PTR) Process->TebBlock <= PEB_BASE && - PEB_BASE + PAGE_SIZE <= (ULONG_PTR) Process->TebBlock + AllocSize); - Peb = (PPEB)PEB_BASE; - PebSize = PAGE_SIZE; - Status = NtAllocateVirtualMemory(ProcessHandle, - (PVOID*)&Peb, - 0, - &PebSize, - MEM_COMMIT, - PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtAllocateVirtualMemory() failed (Status %lx)\n", Status); - return(Status); - } - DPRINT("Peb %p PebSize %lu\n", Peb, PebSize); - ASSERT((PPEB) PEB_BASE == Peb && PAGE_SIZE <= PebSize); - Process->TebLastAllocated = (PVOID) Peb; - - ViewSize = 0; - SectionOffset.QuadPart = (ULONGLONG)0; - TableBase = NULL; - Status = MmMapViewOfSection(NlsSectionObject, - Process, - &TableBase, - 0, - 0, - &SectionOffset, - &ViewSize, - ViewShare, - MEM_TOP_DOWN, - PAGE_READONLY); - if (!NT_SUCCESS(Status)) - { - DPRINT1("MmMapViewOfSection() failed (Status %lx)\n", Status); - return(Status); - } - DPRINT("TableBase %p ViewSize %lx\n", TableBase, ViewSize); - - KeAttachProcess(&Process->Pcb); - - /* Initialize the PEB */ - RtlZeroMemory(Peb, sizeof(PEB)); - Peb->ImageBaseAddress = ImageBase; - - Peb->OSMajorVersion = 4; - Peb->OSMinorVersion = 0; - Peb->OSBuildNumber = 1381; - Peb->OSPlatformId = 2; //VER_PLATFORM_WIN32_NT; - Peb->OSCSDVersion = 6 << 8; - - Peb->AnsiCodePageData = (char*)TableBase + NlsAnsiTableOffset; - Peb->OemCodePageData = (char*)TableBase + NlsOemTableOffset; - Peb->UnicodeCaseTableData = (char*)TableBase + NlsUnicodeTableOffset; - - Process->Peb = Peb; - KeDetachProcess(); - - DPRINT("PsCreatePeb: Peb created at %p\n", Peb); - - return(STATUS_SUCCESS); -} - - -PKPROCESS -KeGetCurrentProcess(VOID) -/* - * FUNCTION: Returns a pointer to the current process - */ -{ - return(&(PsGetCurrentProcess()->Pcb)); -} - -/* - * Warning: Even though it returns HANDLE, it's not a real HANDLE but really a - * ULONG ProcessId! (Skywing) - */ -/* - * @implemented - */ -HANDLE STDCALL -PsGetCurrentProcessId(VOID) -{ - return((HANDLE)PsGetCurrentProcess()->UniqueProcessId); -} - -/* - * @unimplemented - */ -ULONG -STDCALL -PsGetCurrentProcessSessionId ( - VOID - ) -{ - return PsGetCurrentProcess()->SessionId; -} - -/* - * FUNCTION: Returns a pointer to the current process - * - * @implemented - */ -PEPROCESS STDCALL -IoGetCurrentProcess(VOID) -{ - if (PsGetCurrentThread() == NULL || - PsGetCurrentThread()->Tcb.ApcState.Process == NULL) - { - return(PsInitialSystemProcess); - } - else - { - return(PEPROCESS)(PsGetCurrentThread()->Tcb.ApcState.Process); - } -} - -NTSTATUS -PspCreateProcess(OUT PHANDLE ProcessHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, - IN HANDLE ParentProcess OPTIONAL, - IN BOOLEAN InheritObjectTable, - IN HANDLE SectionHandle OPTIONAL, - IN HANDLE DebugPort OPTIONAL, - IN HANDLE ExceptionPort OPTIONAL) -{ - HANDLE hProcess; - PEPROCESS Process; - PEPROCESS pParentProcess; - PKPROCESS KProcess; - PVOID LdrStartupAddr; - PVOID BaseAddress; - PMEMORY_AREA MemoryArea; - PHYSICAL_ADDRESS BoundaryAddressMultiple; - KPROCESSOR_MODE PreviousMode; - PVOID ImageBase = NULL; - PEPORT pDebugPort = NULL; - PEPORT pExceptionPort = NULL; - PSECTION_OBJECT SectionObject = NULL; - NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("PspCreateProcess(ObjectAttributes %x)\n", ObjectAttributes); - - PreviousMode = ExGetPreviousMode(); - - BoundaryAddressMultiple.QuadPart = 0; - - if(ParentProcess != NULL) - { - Status = ObReferenceObjectByHandle(ParentProcess, - PROCESS_CREATE_PROCESS, - PsProcessType, - PreviousMode, - (PVOID*)&pParentProcess, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to reference the parent process: Status: 0x%x\n", Status); - return(Status); - } - } - else - { - pParentProcess = NULL; - } - - /* - * Add the debug port - */ - if (DebugPort != NULL) - { - Status = ObReferenceObjectByHandle(DebugPort, - PORT_ALL_ACCESS, - LpcPortObjectType, - PreviousMode, - (PVOID*)&pDebugPort, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to reference the debug port: Status: 0x%x\n", Status); - goto exitdereferenceobjects; - } - } - - /* - * Add the exception port - */ - if (ExceptionPort != NULL) - { - Status = ObReferenceObjectByHandle(ExceptionPort, - PORT_ALL_ACCESS, - LpcPortObjectType, - PreviousMode, - (PVOID*)&pExceptionPort, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to reference the exception port: Status: 0x%x\n", Status); - goto exitdereferenceobjects; - } - } - - if (SectionHandle != NULL) - { - Status = ObReferenceObjectByHandle(SectionHandle, - 0, - MmSectionObjectType, - PreviousMode, - (PVOID*)&SectionObject, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to reference process image section: Status: 0x%x\n", Status); - goto exitdereferenceobjects; - } - } - - Status = ObCreateObject(PreviousMode, - PsProcessType, - ObjectAttributes, - PreviousMode, - NULL, - sizeof(EPROCESS), - 0, - 0, - (PVOID*)&Process); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create process object, Status: 0x%x\n", Status); - -exitdereferenceobjects: - if(SectionObject != NULL) - ObDereferenceObject(SectionObject); - if(pExceptionPort != NULL) - ObDereferenceObject(pExceptionPort); - if(pDebugPort != NULL) - ObDereferenceObject(pDebugPort); - if(pParentProcess != NULL) - ObDereferenceObject(pParentProcess); - return Status; - } - - KProcess = &Process->Pcb; - - RtlZeroMemory(Process, sizeof(EPROCESS)); - - Status = PsCreateCidHandle(Process, - PsProcessType, - &Process->UniqueProcessId); - if(!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create CID handle (unique process ID)! Status: 0x%x\n", Status); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - - Process->DebugPort = pDebugPort; - Process->ExceptionPort = pExceptionPort; - - if(SectionObject != NULL) - { - UNICODE_STRING FileName; - PWCHAR szSrc; - PCHAR szDest; - USHORT lnFName = 0; - - /* - * Determine the image file name and save it to the EPROCESS structure - */ - - FileName = SectionObject->FileObject->FileName; - szSrc = (PWCHAR)(FileName.Buffer + (FileName.Length / sizeof(WCHAR)) - 1); - while(szSrc >= FileName.Buffer) - { - if(*szSrc == L'\\') - { - szSrc++; - break; - } - else - { - szSrc--; - lnFName++; - } - } - - /* copy the image file name to the process and truncate it to 15 characters - if necessary */ - szDest = Process->ImageFileName; - lnFName = min(lnFName, sizeof(Process->ImageFileName) - 1); - while(lnFName-- > 0) - { - *(szDest++) = (UCHAR)*(szSrc++); - } - /* *szDest = '\0'; */ - } - - KeInitializeDispatcherHeader(&KProcess->DispatcherHeader, - ProcessObject, - sizeof(EPROCESS), - FALSE); - - /* Inherit parent process's affinity. */ - if(pParentProcess != NULL) - { - KProcess->Affinity = pParentProcess->Pcb.Affinity; - Process->InheritedFromUniqueProcessId = pParentProcess->UniqueProcessId; - Process->SessionId = pParentProcess->SessionId; - } - else - { - KProcess->Affinity = KeActiveProcessors; - } - - KProcess->BasePriority = PROCESS_PRIO_NORMAL; - KProcess->IopmOffset = 0xffff; - KProcess->LdtDescriptor[0] = 0; - KProcess->LdtDescriptor[1] = 0; - InitializeListHead(&KProcess->ThreadListHead); - KProcess->ThreadQuantum = 6; - KProcess->AutoAlignment = 0; - MmInitializeAddressSpace(Process, - &Process->AddressSpace); - - ObCreateHandleTable(pParentProcess, - InheritObjectTable, - Process); - MmCopyMmInfo(pParentProcess ? pParentProcess : PsInitialSystemProcess, Process); - - KeInitializeEvent(&Process->LockEvent, SynchronizationEvent, FALSE); - Process->LockCount = 0; - Process->LockOwner = NULL; - - Process->Win32WindowStation = (HANDLE)0; - - ExAcquireFastMutex(&PspActiveProcessMutex); - InsertTailList(&PsActiveProcessHead, &Process->ProcessListEntry); - InitializeListHead(&Process->ThreadListHead); - ExReleaseFastMutex(&PspActiveProcessMutex); - - Process->Pcb.State = PROCESS_STATE_ACTIVE; - - /* - * Now we have created the process proper - */ - - MmLockAddressSpace(&Process->AddressSpace); - - /* Protect the highest 64KB of the process address space */ - BaseAddress = (PVOID)MmUserProbeAddress; - Status = MmCreateMemoryArea(Process, - &Process->AddressSpace, - MEMORY_AREA_NO_ACCESS, - &BaseAddress, - 0x10000, - PAGE_NOACCESS, - &MemoryArea, - FALSE, - FALSE, - BoundaryAddressMultiple); - if (!NT_SUCCESS(Status)) - { - MmUnlockAddressSpace(&Process->AddressSpace); - DPRINT1("Failed to protect the highest 64KB of the process address space\n"); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - - /* Protect the lowest 64KB of the process address space */ -#if 0 - BaseAddress = (PVOID)0x00000000; - Status = MmCreateMemoryArea(Process, - &Process->AddressSpace, - MEMORY_AREA_NO_ACCESS, - &BaseAddress, - 0x10000, - PAGE_NOACCESS, - &MemoryArea, - FALSE, - FALSE, - BoundaryAddressMultiple); - if (!NT_SUCCESS(Status)) - { - MmUnlockAddressSpace(&Process->AddressSpace); - DPRINT1("Failed to protect the lowest 64KB of the process address space\n"); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } -#endif - - /* Protect the 60KB above the shared user page */ - BaseAddress = (char*)USER_SHARED_DATA + PAGE_SIZE; - Status = MmCreateMemoryArea(Process, - &Process->AddressSpace, - MEMORY_AREA_NO_ACCESS, - &BaseAddress, - 0x10000 - PAGE_SIZE, - PAGE_NOACCESS, - &MemoryArea, - FALSE, - FALSE, - BoundaryAddressMultiple); - if (!NT_SUCCESS(Status)) - { - MmUnlockAddressSpace(&Process->AddressSpace); - DPRINT1("Failed to protect the memory above the shared user page\n"); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - - /* Create the shared data page */ - BaseAddress = (PVOID)USER_SHARED_DATA; - Status = MmCreateMemoryArea(Process, - &Process->AddressSpace, - MEMORY_AREA_SHARED_DATA, - &BaseAddress, - PAGE_SIZE, - PAGE_READONLY, - &MemoryArea, - FALSE, - FALSE, - BoundaryAddressMultiple); - MmUnlockAddressSpace(&Process->AddressSpace); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create shared data page\n"); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - -#if 1 - /* - * FIXME - the handle should be created after all things are initialized, NOT HERE! - */ - Status = ObInsertObject ((PVOID)Process, - NULL, - DesiredAccess, - 0, - NULL, - &hProcess); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create a handle for the process\n"); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } -#endif - - /* - * FIXME - Map ntdll - */ - Status = LdrpMapSystemDll(hProcess, /* FIXME - hProcess shouldn't be available at this point! */ - &LdrStartupAddr); - if (!NT_SUCCESS(Status)) - { - DbgPrint("LdrpMapSystemDll failed (Status %x)\n", Status); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - - /* - * Map the process image - */ - if (SectionObject != NULL) - { - ULONG ViewSize = 0; - DPRINT("Mapping process image\n"); - Status = MmMapViewOfSection(SectionObject, - Process, - (PVOID*)&ImageBase, - 0, - ViewSize, - NULL, - &ViewSize, - 0, - MEM_COMMIT, - PAGE_READWRITE); - ObDereferenceObject(SectionObject); - if (!NT_SUCCESS(Status)) - { - DbgPrint("Failed to map the process section (Status %x)\n", Status); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - } - - if(pParentProcess != NULL) - { - /* - * Duplicate the token - */ - Status = SepInitializeNewProcess(Process, pParentProcess); - if (!NT_SUCCESS(Status)) - { - DbgPrint("SepInitializeNewProcess failed (Status %x)\n", Status); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - } - else - { - /* FIXME */ - } - - /* - * FIXME - Create PEB - */ - DPRINT("Creating PEB\n"); - Status = PsCreatePeb(hProcess, /* FIXME - hProcess shouldn't be available at this point! */ - Process, - ImageBase); - if (!NT_SUCCESS(Status)) - { - DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status); - ObDereferenceObject(Process); - goto exitdereferenceobjects; - } - - /* - * Maybe send a message to the creator process's debugger - */ -#if 0 - if (pParentProcess->DebugPort != NULL) - { - LPC_DBG_MESSAGE Message; - HANDLE FileHandle; - - ObCreateHandle(NULL, // Debugger Process - NULL, // SectionHandle - FILE_ALL_ACCESS, - FALSE, - &FileHandle); - - Message.Header.MessageSize = sizeof(LPC_DBG_MESSAGE); - Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) - - sizeof(LPC_MESSAGE); - Message.Type = DBG_EVENT_CREATE_PROCESS; - Message.Data.CreateProcess.FileHandle = FileHandle; - Message.Data.CreateProcess.Base = ImageBase; - Message.Data.CreateProcess.EntryPoint = NULL; // - - Status = LpcSendDebugMessagePort(pParentProcess->DebugPort, - &Message); - } -#endif - - PspRunCreateProcessNotifyRoutines(Process, TRUE); - - /* - * FIXME - the handle should be created not before this point! - */ -#if 0 - Status = ObInsertObject ((PVOID)Process, - NULL, - DesiredAccess, - 0, - NULL, - &hProcess); -#endif - if (NT_SUCCESS(Status)) - { - _SEH_TRY - { - *ProcessHandle = hProcess; - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } - - /* - * don't dereference the debug port, exception port and section object even - * if ObInsertObject() failed, the process is alive! We just couldn't return - * the handle to the caller! - */ - - ObDereferenceObject(Process); - if(pParentProcess != NULL) - ObDereferenceObject(pParentProcess); - - return Status; -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -PsCreateSystemProcess(PHANDLE ProcessHandle, - ACCESS_MASK DesiredAccess, - POBJECT_ATTRIBUTES ObjectAttributes) -{ - return PspCreateProcess(ProcessHandle, - DesiredAccess, - ObjectAttributes, - NULL, /* no parent process */ - FALSE, - NULL, - NULL, - NULL); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -NtCreateProcess(OUT PHANDLE ProcessHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, - IN HANDLE ParentProcess, - IN BOOLEAN InheritObjectTable, - IN HANDLE SectionHandle OPTIONAL, - IN HANDLE DebugPort OPTIONAL, - IN HANDLE ExceptionPort OPTIONAL) -/* - * FUNCTION: Creates a process. - * ARGUMENTS: - * ProcessHandle (OUT) = Caller supplied storage for the resulting - * handle - * DesiredAccess = Specifies the allowed or desired access to the - * process can be a combination of - * STANDARD_RIGHTS_REQUIRED| .. - * ObjectAttribute = Initialized attributes for the object, contains - * the rootdirectory and the filename - * ParentProcess = Handle to the parent process. - * InheritObjectTable = Specifies to inherit the objects of the parent - * process if true. - * SectionHandle = Handle to a section object to back the image file - * DebugPort = Handle to a DebugPort if NULL the system default debug - * port will be used. - * ExceptionPort = Handle to a exception port. - * REMARKS: - * This function maps to the win32 CreateProcess. - * RETURNS: Status - */ -{ - KPROCESSOR_MODE PreviousMode; - NTSTATUS Status = STATUS_SUCCESS; - - PAGED_CODE(); - - PreviousMode = ExGetPreviousMode(); - - if(PreviousMode != KernelMode) - { - _SEH_TRY - { - ProbeForWrite(ProcessHandle, - sizeof(HANDLE), - sizeof(ULONG)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(!NT_SUCCESS(Status)) - { - return Status; - } - } - - if(ParentProcess == NULL) - { - Status = STATUS_INVALID_PARAMETER; - } - else - { - Status = PspCreateProcess(ProcessHandle, - DesiredAccess, - ObjectAttributes, - ParentProcess, - InheritObjectTable, - SectionHandle, - DebugPort, - ExceptionPort); - } - - return Status; -} - - -/* - * @unimplemented - */ -NTSTATUS STDCALL -NtOpenProcess(OUT PHANDLE ProcessHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN PCLIENT_ID ClientId) -{ - DPRINT("NtOpenProcess(ProcessHandle %x, DesiredAccess %x, " - "ObjectAttributes %x, ClientId %x { UniP %d, UniT %d })\n", - ProcessHandle, DesiredAccess, ObjectAttributes, ClientId, - ClientId->UniqueProcess, ClientId->UniqueThread); - - PAGED_CODE(); - - /* - * Not sure of the exact semantics - */ - if (ObjectAttributes != NULL && ObjectAttributes->ObjectName != NULL && - ObjectAttributes->ObjectName->Buffer != NULL) - { - NTSTATUS Status; - PEPROCESS Process; - - Status = ObReferenceObjectByName(ObjectAttributes->ObjectName, - ObjectAttributes->Attributes, - NULL, - DesiredAccess, - PsProcessType, - UserMode, - NULL, - (PVOID*)&Process); - if (Status != STATUS_SUCCESS) - { - return(Status); - } - - Status = ObCreateHandle(PsGetCurrentProcess(), - Process, - DesiredAccess, - FALSE, - ProcessHandle); - ObDereferenceObject(Process); - - return(Status); - } - else - { - PLIST_ENTRY current_entry; - PEPROCESS current; - NTSTATUS Status; - - ExAcquireFastMutex(&PspActiveProcessMutex); - current_entry = PsActiveProcessHead.Flink; - while (current_entry != &PsActiveProcessHead) - { - current = CONTAINING_RECORD(current_entry, EPROCESS, - ProcessListEntry); - if (current->UniqueProcessId == ClientId->UniqueProcess) - { - if (current->Pcb.State == PROCESS_STATE_TERMINATED) - { - Status = STATUS_PROCESS_IS_TERMINATING; - } - else - { - Status = ObReferenceObjectByPointer(current, - DesiredAccess, - PsProcessType, - UserMode); - } - ExReleaseFastMutex(&PspActiveProcessMutex); - if (NT_SUCCESS(Status)) - { - Status = ObCreateHandle(PsGetCurrentProcess(), - current, - DesiredAccess, - FALSE, - ProcessHandle); - ObDereferenceObject(current); - DPRINT("*ProcessHandle %x\n", ProcessHandle); - DPRINT("NtOpenProcess() = %x\n", Status); - } - return(Status); - } - current_entry = current_entry->Flink; - } - ExReleaseFastMutex(&PspActiveProcessMutex); - DPRINT("NtOpenProcess() = STATUS_UNSUCCESSFUL\n"); - return(STATUS_UNSUCCESSFUL); - } -} - -/* - * @implemented - */ -LARGE_INTEGER STDCALL -PsGetProcessExitTime(VOID) -{ - LARGE_INTEGER Li; - Li.QuadPart = PsGetCurrentProcess()->ExitTime.QuadPart; - return Li; -} - -/* - * @implemented - */ -LONGLONG -STDCALL -PsGetProcessCreateTimeQuadPart( - PEPROCESS Process - ) -{ - return Process->CreateTime.QuadPart; -} - -/* - * @implemented - */ -PVOID -STDCALL -PsGetProcessDebugPort( - PEPROCESS Process - ) -{ - return Process->DebugPort; -} - -/* - * @implemented - */ -BOOLEAN -STDCALL -PsGetProcessExitProcessCalled( - PEPROCESS Process - ) -{ - return Process->ExitProcessCalled; -} - -/* - * @implemented - */ -NTSTATUS -STDCALL -PsGetProcessExitStatus( - PEPROCESS Process - ) -{ - return Process->ExitStatus; -} - -/* - * @implemented - */ -HANDLE -STDCALL -PsGetProcessId( - PEPROCESS Process - ) -{ - return (HANDLE)Process->UniqueProcessId; -} - -/* - * @implemented - */ -LPSTR -STDCALL -PsGetProcessImageFileName( - PEPROCESS Process - ) -{ - return (LPSTR)Process->ImageFileName; -} - -/* - * @implemented - */ -HANDLE -STDCALL -PsGetProcessInheritedFromUniqueProcessId( - PEPROCESS Process - ) -{ - return Process->InheritedFromUniqueProcessId; -} - -/* - * @implemented - */ -PEJOB -STDCALL -PsGetProcessJob( - PEPROCESS Process - ) -{ - return Process->Job; -} - -/* - * @implemented - */ -PPEB -STDCALL -PsGetProcessPeb( - PEPROCESS Process - ) -{ - return Process->Peb; -} - -/* - * @implemented - */ -ULONG -STDCALL -PsGetProcessPriorityClass( - PEPROCESS Process - ) -{ - return Process->PriorityClass; -} - -/* - * @implemented - */ -PVOID -STDCALL -PsGetProcessSectionBaseAddress( - PEPROCESS Process - ) -{ - return Process->SectionBaseAddress; -} - -/* - * @implemented - */ -PVOID -STDCALL -PsGetProcessSecurityPort( - PEPROCESS Process - ) -{ - return Process->SecurityPort; -} - -/* - * @implemented - */ -HANDLE -STDCALL -PsGetProcessSessionId( - PEPROCESS Process - ) -{ - return (HANDLE)Process->SessionId; -} - -/* - * @implemented - */ -PVOID -STDCALL -PsGetProcessWin32Process( - PEPROCESS Process - ) -{ - return Process->Win32Process; -} - -/* - * @implemented - */ -PVOID -STDCALL -PsGetProcessWin32WindowStation( - PEPROCESS Process - ) -{ - return Process->Win32WindowStation; -} - -/* - * @implemented - */ -BOOLEAN -STDCALL -PsIsProcessBeingDebugged( - PEPROCESS Process - ) -{ - return FALSE/*Process->IsProcessBeingDebugged*/; -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -PsLookupProcessByProcessId(IN HANDLE ProcessId, - OUT PEPROCESS *Process) -{ - PHANDLE_TABLE_ENTRY CidEntry; - PEPROCESS FoundProcess; - - PAGED_CODE(); - - ASSERT(Process); - - CidEntry = PsLookupCidHandle(ProcessId, PsProcessType, (PVOID*)&FoundProcess); - if(CidEntry != NULL) - { - ObReferenceObject(FoundProcess); - - PsUnlockCidHandle(CidEntry); - - *Process = FoundProcess; - return STATUS_SUCCESS; - } - - return STATUS_INVALID_PARAMETER; -} - -VOID -STDCALL -PspRunCreateProcessNotifyRoutines -( - PEPROCESS CurrentProcess, - BOOLEAN Create -) -{ - ULONG i; - HANDLE ProcessId = (HANDLE)CurrentProcess->UniqueProcessId; - HANDLE ParentId = CurrentProcess->InheritedFromUniqueProcessId; - - for(i = 0; i < MAX_PROCESS_NOTIFY_ROUTINE_COUNT; ++ i) - if(PiProcessNotifyRoutine[i]) - PiProcessNotifyRoutine[i](ParentId, ProcessId, Create); -} - -/* - * @implemented - */ -NTSTATUS STDCALL -PsSetCreateProcessNotifyRoutine(IN PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine, - IN BOOLEAN Remove) -{ - ULONG i; - - if (Remove) - { - for(i=0;iPriorityClass = PriorityClass; -} - -/* - * @implemented - */ -VOID -STDCALL -PsSetProcessSecurityPort( - PEPROCESS Process, - PVOID SecurityPort - ) -{ - Process->SecurityPort = SecurityPort; -} - -/* - * @implemented - */ -VOID -STDCALL -PsSetProcessWin32Process( - PEPROCESS Process, - PVOID Win32Process - ) -{ - Process->Win32Process = Win32Process; -} - -/* - * @implemented - */ -VOID -STDCALL -PsSetProcessWin32WindowStation( - PEPROCESS Process, - PVOID WindowStation - ) -{ - Process->Win32WindowStation = WindowStation; -} - -/* Pool Quotas */ -/* - * @implemented - */ -VOID -STDCALL -PsChargePoolQuota( - IN PEPROCESS Process, - IN POOL_TYPE PoolType, - IN ULONG_PTR Amount - ) -{ - NTSTATUS Status; - - /* Charge the usage */ - Status = PsChargeProcessPoolQuota(Process, PoolType, Amount); - - /* Raise Exception */ - if (!NT_SUCCESS(Status)) { - ExRaiseStatus(Status); - } -} - -/* - * @implemented - */ -NTSTATUS -STDCALL -PsChargeProcessNonPagedPoolQuota ( - IN PEPROCESS Process, - IN ULONG_PTR Amount - ) -{ - /* Call the general function */ - return PsChargeProcessPoolQuota(Process, NonPagedPool, Amount); -} - -/* - * @implemented - */ -NTSTATUS -STDCALL -PsChargeProcessPagedPoolQuota ( - IN PEPROCESS Process, - IN ULONG_PTR Amount - ) -{ - /* Call the general function */ - return PsChargeProcessPoolQuota(Process, PagedPool, Amount); -} - -/* - * @implemented - */ -NTSTATUS -STDCALL -PsChargeProcessPoolQuota( - IN PEPROCESS Process, - IN POOL_TYPE PoolType, - IN ULONG_PTR Amount - ) -{ - PEPROCESS_QUOTA_BLOCK QuotaBlock; - ULONG NewUsageSize; - ULONG NewMaxQuota; - - /* Get current Quota Block */ - QuotaBlock = Process->QuotaBlock; - - /* Quota Operations are not to be done on the SYSTEM Process */ - if (Process == PsInitialSystemProcess) return STATUS_SUCCESS; - - /* New Size in use */ - NewUsageSize = QuotaBlock->QuotaEntry[PoolType].Usage + Amount; - - /* Does this size respect the quota? */ - if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Limit) { - - /* It doesn't, so keep raising the Quota */ - while (MiRaisePoolQuota(PoolType, QuotaBlock->QuotaEntry[PoolType].Limit, &NewMaxQuota)) { - /* Save new Maximum Quota */ - QuotaBlock->QuotaEntry[PoolType].Limit = NewMaxQuota; - - /* See if the new Maximum Quota fulfills our need */ - if (NewUsageSize <= NewMaxQuota) goto QuotaChanged; - } - - return STATUS_QUOTA_EXCEEDED; - } - -QuotaChanged: - /* Save new Usage */ - QuotaBlock->QuotaEntry[PoolType].Usage = NewUsageSize; - - /* Is this a new peak? */ - if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Peak) { - QuotaBlock->QuotaEntry[PoolType].Peak = NewUsageSize; - } - - /* All went well */ - return STATUS_SUCCESS; -} - -/* - * @unimplemented - */ -VOID -STDCALL -PsReturnPoolQuota( - IN PEPROCESS Process, - IN POOL_TYPE PoolType, - IN ULONG_PTR Amount - ) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -STDCALL -PsReturnProcessNonPagedPoolQuota( - IN PEPROCESS Process, - IN ULONG_PTR Amount - ) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -STDCALL -PsReturnProcessPagedPoolQuota( - IN PEPROCESS Process, - IN ULONG_PTR Amount - ) -{ - UNIMPLEMENTED; -} +LARGE_INTEGER ShortPsLockDelay, PsLockTimeout; + +/* INTERNAL FUNCTIONS *****************************************************************/ NTSTATUS PsLockProcess(PEPROCESS Process, BOOLEAN Timeout) @@ -1717,4 +100,822 @@ PsUnlockProcess(PEPROCESS Process) KeLeaveCriticalRegion(); } +PEPROCESS +STDCALL +PsGetNextProcess(PEPROCESS OldProcess) +{ + PEPROCESS NextProcess; + NTSTATUS Status; + + /* Check if we have a previous process */ + if (OldProcess == NULL) + { + /* We don't, start with the Idle Process */ + Status = ObReferenceObjectByPointer(PsIdleProcess, + PROCESS_ALL_ACCESS, + PsProcessType, + KernelMode); + if (!NT_SUCCESS(Status)) + { + DPRINT1("PsGetNextProcess(): ObReferenceObjectByPointer failed for PsIdleProcess\n"); + KEBUGCHECK(0); + } + + return PsIdleProcess; + } + + /* Acquire the Active Process Lock */ + ExAcquireFastMutex(&PspActiveProcessMutex); + + /* Start at the previous process */ + NextProcess = OldProcess; + + /* Loop until we fail */ + while (1) + { + /* Get the Process Link */ + PLIST_ENTRY Flink = (NextProcess == PsIdleProcess ? PsActiveProcessHead.Flink : + NextProcess->ProcessListEntry.Flink); + + /* Move to the next Process if we're not back at the beginning */ + if (Flink != &PsActiveProcessHead) + { + NextProcess = CONTAINING_RECORD(Flink, EPROCESS, ProcessListEntry); + } + else + { + NextProcess = NULL; + break; + } + + /* Reference the Process */ + Status = ObReferenceObjectByPointer(NextProcess, + PROCESS_ALL_ACCESS, + PsProcessType, + KernelMode); + + /* Exit the loop if the reference worked, keep going if there's an error */ + if (NT_SUCCESS(Status)) break; + } + + /* Release the lock */ + ExReleaseFastMutex(&PspActiveProcessMutex); + + /* Reference the Process we had referenced earlier */ + ObDereferenceObject(OldProcess); + return(NextProcess); +} + +NTSTATUS +STDCALL +PspCreateProcess(OUT PHANDLE ProcessHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ParentProcess OPTIONAL, + IN BOOLEAN InheritObjectTable, + IN HANDLE SectionHandle OPTIONAL, + IN HANDLE DebugPort OPTIONAL, + IN HANDLE ExceptionPort OPTIONAL) +{ + HANDLE hProcess; + PEPROCESS Process; + PEPROCESS pParentProcess; + PEPORT pDebugPort = NULL; + PEPORT pExceptionPort = NULL; + PSECTION_OBJECT SectionObject = NULL; + NTSTATUS Status = STATUS_SUCCESS; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + PHYSICAL_ADDRESS DirectoryTableBase; + KAFFINITY Affinity; + DirectoryTableBase.QuadPart = (ULONGLONG)0; + + DPRINT("PspCreateProcess(ObjectAttributes %x)\n", ObjectAttributes); + + /* Reference the Parent if there is one */ + if(ParentProcess != NULL) + { + Status = ObReferenceObjectByHandle(ParentProcess, + PROCESS_CREATE_PROCESS, + PsProcessType, + PreviousMode, + (PVOID*)&pParentProcess, + NULL); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to reference the parent process: Status: 0x%x\n", Status); + return(Status); + } + + /* Inherit Parent process's Affinity. */ + Affinity = pParentProcess->Pcb.Affinity; + + } + else + { + pParentProcess = NULL; + Affinity = KeActiveProcessors; + } + + /* Add the debug port */ + if (DebugPort != NULL) + { + Status = ObReferenceObjectByHandle(DebugPort, + PORT_ALL_ACCESS, + LpcPortObjectType, + PreviousMode, + (PVOID*)&pDebugPort, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to reference the debug port: Status: 0x%x\n", Status); + goto exitdereferenceobjects; + } + } + + /* Add the exception port */ + if (ExceptionPort != NULL) + { + Status = ObReferenceObjectByHandle(ExceptionPort, + PORT_ALL_ACCESS, + LpcPortObjectType, + PreviousMode, + (PVOID*)&pExceptionPort, + NULL); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to reference the exception port: Status: 0x%x\n", Status); + goto exitdereferenceobjects; + } + } + + /* Add the Section */ + if (SectionHandle != NULL) + { + Status = ObReferenceObjectByHandle(SectionHandle, + 0, + MmSectionObjectType, + PreviousMode, + (PVOID*)&SectionObject, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to reference process image section: Status: 0x%x\n", Status); + goto exitdereferenceobjects; + } + } + + /* Create the Object */ + DPRINT("Creating Process Object\n"); + Status = ObCreateObject(PreviousMode, + PsProcessType, + ObjectAttributes, + PreviousMode, + NULL, + sizeof(EPROCESS), + 0, + 0, + (PVOID*)&Process); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create process object, Status: 0x%x\n", Status); + goto exitdereferenceobjects; + } + + /* Clean up the Object */ + DPRINT("Cleaning Process Object\n"); + RtlZeroMemory(Process, sizeof(EPROCESS)); + + /* Inherit stuff from the Parent since we now have the object created */ + if (pParentProcess) + { + Process->InheritedFromUniqueProcessId = pParentProcess->UniqueProcessId; + Process->SessionId = pParentProcess->SessionId; + } + + /* FIXME: Set up the Quota Block from the Parent + PspInheritQuota(Parent, Process); */ + + /* FIXME: Set up Dos Device Map from the Parent + ObInheritDeviceMap(Parent, Process) */ + + /* Set the Process' LPC Ports */ + Process->DebugPort = pDebugPort; + Process->ExceptionPort = pExceptionPort; + + /* Setup the Lock Event */ + DPRINT("Initialzing Process Lock\n"); + KeInitializeEvent(&Process->LockEvent, SynchronizationEvent, FALSE); + + /* Setup the Thread List Head */ + DPRINT("Initialzing Process ThreadListHead\n"); + InitializeListHead(&Process->ThreadListHead); + + /* Create or Clone the Handle Table */ + DPRINT("Initialzing Process Handle Table\n"); + ObCreateHandleTable(pParentProcess, InheritObjectTable, Process); + DPRINT("Handle Table: %x\n", Process->ObjectTable); + + /* Set Process's Directory Base */ + DPRINT("Initialzing Process Directory Base\n"); + MmCopyMmInfo(pParentProcess ? pParentProcess : PsInitialSystemProcess, + Process, + &DirectoryTableBase); + + /* Now initialize the Kernel Process */ + DPRINT("Initialzing Kernel Process\n"); + KeInitializeProcess(&Process->Pcb, + PROCESS_PRIO_NORMAL, + Affinity, + DirectoryTableBase); + + /* Duplicate Parent Token */ + DPRINT("Initialzing Process Token\n"); + Status = PspInitializeProcessSecurity(Process, pParentProcess); + if (!NT_SUCCESS(Status)) + { + DbgPrint("PspInitializeProcessSecurity failed (Status %x)\n", Status); + ObDereferenceObject(Process); + goto exitdereferenceobjects; + } + + /* Create the Process' Address Space */ + DPRINT("Initialzing Process Address Space\n"); + Status = MmCreateProcessAddressSpace(Process, SectionObject); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create Address Space\n"); + ObDereferenceObject(Process); + goto exitdereferenceobjects; + } + + if (SectionObject) + { + /* Map the System Dll */ + DPRINT("Mapping System DLL\n"); + LdrpMapSystemDll(Process, NULL); + } + + /* Create a handle for the Process */ + DPRINT("Initialzing Process CID Handle\n"); + Status = PsCreateCidHandle(Process, + PsProcessType, + &Process->UniqueProcessId); + DPRINT("Created CID: %d\n", Process->UniqueProcessId); + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create CID handle (unique process ID)! Status: 0x%x\n", Status); + ObDereferenceObject(Process); + goto exitdereferenceobjects; + } + + /* FIXME: Insert into Job Object */ + + /* Create PEB only for User-Mode Processes */ + if (pParentProcess) + { + DPRINT("Creating PEB\n"); + Status = MmCreatePeb(Process); + if (!NT_SUCCESS(Status)) + { + DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status); + ObDereferenceObject(Process); + goto exitdereferenceobjects; + } + + /* Let's take advantage of this time to kill the reference too */ + ObDereferenceObject(pParentProcess); + pParentProcess = NULL; + } + + /* W00T! The process can now be activated */ + DPRINT("Inserting into Active Process List\n"); + ExAcquireFastMutex(&PspActiveProcessMutex); + InsertTailList(&PsActiveProcessHead, &Process->ProcessListEntry); + ExReleaseFastMutex(&PspActiveProcessMutex); + + /* FIXME: SeCreateAccessStateEx */ + + /* Insert the Process into the Object Directory */ + DPRINT("Inserting Process Object\n"); + Status = ObInsertObject(Process, + NULL, + DesiredAccess, + 0, + NULL, + &hProcess); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Could not get a handle to the Process Object\n"); + ObDereferenceObject(Process); + goto exitdereferenceobjects; + } + + /* Set the Creation Time */ + KeQuerySystemTime(&Process->CreateTime); + + DPRINT("Done. Returning handle: %x\n", hProcess); + _SEH_TRY + { + *ProcessHandle = hProcess; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } _SEH_END; + + /* FIXME: ObGetObjectSecurity(Process, &SecurityDescriptor) + SeAccessCheck + */ + ObDereferenceObject(Process); + return Status; + +exitdereferenceobjects: + if(SectionObject != NULL) ObDereferenceObject(SectionObject); + if(pExceptionPort != NULL) ObDereferenceObject(pExceptionPort); + if(pDebugPort != NULL) ObDereferenceObject(pDebugPort); + if(pParentProcess != NULL) ObDereferenceObject(pParentProcess); + return Status; +} + +/* PUBLIC FUNCTIONS *****************************************************************/ + +/* + * @implemented + */ +NTSTATUS +STDCALL +PsCreateSystemProcess(PHANDLE ProcessHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes) +{ + return PspCreateProcess(ProcessHandle, + DesiredAccess, + ObjectAttributes, + NULL, /* no parent process */ + FALSE, + NULL, + NULL, + NULL); +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +PsLookupProcessByProcessId(IN HANDLE ProcessId, + OUT PEPROCESS *Process) +{ + PHANDLE_TABLE_ENTRY CidEntry; + PEPROCESS FoundProcess; + + PAGED_CODE(); + + ASSERT(Process); + + CidEntry = PsLookupCidHandle(ProcessId, PsProcessType, (PVOID*)&FoundProcess); + if(CidEntry != NULL) + { + ObReferenceObject(FoundProcess); + + PsUnlockCidHandle(CidEntry); + + *Process = FoundProcess; + return STATUS_SUCCESS; + } + + return STATUS_INVALID_PARAMETER; +} + +/* + * FUNCTION: Returns a pointer to the current process + * + * @implemented + */ +PEPROCESS STDCALL +IoGetCurrentProcess(VOID) +{ + if (PsGetCurrentThread() == NULL || + PsGetCurrentThread()->Tcb.ApcState.Process == NULL) + { + return(PsInitialSystemProcess); + } + else + { + return(PEPROCESS)(PsGetCurrentThread()->Tcb.ApcState.Process); + } +} + +/* + * @implemented + */ +LARGE_INTEGER STDCALL +PsGetProcessExitTime(VOID) +{ + LARGE_INTEGER Li; + Li.QuadPart = PsGetCurrentProcess()->ExitTime.QuadPart; + return Li; +} + +/* + * @implemented + */ +LONGLONG +STDCALL +PsGetProcessCreateTimeQuadPart(PEPROCESS Process) +{ + return Process->CreateTime.QuadPart; +} + +/* + * @implemented + */ +PVOID +STDCALL +PsGetProcessDebugPort(PEPROCESS Process) +{ + return Process->DebugPort; +} + +/* + * @implemented + */ +BOOLEAN +STDCALL +PsGetProcessExitProcessCalled(PEPROCESS Process) +{ + return Process->ExitProcessCalled; +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +PsGetProcessExitStatus(PEPROCESS Process) +{ + return Process->ExitStatus; +} + +/* + * @implemented + */ +HANDLE +STDCALL +PsGetProcessId(PEPROCESS Process) +{ + return (HANDLE)Process->UniqueProcessId; +} + +/* + * @implemented + */ +LPSTR +STDCALL +PsGetProcessImageFileName(PEPROCESS Process) +{ + return (LPSTR)Process->ImageFileName; +} + +/* + * @implemented + */ +HANDLE +STDCALL +PsGetProcessInheritedFromUniqueProcessId(PEPROCESS Process) +{ + return Process->InheritedFromUniqueProcessId; +} + +/* + * @implemented + */ +PEJOB +STDCALL +PsGetProcessJob(PEPROCESS Process) +{ + return Process->Job; +} + +/* + * @implemented + */ +PPEB +STDCALL +PsGetProcessPeb(PEPROCESS Process) +{ + return Process->Peb; +} + +/* + * @implemented + */ +ULONG +STDCALL +PsGetProcessPriorityClass(PEPROCESS Process) +{ + return Process->PriorityClass; +} + +/* + * @implemented + */ +HANDLE STDCALL +PsGetCurrentProcessId(VOID) +{ + return((HANDLE)PsGetCurrentProcess()->UniqueProcessId); +} + +/* + * @implemented + */ +ULONG +STDCALL +PsGetCurrentProcessSessionId(VOID) +{ + return PsGetCurrentProcess()->SessionId; +} + +/* + * @implemented + */ +PVOID +STDCALL +PsGetProcessSectionBaseAddress(PEPROCESS Process) +{ + return Process->SectionBaseAddress; +} + +/* + * @implemented + */ +PVOID +STDCALL +PsGetProcessSecurityPort(PEPROCESS Process) +{ + return Process->SecurityPort; +} + +/* + * @implemented + */ +HANDLE +STDCALL +PsGetProcessSessionId(PEPROCESS Process) +{ + return (HANDLE)Process->SessionId; +} + +/* + * @implemented + */ +PVOID +STDCALL +PsGetProcessWin32Process(PEPROCESS Process) +{ + return Process->Win32Process; +} + +/* + * @implemented + */ +PVOID +STDCALL +PsGetProcessWin32WindowStation(PEPROCESS Process) +{ + return Process->Win32WindowStation; +} + +/* + * @implemented + */ +BOOLEAN +STDCALL +PsIsProcessBeingDebugged(PEPROCESS Process) +{ + return FALSE; //Process->IsProcessBeingDebugged; +} + +/* + * @implemented + */ +VOID +STDCALL +PsSetProcessPriorityClass(PEPROCESS Process, + ULONG PriorityClass) +{ + Process->PriorityClass = PriorityClass; +} + +/* + * @implemented + */ +VOID +STDCALL +PsSetProcessSecurityPort(PEPROCESS Process, + PVOID SecurityPort) +{ + Process->SecurityPort = SecurityPort; +} + +/* + * @implemented + */ +VOID +STDCALL +PsSetProcessWin32Process(PEPROCESS Process, + PVOID Win32Process) +{ + Process->Win32Process = Win32Process; +} + +/* + * @implemented + */ +VOID +STDCALL +PsSetProcessWin32WindowStation(PEPROCESS Process, + PVOID WindowStation) +{ + Process->Win32WindowStation = WindowStation; +} + +/* + * FUNCTION: Creates a process. + * ARGUMENTS: + * ProcessHandle (OUT) = Caller supplied storage for the resulting + * handle + * DesiredAccess = Specifies the allowed or desired access to the + * process can be a combination of + * STANDARD_RIGHTS_REQUIRED| .. + * ObjectAttribute = Initialized attributes for the object, contains + * the rootdirectory and the filename + * ParentProcess = Handle to the parent process. + * InheritObjectTable = Specifies to inherit the objects of the parent + * process if true. + * SectionHandle = Handle to a section object to back the image file + * DebugPort = Handle to a DebugPort if NULL the system default debug + * port will be used. + * ExceptionPort = Handle to a exception port. + * REMARKS: + * This function maps to the win32 CreateProcess. + * RETURNS: Status + * + * @implemented + */ +NTSTATUS +STDCALL +NtCreateProcess(OUT PHANDLE ProcessHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ParentProcess, + IN BOOLEAN InheritObjectTable, + IN HANDLE SectionHandle OPTIONAL, + IN HANDLE DebugPort OPTIONAL, + IN HANDLE ExceptionPort OPTIONAL) +{ + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + NTSTATUS Status = STATUS_SUCCESS; + + PAGED_CODE(); + + /* Check parameters */ + if(PreviousMode != KernelMode) + { + _SEH_TRY + { + ProbeForWrite(ProcessHandle, + sizeof(HANDLE), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) return Status; + } + + /* Make sure there's a parent process */ + if(ParentProcess == NULL) + { + /* Can't create System Processes like this */ + Status = STATUS_INVALID_PARAMETER; + } + else + { + /* Create a user Process */ + Status = PspCreateProcess(ProcessHandle, + DesiredAccess, + ObjectAttributes, + ParentProcess, + InheritObjectTable, + SectionHandle, + DebugPort, + ExceptionPort); + } + + /* Return Status */ + return Status; +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +NtOpenProcess(OUT PHANDLE ProcessHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PCLIENT_ID ClientId) +{ + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + NTSTATUS Status = STATUS_INVALID_PARAMETER; + PEPROCESS Process; + PETHREAD Thread = NULL; + + DPRINT("NtOpenProcess(ProcessHandle %x, DesiredAccess %x, " + "ObjectAttributes %x, ClientId %x { UniP %d, UniT %d })\n", + ProcessHandle, DesiredAccess, ObjectAttributes, ClientId, + ClientId->UniqueProcess, ClientId->UniqueThread); + + PAGED_CODE(); + + /* Open by name if one was given */ + DPRINT("Checking type\n"); + if (ObjectAttributes->ObjectName) + { + /* Open it */ + DPRINT("Opening by name\n"); + Status = ObOpenObjectByName(ObjectAttributes, + PsProcessType, + NULL, + PreviousMode, + DesiredAccess, + NULL, + ProcessHandle); + + if (Status != STATUS_SUCCESS) + { + DPRINT1("Could not open object by name\n"); + } + + /* Return Status */ + DPRINT("Found: %x\n", ProcessHandle); + return(Status); + } + else if (ClientId) + { + /* Open by Thread ID */ + if (ClientId->UniqueThread) + { + /* Get the Process */ + if (ClientId->UniqueThread == (HANDLE)-1) KEBUGCHECK(0); + DPRINT("Opening by Thread ID: %x\n", ClientId->UniqueThread); + Status = PsLookupProcessThreadByCid(ClientId, + &Process, + &Thread); + DPRINT("Found: %x\n", Process); + } + else + { + /* Get the Process */ + DPRINT("Opening by Process ID: %x\n", ClientId->UniqueProcess); + Status = PsLookupProcessByProcessId(ClientId->UniqueProcess, + &Process); + DPRINT("Found: %x\n", Process); + } + + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failure to find process\n"); + return Status; + } + + /* Open the Process Object */ + Status = ObOpenObjectByPointer(Process, + ObjectAttributes->Attributes, + NULL, + DesiredAccess, + PsProcessType, + PreviousMode, + ProcessHandle); + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failure to open process\n"); + } + + /* Dereference the thread if we used it */ + if (Thread) ObDereferenceObject(Thread); + + /* Dereference the Process */ + ObDereferenceObject(Process); + } + + return Status; +} /* EOF */ diff --git a/reactos/ntoskrnl/ps/psmgr.c b/reactos/ntoskrnl/ps/psmgr.c index d8070ab7f56..f598acc55db 100644 --- a/reactos/ntoskrnl/ps/psmgr.c +++ b/reactos/ntoskrnl/ps/psmgr.c @@ -14,13 +14,44 @@ #define NDEBUG #include +extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout; +extern LIST_ENTRY PriorityListHead[MAXIMUM_PRIORITY]; + +static GENERIC_MAPPING PiProcessMapping = { + STANDARD_RIGHTS_READ | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, + STANDARD_RIGHTS_WRITE | PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | + PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_DUP_HANDLE | + PROCESS_TERMINATE | PROCESS_SET_QUOTA | PROCESS_SET_INFORMATION | + PROCESS_SUSPEND_RESUME, + STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE, + PROCESS_ALL_ACCESS}; + +static GENERIC_MAPPING PiThreadMapping = { + STANDARD_RIGHTS_READ | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, + STANDARD_RIGHTS_WRITE | THREAD_TERMINATE | THREAD_SUSPEND_RESUME | + THREAD_ALERT | THREAD_SET_INFORMATION | THREAD_SET_CONTEXT, + STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE, + THREAD_ALL_ACCESS}; + +BOOLEAN DoneInitYet = FALSE; + +extern ULONG NtBuildNumber; +extern ULONG NtMajorVersion; +extern ULONG NtMinorVersion; + +VOID +INIT_FUNCTION +PsInitClientIDManagment(VOID); + +VOID STDCALL PspKillMostProcesses(); + /* FUNCTIONS ***************************************************************/ VOID PiShutdownProcessManager(VOID) { DPRINT("PiShutdownProcessManager()\n"); - PiKillMostProcesses(); + PspKillMostProcesses(); } VOID INIT_FUNCTION @@ -33,7 +64,231 @@ PiInitProcessManager(VOID) PsInitialiseW32Call(); } +VOID +INIT_FUNCTION +PsInitThreadManagment(VOID) +/* + * FUNCTION: Initialize thread managment + */ +{ + PETHREAD FirstThread; + ULONG i; + for (i=0; i < MAXIMUM_PRIORITY; i++) + { + InitializeListHead(&PriorityListHead[i]); + } + + PsThreadType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE)); + + PsThreadType->Tag = TAG('T', 'H', 'R', 'T'); + PsThreadType->TotalObjects = 0; + PsThreadType->TotalHandles = 0; + PsThreadType->PeakObjects = 0; + PsThreadType->PeakHandles = 0; + PsThreadType->PagedPoolCharge = 0; + PsThreadType->NonpagedPoolCharge = sizeof(ETHREAD); + PsThreadType->Mapping = &PiThreadMapping; + PsThreadType->Dump = NULL; + PsThreadType->Open = NULL; + PsThreadType->Close = NULL; + PsThreadType->Delete = PspDeleteThread; + PsThreadType->Parse = NULL; + PsThreadType->Security = NULL; + PsThreadType->QueryName = NULL; + PsThreadType->OkayToClose = NULL; + PsThreadType->Create = NULL; + PsThreadType->DuplicationNotify = NULL; + + RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread"); + + ObpCreateTypeObject(PsThreadType); + + PsInitializeIdleOrFirstThread(PsInitialSystemProcess, &FirstThread, NULL, KernelMode, TRUE); + FirstThread->Tcb.State = Running; + FirstThread->Tcb.FreezeCount = 0; + FirstThread->Tcb.UserAffinity = (1 << 0); /* Set the affinity of the first thread to the boot processor */ + FirstThread->Tcb.Affinity = (1 << 0); + KeGetCurrentPrcb()->CurrentThread = (PVOID)FirstThread; + + DPRINT("FirstThread %x\n",FirstThread); + + DoneInitYet = TRUE; + + ExInitializeWorkItem(&PspReaperWorkItem, PspReapRoutine, NULL); +} + +VOID +INIT_FUNCTION +PsInitProcessManagment(VOID) +{ + PKPROCESS KProcess; + NTSTATUS Status; + + ShortPsLockDelay.QuadPart = -100LL; + PsLockTimeout.QuadPart = -10000000LL; /* one second */ + /* + * Register the process object type + */ + + PsProcessType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); + + PsProcessType->Tag = TAG('P', 'R', 'O', 'C'); + PsProcessType->TotalObjects = 0; + PsProcessType->TotalHandles = 0; + PsProcessType->PeakObjects = 0; + PsProcessType->PeakHandles = 0; + PsProcessType->PagedPoolCharge = 0; + PsProcessType->NonpagedPoolCharge = sizeof(EPROCESS); + PsProcessType->Mapping = &PiProcessMapping; + PsProcessType->Dump = NULL; + PsProcessType->Open = NULL; + PsProcessType->Close = NULL; + PsProcessType->Delete = PspDeleteProcess; + PsProcessType->Parse = NULL; + PsProcessType->Security = NULL; + PsProcessType->QueryName = NULL; + PsProcessType->OkayToClose = NULL; + PsProcessType->Create = NULL; + PsProcessType->DuplicationNotify = NULL; + + RtlInitUnicodeString(&PsProcessType->TypeName, L"Process"); + + ObpCreateTypeObject(PsProcessType); + + InitializeListHead(&PsActiveProcessHead); + ExInitializeFastMutex(&PspActiveProcessMutex); + + /* + * Initialize the idle process + */ + Status = ObCreateObject(KernelMode, + PsProcessType, + NULL, + KernelMode, + NULL, + sizeof(EPROCESS), + 0, + 0, + (PVOID*)&PsIdleProcess); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create the idle process object, Status: 0x%x\n", Status); + KEBUGCHECK(0); + return; + } + + RtlZeroMemory(PsIdleProcess, sizeof(EPROCESS)); + + PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF; + PsIdleProcess->Pcb.IopmOffset = 0xffff; + PsIdleProcess->Pcb.LdtDescriptor[0] = 0; + PsIdleProcess->Pcb.LdtDescriptor[1] = 0; + PsIdleProcess->Pcb.BasePriority = PROCESS_PRIO_IDLE; + PsIdleProcess->Pcb.ThreadQuantum = 6; + InitializeListHead(&PsIdleProcess->Pcb.ThreadListHead); + InitializeListHead(&PsIdleProcess->ThreadListHead); + InitializeListHead(&PsIdleProcess->ProcessListEntry); + KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.DispatcherHeader, + ProcessObject, + sizeof(EPROCESS), + FALSE); + PsIdleProcess->Pcb.DirectoryTableBase = + (LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory(); + strcpy(PsIdleProcess->ImageFileName, "Idle"); + + /* + * Initialize the system process + */ + Status = ObCreateObject(KernelMode, + PsProcessType, + NULL, + KernelMode, + NULL, + sizeof(EPROCESS), + 0, + 0, + (PVOID*)&PsInitialSystemProcess); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create the system process object, Status: 0x%x\n", Status); + KEBUGCHECK(0); + return; + } + + /* System threads may run on any processor. */ + PsInitialSystemProcess->Pcb.Affinity = 0xFFFFFFFF; + PsInitialSystemProcess->Pcb.IopmOffset = 0xffff; + PsInitialSystemProcess->Pcb.LdtDescriptor[0] = 0; + PsInitialSystemProcess->Pcb.LdtDescriptor[1] = 0; + PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIO_NORMAL; + PsInitialSystemProcess->Pcb.ThreadQuantum = 6; + InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead); + KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.DispatcherHeader, + ProcessObject, + sizeof(EPROCESS), + FALSE); + KProcess = &PsInitialSystemProcess->Pcb; + + MmInitializeAddressSpace(PsInitialSystemProcess, + &PsInitialSystemProcess->AddressSpace); + + KeInitializeEvent(&PsInitialSystemProcess->LockEvent, SynchronizationEvent, FALSE); + PsInitialSystemProcess->LockCount = 0; + PsInitialSystemProcess->LockOwner = NULL; + +#if defined(__GNUC__) + KProcess->DirectoryTableBase = + (LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory(); +#else + { + LARGE_INTEGER dummy; + dummy.QuadPart = (LONGLONG)(ULONG)MmGetPageDirectory(); + KProcess->DirectoryTableBase = dummy; + } +#endif + + strcpy(PsInitialSystemProcess->ImageFileName, "System"); + + PsInitialSystemProcess->Win32WindowStation = (HANDLE)0; + + InsertHeadList(&PsActiveProcessHead, + &PsInitialSystemProcess->ProcessListEntry); + InitializeListHead(&PsInitialSystemProcess->ThreadListHead); + +#ifndef SCHED_REWRITE + PTOKEN BootToken; + + /* No parent, this is the Initial System Process. Assign Boot Token */ + BootToken = SepCreateSystemProcessToken(); + BootToken->TokenInUse = TRUE; + PsInitialSystemProcess->Token = BootToken; + ObReferenceObject(BootToken); +#endif +} + +VOID +PspPostInitSystemProcess(VOID) +{ + NTSTATUS Status; + + /* this routine is called directly after the exectuive handle tables were + initialized. We'll set up the Client ID handle table and assign the system + process a PID */ + PsInitClientIDManagment(); + + ObCreateHandleTable(NULL, FALSE, PsInitialSystemProcess); + ObpKernelHandleTable = PsInitialSystemProcess->ObjectTable; + + Status = PsCreateCidHandle(PsInitialSystemProcess, + PsProcessType, + &PsInitialSystemProcess->UniqueProcessId); + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create CID handle (unique process id) for the system process!\n"); + KEBUGCHECK(0); + } +} /********************************************************************** * NAME EXPORTED * PsGetVersion @@ -59,44 +314,39 @@ PiInitProcessManager(VOID) * FALSE OS is a free build. * * NOTES - * The DDK docs say something about a 'CmCSDVersionString'. - * How do we determine in the build is checked or free?? * - * @unimplemented + * @implemented */ - BOOLEAN STDCALL -PsGetVersion ( - PULONG MajorVersion OPTIONAL, - PULONG MinorVersion OPTIONAL, - PULONG BuildNumber OPTIONAL, - PUNICODE_STRING CSDVersion OPTIONAL - ) +PsGetVersion(PULONG MajorVersion OPTIONAL, + PULONG MinorVersion OPTIONAL, + PULONG BuildNumber OPTIONAL, + PUNICODE_STRING CSDVersion OPTIONAL) { - if (MajorVersion) - *MajorVersion = 4; + if (MajorVersion) + *MajorVersion = NtMajorVersion; - if (MinorVersion) - *MinorVersion = 0; + if (MinorVersion) + *MinorVersion = NtMinorVersion; - if (BuildNumber) - *BuildNumber = 1381; + if (BuildNumber) + *BuildNumber = NtBuildNumber; - if (CSDVersion) - { - CSDVersion->Length = 0; - CSDVersion->MaximumLength = 0; - CSDVersion->Buffer = NULL; + if (CSDVersion) + { + CSDVersion->Length = 0; + CSDVersion->MaximumLength = 0; + CSDVersion->Buffer = NULL; #if 0 - CSDVersion->Length = CmCSDVersionString.Length; - CSDVersion->MaximumLength = CmCSDVersionString.Maximum; - CSDVersion->Buffer = CmCSDVersionString.Buffer; + CSDVersion->Length = CmCSDVersionString.Length; + CSDVersion->MaximumLength = CmCSDVersionString.Maximum; + CSDVersion->Buffer = CmCSDVersionString.Buffer; #endif - } + } - /* FIXME: How do we determine if build is checked or free? */ - return FALSE; + /* Check the High word */ + return (NtBuildNumber >> 28) == 0xC; } /* EOF */ diff --git a/reactos/ntoskrnl/ps/query.c b/reactos/ntoskrnl/ps/query.c index b6dbac108a7..3e6034cb232 100644 --- a/reactos/ntoskrnl/ps/query.c +++ b/reactos/ntoskrnl/ps/query.c @@ -16,7 +16,6 @@ /* GLOBALS ******************************************************************/ - static const INFORMATION_CLASS_INFO PsProcessInfoClass[] = { ICI_SQ_SAME( sizeof(PROCESS_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ), /* ProcessBasicInformation */ @@ -26,7 +25,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] = ICI_SQ_SAME( sizeof(KERNEL_USER_TIMES), sizeof(ULONG), ICIF_QUERY ), /* ProcessTimes */ ICI_SQ_SAME( sizeof(KPRIORITY), sizeof(ULONG), ICIF_SET ), /* ProcessBasePriority */ ICI_SQ_SAME( sizeof(ULONG), sizeof(ULONG), ICIF_SET ), /* ProcessRaisePriority */ - ICI_SQ_SAME( sizeof(HANDLE), sizeof(ULONG), ICIF_QUERY | ICIF_SET ), /* ProcessDebugPort */ + ICI_SQ_SAME( sizeof(HANDLE), sizeof(ULONG), ICIF_QUERY ), /* ProcessDebugPort */ ICI_SQ_SAME( sizeof(HANDLE), sizeof(ULONG), ICIF_SET ), /* ProcessExceptionPort */ ICI_SQ_SAME( sizeof(PROCESS_ACCESS_TOKEN), sizeof(ULONG), ICIF_SET ), /* ProcessAccessToken */ ICI_SQ_SAME( 0 /* FIXME */, sizeof(ULONG), ICIF_QUERY | ICIF_SET ), /* ProcessLdtInformation */ @@ -467,6 +466,8 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle, else { PWSTR StrSource = NULL; + + RtlZeroMemory(&LocalDest, sizeof(LocalDest)); /* create a DstPath structure on the stack */ _SEH_TRY @@ -672,8 +673,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle, Access = PROCESS_SET_INFORMATION | PROCESS_SET_SESSIONID; break; case ProcessExceptionPort: - case ProcessDebugPort: - Access = PROCESS_SET_INFORMATION | PROCESS_SET_PORT; + Access = PROCESS_SET_INFORMATION | PROCESS_SUSPEND_RESUME; break; default: @@ -700,87 +700,6 @@ NtSetInformationProcess(IN HANDLE ProcessHandle, Status = STATUS_NOT_IMPLEMENTED; break; - case ProcessDebugPort: - { - HANDLE PortHandle = NULL; - - /* make a safe copy of the buffer on the stack */ - _SEH_TRY - { - PortHandle = *(PHANDLE)ProcessInformation; - Status = (PortHandle != NULL ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(NT_SUCCESS(Status)) - { - PEPORT DebugPort; - - /* in case we had success reading from the buffer, verify the provided - * LPC port handle - */ - Status = ObReferenceObjectByHandle(PortHandle, - 0, - LpcPortObjectType, - PreviousMode, - (PVOID)&DebugPort, - NULL); - if(NT_SUCCESS(Status)) - { - /* lock the process to be thread-safe! */ - - Status = PsLockProcess(Process, FALSE); - if(NT_SUCCESS(Status)) - { - /* - * according to "NT Native API" documentation, setting the debug - * port is only permitted once! - */ - if(Process->DebugPort == NULL) - { - /* keep the reference to the handle! */ - Process->DebugPort = DebugPort; - - if(Process->Peb) - { - /* we're now debugging the process, so set the flag in the PEB - structure. However, to access it we need to attach to the - process so we're sure we're in the right context! */ - - KeAttachProcess(&Process->Pcb); - _SEH_TRY - { - Process->Peb->BeingDebugged = TRUE; - } - _SEH_HANDLE - { - DPRINT1("Trying to set the Peb->BeingDebugged field of process 0x%x failed, exception: 0x%x\n", Process, _SEH_GetExceptionCode()); - } - _SEH_END; - KeDetachProcess(); - } - Status = STATUS_SUCCESS; - } - else - { - ObDereferenceObject(DebugPort); - Status = STATUS_PORT_ALREADY_SET; - } - PsUnlockProcess(Process); - } - else - { - ObDereferenceObject(DebugPort); - } - } - } - break; - } - case ProcessExceptionPort: { HANDLE PortHandle = NULL; @@ -888,6 +807,8 @@ NtSetInformationProcess(IN HANDLE ProcessHandle, PROCESS_SESSION_INFORMATION SessionInfo; Status = STATUS_SUCCESS; + RtlZeroMemory(&SessionInfo, sizeof(SessionInfo)); + _SEH_TRY { /* copy the structure to the stack */ @@ -988,6 +909,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle, case ProcessWx86Information: case ProcessHandleCount: case ProcessWow64Information: + case ProcessDebugPort: default: Status = STATUS_INVALID_INFO_CLASS; } diff --git a/reactos/ntoskrnl/ps/quota.c b/reactos/ntoskrnl/ps/quota.c new file mode 100644 index 00000000000..73015e76ff6 --- /dev/null +++ b/reactos/ntoskrnl/ps/quota.c @@ -0,0 +1,151 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ps/quota.c + * PURPOSE: Process Pool Quotas + * + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES **************************************************************/ + +#include +#define NDEBUG +#include + +/* FUNCTIONS ***************************************************************/ + +/* + * @implemented + */ +VOID +STDCALL +PsChargePoolQuota(IN PEPROCESS Process, + IN POOL_TYPE PoolType, + IN ULONG_PTR Amount) +{ + NTSTATUS Status; + + /* Charge the usage */ + Status = PsChargeProcessPoolQuota(Process, PoolType, Amount); + + /* Raise Exception */ + if (!NT_SUCCESS(Status)) + { + ExRaiseStatus(Status); + } +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +PsChargeProcessNonPagedPoolQuota(IN PEPROCESS Process, + IN ULONG_PTR Amount) +{ + /* Call the general function */ + return PsChargeProcessPoolQuota(Process, NonPagedPool, Amount); +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +PsChargeProcessPagedPoolQuota(IN PEPROCESS Process, + IN ULONG_PTR Amount) +{ + /* Call the general function */ + return PsChargeProcessPoolQuota(Process, PagedPool, Amount); +} + +/* + * @implemented + */ +NTSTATUS +STDCALL +PsChargeProcessPoolQuota(IN PEPROCESS Process, + IN POOL_TYPE PoolType, + IN ULONG_PTR Amount) +{ + PEPROCESS_QUOTA_BLOCK QuotaBlock; + ULONG NewUsageSize; + ULONG NewMaxQuota; + + /* Get current Quota Block */ + QuotaBlock = Process->QuotaBlock; + + /* Quota Operations are not to be done on the SYSTEM Process */ + if (Process == PsInitialSystemProcess) return STATUS_SUCCESS; + + /* New Size in use */ + NewUsageSize = QuotaBlock->QuotaEntry[PoolType].Usage + Amount; + + /* Does this size respect the quota? */ + if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Limit) + { + /* It doesn't, so keep raising the Quota */ + while (MiRaisePoolQuota(PoolType, + QuotaBlock->QuotaEntry[PoolType].Limit, + &NewMaxQuota)) + { + /* Save new Maximum Quota */ + QuotaBlock->QuotaEntry[PoolType].Limit = NewMaxQuota; + + /* See if the new Maximum Quota fulfills our need */ + if (NewUsageSize <= NewMaxQuota) goto QuotaChanged; + } + + return STATUS_QUOTA_EXCEEDED; + } + +QuotaChanged: + /* Save new Usage */ + QuotaBlock->QuotaEntry[PoolType].Usage = NewUsageSize; + + /* Is this a new peak? */ + if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Peak) + { + QuotaBlock->QuotaEntry[PoolType].Peak = NewUsageSize; + } + + /* All went well */ + return STATUS_SUCCESS; +} + +/* + * @unimplemented + */ +VOID +STDCALL +PsReturnPoolQuota(IN PEPROCESS Process, + IN POOL_TYPE PoolType, + IN ULONG_PTR Amount) +{ + UNIMPLEMENTED; +} + +/* + * @unimplemented + */ +VOID +STDCALL +PsReturnProcessNonPagedPoolQuota(IN PEPROCESS Process, + IN ULONG_PTR Amount) +{ + UNIMPLEMENTED; +} + +/* + * @unimplemented + */ +VOID +STDCALL +PsReturnProcessPagedPoolQuota(IN PEPROCESS Process, + IN ULONG_PTR Amount) +{ + UNIMPLEMENTED; +} + +/* EOF */ diff --git a/reactos/ntoskrnl/ps/security.c b/reactos/ntoskrnl/ps/security.c index ef076b3427f..6daa00f393f 100644 --- a/reactos/ntoskrnl/ps/security.c +++ b/reactos/ntoskrnl/ps/security.c @@ -13,8 +13,6 @@ #define NDEBUG #include -/* GLOBALS ******************************************************************/ - /* FUNCTIONS *****************************************************************/ /* @@ -144,6 +142,66 @@ PsOpenTokenOfProcess(HANDLE ProcessHandle, return Status; } +NTSTATUS +STDCALL +PspInitializeProcessSecurity(PEPROCESS Process, + PEPROCESS Parent OPTIONAL) +{ + NTSTATUS Status = STATUS_SUCCESS; + + /* If we have a parent, then duplicate the Token */ + if (Parent) { + + PTOKEN pNewToken; + PTOKEN pParentToken; + OBJECT_ATTRIBUTES ObjectAttributes; + + pParentToken = (PACCESS_TOKEN)Parent->Token; + + /* Initialize the Object Attributes */ + InitializeObjectAttributes(&ObjectAttributes, + NULL, + 0, + NULL, + NULL); + + /* Duplicate the Token */ + Status = SepDuplicateToken(pParentToken, + &ObjectAttributes, + FALSE, + TokenPrimary, + pParentToken->ImpersonationLevel, + KernelMode, + &pNewToken); + + if(!NT_SUCCESS(Status)) { + + DPRINT1("Failed to Duplicate Token\n"); + return Status; + } + + Process->Token = pNewToken; + + } else { + +#ifdef SCHED_REWRITE + PTOKEN BootToken; + + /* No parent, this is the Initial System Process. Assign Boot Token */ + BootToken = SepCreateSystemProcessToken(); + BootToken->TokenInUse = TRUE; + Process->Token = BootToken; + ObReferenceObject(BootToken); +#else + DPRINT1("PspInitializeProcessSecurity called with no parent.\n"); +#endif + } + + /* Return to caller */ + return Status; +} + + NTSTATUS STDCALL PspAssignPrimaryToken(PEPROCESS Process, diff --git a/reactos/ntoskrnl/ps/suspend.c b/reactos/ntoskrnl/ps/suspend.c index 579a5c2e410..5e73015379c 100644 --- a/reactos/ntoskrnl/ps/suspend.c +++ b/reactos/ntoskrnl/ps/suspend.c @@ -18,9 +18,6 @@ ULONG STDCALL KeResumeThread(PKTHREAD Thread); -ULONG -STDCALL -KeSuspendThread(PKTHREAD Thread); /* FUNCTIONS *****************************************************************/ /* @@ -176,4 +173,72 @@ NtSuspendThread(IN HANDLE ThreadHandle, return Status; } + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +NtSuspendProcess(IN HANDLE ProcessHandle) +{ + KPROCESSOR_MODE PreviousMode; + PEPROCESS Process; + NTSTATUS Status; + + PAGED_CODE(); + + PreviousMode = ExGetPreviousMode(); + + Status = ObReferenceObjectByHandle(ProcessHandle, + PROCESS_SUSPEND_RESUME, + PsProcessType, + PreviousMode, + (PVOID*)&Process, + NULL); + if (NT_SUCCESS(Status)) + { + /* FIXME */ + Status = STATUS_NOT_IMPLEMENTED; + DPRINT1("NtSuspendProcess not yet implemented!\n"); + + ObDereferenceObject(Process); + } + + return Status; +} + + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +NtResumeProcess(IN HANDLE ProcessHandle) +{ + KPROCESSOR_MODE PreviousMode; + PEPROCESS Process; + NTSTATUS Status; + + PAGED_CODE(); + + PreviousMode = ExGetPreviousMode(); + + Status = ObReferenceObjectByHandle(ProcessHandle, + PROCESS_SUSPEND_RESUME, + PsProcessType, + PreviousMode, + (PVOID*)&Process, + NULL); + if (NT_SUCCESS(Status)) + { + /* FIXME */ + Status = STATUS_NOT_IMPLEMENTED; + DPRINT1("NtResumeProcess not yet implemented!\n"); + + ObDereferenceObject(Process); + } + + return Status; +} + /* EOF */ diff --git a/reactos/ntoskrnl/ps/thread.c b/reactos/ntoskrnl/ps/thread.c index 952ff730402..fe57eb0a17f 100644 --- a/reactos/ntoskrnl/ps/thread.c +++ b/reactos/ntoskrnl/ps/thread.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ps/thread.c @@ -9,14 +8,6 @@ * Phillip Susi */ -/* - * NOTE: - * - * All of the routines that manipulate the thread queue synchronize on - * a single spinlock - * - */ - /* INCLUDES ****************************************************************/ #include @@ -29,45 +20,350 @@ extern LIST_ENTRY PsActiveProcessHead; extern PEPROCESS PsIdleProcess; POBJECT_TYPE EXPORTED PsThreadType = NULL; - -extern PVOID Ki386InitialStackArray[MAXIMUM_PROCESSORS]; -extern ULONG IdleProcessorMask; -extern LIST_ENTRY PriorityListHead[MAXIMUM_PRIORITY]; - - -BOOLEAN DoneInitYet = FALSE; -static GENERIC_MAPPING PiThreadMapping = {STANDARD_RIGHTS_READ | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, - STANDARD_RIGHTS_WRITE | THREAD_TERMINATE | THREAD_SUSPEND_RESUME | THREAD_ALERT | - THREAD_SET_INFORMATION | THREAD_SET_CONTEXT, - STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE, - THREAD_ALL_ACCESS}; - + /* FUNCTIONS ***************************************************************/ -/* - * @implemented - */ -PKTHREAD STDCALL KeGetCurrentThread(VOID) +VOID +STDCALL +PspThreadSpecialApc(PKAPC Apc, + PKNORMAL_ROUTINE* NormalRoutine, + PVOID* NormalContext, + PVOID* SystemArgument1, + PVOID* SystemArgument2) { -#ifdef CONFIG_SMP - ULONG Flags; - PKTHREAD Thread; - Ke386SaveFlags(Flags); - Ke386DisableInterrupts(); - Thread = KeGetCurrentPrcb()->CurrentThread; - Ke386RestoreFlags(Flags); - return Thread; -#else - return(KeGetCurrentPrcb()->CurrentThread); -#endif + ExFreePool(Apc); +} + +VOID +STDCALL +PspUserThreadStartup(PKSTART_ROUTINE StartRoutine, + PVOID StartContext) +{ + PKAPC ThreadApc; + PETHREAD Thread = PsGetCurrentThread(); + + DPRINT("I am a new USER thread. This is my start routine: %p. This my context: %p." + "This is my IRQL: %d. This is my Thread Pointer: %x.\n", StartRoutine, + StartContext, KeGetCurrentIrql(), Thread); + + if (!Thread->HasTerminated) { + + /* Allocate the APC */ + ThreadApc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG('T', 'h', 'r','d')); + + /* Initialize it */ + KeInitializeApc(ThreadApc, + &Thread->Tcb, + OriginalApcEnvironment, + PspThreadSpecialApc, + NULL, + LdrpGetSystemDllEntryPoint(), + UserMode, + NULL); + + /* Insert it into the queue */ + KeInsertQueueApc(ThreadApc, NULL, NULL, IO_NO_INCREMENT); + Thread->Tcb.ApcState.UserApcPending = TRUE; + } + + /* Go to Passive Level and notify debugger */ + KeLowerIrql(PASSIVE_LEVEL); + DbgkCreateThread(StartContext); +} + +VOID +STDCALL +PspSystemThreadStartup(PKSTART_ROUTINE StartRoutine, + PVOID StartContext) +{ + PETHREAD Thread = PsGetCurrentThread(); + + /* Unlock the dispatcher Database */ + KeLowerIrql(PASSIVE_LEVEL); + + /* Make sure it's not terminated by now */ + if (!Thread->HasTerminated) { + + /* Call it */ + (StartRoutine)(StartContext); + } + + /* Exit the thread */ + PspExitThread(STATUS_SUCCESS); +} + +NTSTATUS +STDCALL +PspCreateThread(OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ProcessHandle, + IN PEPROCESS TargetProcess, + OUT PCLIENT_ID ClientId, + IN PCONTEXT ThreadContext, + IN PINITIAL_TEB InitialTeb, + IN BOOLEAN CreateSuspended, + IN PKSTART_ROUTINE StartRoutine OPTIONAL, + IN PVOID StartContext OPTIONAL) +{ + HANDLE hThread; + PEPROCESS Process; + PETHREAD Thread; + PTEB TebBase; + KIRQL OldIrql; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + NTSTATUS Status; + PVOID KernelStack; + + /* Reference the Process by handle or pointer, depending on what we got */ + DPRINT("PspCreateThread: %x, %x, %x\n", ProcessHandle, TargetProcess, ThreadContext); + if (ProcessHandle) { + + /* Normal thread or System Thread */ + DPRINT("Referencing Parent Process\n"); + Status = ObReferenceObjectByHandle(ProcessHandle, + PROCESS_CREATE_THREAD, + PsProcessType, + PreviousMode, + (PVOID*)&Process, + NULL); + } else { + + /* System thread inside System Process, or Normal Thread with a bug */ + if (StartRoutine) { + + /* Reference the Process by Pointer */ + DPRINT("Referencing Parent System Process\n"); + ObReferenceObject(TargetProcess); + Process = TargetProcess; + Status = STATUS_SUCCESS; + + } else { + + /* Fake ObReference returning this */ + Status = STATUS_INVALID_HANDLE; + } + } + + /* Check for success */ + if(!NT_SUCCESS(Status)) { + + DPRINT1("Invalid Process Handle, or no handle given\n"); + return(Status); + } + + /* Create Thread Object */ + DPRINT("Creating Thread Object\n"); + Status = ObCreateObject(PreviousMode, + PsThreadType, + ObjectAttributes, + KernelMode, + NULL, + sizeof(ETHREAD), + 0, + 0, + (PVOID*)&Thread); + + /* Check for success */ + if (!NT_SUCCESS(Status)) { + + /* Dereference the Process */ + DPRINT1("Failed to Create Thread Object\n"); + ObDereferenceObject(Process); + return(Status); + } + + /* Zero the Object entirely */ + DPRINT("Cleaning Thread Object\n"); + RtlZeroMemory(Thread, sizeof(ETHREAD)); + + /* Create Cid Handle */ + DPRINT("Creating Thread Handle (CID)\n"); + if (!(NT_SUCCESS(PsCreateCidHandle(Thread, PsThreadType, &Thread->Cid.UniqueThread)))) { + + DPRINT1("Failed to create Thread Handle (CID)\n"); + ObDereferenceObject(Process); + ObDereferenceObject(Thread); + return Status; + } + + /* Initialize Lists */ + DPRINT("Initialliazing Thread Lists and Locks\n"); + InitializeListHead(&Thread->LpcReplyChain); + InitializeListHead(&Thread->IrpList); + InitializeListHead(&Thread->ActiveTimerListHead); + KeInitializeSpinLock(&Thread->ActiveTimerListLock); + + /* Initialize LPC */ + DPRINT("Initialliazing Thread Semaphore\n"); + KeInitializeSemaphore(&Thread->LpcReplySemaphore, 0, LONG_MAX); + + /* Allocate Stack for non-GUI Thread */ + DPRINT("Initialliazing Thread Stack\n"); + KernelStack = MmCreateKernelStack(FALSE); + + /* Set the Process CID */ + DPRINT("Initialliazing Thread PID and Parent Process\n"); + Thread->Cid.UniqueProcess = Process->UniqueProcessId; + Thread->ThreadsProcess = Process; + + /* Now let the kernel initialize the context */ + if (ThreadContext) { + + /* User-mode Thread */ + + /* Create Teb */ + DPRINT("Initialliazing Thread PEB\n"); + TebBase = MmCreateTeb(Process, &Thread->Cid, InitialTeb); + + /* Set the Start Addresses */ + DPRINT("Initialliazing Thread Start Addresses :%x, %x\n", ThreadContext->Eip, ThreadContext->Eax); + Thread->StartAddress = (PVOID)ThreadContext->Eip; + Thread->Win32StartAddress = (PVOID)ThreadContext->Eax; + + /* Let the kernel intialize the Thread */ + DPRINT("Initialliazing Kernel Thread\n"); + KeInitializeThread(&Process->Pcb, + &Thread->Tcb, + PspUserThreadStartup, + NULL, + NULL, + ThreadContext, + TebBase, + KernelStack); + + } else { + + /* System Thread */ + DPRINT("Initialliazing Thread Start Address :%x\n", StartRoutine); + Thread->StartAddress = StartRoutine; + Thread->SystemThread = TRUE; + + /* Let the kernel intialize the Thread */ + DPRINT("Initialliazing Kernel Thread\n"); + KeInitializeThread(&Process->Pcb, + &Thread->Tcb, + PspSystemThreadStartup, + StartRoutine, + StartContext, + NULL, + NULL, + KernelStack); + } + + /* + * Insert the Thread into the Process's Thread List + * Note, this is the ETHREAD Thread List. It is removed in + * ps/kill.c!PspExitThread. + */ + DPRINT("Inserting into Process Thread List \n"); + InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry); + + /* Notify Thread Creation */ + DPRINT("Running Thread Notify \n"); + PspRunCreateThreadNotifyRoutines(Thread, TRUE); + + /* FIXME: Use Lock */ + DPRINT("Apcs Queueable: %d \n", Thread->Tcb.ApcQueueable); + Thread->Tcb.ApcQueueable = TRUE; + + /* Suspend the Thread if we have to */ + if (CreateSuspended) { + + DPRINT("Suspending Thread\n"); + KeSuspendThread(&Thread->Tcb); + } + + /* Reference ourselves as a keep-alive */ + ObReferenceObject(Thread); + + /* Insert the Thread into the Object Manager */ + DPRINT("Inserting Thread\n"); + Status = ObInsertObject((PVOID)Thread, + NULL, + DesiredAccess, + 0, + NULL, + &hThread); + + /* Return Cid and Handle */ + DPRINT("All worked great!\n"); + if(NT_SUCCESS(Status)) { + + _SEH_TRY { + + if(ClientId != NULL) { + + *ClientId = Thread->Cid; + } + *ThreadHandle = hThread; + + } _SEH_HANDLE { + + Status = _SEH_GetExceptionCode(); + + } _SEH_END; + } + + /* FIXME: SECURITY */ + + /* Dispatch thread */ + DPRINT("About to dispatch the thread: %x!\n", &Thread->Tcb); + OldIrql = KeAcquireDispatcherDatabaseLock (); + KiUnblockThread(&Thread->Tcb, NULL, 0); + ObDereferenceObject(Thread); + KeReleaseDispatcherDatabaseLock(OldIrql); + + /* Return */ + DPRINT("Returning\n"); + return Status; } /* * @implemented */ -HANDLE STDCALL PsGetCurrentThreadId(VOID) +NTSTATUS +STDCALL +PsCreateSystemThread(PHANDLE ThreadHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + HANDLE ProcessHandle, + PCLIENT_ID ClientId, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext) { - return(PsGetCurrentThread()->Cid.UniqueThread); + PEPROCESS TargetProcess = NULL; + HANDLE Handle = ProcessHandle; + + /* Check if we have a handle. If not, use the System Process */ + if (!ProcessHandle) { + + Handle = NULL; + TargetProcess = PsInitialSystemProcess; + } + + /* Call the shared function */ + return PspCreateThread(ThreadHandle, + DesiredAccess, + ObjectAttributes, + Handle, + TargetProcess, + ClientId, + NULL, + NULL, + FALSE, + StartRoutine, + StartContext); +} + +/* + * @implemented + */ +HANDLE +STDCALL +PsGetCurrentThreadId(VOID) +{ + return(PsGetCurrentThread()->Cid.UniqueThread); } /* @@ -75,11 +371,9 @@ HANDLE STDCALL PsGetCurrentThreadId(VOID) */ ULONG STDCALL -PsGetThreadFreezeCount( - PETHREAD Thread - ) +PsGetThreadFreezeCount(PETHREAD Thread) { - return Thread->Tcb.FreezeCount; + return Thread->Tcb.FreezeCount; } /* @@ -87,11 +381,9 @@ PsGetThreadFreezeCount( */ BOOLEAN STDCALL -PsGetThreadHardErrorsAreDisabled( - PETHREAD Thread - ) +PsGetThreadHardErrorsAreDisabled(PETHREAD Thread) { - return Thread->HardErrorsAreDisabled; + return Thread->HardErrorsAreDisabled; } /* @@ -99,11 +391,9 @@ PsGetThreadHardErrorsAreDisabled( */ HANDLE STDCALL -PsGetThreadId( - PETHREAD Thread - ) +PsGetThreadId(PETHREAD Thread) { - return Thread->Cid.UniqueThread; + return Thread->Cid.UniqueThread; } /* @@ -111,11 +401,9 @@ PsGetThreadId( */ PEPROCESS STDCALL -PsGetThreadProcess( - PETHREAD Thread - ) +PsGetThreadProcess(PETHREAD Thread) { - return Thread->ThreadsProcess; + return Thread->ThreadsProcess; } /* @@ -123,11 +411,9 @@ PsGetThreadProcess( */ HANDLE STDCALL -PsGetThreadProcessId( - PETHREAD Thread - ) +PsGetThreadProcessId(PETHREAD Thread) { - return Thread->Cid.UniqueProcess; + return Thread->Cid.UniqueProcess; } /* @@ -135,11 +421,9 @@ PsGetThreadProcessId( */ HANDLE STDCALL -PsGetThreadSessionId( - PETHREAD Thread - ) +PsGetThreadSessionId(PETHREAD Thread) { - return (HANDLE)Thread->ThreadsProcess->SessionId; + return (HANDLE)Thread->ThreadsProcess->SessionId; } /* @@ -147,11 +431,9 @@ PsGetThreadSessionId( */ PTEB STDCALL -PsGetThreadTeb( - PETHREAD Thread - ) +PsGetThreadTeb(PETHREAD Thread) { - return Thread->Tcb.Teb; + return Thread->Tcb.Teb; } /* @@ -159,11 +441,9 @@ PsGetThreadTeb( */ PVOID STDCALL -PsGetThreadWin32Thread( - PETHREAD Thread - ) +PsGetThreadWin32Thread(PETHREAD Thread) { - return Thread->Tcb.Win32Thread; + return Thread->Tcb.Win32Thread; } /* @@ -171,11 +451,9 @@ PsGetThreadWin32Thread( */ KPROCESSOR_MODE STDCALL -PsGetCurrentThreadPreviousMode ( - VOID - ) +PsGetCurrentThreadPreviousMode(VOID) { - return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode; + return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode; } /* @@ -183,11 +461,9 @@ PsGetCurrentThreadPreviousMode ( */ PVOID STDCALL -PsGetCurrentThreadStackBase ( - VOID - ) +PsGetCurrentThreadStackBase(VOID) { - return PsGetCurrentThread()->Tcb.StackBase; + return PsGetCurrentThread()->Tcb.StackBase; } /* @@ -195,20 +471,19 @@ PsGetCurrentThreadStackBase ( */ PVOID STDCALL -PsGetCurrentThreadStackLimit ( - VOID - ) +PsGetCurrentThreadStackLimit(VOID) { - return (PVOID)PsGetCurrentThread()->Tcb.StackLimit; + return (PVOID)PsGetCurrentThread()->Tcb.StackLimit; } /* * @implemented */ -BOOLEAN STDCALL +BOOLEAN +STDCALL PsIsThreadTerminating(IN PETHREAD Thread) { - return (Thread->HasTerminated ? TRUE : FALSE); + return (Thread->HasTerminated ? TRUE : FALSE); } /* @@ -226,140 +501,9 @@ PsIsSystemThread(PETHREAD Thread) */ BOOLEAN STDCALL -PsIsThreadImpersonating( - PETHREAD Thread - ) +PsIsThreadImpersonating(PETHREAD Thread) { - return Thread->ActiveImpersonationInfo; -} - -VOID PsDumpThreads(BOOLEAN IncludeSystem) -{ - PLIST_ENTRY AThread, AProcess; - PEPROCESS Process; - PETHREAD Thread; - ULONG nThreads = 0; - - AProcess = PsActiveProcessHead.Flink; - while(AProcess != &PsActiveProcessHead) - { - Process = CONTAINING_RECORD(AProcess, EPROCESS, ProcessListEntry); - /* FIXME - skip suspended, ... processes? */ - if((Process != PsInitialSystemProcess) || - (Process == PsInitialSystemProcess && IncludeSystem)) - { - AThread = Process->ThreadListHead.Flink; - while(AThread != &Process->ThreadListHead) - { - Thread = CONTAINING_RECORD(AThread, ETHREAD, ThreadListEntry); - - nThreads++; - DbgPrint("Thread->Tcb.State %d Affinity %08x Priority %d PID.TID %d.%d Name %.8s Stack: \n", - Thread->Tcb.State, - Thread->Tcb.Affinity, - Thread->Tcb.Priority, - Thread->ThreadsProcess->UniqueProcessId, - Thread->Cid.UniqueThread, - Thread->ThreadsProcess->ImageFileName); - if(Thread->Tcb.State == THREAD_STATE_READY || - Thread->Tcb.State == THREAD_STATE_SUSPENDED || - Thread->Tcb.State == THREAD_STATE_BLOCKED) - { - ULONG i = 0; - PULONG Esp = (PULONG)Thread->Tcb.KernelStack; - PULONG Ebp = (PULONG)Esp[4]; - DbgPrint("Ebp 0x%.8X\n", Ebp); - while(Ebp != 0 && Ebp >= (PULONG)Thread->Tcb.StackLimit) - { - DbgPrint("%.8X %.8X%s", Ebp[0], Ebp[1], (i % 8) == 7 ? "\n" : " "); - Ebp = (PULONG)Ebp[0]; - i++; - } - if((i % 8) != 0) - { - DbgPrint("\n"); - } - } - AThread = AThread->Flink; - } - } - AProcess = AProcess->Flink; - } -} - -VOID -PsFreezeAllThreads(PEPROCESS Process) - /* - * Used by the debugging code to freeze all the process's threads - * while the debugger is examining their state. - */ -{ - KIRQL oldIrql; - PLIST_ENTRY current_entry; - PETHREAD current; - - oldIrql = KeAcquireDispatcherDatabaseLock(); - current_entry = Process->ThreadListHead.Flink; - while (current_entry != &Process->ThreadListHead) - { - current = CONTAINING_RECORD(current_entry, ETHREAD, - ThreadListEntry); - - /* - * We have to be careful here, we can't just set the freeze the - * thread inside kernel mode since it may be holding a lock. - */ - - current_entry = current_entry->Flink; - } - - KeReleaseDispatcherDatabaseLock(oldIrql); -} - -ULONG -PsEnumThreadsByProcess(PEPROCESS Process) -{ - KIRQL oldIrql; - PLIST_ENTRY current_entry; - ULONG Count = 0; - - oldIrql = KeAcquireDispatcherDatabaseLock(); - - current_entry = Process->ThreadListHead.Flink; - while (current_entry != &Process->ThreadListHead) - { - Count++; - current_entry = current_entry->Flink; - } - - KeReleaseDispatcherDatabaseLock(oldIrql); - return Count; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -PsRemoveCreateThreadNotifyRoutine ( - IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -ULONG -STDCALL -PsSetLegoNotifyRoutine( - PVOID LegoNotifyRoutine - ) -{ - UNIMPLEMENTED; - return 0; + return Thread->ActiveImpersonationInfo; } /* @@ -367,12 +511,10 @@ PsSetLegoNotifyRoutine( */ VOID STDCALL -PsSetThreadHardErrorsAreDisabled( - PETHREAD Thread, - BOOLEAN HardErrorsAreDisabled - ) +PsSetThreadHardErrorsAreDisabled(PETHREAD Thread, + BOOLEAN HardErrorsAreDisabled) { - Thread->HardErrorsAreDisabled = HardErrorsAreDisabled; + Thread->HardErrorsAreDisabled = HardErrorsAreDisabled; } /* @@ -380,243 +522,237 @@ PsSetThreadHardErrorsAreDisabled( */ VOID STDCALL -PsSetThreadWin32Thread( - PETHREAD Thread, - PVOID Win32Thread - ) +PsSetThreadWin32Thread(PETHREAD Thread, + PVOID Win32Thread) { - Thread->Tcb.Win32Thread = Win32Thread; + Thread->Tcb.Win32Thread = Win32Thread; } -VOID -PsApplicationProcessorInit(VOID) +NTSTATUS +STDCALL +NtCreateThread(OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ProcessHandle, + OUT PCLIENT_ID ClientId, + IN PCONTEXT ThreadContext, + IN PINITIAL_TEB InitialTeb, + IN BOOLEAN CreateSuspended) { - KIRQL oldIrql; - oldIrql = KeAcquireDispatcherDatabaseLock(); - IdleProcessorMask |= (1 << KeGetCurrentProcessorNumber()); - KeReleaseDispatcherDatabaseLock(oldIrql); -} - -VOID INIT_FUNCTION -PsPrepareForApplicationProcessorInit(ULONG Id) -{ - PETHREAD IdleThread; - PKPRCB Prcb = ((PKPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE))->Prcb; - - PsInitializeThread(PsIdleProcess, - &IdleThread, - NULL, - KernelMode, - FALSE); - IdleThread->Tcb.State = THREAD_STATE_RUNNING; - IdleThread->Tcb.FreezeCount = 0; - IdleThread->Tcb.Affinity = 1 << Id; - IdleThread->Tcb.UserAffinity = 1 << Id; - IdleThread->Tcb.Priority = LOW_PRIORITY; - IdleThread->Tcb.BasePriority = LOW_PRIORITY; - Prcb->IdleThread = &IdleThread->Tcb; - Prcb->CurrentThread = &IdleThread->Tcb; - - Ki386InitialStackArray[Id] = (PVOID)IdleThread->Tcb.StackLimit; - - DPRINT("IdleThread for Processor %d has PID %d\n", - Id, IdleThread->Cid.UniqueThread); -} - -VOID INIT_FUNCTION -PsInitThreadManagment(VOID) -/* - * FUNCTION: Initialize thread managment - */ -{ - PETHREAD FirstThread; - ULONG i; - - for (i=0; i < MAXIMUM_PRIORITY; i++) - { - InitializeListHead(&PriorityListHead[i]); - } - - PsThreadType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE)); - - PsThreadType->Tag = TAG('T', 'H', 'R', 'T'); - PsThreadType->TotalObjects = 0; - PsThreadType->TotalHandles = 0; - PsThreadType->PeakObjects = 0; - PsThreadType->PeakHandles = 0; - PsThreadType->PagedPoolCharge = 0; - PsThreadType->NonpagedPoolCharge = sizeof(ETHREAD); - PsThreadType->Mapping = &PiThreadMapping; - PsThreadType->Dump = NULL; - PsThreadType->Open = NULL; - PsThreadType->Close = NULL; - PsThreadType->Delete = PspDeleteThread; - PsThreadType->Parse = NULL; - PsThreadType->Security = NULL; - PsThreadType->QueryName = NULL; - PsThreadType->OkayToClose = NULL; - PsThreadType->Create = NULL; - PsThreadType->DuplicationNotify = NULL; - - RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread"); - - ObpCreateTypeObject(PsThreadType); - - PsInitializeThread(NULL, &FirstThread, NULL, KernelMode, TRUE); - FirstThread->Tcb.State = THREAD_STATE_RUNNING; - FirstThread->Tcb.FreezeCount = 0; - FirstThread->Tcb.UserAffinity = (1 << 0); /* Set the affinity of the first thread to the boot processor */ - FirstThread->Tcb.Affinity = (1 << 0); - KeGetCurrentPrcb()->CurrentThread = (PVOID)FirstThread; - - DPRINT("FirstThread %x\n",FirstThread); - - DoneInitYet = TRUE; + INITIAL_TEB SafeInitialTeb; + + PAGED_CODE(); + + DPRINT("NtCreateThread(ThreadHandle %x, PCONTEXT %x)\n", + ThreadHandle,ThreadContext); + + if(KeGetPreviousMode() != KernelMode) { + + _SEH_TRY { + + ProbeForWrite(ThreadHandle, + sizeof(HANDLE), + sizeof(ULONG)); + + if(ClientId != NULL) { + + ProbeForWrite(ClientId, + sizeof(CLIENT_ID), + sizeof(ULONG)); + } - ExInitializeWorkItem(&PspReaperWorkItem, PspReapRoutine, NULL); + if(ThreadContext != NULL) { + + ProbeForRead(ThreadContext, + sizeof(CONTEXT), + sizeof(ULONG)); + + } else { + + DPRINT1("No context for User-Mode Thread!!\n"); + return STATUS_INVALID_PARAMETER; + } + + ProbeForRead(InitialTeb, + sizeof(INITIAL_TEB), + sizeof(ULONG)); + + } _SEH_HANDLE { + + return _SEH_GetExceptionCode(); + + } _SEH_END; + } + + /* Use probed data for the Initial TEB */ + SafeInitialTeb = *InitialTeb; + InitialTeb = &SafeInitialTeb; + + /* Call the shared function */ + return PspCreateThread(ThreadHandle, + DesiredAccess, + ObjectAttributes, + ProcessHandle, + NULL, + ClientId, + ThreadContext, + InitialTeb, + CreateSuspended, + NULL, + NULL); } -/********************************************************************** - * NtOpenThread/4 - * - * @implemented +/* + * @implemented */ -NTSTATUS STDCALL +NTSTATUS +STDCALL NtOpenThread(OUT PHANDLE ThreadHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, - IN PCLIENT_ID ClientId OPTIONAL) + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN PCLIENT_ID ClientId OPTIONAL) { - KPROCESSOR_MODE PreviousMode; - CLIENT_ID SafeClientId; - HANDLE hThread; - NTSTATUS Status = STATUS_SUCCESS; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + CLIENT_ID SafeClientId; + HANDLE hThread = 0; + NTSTATUS Status = STATUS_SUCCESS; + PETHREAD Thread; - PAGED_CODE(); + PAGED_CODE(); - PreviousMode = ExGetPreviousMode(); + /* Probe the paraemeters */ + if(PreviousMode != KernelMode) + { + _SEH_TRY + { + ProbeForWrite(ThreadHandle, + sizeof(HANDLE), + sizeof(ULONG)); + + if(ClientId != NULL) + { + ProbeForRead(ClientId, + sizeof(CLIENT_ID), + sizeof(ULONG)); + + SafeClientId = *ClientId; + ClientId = &SafeClientId; + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; - if(PreviousMode != KernelMode) - { - _SEH_TRY - { - ProbeForWrite(ThreadHandle, - sizeof(HANDLE), - sizeof(ULONG)); - if(ClientId != NULL) - { - ProbeForRead(ClientId, - sizeof(CLIENT_ID), - sizeof(ULONG)); - SafeClientId = *ClientId; - ClientId = &SafeClientId; - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; + if(!NT_SUCCESS(Status)) return Status; + } - if(!NT_SUCCESS(Status)) - { - return Status; - } - } + /* Open by name if one was given */ + if (ObjectAttributes->ObjectName) + { + /* Open it */ + Status = ObOpenObjectByName(ObjectAttributes, + PsThreadType, + NULL, + PreviousMode, + DesiredAccess, + NULL, + hThread); + + if (Status != STATUS_SUCCESS) + { + DPRINT1("Could not open object by name\n"); + } + + /* Return Status */ + return(Status); + } + else if (ClientId) + { + /* Open by Thread ID */ + if (ClientId->UniqueProcess) + { + /* Get the Process */ + if (ClientId->UniqueProcess == (HANDLE)-1) KEBUGCHECK(0); + DPRINT("Opening by Process ID: %x\n", ClientId->UniqueProcess); + Status = PsLookupProcessThreadByCid(ClientId, + NULL, + &Thread); + } + else + { + /* Get the Process */ + DPRINT("Opening by Thread ID: %x\n", ClientId->UniqueThread); + Status = PsLookupThreadByThreadId(ClientId->UniqueThread, + &Thread); + } + + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failure to find Thread\n"); + return Status; + } + + /* Open the Thread Object */ + Status = ObOpenObjectByPointer(Thread, + ObjectAttributes->Attributes, + NULL, + DesiredAccess, + PsThreadType, + PreviousMode, + hThread); + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failure to open Thread\n"); + } + + /* Dereference the thread */ + ObDereferenceObject(Thread); + } - if(!((ObjectAttributes == NULL) ^ (ClientId == NULL))) - { - DPRINT("NtOpenThread should be called with either ObjectAttributes or ClientId!\n"); - return STATUS_INVALID_PARAMETER; - } + /* Write back the handle */ + if(NT_SUCCESS(Status)) + { + _SEH_TRY + { + *ThreadHandle = hThread; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } - if(ClientId != NULL) - { - PETHREAD Thread; - - Status = PsLookupThreadByThreadId(ClientId->UniqueThread, - &Thread); - if(NT_SUCCESS(Status)) - { - Status = ObInsertObject(Thread, - NULL, - DesiredAccess, - 0, - NULL, - &hThread); - - ObDereferenceObject(Thread); - } - } - else - { - Status = ObOpenObjectByName(ObjectAttributes, - PsThreadType, - NULL, - PreviousMode, - DesiredAccess, - NULL, - &hThread); - } - - if(NT_SUCCESS(Status)) - { - _SEH_TRY - { - *ThreadHandle = hThread; - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } - - return Status; + /* Return status */ + return Status; } -NTSTATUS STDCALL +NTSTATUS +STDCALL NtYieldExecution(VOID) { - KiDispatchThread(THREAD_STATE_READY); - return(STATUS_SUCCESS); + KiDispatchThread(Ready); + return(STATUS_SUCCESS); } - -/* - * NOT EXPORTED - */ -NTSTATUS STDCALL +NTSTATUS +STDCALL NtTestAlert(VOID) { - /* Check and Alert Thread if needed */ - return KeTestAlertThread(ExGetPreviousMode()) ? STATUS_ALERTED : STATUS_SUCCESS; + /* Check and Alert Thread if needed */ + return KeTestAlertThread(ExGetPreviousMode()) ? STATUS_ALERTED : STATUS_SUCCESS; } -VOID -KeSetPreviousMode (ULONG Mode) -{ - PsGetCurrentThread()->Tcb.PreviousMode = (UCHAR)Mode; -} - - /* * @implemented */ -KPROCESSOR_MODE STDCALL -KeGetPreviousMode (VOID) -{ - return (ULONG)PsGetCurrentThread()->Tcb.PreviousMode; -} - - -/* - * @implemented - */ -KPROCESSOR_MODE STDCALL +KPROCESSOR_MODE +STDCALL ExGetPreviousMode (VOID) { - return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode; + return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode; } /* EOF */ diff --git a/reactos/ntoskrnl/rtl/capture.c b/reactos/ntoskrnl/rtl/capture.c index 8eb7529d5b6..aebacafb8e9 100644 --- a/reactos/ntoskrnl/rtl/capture.c +++ b/reactos/ntoskrnl/rtl/capture.c @@ -34,6 +34,8 @@ RtlCaptureUnicodeString(OUT PUNICODE_STRING Dest, if(CurrentMode == UserMode) { + RtlZeroMemory(&Src, sizeof(Src)); + _SEH_TRY { ProbeForRead(UnsafeSrc, diff --git a/reactos/ntoskrnl/dbg/print.c b/reactos/ntoskrnl/rtl/debug.c similarity index 73% rename from reactos/ntoskrnl/dbg/print.c rename to reactos/ntoskrnl/rtl/debug.c index cc0649d12fe..e6c6b127e73 100644 --- a/reactos/ntoskrnl/dbg/print.c +++ b/reactos/ntoskrnl/rtl/debug.c @@ -1,8 +1,7 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: ntoskrnl/dbg/print.c + * FILE: ntoskrnl/rtl/dbgprint.c * PURPOSE: Debug output * * PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de) @@ -15,17 +14,6 @@ /* FUNCTIONS ****************************************************************/ -#if 0 -ULONG DbgService (ULONG Service, PVOID Context1, PVOID Context2); -__asm__ ("\n\t.global _DbgService\n\t" - "_DbgService:\n\t" - "mov 4(%esp), %eax\n\t" - "mov 8(%esp), %ecx\n\t" - "mov 12(%esp), %edx\n\t" - "int $0x2D\n\t" - "ret\n\t"); -#endif - /* * Note: DON'T CHANGE THIS FUNCTION!!! * DON'T CALL HalDisplayString OR SOMETING ELSE!!! @@ -117,12 +105,10 @@ DbgPrint(PCH Format, ...) */ ULONG __cdecl -DbgPrintEx( - IN ULONG ComponentId, - IN ULONG Level, - IN PCH Format, - ... - ) +DbgPrintEx(IN ULONG ComponentId, + IN ULONG Level, + IN PCH Format, + ...) { UNIMPLEMENTED; return 0; @@ -133,10 +119,8 @@ DbgPrintEx( */ ULONG __cdecl -DbgPrintReturnControlC( - PCH Format, - ... - ) +DbgPrintReturnControlC(PCH Format, + ...) { UNIMPLEMENTED; return 0; @@ -145,25 +129,25 @@ DbgPrintReturnControlC( /* * @unimplemented */ -VOID STDCALL -DbgPrompt (PCH OutputString, - PCH InputString, - USHORT InputSize) +VOID +STDCALL +DbgPrompt(PCH OutputString, + PCH InputString, + USHORT InputSize) { - ANSI_STRING Output; - ANSI_STRING Input; + ANSI_STRING Output; + ANSI_STRING Input; - Input.Length = 0; - Input.MaximumLength = InputSize; - Input.Buffer = InputString; + Input.Length = 0; + Input.MaximumLength = InputSize; + Input.Buffer = InputString; - Output.Length = strlen (OutputString); - Output.MaximumLength = Output.Length + 1; - Output.Buffer = OutputString; + Output.Length = strlen (OutputString); + Output.MaximumLength = Output.Length + 1; + Output.Buffer = OutputString; - /* FIXME: Not implemented yet! */ - // KdpPromptString (&Output, - // &Input); + /* FIXME: Not implemented yet! + KdpPromptString (&Output, &Input); */ } /* @@ -171,13 +155,11 @@ DbgPrompt (PCH OutputString, */ NTSTATUS STDCALL -DbgQueryDebugFilterState( - IN ULONG ComponentId, - IN ULONG Level - ) +DbgQueryDebugFilterState(IN ULONG ComponentId, + IN ULONG Level) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } /* @@ -185,14 +167,24 @@ DbgQueryDebugFilterState( */ NTSTATUS STDCALL -DbgSetDebugFilterState( - IN ULONG ComponentId, - IN ULONG Level, - IN BOOLEAN State - ) +DbgSetDebugFilterState(IN ULONG ComponentId, + IN ULONG Level, + IN BOOLEAN State) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } +/* + * @unimplemented + */ +NTSTATUS +STDCALL +DbgLoadImageSymbols(IN PUNICODE_STRING Name, + IN ULONG Base, + IN ULONG Unknown3) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} /* EOF */ diff --git a/reactos/ntoskrnl/rtl/misc.c b/reactos/ntoskrnl/rtl/misc.c index 62f43189142..311db1df9de 100644 --- a/reactos/ntoskrnl/rtl/misc.c +++ b/reactos/ntoskrnl/rtl/misc.c @@ -1,104 +1,104 @@ -/* $Id:$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/rtl/misc.c - * PURPOSE: Various functions - * - * PROGRAMMERS: Hartmut Birr - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* GLOBALS *******************************************************************/ - -extern ULONG NtGlobalFlag; -extern ULONG NtMajorVersion; -extern ULONG NtMinorVersion; -extern ULONG NtOSCSDVersion; - -/* header hell made me do this...sorry */ -typedef struct _OSVERSIONINFOW { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - WCHAR szCSDVersion[ 128 ]; -} OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW; - -typedef struct _OSVERSIONINFOEXW { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - WCHAR szCSDVersion[ 128 ]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW; - -#ifndef VER_PLATFORM_WIN32_NT -#define VER_PLATFORM_WIN32_NT (2) -#endif - -/* FUNCTIONS *****************************************************************/ - -/* -* @implemented -*/ -ULONG -STDCALL -RtlGetNtGlobalFlags(VOID) -{ - return(NtGlobalFlag); -} - - -/* -* @implemented -*/ -NTSTATUS STDCALL -RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation) -{ - if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) || - lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW)) - { - lpVersionInformation->dwMajorVersion = NtMajorVersion; - lpVersionInformation->dwMinorVersion = NtMinorVersion; - lpVersionInformation->dwBuildNumber = NtBuildNumber; - lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT; - if(((NtOSCSDVersion >> 8) & 0xFF) != 0) - { - int i = _snwprintf(lpVersionInformation->szCSDVersion, - (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0])) - 1, - L"Service Pack %d", - ((NtOSCSDVersion >> 8) & 0xFF)); - lpVersionInformation->szCSDVersion[i] = L'\0'; - } - else - { - RtlZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion)); - } - if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) - { - RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)lpVersionInformation; - InfoEx->wServicePackMajor = (NtOSCSDVersion >> 8) & 0xFF; - InfoEx->wServicePackMinor = NtOSCSDVersion & 0xFF; - InfoEx->wSuiteMask = SharedUserData->SuiteMask; - InfoEx->wProductType = SharedUserData->NtProductType; - } - - return STATUS_SUCCESS; - } - - return STATUS_INVALID_PARAMETER; -} - +/* $Id:$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/rtl/misc.c + * PURPOSE: Various functions + * + * PROGRAMMERS: Hartmut Birr + */ + +/* INCLUDES *****************************************************************/ + +#include +#define NDEBUG +#include + +/* GLOBALS *******************************************************************/ + +extern ULONG NtGlobalFlag; +extern ULONG NtMajorVersion; +extern ULONG NtMinorVersion; +extern ULONG NtOSCSDVersion; + +/* header hell made me do this...sorry */ +typedef struct _OSVERSIONINFOW { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[ 128 ]; +} OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW; + +typedef struct _OSVERSIONINFOEXW { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[ 128 ]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; +} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW; + +#ifndef VER_PLATFORM_WIN32_NT +#define VER_PLATFORM_WIN32_NT (2) +#endif + +/* FUNCTIONS *****************************************************************/ + +/* +* @implemented +*/ +ULONG +STDCALL +RtlGetNtGlobalFlags(VOID) +{ + return(NtGlobalFlag); +} + + +/* +* @implemented +*/ +NTSTATUS STDCALL +RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation) +{ + if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) || + lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW)) + { + lpVersionInformation->dwMajorVersion = NtMajorVersion; + lpVersionInformation->dwMinorVersion = NtMinorVersion; + lpVersionInformation->dwBuildNumber = NtBuildNumber; + lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT; + if(((NtOSCSDVersion >> 8) & 0xFF) != 0) + { + int i = _snwprintf(lpVersionInformation->szCSDVersion, + (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0])) - 1, + L"Service Pack %d", + ((NtOSCSDVersion >> 8) & 0xFF)); + lpVersionInformation->szCSDVersion[i] = L'\0'; + } + else + { + RtlZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion)); + } + if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) + { + RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)lpVersionInformation; + InfoEx->wServicePackMajor = (NtOSCSDVersion >> 8) & 0xFF; + InfoEx->wServicePackMinor = NtOSCSDVersion & 0xFF; + InfoEx->wSuiteMask = SharedUserData->SuiteMask; + InfoEx->wProductType = SharedUserData->NtProductType; + } + + return STATUS_SUCCESS; + } + + return STATUS_INVALID_PARAMETER; +} + diff --git a/reactos/ntoskrnl/se/access.c b/reactos/ntoskrnl/se/access.c index 62687dec6f3..0e1f2008f9a 100644 --- a/reactos/ntoskrnl/se/access.c +++ b/reactos/ntoskrnl/se/access.c @@ -1,11 +1,10 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/se/access.c - * PURPOSE: Access rights handling functions - * - * PROGRAMMERS: Eric Kohl + * PURPOSE: Access state functions + * + * PROGRAMMERS: Eric Kohl */ /* INCLUDES *****************************************************************/ @@ -16,65 +15,6 @@ /* FUNCTIONS ***************************************************************/ -/* - * @implemented - */ -BOOLEAN -STDCALL -RtlAreAllAccessesGranted ( - ACCESS_MASK GrantedAccess, - ACCESS_MASK DesiredAccess - ) -{ - PAGED_CODE_RTL(); - - return ((GrantedAccess & DesiredAccess) == DesiredAccess); -} - - -/* - * @implemented - */ -BOOLEAN -STDCALL -RtlAreAnyAccessesGranted ( - ACCESS_MASK GrantedAccess, - ACCESS_MASK DesiredAccess - ) -{ - PAGED_CODE_RTL(); - - return ((GrantedAccess & DesiredAccess) != 0); -} - - -/* - * @implemented - */ -VOID -STDCALL -RtlMapGenericMask ( - PACCESS_MASK AccessMask, - PGENERIC_MAPPING GenericMapping - ) -{ - PAGED_CODE_RTL(); - - if (*AccessMask & GENERIC_READ) - *AccessMask |= GenericMapping->GenericRead; - - if (*AccessMask & GENERIC_WRITE) - *AccessMask |= GenericMapping->GenericWrite; - - if (*AccessMask & GENERIC_EXECUTE) - *AccessMask |= GenericMapping->GenericExecute; - - if (*AccessMask & GENERIC_ALL) - *AccessMask |= GenericMapping->GenericAll; - - *AccessMask &= ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); -} - /* * @unimplemented */ diff --git a/reactos/ntoskrnl/se/sd.c b/reactos/ntoskrnl/se/sd.c index 3e12f8062ec..9f55266f969 100644 --- a/reactos/ntoskrnl/se/sd.c +++ b/reactos/ntoskrnl/se/sd.c @@ -301,6 +301,8 @@ SeCaptureSecurityDescriptor( { if(CurrentMode != KernelMode) { + RtlZeroMemory(&DescriptorCopy, sizeof(DescriptorCopy)); + _SEH_TRY { /* first only probe and copy until the control field of the descriptor diff --git a/reactos/ntoskrnl/se/token.c b/reactos/ntoskrnl/se/token.c index 7ff0e25a75a..ab4f2690b79 100644 --- a/reactos/ntoskrnl/se/token.c +++ b/reactos/ntoskrnl/se/token.c @@ -169,6 +169,7 @@ SepFindPrimaryGroupAndDefaultOwner(PTOKEN Token, NTSTATUS +STDCALL SepDuplicateToken(PTOKEN Token, POBJECT_ATTRIBUTES ObjectAttributes, BOOLEAN EffectiveOnly, @@ -300,39 +301,6 @@ SepDuplicateToken(PTOKEN Token, return(Status); } - -NTSTATUS -SepInitializeNewProcess(struct _EPROCESS* NewProcess, - struct _EPROCESS* ParentProcess) -{ - NTSTATUS Status; - PTOKEN pNewToken; - PTOKEN pParentToken; - - OBJECT_ATTRIBUTES ObjectAttributes; - - pParentToken = (PACCESS_TOKEN) ParentProcess->Token; - - InitializeObjectAttributes(&ObjectAttributes, - NULL, - 0, - NULL, - NULL); - - Status = SepDuplicateToken(pParentToken, - &ObjectAttributes, - FALSE, - TokenPrimary, - pParentToken->ImpersonationLevel, - KernelMode, - &pNewToken); - if ( ! NT_SUCCESS(Status) ) - return Status; - - NewProcess->Token = pNewToken; - return(STATUS_SUCCESS); -} - /* * @unimplemented */ @@ -1800,9 +1768,9 @@ NtAdjustPrivilegesToken (IN HANDLE TokenHandle, return Status; } - -NTSTATUS -SepCreateSystemProcessToken(struct _EPROCESS* Process) +PTOKEN +STDCALL +SepCreateSystemProcessToken(VOID) { NTSTATUS Status; ULONG uSize; @@ -1833,28 +1801,28 @@ SepCreateSystemProcessToken(struct _EPROCESS* Process) (PVOID*)&AccessToken); if (!NT_SUCCESS(Status)) { - return(Status); + return NULL; } Status = ExpAllocateLocallyUniqueId(&AccessToken->TokenId); if (!NT_SUCCESS(Status)) { ObDereferenceObject(AccessToken); - return(Status); + return NULL; } Status = ExpAllocateLocallyUniqueId(&AccessToken->ModifiedId); if (!NT_SUCCESS(Status)) { ObDereferenceObject(AccessToken); - return(Status); + return NULL; } Status = ExpAllocateLocallyUniqueId(&AccessToken->AuthenticationId); if (!NT_SUCCESS(Status)) { ObDereferenceObject(AccessToken); - return Status; + return NULL; } AccessToken->TokenLock = &SepTokenLock; @@ -2002,11 +1970,10 @@ SepCreateSystemProcessToken(struct _EPROCESS* Process) if ( ! NT_SUCCESS(Status) ) { ObDereferenceObject(AccessToken); - return Status; + return NULL; } - Process->Token = AccessToken; - return(STATUS_SUCCESS); + return AccessToken; } diff --git a/reactos/services/eventlog/eventlog.c b/reactos/services/eventlog/eventlog.c index 4da6ffcd263..c5590fdbbf1 100644 --- a/reactos/services/eventlog/eventlog.c +++ b/reactos/services/eventlog/eventlog.c @@ -36,7 +36,6 @@ #include "eventlog.h" -#define DBG #define NDEBUG #include diff --git a/reactos/services/umpnpmgr/umpnpmgr.c b/reactos/services/umpnpmgr/umpnpmgr.c index a4b0b156595..6781b497526 100644 --- a/reactos/services/umpnpmgr/umpnpmgr.c +++ b/reactos/services/umpnpmgr/umpnpmgr.c @@ -40,7 +40,6 @@ #include "pnp_s.h" -#define DBG #define NDEBUG #include diff --git a/reactos/subsys/csrss/init.c b/reactos/subsys/csrss/init.c index e8c0076da1f..43b8ae7f05c 100644 --- a/reactos/subsys/csrss/init.c +++ b/reactos/subsys/csrss/init.c @@ -131,14 +131,13 @@ CsrpParseCommandLine ( InitializeObjectAttributes (&Attributes, &CsrDirectoryName, - 0, + OBJ_OPENIF, NULL, NULL); - Status = NtCreateDirectoryObject(&CsrObjectDirectory, - 0xF000F, /* ea:??? */ - &Attributes); - + Status = NtOpenDirectoryObject(&CsrObjectDirectory, + 0xF000F, /* ea:??? */ + &Attributes); return Status; } diff --git a/reactos/subsys/csrss/win32csr/desktopbg.c b/reactos/subsys/csrss/win32csr/desktopbg.c index da8132034e1..0eb3bd5ccf7 100644 --- a/reactos/subsys/csrss/win32csr/desktopbg.c +++ b/reactos/subsys/csrss/win32csr/desktopbg.c @@ -53,7 +53,7 @@ typedef struct tagPRIVATE_NOTIFY_DESKTOP }; } PRIVATE_NOTIFY_DESKTOP, *PPRIVATE_NOTIFY_DESKTOP; -static BOOL Initialized = FALSE; +static BOOL BgInitialized = FALSE; static HWND VisibleDesktopWindow = NULL; static LRESULT CALLBACK @@ -220,9 +220,9 @@ CSR_API(CsrCreateDesktop) Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY); Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE; - if (! Initialized) + if (! BgInitialized) { - Initialized = TRUE; + BgInitialized = TRUE; if (! DtbgInit()) { return Reply->Status = STATUS_UNSUCCESSFUL; diff --git a/reactos/subsys/csrss/win32csr/guiconsole.c b/reactos/subsys/csrss/win32csr/guiconsole.c index 1d44b97937f..5845fc281a2 100644 --- a/reactos/subsys/csrss/win32csr/guiconsole.c +++ b/reactos/subsys/csrss/win32csr/guiconsole.c @@ -45,7 +45,7 @@ typedef struct GUI_CONSOLE_DATA_TAG #define CURSOR_BLINK_TIME 500 -static BOOL Initialized = FALSE; +static BOOL ConsInitialized = FALSE; static HWND NotifyWnd; /* FUNCTIONS *****************************************************************/ @@ -975,12 +975,12 @@ GuiInitConsole(PCSRSS_CONSOLE Console) HANDLE GraphicsStartupEvent; HANDLE ThreadHandle; - if (! Initialized) + if (! ConsInitialized) { - Initialized = TRUE; + ConsInitialized = TRUE; if (! GuiInit()) { - Initialized = FALSE; + ConsInitialized = FALSE; return STATUS_UNSUCCESSFUL; } } diff --git a/reactos/subsys/csrss/win32csr/tuiconsole.c b/reactos/subsys/csrss/win32csr/tuiconsole.c index 12aae3338bb..90473a7159a 100644 --- a/reactos/subsys/csrss/win32csr/tuiconsole.c +++ b/reactos/subsys/csrss/win32csr/tuiconsole.c @@ -22,7 +22,7 @@ static COORD PhysicalConsoleSize; static HANDLE ConsoleDeviceHandle; static PCSRSS_CONSOLE ActiveConsole; -static BOOL Initialized = FALSE; +static BOOL ConsInitialized = FALSE; static BOOL FASTCALL TuiInit(VOID) @@ -234,12 +234,12 @@ static CSRSS_CONSOLE_VTBL TuiVtbl = NTSTATUS FASTCALL TuiInitConsole(PCSRSS_CONSOLE Console) { - if (! Initialized) + if (! ConsInitialized) { - Initialized = TRUE; + ConsInitialized = TRUE; if (! TuiInit()) { - Initialized = FALSE; + ConsInitialized = FALSE; return STATUS_UNSUCCESSFUL; } } diff --git a/reactos/subsys/ntvdm/En.rc b/reactos/subsys/ntvdm/En.rc new file mode 100644 index 00000000000..14a9116bccc --- /dev/null +++ b/reactos/subsys/ntvdm/En.rc @@ -0,0 +1,13 @@ +#include "resource.h" +/* + * Moved all hardcoded strings to En.rc. + * By Magnus Olsen 2005 + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +STRINGTABLE DISCARDABLE +{ + +STRING_WelcomeMsg, "ReactOS Virtual DOS Machine support.\n" +STRING_PromptMsg, "Type r to run, s to shutdown or q to quit now." +} diff --git a/reactos/subsys/ntvdm/ntvdm.c b/reactos/subsys/ntvdm/ntvdm.c index 11f7845bd87..362e629585c 100644 --- a/reactos/subsys/ntvdm/ntvdm.c +++ b/reactos/subsys/ntvdm/ntvdm.c @@ -15,6 +15,7 @@ #include #include #include +#include "resource.h" #define NDEBUG #include @@ -205,6 +206,7 @@ CreateVDM(PVDM_CONTROL_BLOCK vdm) SYSTEM_INFO inf; MEMORYSTATUS stat; + GlobalMemoryStatus(&stat); if (stat.dwLength != sizeof(MEMORYSTATUS)) { printf("WARNING: GlobalMemoryStatus() returned unknown structure version, size %ld, expected %d.\n", stat.dwLength, sizeof(stat)); @@ -223,6 +225,7 @@ CreateVDM(PVDM_CONTROL_BLOCK vdm) //SetLastError(); return FALSE; } + } GetSystemInfo(&inf); @@ -273,10 +276,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho ULONG i; BOOL vdmStarted = FALSE; - WCHAR WelcomeMsg[] = L"ReactOS Virtual DOS Machine support.\n"; - WCHAR PromptMsg[] = L"Type r to run, s to shutdown or q to quit now."; + WCHAR WelcomeMsg[RC_STRING_MAX_SIZE]; + WCHAR PromptMsg[RC_STRING_MAX_SIZE]; CHAR InputBuffer[255]; - + + LoadString( GetModuleHandle(NULL), STRING_WelcomeMsg, (LPTSTR) WelcomeMsg,sizeof(WelcomeMsg) / sizeof(WelcomeMsg[0])); + LoadString( GetModuleHandle(NULL), STRING_PromptMsg, (LPTSTR) PromptMsg ,sizeof(PromptMsg) / sizeof(PromptMsg[0])); + AllocConsole(); SetConsoleTitleW(L"ntvdm"); diff --git a/reactos/subsys/ntvdm/ntvdm.rc b/reactos/subsys/ntvdm/ntvdm.rc index 4363aab2436..afba36cb357 100644 --- a/reactos/subsys/ntvdm/ntvdm.rc +++ b/reactos/subsys/ntvdm/ntvdm.rc @@ -1,6 +1,10 @@ /* $Id$ */ +#include #define REACTOS_STR_FILE_DESCRIPTION "ReactOS Virtual DOS Machine\0" #define REACTOS_STR_INTERNAL_NAME "ntvdm\0" #define REACTOS_STR_ORIGINAL_FILENAME "ntvdm.exe\0" #include + +#include "En.rc" + diff --git a/reactos/subsys/ntvdm/resource.h b/reactos/subsys/ntvdm/resource.h new file mode 100644 index 00000000000..0600fe4030d --- /dev/null +++ b/reactos/subsys/ntvdm/resource.h @@ -0,0 +1,6 @@ +#define RC_STRING_MAX_SIZE 2048 +#define STRING_WelcomeMsg 100 +#define STRING_PromptMsg 101 + + +/* EOF */ diff --git a/reactos/subsys/smss/client.c b/reactos/subsys/smss/client.c index 33dc6bf5477..212e3332e86 100644 --- a/reactos/subsys/smss/client.c +++ b/reactos/subsys/smss/client.c @@ -166,14 +166,14 @@ SmCreateClient(PSM_PORT_MESSAGE Request, PSM_CLIENT_DATA * ClientData) /* * Check if a client for the ID already exist. */ - if (SmpLookupClient(ConnectData->Subsystem)) + if (SmpLookupClient(ConnectData->SubSystemId)) { DPRINT("SM: %s: attempt to register again subsystem %d.\n", __FUNCTION__, - ConnectData->Subsystem); + ConnectData->SubSystemId); return STATUS_UNSUCCESSFUL; } - DPRINT("SM: %s: registering subsystem %d \n", __FUNCTION__, ConnectData->Subsystem); + DPRINT("SM: %s: registering subsystem ID=%d \n", __FUNCTION__, ConnectData->SubSystemId); /* * Allocate the storage for client data */ @@ -188,7 +188,7 @@ SmCreateClient(PSM_PORT_MESSAGE Request, PSM_CLIENT_DATA * ClientData) /* * Initialize the client data */ - pClient->SubsystemId = ConnectData->Subsystem; + pClient->SubsystemId = ConnectData->SubSystemId; /* SM auto-initializes; other subsystems are required to call * SM_API_COMPLETE_SESSION via SMDLL. */ pClient->Initialized = (IMAGE_SUBSYSTEM_NATIVE == pClient->SubsystemId); @@ -276,4 +276,49 @@ SmDestroyClient (ULONG SubsystemId) return Status; } +/* === Utilities for SmQryInfo === */ + +/********************************************************************** + * SmGetClientBasicInformation/1 + */ +NTSTATUS FASTCALL +SmGetClientBasicInformation (PSM_BASIC_INFORMATION i) +{ + INT Index = 0; + PSM_CLIENT_DATA Client = NULL; + + DPRINT("SM: %s called\n", __FUNCTION__); + + RtlEnterCriticalSection (& SmpClientDirectory.Lock); + + i->SubSystemCount = SmpClientDirectory.Count; + i->Unused = 0; + + if (SmpClientDirectory.Count > 0) + { + Client = SmpClientDirectory.Client; + while ((NULL != Client) && (Index < SM_QRYINFO_MAX_SS_COUNT)) + { + i->SubSystem[Index].Id = Client->SubsystemId; + i->SubSystem[Index].Flags = 0; /* TODO */ + i->SubSystem[Index].ProcessId = 0; /* TODO */ + Client = Client->Next; + } + } + + RtlLeaveCriticalSection (& SmpClientDirectory.Lock); + return STATUS_SUCCESS; +} + +/********************************************************************** + * SmGetSubSystemInformation/1 + */ +NTSTATUS FASTCALL +SmGetSubSystemInformation (PSM_SUBSYSTEM_INFORMATION i) +{ + DPRINT("SM: %s called\n", __FUNCTION__); + + return STATUS_NOT_IMPLEMENTED; +} + /* EOF */ diff --git a/reactos/subsys/smss/makefile b/reactos/subsys/smss/makefile index 3845a347e7a..87f64a855bb 100644 --- a/reactos/subsys/smss/makefile +++ b/reactos/subsys/smss/makefile @@ -24,8 +24,12 @@ TARGET_OBJECTS = $(TARGET_NAME).o \ smapi.o smapicomp.o smapiexec.o smapiquery.o \ client.o debug.o print.o +DEP_OBJECTS = $(TARGET_OBJECTS) + include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk +include $(TOOLS_PATH)/depend.mk + # EOF diff --git a/reactos/subsys/smss/smapi.c b/reactos/subsys/smss/smapi.c index a1578507f7e..b514546c765 100644 --- a/reactos/subsys/smss/smapi.c +++ b/reactos/subsys/smss/smapi.c @@ -21,7 +21,7 @@ static HANDLE SmApiPort = INVALID_HANDLE_VALUE; SMAPI(SmInvalid) { DPRINT("SM: %s called\n",__FUNCTION__); - Request->Status = STATUS_NOT_IMPLEMENTED; + Request->SmHeader.Status = STATUS_NOT_IMPLEMENTED; return STATUS_SUCCESS; } @@ -67,10 +67,12 @@ SmpCallbackServer (PSM_PORT_MESSAGE Request, PSM_CONNECT_DATA ConnectData = SmpGetConnectData (Request); UNICODE_STRING CallbackPortName; ULONG CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */ + SB_CONNECT_DATA SbConnectData; + ULONG SbConnectDataLength = sizeof SbConnectData; DPRINT("SM: %s called\n", __FUNCTION__); - if(IMAGE_SUBSYSTEM_NATIVE == ConnectData->Subsystem) + if(IMAGE_SUBSYSTEM_NATIVE == ConnectData->SubSystemId) { DPRINT("SM: %s: we do not need calling back SM!\n", __FUNCTION__); @@ -81,14 +83,16 @@ SmpCallbackServer (PSM_PORT_MESSAGE Request, CallbackPortNameLength); RtlInitUnicodeString (& CallbackPortName, ClientData->SbApiPortName); + + SbConnectData.SmApiMax = (sizeof SmApi / sizeof SmApi[0]); Status = NtConnectPort (& ClientData->SbApiPort, & CallbackPortName, NULL, NULL, NULL, NULL, - NULL, - NULL); + & SbConnectData, + & SbConnectDataLength); return Status; } @@ -138,13 +142,13 @@ SmpApiConnectedThread(PVOID pConnectedPort) Reply = NULL; break; default: - if ((Request.ApiIndex) && - (Request.ApiIndex < (sizeof SmApi / sizeof SmApi[0]))) + if ((Request.SmHeader.ApiIndex) && + (Request.SmHeader.ApiIndex < (sizeof SmApi / sizeof SmApi[0]))) { - Status = SmApi[Request.ApiIndex](&Request); + Status = SmApi[Request.SmHeader.ApiIndex](&Request); Reply = (PLPC_MESSAGE) & Request; } else { - Request.Status = STATUS_NOT_IMPLEMENTED; + Request.SmHeader.Status = STATUS_NOT_IMPLEMENTED; Reply = (PLPC_MESSAGE) & Request; } } @@ -181,11 +185,11 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request) PVOID Context = NULL; DPRINT("SM: %s called:\n SubSystemID=%d\n SbName=\"%S\"\n", - __FUNCTION__, ConnectData->Subsystem, ConnectData->SbName); + __FUNCTION__, ConnectData->SubSystemId, ConnectData->SbName); if(sizeof (SM_CONNECT_DATA) == Request->Header.DataSize) { - if(IMAGE_SUBSYSTEM_UNKNOWN == ConnectData->Subsystem) + if(IMAGE_SUBSYSTEM_UNKNOWN == ConnectData->SubSystemId) { /* * This is not a call to register an image set, @@ -202,9 +206,9 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request) * Reject GUIs classes: only odd subsystem IDs are * allowed to register here (tty mode images). */ - if(1 == (ConnectData->Subsystem % 2)) + if(1 == (ConnectData->SubSystemId % 2)) { - DPRINT("SM: %s: id = %d\n", __FUNCTION__, ConnectData->Subsystem); + DPRINT("SM: %s: id = %d\n", __FUNCTION__, ConnectData->SubSystemId); /* * SmCreateClient/2 is called here explicitly to *fail*. * If it succeeds, there is something wrong in the @@ -236,7 +240,7 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request) } else { DPRINT("SM: %s: SmpCallbackServer failed (Status=%08lx)\n", __FUNCTION__, Status); - Status = SmDestroyClient (ConnectData->Subsystem); + Status = SmDestroyClient (ConnectData->SubSystemId); } } } diff --git a/reactos/subsys/smss/smapicomp.c b/reactos/subsys/smss/smapicomp.c index 52ef9613954..94abeb96ef1 100644 --- a/reactos/subsys/smss/smapicomp.c +++ b/reactos/subsys/smss/smapicomp.c @@ -36,15 +36,12 @@ SMAPI(SmCompSes) { NTSTATUS Status = STATUS_SUCCESS; - DPRINT("SM: %s called from [%lx|%lx]\n", - __FUNCTION__, - Request->ClientId.UniqueProcessId, - Request->ClientId.UniqueThreadId); + DPRINT("SM: %s called\n", __FUNCTION__); Status = SmCompleteClientInitialization (Request->Header.ClientId.UniqueProcess); if(!NT_SUCCESS(Status)) { - Request->Status = STATUS_UNSUCCESSFUL; + Request->SmHeader.Status = STATUS_UNSUCCESSFUL; } return Status; } diff --git a/reactos/subsys/smss/smapiexec.c b/reactos/subsys/smss/smapiexec.c index 7efc800b110..f74ac34b3b9 100644 --- a/reactos/subsys/smss/smapiexec.c +++ b/reactos/subsys/smss/smapiexec.c @@ -253,7 +253,7 @@ SMAPI(SmExecPgm) DPRINT("SM: %s called from CID(%lx|%lx)\n", __FUNCTION__, Request->Header.ClientId.UniqueProcess, Request->Header.ClientId.UniqueThread); - ExecPgm = & Request->ExecPgm; + ExecPgm = & Request->Request.ExecPgm; /* Check if the name lenght is valid */ if((ExecPgm->NameLength > 0) && (ExecPgm->NameLength <= SM_EXEXPGM_MAX_LENGTH) && @@ -277,7 +277,7 @@ SMAPI(SmExecPgm) * independent process; now it is embedded in the * SM for performance or security. */ - Request->Status = SmInitializeDbgSs(); + Request->SmHeader.Status = SmInitializeDbgSs(); } else { @@ -299,20 +299,20 @@ SMAPI(SmExecPgm) wcscat (ImagePath, Data); /* Create native process */ - Request->Status = SmCreateUserProcess(ImagePath, + Request->SmHeader.Status = SmCreateUserProcess(ImagePath, L"", /* FIXME */ FALSE, /* wait */ NULL, FALSE, /* terminate */ NULL); }else{ - Request->Status = Status; + Request->SmHeader.Status = Status; } } } else { - Request->Status = Status = STATUS_INVALID_PARAMETER; + Request->SmHeader.Status = Status = STATUS_INVALID_PARAMETER; } return Status; } diff --git a/reactos/subsys/smss/smapiquery.c b/reactos/subsys/smss/smapiquery.c index e93e593405a..d1c402de757 100644 --- a/reactos/subsys/smss/smapiquery.c +++ b/reactos/subsys/smss/smapiquery.c @@ -1,4 +1,4 @@ -/* $Id: $ +/* $Id$ * * smapiquery.c - SM_API_QUERY_INFORMATION * @@ -37,8 +37,33 @@ SMAPI(SmQryInfo) NTSTATUS Status = STATUS_SUCCESS; DPRINT("SM: %s called\n", __FUNCTION__); - - Request->Status = STATUS_NOT_IMPLEMENTED; + + switch (Request->Request.QryInfo.SmInformationClass) + { + case SmBasicInformation: + if(Request->Request.QryInfo.DataLength != sizeof (SM_BASIC_INFORMATION)) + { + Request->Reply.QryInfo.DataLength = sizeof (SM_BASIC_INFORMATION); + Request->SmHeader.Status = STATUS_INFO_LENGTH_MISMATCH; + }else{ + Request->SmHeader.Status = + SmGetClientBasicInformation (& Request->Reply.QryInfo.BasicInformation); + } + break; + case SmSubSystemInformation: + if(Request->Request.QryInfo.DataLength != sizeof (SM_SUBSYSTEM_INFORMATION)) + { + Request->Reply.QryInfo.DataLength = sizeof (SM_SUBSYSTEM_INFORMATION); + Request->SmHeader.Status = STATUS_INFO_LENGTH_MISMATCH; + }else{ + Request->SmHeader.Status = + SmGetSubSystemInformation (& Request->Reply.QryInfo.SubSystemInformation); + } + break; + default: + Request->SmHeader.Status = STATUS_NOT_IMPLEMENTED; + break; + } return Status; } diff --git a/reactos/subsys/smss/smss.c b/reactos/subsys/smss/smss.c index b03197c0a70..09438cfcab8 100644 --- a/reactos/subsys/smss/smss.c +++ b/reactos/subsys/smss/smss.c @@ -56,6 +56,7 @@ NtProcessStartup(PPEB Peb) } /* Initialize the system */ Status = InitSessionManager(); + /* Watch required subsystems TODO */ #if 0 if (!NT_SUCCESS(Status)) { diff --git a/reactos/subsys/smss/smss.h b/reactos/subsys/smss/smss.h index eae61437e30..b5352bfcdba 100644 --- a/reactos/subsys/smss/smss.h +++ b/reactos/subsys/smss/smss.h @@ -96,6 +96,8 @@ NTSTATUS SmInitializeClientManagement(VOID); NTSTATUS STDCALL SmCreateClient(PSM_PORT_MESSAGE,PSM_CLIENT_DATA*); NTSTATUS STDCALL SmDestroyClient(ULONG); NTSTATUS STDCALL SmCompleteClientInitialization (HANDLE hProcess); +NTSTATUS FASTCALL SmGetClientBasicInformation (PSM_BASIC_INFORMATION); +NTSTATUS FASTCALL SmGetSubSystemInformation (PSM_SUBSYSTEM_INFORMATION); /* debug.c */ extern HANDLE DbgSsApiPort; diff --git a/reactos/subsys/system/calc/Cz.rc b/reactos/subsys/system/calc/Cz.rc new file mode 100644 index 00000000000..7aca39f9209 --- /dev/null +++ b/reactos/subsys/system/calc/Cz.rc @@ -0,0 +1,157 @@ +/* + * Czech language support + * + * WineCalc (En.rc) + * + * Copyright 2005 Denzil + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "windows.h" +#include "resource.h" +#include "winecalc.h" + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +{ + IDS_APPNAME, "Kalkulátor" + + IDS_COPYRIGHT1, "Kalkulátor 5.0. Licencován pod LGPL 2" + IDS_COPYRIGHT2 "Copyright 2003, James Briggs" + IDS_COPYRIGHT3 "San Jose, California, USA" + IDS_COPYRIGHT4 "james@ActionMessage.com" + IDS_COPYRIGHT5 "http://www.ActionMessage.com/winecalc/" + + IDS_BTN_BACKSPACE, "Zpìt" + IDS_BTN_CLEAR_ENTRY, "CE" + IDS_BTN_CLEAR_ALL, "C" + IDS_BTN_MEM_CLEAR, "MC" + IDS_BTN_MEM_RECALL, "MR" + IDS_BTN_MEM_STORE, "MS" + IDS_BTN_MEM_PLUS, "M+" + IDS_BTN_MEM_STATUS_M, "M" + IDS_BTN_SQRT, "sqrt" + IDS_ERR_INVALID_INPUT, "Neplatný vstup pro funkci." + IDS_ERR_DIVIDE_BY_ZERO, "Nelze dìlit nulou." + IDS_ERR_UNDEFINED, "Výsledek funkce není definován." +} + +MAIN_MENU MENU DISCARDABLE +{ + POPUP "&Editace" { + MENUITEM "&Kopírovat Ctrl+C", IDM_COPY + MENUITEM "&Vložit Ctrl+V", IDM_PASTE + } + POPUP "&Zobrazení" { + MENUITEM "Standartní", IDM_MODE_STANDARD + MENUITEM "Vìdecké", IDM_MODE_SCIENTIFIC + MENUITEM SEPARATOR + MENUITEM "Seskupování èíslic", IDM_DIGIT_GROUPING + } + POPUP "&Pomoc" { + MENUITEM "Témata nápovìdy", IDM_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "O Kalkulátoru", IDM_ABOUT + } +} + +SCIMS_MENU MENU DISCARDABLE +{ + POPUP "&Editace" { + MENUITEM "&Kopírovat Ctrl+C", IDM_COPY + MENUITEM "&Vložit Ctrl+V", IDM_PASTE + } + POPUP "&Zobrazení" { + MENUITEM "Standartní", IDM_MODE_STANDARD + MENUITEM "Vìdecké", IDM_MODE_SCIENTIFIC + MENUITEM SEPARATOR + MENUITEM "Šestnáctkové\tF5", ID_CALC_NS_HEX + MENUITEM "Desítkové\tF6", ID_CALC_NS_DEC + MENUITEM "Osmièkové\tF7", ID_CALC_NS_OCT + MENUITEM "Dvojkové\tF8", ID_CALC_NS_BIN + MENUITEM SEPARATOR + MENUITEM "Stupnì\tF2", ID_CALC_MS_DEGREES + MENUITEM "Radiány\tF3", ID_CALC_MS_RADIANS + MENUITEM "Grady\tF4", ID_CALC_MS_GRADS + MENUITEM SEPARATOR + MENUITEM "Seskupování èíslic", IDM_DIGIT_GROUPING + } + POPUP "&Pomoc" { + MENUITEM "Témata nápovìdy", IDM_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "O Kalkulátoru", IDM_ABOUT + } +} + +SCIWS_MENU MENU DISCARDABLE +{ + POPUP "&Editace" { + MENUITEM "&Kopírovat Ctrl+C", IDM_COPY + MENUITEM "&Vložit Ctrl+V", IDM_PASTE + } + POPUP "&Zobrazení" { + MENUITEM "Standartní", IDM_MODE_STANDARD + MENUITEM "Vìdecké", IDM_MODE_SCIENTIFIC + MENUITEM SEPARATOR + MENUITEM "Šestnáctkové\tF5", ID_CALC_NS_HEX + MENUITEM "Desítkové\tF6", ID_CALC_NS_DEC + MENUITEM "Osmièkové\tF7", ID_CALC_NS_OCT + MENUITEM "Dvojkové\tF8", ID_CALC_NS_BIN + MENUITEM SEPARATOR + MENUITEM "Qword\tF12", ID_CALC_WS_QWORD + MENUITEM "Dword\tF2", ID_CALC_WS_DWORD + MENUITEM "Word\tF3", ID_CALC_WS_WORD + MENUITEM "Byte\tF4", ID_CALC_WS_BYTE + MENUITEM SEPARATOR + MENUITEM "Seskupování èíslic", IDM_DIGIT_GROUPING + } + POPUP "&Pomoc" { + MENUITEM "Témata nápovìdy", IDM_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "O Kalkulátoru", IDM_ABOUT + } +} + +MAIN_MENU ACCELERATORS +BEGIN + VK_F1, IDV_HELP, VIRTKEY +END + +DLG_ABOUT DIALOG 12,0,120,82 +CAPTION "O GNU winecalc" +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +BEGIN + DEFPUSHBUTTON "OK", IDOK, 42, 60, 30, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END + +WHATS_THIS_MENU MENU DISCARDABLE +{ + POPUP "" { + MENUITEM "Co je toto?", IDM_WHATS_THIS + } +} + +DLG_STATS DIALOG 12,0,125,78 +CAPTION "Statistics Box" +FONT 9, "Tahoma" +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +BEGIN + DEFPUSHBUTTON "&RET", ID_STATS_RET, 4, 52, 25, 13, WS_TABSTOP | WS_GROUP + PUSHBUTTON "&LOAD", ID_STATS_LOAD, 34, 52, 25, 13, WS_TABSTOP | WS_GROUP + PUSHBUTTON "&CD" ID_STATS_CD, 64, 52, 25, 13, WS_TABSTOP | WS_GROUP + PUSHBUTTON "C&AD", ID_STATS_CAD, 94, 52, 25, 13, WS_TABSTOP | WS_GROUP +END diff --git a/reactos/subsys/system/calc/rsrc.rc b/reactos/subsys/system/calc/rsrc.rc index 221463ac993..df8663287ff 100644 --- a/reactos/subsys/system/calc/rsrc.rc +++ b/reactos/subsys/system/calc/rsrc.rc @@ -22,6 +22,7 @@ #include "resource.h" #include "En.rc" +#include "Cz.rc" #include "De.rc" #include "Es.rc" #include "Fr.rc" diff --git a/reactos/subsys/system/cmd/En.rc b/reactos/subsys/system/cmd/En.rc index 74b9aaae3cd..431600aa6ad 100644 --- a/reactos/subsys/system/cmd/En.rc +++ b/reactos/subsys/system/cmd/En.rc @@ -1,65 +1,67 @@ #include "resource.h" -/* Start move all hard code string to En.rc +/* + * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 */ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE { -STRING_ATTRIB_HELP, "Displays or changes file attributes.\n\n \ -ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n \ - [/S [/D]]\n\n \ - + Sets an attribute\n \ - - Clears an attribute\n \ - R Read-only file attribute\n \ - A Archive file attribute\n \ - S System file attribute\n \ - H Hidden file attribute\n \ - /S Processes matching files in the current directory\n \ - and all subdirectories\n \ - /D Processes direcories as well\n\n \ + +STRING_ATTRIB_HELP, "Displays or changes file attributes.\n\n\ +ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n\ + [/S [/D]]\n\n\ + + Sets an attribute\n\ + - Clears an attribute\n\ + R Read-only file attribute\n\ + A Archive file attribute\n\ + S System file attribute\n\ + H Hidden file attribute\n\ + /S Processes matching files in the current directory\n\ + and all subdirectories\n\ + /D Processes direcories as well\n\n\ Type ATTRIB without a parameter to display the attributes of all files." -STRING_ALIAS_HELP, "Sets, removes or shows aliases.\n\n \ -ALIAS [alias=[command]]\n\n \ - alias Name for an alias.\n \ - command Text to be substituted for an alias.\n\n \ -To list all aliases:\n \ - ALIAS\n\n \ -To set a new or replace an existing alias:\n \ - ALIAS da=dir a:\n\n \ -To remove an alias from the alias list:\n \ +STRING_ALIAS_HELP, "Sets, removes or shows aliases.\n\n\ +ALIAS [alias=[command]]\n\n\ + alias Name for an alias.\n\ + command Text to be substituted for an alias.\n\n\ +To list all aliases:\n\ + ALIAS\n\n\ +To set a new or replace an existing alias:\n\ + ALIAS da=dir a:\n\n\ +To remove an alias from the alias list:\n\ ALIAS da=" STRING_BEEP_HELP, "Beep the speaker.\n\nBEEP" -STRING_CALL_HELP, "Calls one batch program from another.\n\n \ -CALL [drive:][path]filename [batch-parameter]\n\n \ - batch-parameter Specifies any command-line information required by the\n \ +STRING_CALL_HELP, "Calls one batch program from another.\n\n\ +CALL [drive:][path]filename [batch-parameter]\n\n\ + batch-parameter Specifies any command-line information required by the\n\ batch program." -STRING_CD_HELP, "Changes the current directory or displays it's name\n\n \ -CHDIR [drive:][path]\n \ -CHDIR[..|-]\n \ -CD [drive:][path]\n \ -CD[..|-]\n\n \ - .. parent directory\n \ - - previous directory\n\n \ -Type CD drive: to display the current directory on the specified drive.\n \ -Type CD without a parameter to display the current drive and directory. " +STRING_CD_HELP, "Changes the current directory or displays it's name\n\n\ +CHDIR [drive:][path]\n\ +CHDIR[..|-]\n\ +CD [drive:][path]\n\ +CD[..|-]\n\n\ + .. parent directory\n\ + - previous directory\n\n\ +Type CD drive: to display the current directory on the specified drive.\n\ +Type CD without a parameter to display the current drive and directory." -STRING_CHCP_HELP, "Displays or sets the active code page number.\n\n \ -CHCP [nnn]\n\n \ - nnn Specifies the active code page number.\n\n \ +STRING_CHCP_HELP, "Displays or sets the active code page number.\n\n\ +CHCP [nnn]\n\n\ + nnn Specifies the active code page number.\n\n\ Type CHCP without a parameter to display the active code page number." -STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n \ -CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n \ - /C[:]choices Specifies allowable keys. Default is YN.\n \ - /N Do not display choices and ? at the end of the prompt string.\n \ - /S Treat choice keys as case sensitive.\n \ - /T[:]c,nn Default choice to c after nn seconds.\n \ - text Prompt string to display.\n\n \ +STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n\ +CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n\ + /C[:]choices Specifies allowable keys. Default is YN.\n\ + /N Do not display choices and ? at the end of the prompt string.\n\ + /S Treat choice keys as case sensitive.\n\ + /T[:]c,nn Default choice to c after nn seconds.\n\ + text Prompt string to display.\n\n\ ERRORLEVEL is set to offset of key user presses in choices." STRING_CLS_HELP, "Clears the screen.\n\nCLS" @@ -78,48 +80,48 @@ STRING_CMD_HELP6," [directory stack]" STRING_CMD_HELP7," [redirections and piping]" -STRING_CMD_HELP8, "Starts a new instance of the ReactOS command line interpreter.\n\n \ -CMD [/[C|K] command][/P][/Q][/T:bf]\n\n \ - /C command Runs the specified command and terminates.\n \ - /K command Runs the specified command and remains.\n \ - /P CMD becomes permanent and runs autoexec.bat\n \ - (cannot be terminated).\n \ +STRING_CMD_HELP8, "Starts a new instance of the ReactOS command line interpreter.\n\n\ +CMD [/[C|K] command][/P][/Q][/T:bf]\n\n\ + /C command Runs the specified command and terminates.\n\ + /K command Runs the specified command and remains.\n\ + /P CMD becomes permanent and runs autoexec.bat\n\ + (cannot be terminated).\n\ /T:bf Sets the background/foreground color (see COLOR command)." -STRING_COLOR_HELP1, "Sets the default foreground and background colors.\n\n \ -COLOR [attr [/F]] \n\n \ - attr Specifies color attribute of console output\n \ - /F fill the console with color attribute\n\n \ -There are three ways to specify the colors:\n \ -1) [bright] name on [bright] name (only the first three letters are required)\n \ -2) decimal on decimal\n \ -3) two hex digits\n\n \ -Colors are:\n \ -dec hex name dec hex name\n \ -0 0 Black 8 8 Gray(Bright black)\n \ -1 1 Blue 9 9 Bright Blue\n \ -2 2 Green 10 A Bright Green\n \ -3 3 Cyan 11 B Bright Cyan\n \ -4 4 Red 12 C Bright Red\n \ -5 5 Magenta 13 D Bright Magenta\n \ -6 6 Yellow 14 E Bright Yellow\n \ +STRING_COLOR_HELP1, "Sets the default foreground and background colors.\n\n\ +COLOR [attr [/F]] \n\n\ + attr Specifies color attribute of console output\n\ + /F fill the console with color attribute\n\n\ +There are three ways to specify the colors:\n\ +1) [bright] name on [bright] name (only the first three letters are required)\n\ +2) decimal on decimal\n\ +3) two hex digits\n\n\ +Colors are:\n\ +dec hex name dec hex name\n\ +0 0 Black 8 8 Gray(Bright black)\n\ +1 1 Blue 9 9 Bright Blue\n\ +2 2 Green 10 A Bright Green\n\ +3 3 Cyan 11 B Bright Cyan\n\ +4 4 Red 12 C Bright Red\n\ +5 5 Magenta 13 D Bright Magenta\n\ +6 6 Yellow 14 E Bright Yellow\n\ 7 7 White 15 F Bright White" STRING_COPY_HELP1, "Overwrite %s (Yes/No/All)? " -STRING_COPY_HELP2, "Copies one or more files to another location.\n\n \ -COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n \ - [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n \ - source Specifies the file or files to be copied.\n \ - /A Indicates an ASCII text file.\n \ - /B Indicates a binary file.\n \ - destination Specifies the directory and/or filename for the new file(s).\n \ - /V Verifies that new files are written correctly.\n \ - /Y Suppresses prompting to confirm you want to overwrite an\n \ - existing destination file.\n \ - /-Y Causes prompting to confirm you want to overwrite an\n \ - existing destination file.\n\n \ -The switch /Y may be present in the COPYCMD environment variable.\n \ +STRING_COPY_HELP2, "Copies one or more files to another location.\n\n\ +COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n\ + [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n\ + source Specifies the file or files to be copied.\n\ + /A Indicates an ASCII text file.\n\ + /B Indicates a binary file.\n\ + destination Specifies the directory and/or filename for the new file(s).\n\ + /V Verifies that new files are written correctly.\n\ + /Y Suppresses prompting to confirm you want to overwrite an\n\ + existing destination file.\n\ + /-Y Causes prompting to confirm you want to overwrite an\n\ + existing destination file.\n\n\ +The switch /Y may be present in the COPYCMD environment variable.\n\ ..." STRING_DATE_HELP1, "\nEnter new date (mm%cdd%cyyyy): " @@ -128,67 +130,67 @@ STRING_DATE_HELP2, "\nEnter new date (dd%cmm%cyyyy): " STRING_DATE_HELP3, "\nEnter new date (yyyy%cmm%cdd): " -STRING_DATE_HELP4, "Displays or sets the date.\n\n \ -DATE [/T][date]\n\n \ - /T display only\n\n \ -Type DATE without parameters to display the current date setting and\n \ +STRING_DATE_HELP4, "Displays or sets the date.\n\n\ +DATE [/T][date]\n\n\ + /T display only\n\n\ +Type DATE without parameters to display the current date setting and\n\ a prompt for a new one. Press ENTER to keep the same date." -STRING_DEL_HELP1, "Deletes one or more files.\n\n \ -DEL [/%c /%c /%c /%c /%c /%c /%c] file ...\n \ -DELETE [/%c /%c /%c /%c /%c /%c /%c] file ...\n \ -ERASE [/%c /%c /%c /%c /%c /%c /%c] file ...\n\n \ - file Specifies the file(s) to delete.\n\n \ - /%c Nothing.\n \ - /%c Prompt. Ask before deleting each file.\n \ - /%c Total. Display total number of deleted files and freed disk space.\n \ - /%c Quiet.\n \ - /%c Wipe. Overwrite the file with random numbers before deleting it.\n \ - /%c Yes. Kill even *.* without asking.\n \ - /%c Zap. Delete hidden, read-only and system files).\n" +STRING_DEL_HELP1, "Deletes one or more files.\n\n\ +DEL [/N /P /T /Q /W /Y /Z] file ...\n\ +DELETE [/N /P /T /Q /W /Y /Z] file ...\n\ +ERASE [/N /P /T /Q /W /Y /Z] file ...\n\n\ + file Specifies the file(s) to delete.\n\n\ + /N Nothing.\n\ + /P Prompt. Ask before deleting each file.\n\ + /T Total. Display total number of deleted files and freed disk space.\n\ + /Q Quiet.\n\ + /W Wipe. Overwrite the file with random numbers before deleting it.\n\ + /Y Yes. Kill even *.* without asking.\n\ + /Z Zap. Delete hidden, read-only and system files.\n" STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you sure (Y/N)?" STRING_DEL_HELP3, " %lu file deleted\n" STRING_DEL_HELP4, " %lu files deleted\n" -STRING_DELAY_HELP, "pause for n seconds or milliseconds\n \ -DELAY [/m]n\n\n \ - /m specifiy than n are milliseconds\n \ +STRING_DELAY_HELP, "pause for n seconds or milliseconds\n\ +DELAY [/m]n\n\n\ + /m specifiy than n are milliseconds\n\ otherwise n are seconds" -STRING_DIR_HELP1, "DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n \ - [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n \ - [drive:][path][filename]\n \ - Specifies drive, directory, and/or files to list.\n\n \ - /A Displays files with specified attributes.\n \ - attributes D Directories R Read-only files\n \ - H Hidden files A Files ready for archiving\n \ - S System files - Prefix meaning not\n \ - /B Uses bare format (no heading information or summary).\n \ - /C Display the thousand separator in file sizes. This is the\n \ - default. Use /-C to disable display of separator.\n \ - /D Same as wide but files are list sorted by column.\n \ - /L Uses lowercase.\n \ - /N New long list format where filenames are on the far right.\n \ - /O List by files in sorted order.\n \ - sortorder N By name (alphabetic) S By size (smallest first)\n \ - E By extension (alphabetic) D By date/time (oldest first)\n \ - G Group directories first - Prefix to reverse order\n \ - /P Pauses after each screenful of information.\n \ - /Q Display the owner of the file.\n \ - /S Displays files in specified directory and all subdirectories.\n \ - /T Controls which time field displayed or used for sorting\n \ - timefield C Creation\n \ - A Last Access\n \ - W Last Written\n \ - /W Uses wide list format.\n \ - /X This displays the short names generated for non-8dot3 file\n \ - names. The format is that of /N with the short name inserted\n \ - before the long name. If no short name is present, blanks are\n \ - displayed in its place.\n \ - /4 Displays four-digit years\n\n \ -Switches may be preset in the DIRCMD environment variable. Override\n \ -preset switches by prefixing any switch with - (hyphen)--for example, /-W.\n " +STRING_DIR_HELP1, "DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n\ + [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n\ + [drive:][path][filename]\n\ + Specifies drive, directory, and/or files to list.\n\n\ + /A Displays files with specified attributes.\n\ + attributes D Directories R Read-only files\n\ + H Hidden files A Files ready for archiving\n\ + S System files - Prefix meaning not\n\ + /B Uses bare format (no heading information or summary).\n\ + /C Display the thousand separator in file sizes. This is the\n\ + default. Use /-C to disable display of separator.\n\ + /D Same as wide but files are list sorted by column.\n\ + /L Uses lowercase.\n\ + /N New long list format where filenames are on the far right.\n\ + /O List by files in sorted order.\n\ + sortorder N By name (alphabetic) S By size (smallest first)\n\ + E By extension (alphabetic) D By date/time (oldest first)\n\ + G Group directories first - Prefix to reverse order\n\ + /P Pauses after each screenful of information.\n\ + /Q Display the owner of the file.\n\ + /S Displays files in specified directory and all subdirectories.\n\ + /T Controls which time field displayed or used for sorting\n\ + timefield C Creation\n\ + A Last Access\n\ + W Last Written\n\ + /W Uses wide list format.\n\ + /X This displays the short names generated for non-8dot3 file\n\ + names. The format is that of /N with the short name inserted\n\ + before the long name. If no short name is present, blanks are\n\ + displayed in its place.\n\ + /4 Displays four-digit years\n\n\ +Switches may be preset in the DIRCMD environment variable. Override\n\ +preset switches by prefixing any switch with - (hyphen)--for example, /-W.\n" STRING_DIR_HELP2, " Volume in drive %c is %s" STRING_DIR_HELP3, " Volume in drive %c has no label" @@ -198,9 +200,9 @@ STRING_DIR_HELP6, "%16i Dir(s)% 15s bytes\n" STRING_DIR_HELP7, "\n Directory of %s\n\n" STRING_DIR_HELP8, "%16i Dir(s)% 14s bytes\n" -STRING_DIRSTACK_HELP1, "Stores the current directory for use by the POPD command, then\n \ -changes to the specified directory.\n\n \ -PUSHD [path | ..]\n\n \ +STRING_DIRSTACK_HELP1, "Stores the current directory for use by the POPD command, then\n\ +changes to the specified directory.\n\n\ +PUSHD [path | ..]\n\n\ path Specifies the directory to make the current directory" STRING_DIRSTACK_HELP2, "Changes to the directory stored by the PUSHD command.\n\nPOPD" @@ -209,30 +211,285 @@ STRING_DIRSTACK_HELP3, "Prints the contents of the directory stack.\n\nDIRS" STRING_DIRSTACK_HELP4, "Directory stack empty" +STRING_ECHO_HELP1, "Display a messages without trailing carridge return and line feed.\n\n\ + ECHOS message" + +STRING_ECHO_HELP2, "Displays a message to the standard error.\n\n\ + ECHOERR message\n\ + ECHOERR. prints an empty line" + +STRING_ECHO_HELP3, "Prints a messages to standard error output without trailing carridge return and line feed.\n\n\ + ECHOSERR message" + +STRING_ECHO_HELP4, "Displays a message or switches command echoing on or off.\n\n\ + ECHO [ON | OFF]\n\ + ECHO [message]\n\ + ECHO. prints an empty line\n\n\ +Type ECHO without a parameter to display the current ECHO setting." + +STRING_ECHO_HELP5, "ECHO is %s\n" STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT" -STRING_MKDIR_HELP, "Creates a directory.\n\n \ +STRING_FOR_HELP1, "Runs a specified command for each file in a set of files\n\n\ +FOR %variable IN (set) DO command [parameters]\n\n\ + %variable Specifies a replaceable parameter.\n\ + (set) Specifies a set of one or more files. Wildcards may be used.\n\ + command Specifies the command to carry out for each file.\n\ + parameters Specifies parameters or switches for the specified command.\n\n\ +To user the FOR comamnd in a batch program, specify %%variable instead of\n\ +%variable." + +STRING_FREE_HELP1, "\n Volume in drive %s is %-11s Serial number is %s\n\ + %16s bytes total disk space\n\ + %16s bytes used\n\ + %16s bytes free\n" + +STRING_FREE_HELP2, "Displays drive information.\n\nFREE [drive: ...]" + +STRING_IF_HELP1, "Performs conditional processing in batch programs.\n\n\ + IF [NOT] ERRORLEVEL number command\n\ + IF [NOT] string1==string2 command\n\ + IF [NOT] EXIST filename command\n\ + IF [NOT] DEFINED variable command\n\n\ +NOT Specifies that CMD should carry out the command only if\n\ + the condition is false\n\ +ERRORLEVEL number Specifies a true condition if the last program run returned\n\ + an exit code equal or greater than the number specified.\n\ +command Specifies the command to carry out if the condition is met.\n\ +string1==string2 Specifies a true condition if the specified text strings\n\ + match.\n\ +EXIST filename Specifies a true condition if the specified filename exists.\n\ +DEFINED variable Specifies a true condition if the specified variable is\n\ + defined." + +STRING_GOTO_HELP1, "Directs CMD to a labeled line in a batch script.\n\n\ +GOTO label\n\n\ + label Specifies a text string used in a batch script as a label.\n\n\ +You type a label on a line by itself, beginning with a colon." + +STRING_LABEL_HELP1, "Displays or changes drive label.\n\nLABEL [drive:][label]" + +STRING_LABEL_HELP2, "Volume in drive %c: is %s\n" +STRING_LABEL_HELP3, "Volume in drive %c: has no label\n" +STRING_LABEL_HELP4, "Volume Serial Number is %04X-%04X\n" +STRING_LABEL_HELP5, "Drive label (11 Characters, ENTER if none)? " + +STRING_LOCALE_HELP1, "Current time is" + +STRING_MKDIR_HELP, "Creates a directory.\n\n\ MKDIR [drive:]path\nMD [drive:]path" -STRING_RMDIR_HELP, "Removes a directory.\n\n \ -RMDIR [drive:]path\nRD [drive:]path" +STRING_MEMMORY_HELP1, "Displays the amount of system memory.\n\nMEMORY" + +STRING_MEMMORY_HELP2, "\n %12s%% memory load.\n\n\ + %13s bytes total physical RAM.\n\ + %13s bytes available physical RAM.\n\n\ + %13s bytes total page file.\n\ + %13s bytes available page file.\n\n\ + %13s bytes total virtual memory.\n\ + %13s bytes available virtual memory.\n" + +STRING_MISC_HELP1, "Press a key to continue...\n" + +STRING_MOVE_HELP1, "Overwrite %s (Yes/No/All)? " + +STRING_MOVE_HELP2, "Moves files and renames files and directories.\n\n\ +To move one or more files:\n\ +MOVE [/N][drive:][path]filename1[,...] destination\n\n\ +To rename a directory:\n\ +MOVE [/N][drive:][path]dirname1 dirname2\n\n\ + [drive:][path]filename1 Specifies the location and name of the file\n\ + or files you want to move.\n\ + /N Nothing. Do everything but move files or direcories.\n\n\ +Current limitations:\n\ + - You can't move a file or directory from one drive to another.\n" + +STRING_MSGBOX_HELP, "display a message box and return user responce\n\n\ +MSGBOX type ['title'] prompt\n\n\ +type button displayed\n\ + possible values are: OK, OKCANCEL,\n\ + YESNO, YESNOCANCEL\n\ +title title of message box\n\ +prompt text displayed by the message box\n\n\n\ +ERRORLEVEL is set according the button pressed:\n\n\ +YES : 10 | NO : 11\n\ +OK : 10 | CANCEL : 12\n" + +STRING_PATH_HELP1, "Displays or sets a search path for executable files.\n\n\ +PATH [[drive:]path[;...]]\nPATH ;\n\n\ +Type PATH ; to clear all search-path settings and direct the command shell\n\ +to search only in the current directory.\n\ +Type PATH without parameters to display the current path.\n" + +STRING_PROMPT_HELP1, "Changes the command prompt.\n\n\ +PROMPT [text]\n\n\ + text Specifies a new command prompt.\n\n\ +Prompt can be made up of normal characters and the following special codes:\n\n\ + $A & (Ampersand)\n\ + $B | (pipe)\n\ + $C ( (Left parenthesis)\n\ + $D Current date\n\ + $E Escape code (ASCII code 27)\n\ + $F ) (Right parenthesis)\n\ + $G > (greater-than sign)\n\ + $H Backspace (erases previous character)\n\ + $L < (less-than sign)\n\ + $N Current drive\n\ + $P Current drive and path\n\ + $Q = (equal sign)\n\ + $T Current time\n\ + $V OS version number\n\ + $_ Carriage return and linefeed\n\ + $$ $ (dollar sign)" + +STRING_PAUSE_HELP1, "Stops the execution of a batch file and shows the following message:\n\ +'Press any key to continue...' or a user defined message.\n\n\ +PAUSE [message]" + +STRING_PROMPT_HELP2, " $+ Displays the current depth of the directory stack" + +STRING_PROMPT_HELP3, "\nType PROMPT without parameters to reset the prompt to the default setting." STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]" +STRING_RMDIR_HELP, "Removes a directory.\n\n\ +RMDIR [drive:]path\nRD [drive:]path" +STRING_REN_HELP1, "Renames a file/directory or files/directories.\n\n\ +RENAME [/E /N /P /Q /S /T] old_name ... new_name\n\ +REN [/E /N /P /Q /S /T] old_name ... new_name\n\n\ + /E No eror messages.\n\ + /N Nothing.\n\ + /P Prompts for confirmation before renaming each file.\n\ + (Not implemented yet!)\n\ + /Q Quiet.\n\ + /S Rename subdirectories.\n\ + /T Display total number of renamed files.\n\n\ +Note that you cannot specify a new drive or path for your destination. Use\n\ +the MOVE command for that purpose." +STRING_REN_HELP2, " %lu file renamed\n" - +STRING_REN_HELP3, " %lu files renamed\n" + +STRING_SHIFT_HELP, "Changes the position of replaceable parameters in a batch file.\n\n\ +SHIFT [DOWN]" +STRING_SCREEN_HELP, "move cursor and optionally print text\n\n\ +SCREEN row col [text]\n\n\ + row row to wich move the cursor\n\ + col column to wich move the cursor" +STRING_SET_HELP, "Displays, sets, or removes environment variables.\n\n\ +SET [variable[=][string]]\n\n\ + variable Specifies the environment-variable name.\n\ + string Specifies a series of characters to assign to the variable.\n\n\ +Type SET without parameters to display the current environment variables.\n" +STRING_START_HELP1, "Starts a command.\n\n\ +START command\n\n\ + command Specifies the command to run.\n\n\ +At the moment all commands are started asynchronously.\n" +STRING_TITLE_HELP, "Sets the window title for the command prompt window.\n\n\ +TITLE [string]\n\n\ +string Specifies the title for the command prompt window." + +STRING_TIME_HELP1, "Displays or sets the system time.\n\n\ +TIME [/T][time]\n\n\ + /T display only\n\n\ +Type TIME with no parameters to display the current time setting and a prompt\n\ +for a new one. Press ENTER to keep the same time." + +STRING_TIME_HELP2, "Enter new time: " + +STRING_TIMER_HELP1, "Elapsed %d msecs\n" + +STRING_TIMER_HELP2, "Elapsed %02d%c%02d%c%02d%c%02d\n" + +STRING_TIMER_HELP3, "allow the use of ten stopwaches.\n\n\ +TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\ + ON set stopwach ON\n\ + OFF set stopwach OFF\n\ + /S Split time. Return stopwach split\n\ + time without changing its value\n\ + /n Specifiy the stopwach number.\n\ + Stopwaches avaliable are 0 to 10\n\ + If it is not specified default is 1\n\ + /Fn Format for output\n\ + n can be:\n\ + 0 milliseconds\n\ + 1 hh%cmm%css%cdd\n\n\ +if none of ON, OFF or /S is specified the command\n\ +will toggle stopwach state\n\n" + +STRING_TYPE_HELP1, "Displays the contents of text files.\n\nTYPE [drive:][path]filename" + +STRING_VERIFY_HELP1, "This command is just a dummy!!\n\ +Sets whether to verify that your files are written correctly to a\n\ +disk.\n\n\ +VERIFY [ON | OFF]\n\n\ +Type VERIFY without a parameter to display the current VERIFY setting." + +STRING_VERIFY_HELP2, "VERIFY is %s.\n" + +STRING_VERIFY_HELP3, "Must specify ON or OFF." + +STRING_VERSION_HELP1, "Displays shell version information\n\n\ +VER [/C][/R][/W]\n\n\ + /C Displays credits.\n\ + /R Displays redistribution information.\n\ + /W Displays warranty information." + +STRING_VERSION_HELP2, " comes with ABSOLUTELY NO WARRANTY; for details\n\ +type: `ver /w'. This is free software, and you are welcome to redistribute\n\ +it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n\ +listing of credits." + +STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + GNU General Public License for more details." + +STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n\ + it under the terms of the GNU General Public License as published by\n\ + the Free Software Foundation; either version 2 of the License, or\n\ + (at your option) any later version." + +STRING_VERSION_HELP5, "\nSend bug reports to .\n\ +Updates are available at: http://www.reactos.com" + +STRING_VERSION_HELP6, "\nFreeDOS version written by:\n" + +STRING_VERSION_HELP7, "\nReactOS version written by:\n" + +STRING_VOL_HELP1, " Volume in drive %c: is %s" +STRING_VOL_HELP2, " Volume in drive %c: has no label" +STRING_VOL_HELP3, " Volume Serial Number is %04X-%04X\n" +STRING_VOL_HELP4, "Displays the disk volume label and serial number, if they exist.\n\nVOL [drive:]" + +STRING_WINDOW_HELP1, "change console window aspect\n\n\ +WINDOW [/POS[=]left,top,width,heigth]\n\ + [MIN|MAX|RESTORE] ['title']\n\n\ +/POS specify window placement and dimensions\n\ +MIN minimize the window\n\ +MAX maximize the window\n\ +RESTORE restore the window" + +STRING_WINDOW_HELP2, "change console window aspect\n\n\ +ACTIAVTE 'window' [/POS[=]left,top,width,heigth]\n\ + [MIN|MAX|RESTORE] ['title']\n\n\ +window tile of window on wich perform actions\n\ +/POS specify window placement and dimensions\n\ +MIN minimize the window\n\ +MAX maximize the window\n\ +RESTORE restore the window\n\ +title new title" STRING_CHOICE_OPTION, "YN" STRING_COPY_OPTION, "YNA" -STRING_DEL_OPTION, "AENPQSTWXYZ" STRING_ALIAS_ERROR, "Command line too long after alias expansion!\n" @@ -259,15 +516,49 @@ STRING_COPY_ERROR2, "Error: Can't copy onto itself!\n" STRING_COPY_ERROR3, "Error writing destination!\n" STRING_COPY_ERROR4, "Error: Not implemented yet!\n" STRING_DATE_ERROR, "Invalid date." -STRING_DEL_ERROR1, "Wildcards!\n\n" -STRING_DEL_ERROR2, "Full path: %s\n" -STRING_DEL_ERROR3, "File part: %s\n" -STRING_DEL_ERROR4, "Full filename: %s\n" STRING_DEL_ERROR5, "The file %s will be deleted! " STRING_DEL_ERROR6, "Are you sure (Y/N)?" STRING_DEL_ERROR7, "Deleting: %s\n" -STRING_DEL_ERROR8, "No Wildcards!\n" +STRING_ERROR_ERROR1, "Unknown error! Error code: 0x%lx\n" +STRING_ERROR_ERROR2, "Syntax error" +STRING_FOR_ERROR1, "'in' missing in for statement." +STRING_FOR_ERROR2, "no brackets found." +STRING_FOR_ERROR3, "'do' missing." +STRING_FOR_ERROR4, "no command after 'do'." +STRING_FREE_ERROR1, "Invalid drive" +STRING_FREE_ERROR2, "unlabeled" +STRING_GOTO_ERROR1, "No label specified for GOTO" +STRING_GOTO_ERROR2, "Label '%s' not found\n" + +STRING_MOVE_ERROR1, "[OK]\n" +STRING_MOVE_ERROR2, "[Error]\n" + STRING_PARAM_ERROR, "Required parameter missing\n" +STRING_PATH_ERROR, "CMD: Not in environment 'PATH'\n" +STRING_REN_ERROR1, "MoveFile() failed. Error: %lu\n" + +STRING_START_ERROR1, "No batch support at the moment!" + +STRING_TIME_ERROR1, "Invalid time." + +STRING_TYPE_ERROR1, "Invalid option '/%s'\n" + +STRING_WINDOW_ERROR1, "window not found" + + +STRING_ERROR_PARAMETERF_ERROR, "Parameter format not correct - %c\n" +STRING_ERROR_INVALID_SWITCH, "Invalid switch - /%c\n" +STRING_ERROR_TOO_MANY_PARAMETERS, "Too many parameters - %s\n" +STRING_ERROR_PATH_NOT_FOUND, "Path not found\n" +STRING_ERROR_FILE_NOT_FOUND, "File not found\n" +STRING_ERROR_REQ_PARAM_MISSING, "Required parameter missing\n" +STRING_ERROR_INVALID_DRIVE, "Invalid drive specification\n" +STRING_ERROR_INVALID_PARAM_FORMAT, "Invalid parameter format - %s\n" +STRING_ERROR_BADCOMMAND, "Bad command or filename\n" +STRING_ERROR_OUT_OF_MEMORY, "Out of memory error.\n" +STRING_ERROR_CANNOTPIPE, "Error! Cannot pipe! Cannot open temporary file!\n" +STRING_ERROR_D_PAUSEMSG, "Press any key to continue . . ." +STRING_ERROR_DRIVER_NOT_READY "Drive not ready" } diff --git a/reactos/subsys/system/cmd/alias.c b/reactos/subsys/system/cmd/alias.c index 8c69eef43f8..8eb1695bf0f 100644 --- a/reactos/subsys/system/cmd/alias.c +++ b/reactos/subsys/system/cmd/alias.c @@ -237,7 +237,7 @@ VOID DestroyAlias (VOID) /* specified routines */ VOID ExpandAlias (LPTSTR cmd, INT maxlen) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; unsigned n = 0, m, i, @@ -281,8 +281,9 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen) m = _tcslen (ptr->lpSubst); if ((int)(_tcslen (cmd) - len + m - n) > maxlen) { - LoadString( GetModuleHandle(NULL), STRING_ALIAS_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_ALIAS_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); + /* the parser won't cause any problems with an empty line */ cmd[0] = _T('\0'); } @@ -305,13 +306,13 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen) INT CommandAlias (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR ptr; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_ALIAS_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_ALIAS_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/attrib.c b/reactos/subsys/system/cmd/attrib.c index 33548778a51..650a58a81d4 100644 --- a/reactos/subsys/system/cmd/attrib.c +++ b/reactos/subsys/system/cmd/attrib.c @@ -44,7 +44,7 @@ PrintAttribute (LPTSTR pszPath, LPTSTR pszFile, BOOL bRecurse) WIN32_FIND_DATA findData; HANDLE hFind; TCHAR szFullName[MAX_PATH]; - LPTSTR pszFileName; + LPTSTR pszFileName; /* prepare full file name buffer */ _tcscpy (szFullName, pszPath); @@ -112,7 +112,7 @@ PrintAttribute (LPTSTR pszPath, LPTSTR pszFile, BOOL bRecurse) static VOID ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask, - DWORD dwAttrib, BOOL bRecurse, BOOL bDirectories) + DWORD dwAttrib, BOOL bRecurse, BOOL bDirectories) { WIN32_FIND_DATA findData; HANDLE hFind; @@ -143,7 +143,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask, if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (!_tcscmp (findData.cFileName, _T(".")) || - !_tcscmp (findData.cFileName, _T(".."))) + !_tcscmp (findData.cFileName, _T(".."))) continue; _tcscpy (pszFileName, findData.cFileName); @@ -189,6 +189,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask, INT CommandAttrib (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR *arg; INT argc, i; TCHAR szPath[MAX_PATH]; @@ -197,7 +198,6 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param) BOOL bDirectories = FALSE; DWORD dwAttrib = 0; DWORD dwMask = 0; - WCHAR szMsg[RC_STRING_MAX_SIZE]; /* initialize strings */ szPath[0] = _T('\0'); @@ -206,8 +206,8 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param) /* print help */ if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_ATTRIB_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_ATTRIB_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -321,7 +321,7 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param) /* get full file name */ for (i = 0; i < argc; i++) { - if ((*arg[i] != _T('+')) && (*arg[i] != _T('-')) && (*arg[i] != _T('/'))) + if ((*arg[i] != _T('+')) && (*arg[i] != _T('-')) && (*arg[i] != _T('/'))) { LPTSTR p; GetFullPathName (arg[i], MAX_PATH, szPath, NULL); @@ -333,7 +333,7 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param) PrintAttribute (szPath, szFileName, bRecurse); else ChangeAttribute (szPath, szFileName, dwMask, - dwAttrib, bRecurse, bDirectories); + dwAttrib, bRecurse, bDirectories); } } diff --git a/reactos/subsys/system/cmd/batch.c b/reactos/subsys/system/cmd/batch.c index 336227570c1..e2ad269bd89 100644 --- a/reactos/subsys/system/cmd/batch.c +++ b/reactos/subsys/system/cmd/batch.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * BATCH.C - batch file processor for CMD.EXE. * * @@ -218,12 +217,12 @@ VOID ExitBatch (LPTSTR msg) BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; HANDLE hFile; - WCHAR szMsg[RC_STRING_MAX_SIZE]; hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | - FILE_FLAG_SEQUENTIAL_SCAN, NULL); + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | + FILE_FLAG_SEQUENTIAL_SCAN, NULL); #ifdef _DEBUG DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"), @@ -232,8 +231,8 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param) if (hFile == INVALID_HANDLE_VALUE) { - LoadString( GetModuleHandle(NULL), STRING_BATCH_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_BATCH_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); return FALSE; } diff --git a/reactos/subsys/system/cmd/beep.c b/reactos/subsys/system/cmd/beep.c index ae0c9bcdb4d..e14334e3aff 100644 --- a/reactos/subsys/system/cmd/beep.c +++ b/reactos/subsys/system/cmd/beep.c @@ -32,12 +32,12 @@ INT cmd_beep (LPTSTR cmd, LPTSTR param) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; if (_tcsncmp (param, _T("/?"), 2) == 0) { - LoadString( GetModuleHandle(NULL), STRING_ALIAS_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_ALIAS_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/call.c b/reactos/subsys/system/cmd/call.c index 32ca9f899a6..4429eb2471e 100644 --- a/reactos/subsys/system/cmd/call.c +++ b/reactos/subsys/system/cmd/call.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * CALL.C - call internal batch command. * * @@ -44,17 +43,16 @@ INT cmd_call (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPBATCH_CONTEXT n = NULL; - WCHAR szMsg[RC_STRING_MAX_SIZE]; #ifdef _DEBUG DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_CALL_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - + LoadString(GetModuleHandle(NULL), STRING_CALL_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/chcp.c b/reactos/subsys/system/cmd/chcp.c index d21c9b1f40f..1b3e7a9b099 100644 --- a/reactos/subsys/system/cmd/chcp.c +++ b/reactos/subsys/system/cmd/chcp.c @@ -18,17 +18,17 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR *arg; INT args; UINT uOldCodePage; UINT uNewCodePage; - WCHAR szMsg[RC_STRING_MAX_SIZE]; /* print help */ if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_CHCP_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CHCP_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -38,39 +38,37 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param) if (args == 0) { /* display active code page number */ - LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), GetConsoleCP ()); - + LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, GetConsoleCP()); return 0; } if (args >= 2) { /* too many parameters */ - LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR2, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), param); - + LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, param); return 1; } /* save old code page */ - uOldCodePage = GetConsoleCP (); + uOldCodePage = GetConsoleCP(); - uNewCodePage = (UINT)_ttoi (arg[0]); + uNewCodePage = (UINT)_ttoi(arg[0]); if (uNewCodePage == 0) { - LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), arg[0]); + LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR3, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, arg[0]); freep (arg); return 1; } - if (!SetConsoleCP (uNewCodePage)) + if (!SetConsoleCP(uNewCodePage)) { - LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR4, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR4, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } else { diff --git a/reactos/subsys/system/cmd/choice.c b/reactos/subsys/system/cmd/choice.c index 16f216f8ebf..f2721861c35 100644 --- a/reactos/subsys/system/cmd/choice.c +++ b/reactos/subsys/system/cmd/choice.c @@ -103,6 +103,7 @@ IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive) INT CommandChoice (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR lpOptions; TCHAR Options[2]; LPTSTR lpText = NULL; @@ -121,17 +122,15 @@ CommandChoice (LPTSTR cmd, LPTSTR param) INT GCret; TCHAR Ch; DWORD amount,clk; - WCHAR szMsg[RC_STRING_MAX_SIZE]; - LoadString( GetModuleHandle(NULL), STRING_CHOICE_OPTION, (LPTSTR) Options,sizeof(lpOptions)); - lpOptions = _T(Options); + LoadString(GetModuleHandle(NULL), STRING_CHOICE_OPTION, Options, 2); + lpOptions = Options; if (_tcsncmp (param, _T("/?"), 2) == 0) { - LoadString( GetModuleHandle(NULL), STRING_CHOICE_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - - return 0; + LoadString(GetModuleHandle(NULL), STRING_CHOICE_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); + return 0; } /* retrieve text */ @@ -170,9 +169,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param) if (_tcslen (lpOptions) == 0) { - - LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); freep (arg); return 1; } @@ -202,8 +200,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param) if (*s != _T(',')) { - LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_TXT, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR_TXT, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); freep (arg); return 1; } @@ -214,8 +212,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param) } else if (arg[i][0] == _T('/')) { - LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_OPTION, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), arg[i]); + LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR_OPTION, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, arg[i]); freep (arg); return 1; } diff --git a/reactos/subsys/system/cmd/cls.c b/reactos/subsys/system/cmd/cls.c index d44cddf3660..e96d33038a9 100644 --- a/reactos/subsys/system/cmd/cls.c +++ b/reactos/subsys/system/cmd/cls.c @@ -33,29 +33,29 @@ INT cmd_cls (LPTSTR cmd, LPTSTR param) { - DWORD dwWritten; + TCHAR szMsg[RC_STRING_MAX_SIZE]; CONSOLE_SCREEN_BUFFER_INFO csbi; COORD coPos; - WCHAR szMsg[RC_STRING_MAX_SIZE]; + DWORD dwWritten; if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_CLS_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CLS_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } - GetConsoleScreenBufferInfo (hConsole, &csbi); + GetConsoleScreenBufferInfo(hConsole, &csbi); coPos.X = 0; coPos.Y = 0; - FillConsoleOutputAttribute (hConsole, wColor, - (csbi.dwSize.X)*(csbi.dwSize.Y), - coPos, &dwWritten); - FillConsoleOutputCharacter (hConsole, _T(' '), - (csbi.dwSize.X)*(csbi.dwSize.Y), - coPos, &dwWritten); - SetConsoleCursorPosition (hConsole, coPos); + FillConsoleOutputAttribute(hConsole, wColor, + csbi.dwSize.X * csbi.dwSize.Y, + coPos, &dwWritten); + FillConsoleOutputCharacter(hConsole, _T(' '), + csbi.dwSize.X * csbi.dwSize.Y, + coPos, &dwWritten); + SetConsoleCursorPosition(hConsole, coPos); bIgnoreEcho = TRUE; diff --git a/reactos/subsys/system/cmd/cmd.c b/reactos/subsys/system/cmd/cmd.c index a868f56658c..2399496e3f1 100644 --- a/reactos/subsys/system/cmd/cmd.c +++ b/reactos/subsys/system/cmd/cmd.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * CMD.C - command-line interface. * * @@ -550,9 +549,9 @@ DoCommand (LPTSTR line) VOID ParseCommandLine (LPTSTR cmd) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR cmdline[CMDLINE_LENGTH]; LPTSTR s; - WCHAR szMsg[RC_STRING_MAX_SIZE]; #ifdef FEATURE_REDIRECTION TCHAR in[CMDLINE_LENGTH] = _T(""); TCHAR out[CMDLINE_LENGTH] = _T(""); @@ -634,15 +633,15 @@ VOID ParseCommandLine (LPTSTR cmd) FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), in); + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, in); return; } if (!SetStdHandle (STD_INPUT_HANDLE, hFile)) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), in); + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, in); return; } #ifdef _DEBUG @@ -664,13 +663,12 @@ VOID ParseCommandLine (LPTSTR cmd) /* Set current stdout to temporary file */ hFile[1] = CreateFile (szFileName[1], GENERIC_WRITE, 0, &sa, TRUNCATE_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL); - - if (hFile[1] == INVALID_HANDLE_VALUE){ - - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR2, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); - return; - } + if (hFile[1] == INVALID_HANDLE_VALUE) + { + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); + return; + } SetStdHandle (STD_OUTPUT_HANDLE, hFile[1]); @@ -720,16 +718,15 @@ VOID ParseCommandLine (LPTSTR cmd) FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), out); - + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, out); return; } if (!SetStdHandle (STD_OUTPUT_HANDLE, hFile)) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), out); + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, out); return; } @@ -782,17 +779,16 @@ VOID ParseCommandLine (LPTSTR cmd) NULL); if (hFile == INVALID_HANDLE_VALUE) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), err); - + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, err); return; } } + if (!SetStdHandle (STD_ERROR_HANDLE, hFile)) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), err); - + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, err); return; } @@ -1076,38 +1072,38 @@ VOID RemoveBreakHandler (VOID) static VOID ShowCommands (VOID) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; /* print command list */ - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg)); - PrintCommandList (); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); + PrintCommandList(); /* print feature list */ - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #ifdef FEATURE_ALIASES - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #endif #ifdef FEATURE_HISTORY - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #endif #ifdef FEATURE_UNIX_FILENAME_COMPLETION - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP5, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP5, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #endif #ifdef FEATURE_DIRECTORY_STACK - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP6, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP6, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #endif #ifdef FEATURE_REDIRECTION - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP7, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP7, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #endif - ConOutChar (_T('\n')); + ConOutChar(_T('\n')); } #endif @@ -1121,10 +1117,10 @@ ShowCommands (VOID) static VOID Initialize (int argc, TCHAR* argv[]) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR commandline[CMDLINE_LENGTH]; TCHAR ModuleName[_MAX_PATH + 1]; INT i; - WCHAR szMsg[RC_STRING_MAX_SIZE]; //INT len; //TCHAR *ptr, *cmdLine; @@ -1154,9 +1150,9 @@ Initialize (int argc, TCHAR* argv[]) if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_CMD_HELP8, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - ExitProcess (0); + LoadString(GetModuleHandle(NULL), STRING_CMD_HELP8, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); + ExitProcess(0); } SetConsoleMode (hIn, ENABLE_PROCESSED_INPUT); @@ -1259,8 +1255,8 @@ Initialize (int argc, TCHAR* argv[]) if (IsExistingFile (_T("commandline"))) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR4, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), commandline); + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR4, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, commandline); ParseCommandLine (commandline); } } @@ -1291,20 +1287,20 @@ Initialize (int argc, TCHAR* argv[]) static VOID Cleanup (int argc, TCHAR *argv[]) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; /* run cmdexit.bat */ if (IsExistingFile (_T("cmdexit.bat"))) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); ParseCommandLine (_T("cmdexit.bat")); } else if (IsExistingFile (_T("\\cmdexit.bat"))) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf ((LPTSTR)szMsg); ParseCommandLine (_T("\\cmdexit.bat")); } #ifndef __REACTOS__ @@ -1320,8 +1316,8 @@ static VOID Cleanup (int argc, TCHAR *argv[]) if (IsExistingFile (_T("commandline"))) { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR4, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), commandline); + LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR4, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, commandline); ParseCommandLine (commandline); } } diff --git a/reactos/subsys/system/cmd/cmd.h b/reactos/subsys/system/cmd/cmd.h index 4beb8148198..3229f6d573b 100644 --- a/reactos/subsys/system/cmd/cmd.h +++ b/reactos/subsys/system/cmd/cmd.h @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * CMD.H - header file for the modules in CMD.EXE * * @@ -170,7 +169,7 @@ VOID ConOutPrintf (LPTSTR, ...); VOID ConErrChar (TCHAR); VOID ConErrPuts (LPTSTR); VOID ConErrPrintf (LPTSTR, ...); -VOID ConOutFormatMessage (DWORD MessageId, ...); +VOID ConOutFormatMessage (DWORD MessageId, ...); SHORT GetCursorX (VOID); SHORT GetCursorY (VOID); @@ -289,10 +288,9 @@ extern TCHAR cDateSeparator; extern INT nDateFormat; extern TCHAR cTimeSeparator; extern INT nTimeFormat; -extern TCHAR aszDayNames[7][8]; extern TCHAR cThousandSeparator; extern TCHAR cDecimalSeparator; -extern INT nNumberGroups; +extern INT nNumberGroups; VOID InitLocale (VOID); VOID PrintDate (VOID); diff --git a/reactos/subsys/system/cmd/cmd.rc b/reactos/subsys/system/cmd/cmd.rc index ad10b0dd4f4..1f886f12cb0 100644 --- a/reactos/subsys/system/cmd/cmd.rc +++ b/reactos/subsys/system/cmd/cmd.rc @@ -5,13 +5,25 @@ #define REACTOS_STR_INTERNAL_NAME "cmd\0" #define REACTOS_STR_ORIGINAL_FILENAME "cmd.exe\0" #define REACTOS_STR_ORIGINAL_COPYRIGHT "Copyright (C) 1994-1998 Tim Norman and others\0" -#define REACTOS_STR_LEGAL_COPYRIGHT "Copyright (C) 1998-2001 Eric Kohl and others\0" +#define REACTOS_STR_LEGAL_COPYRIGHT "Copyright (C) 1998-2005 Eric Kohl and others\0" + #include #include "En.rc" +STRINGTABLE DISCARDABLE +{ + STRING_FREEDOS_DEV, " Tim Norman Matt Rains\n\ + Evan Jeffrey Steffen Kaiser\n\ + Svante Frey Oliver Mueller\n\ + Aaron Kaufman Marc Desrochers\n\ + Rob Lake John P Price\n\ + Hans B Pufal\n" + STRING_REACTOS_DEV, " Eric Kohl Emanuele Aliberti\n\ + Paolo Pantaleo Phillip Susi\n" +} -1 ICON DISCARDABLE res/terminal.ico +1 ICON DISCARDABLE res/terminal.ico diff --git a/reactos/subsys/system/cmd/cmd.xml b/reactos/subsys/system/cmd/cmd.xml index 2f372fdecc5..66e4a9d0fa0 100644 --- a/reactos/subsys/system/cmd/cmd.xml +++ b/reactos/subsys/system/cmd/cmd.xml @@ -1,4 +1,4 @@ - + include/wine . diff --git a/reactos/subsys/system/cmd/cmdinput.c b/reactos/subsys/system/cmd/cmdinput.c index daa5c71d602..ca704ad4bc6 100644 --- a/reactos/subsys/system/cmd/cmdinput.c +++ b/reactos/subsys/system/cmd/cmdinput.c @@ -332,7 +332,7 @@ VOID ReadCommand (LPTSTR str, INT maxlen) { if (((charcount + orgx) / maxx) + orgy > maxy - 1) orgy += maxy - ((charcount + orgx) / maxx + orgy + 1); - } + } /* set cursor position */ SetCursorXY ((orgx + current) % maxx, diff --git a/reactos/subsys/system/cmd/color.c b/reactos/subsys/system/cmd/color.c index a409149a488..716eb86e80d 100644 --- a/reactos/subsys/system/cmd/color.c +++ b/reactos/subsys/system/cmd/color.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COLOR.C - color internal command. * * @@ -15,10 +14,10 @@ * Redirection ready! * * 14-Oct-1999 (Paolo Pantaleo ) - * 4nt's syntax implemented + * 4nt's syntax implemented. * * 03-Apr-2005 (Magnus Olsen) ) - * Remove all hardcode string to En.rc + * Move all hardcoded strings to En.rc. */ #include "precomp.h" @@ -29,10 +28,10 @@ static VOID ColorHelp (VOID) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; - LoadString( GetModuleHandle(NULL), STRING_COLOR_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + LoadString(GetModuleHandle(NULL), STRING_COLOR_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); } @@ -41,29 +40,29 @@ VOID SetScreenColor (WORD wColor, BOOL bFill) DWORD dwWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; COORD coPos; - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; if ((wColor & 0xF) == (wColor &0xF0) >> 4) { - LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPuts (_T((LPTSTR)szMsg)); - } - else - { - if (bFill == TRUE) - { - GetConsoleScreenBufferInfo (hConsole, &csbi); + LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); + } + else + { + if (bFill == TRUE) + { + GetConsoleScreenBufferInfo (hConsole, &csbi); - coPos.X = 0; - coPos.Y = 0; - FillConsoleOutputAttribute (hConsole, - (WORD)(wColor & 0x00FF), - (csbi.dwSize.X)*(csbi.dwSize.Y), - coPos, - &dwWritten); - } - SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF)); - } + coPos.X = 0; + coPos.Y = 0; + FillConsoleOutputAttribute (hConsole, + (WORD)(wColor & 0x00FF), + (csbi.dwSize.X)*(csbi.dwSize.Y), + coPos, + &dwWritten); + } + SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF)); + } } @@ -74,7 +73,7 @@ VOID SetScreenColor (WORD wColor, BOOL bFill) */ INT CommandColor (LPTSTR first, LPTSTR rest) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; if (_tcsncmp (rest, _T("/?"), 2) == 0) { @@ -90,26 +89,26 @@ INT CommandColor (LPTSTR first, LPTSTR rest) return 0; } - if (StringToColor (&wColor, &rest) == FALSE) + if (StringToColor(&wColor, &rest) == FALSE) { - LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR2, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); return 1; } - LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), wColor); + LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR3, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, wColor); if ((wColor & 0xF) == (wColor &0xF0) >> 4) { - LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR4, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), wColor); + LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR4, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, wColor); return 1; } /* set color */ - SetScreenColor (wColor, - (_tcsstr (rest,_T("/F")) || _tcsstr (rest,_T("/f")))); + SetScreenColor(wColor, + (_tcsstr (rest,_T("/F")) || _tcsstr (rest,_T("/f")))); return 0; } diff --git a/reactos/subsys/system/cmd/console.c b/reactos/subsys/system/cmd/console.c index 4c72ad446bb..b9b31d63488 100644 --- a/reactos/subsys/system/cmd/console.c +++ b/reactos/subsys/system/cmd/console.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * CONSOLE.C - console input/output functions. * * @@ -211,11 +210,11 @@ VOID ConPrintf(LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle) VOID ConOutFormatMessage (DWORD MessageId, ...) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; DWORD ret; LPTSTR text; va_list arg_ptr; - WCHAR szMsg[RC_STRING_MAX_SIZE]; - + va_start (arg_ptr, MessageId); ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, @@ -233,8 +232,8 @@ VOID ConOutFormatMessage (DWORD MessageId, ...) } else { - LoadString( GetModuleHandle(NULL), STRING_CONSOLE_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } } diff --git a/reactos/subsys/system/cmd/copy.c b/reactos/subsys/system/cmd/copy.c index c7a784812d4..01be1cfadf6 100644 --- a/reactos/subsys/system/cmd/copy.c +++ b/reactos/subsys/system/cmd/copy.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPY.C -- copy internal command. * * @@ -296,29 +295,26 @@ DeleteFileList (LPFILES f) static INT Overwrite (LPTSTR fn) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR inp[10]; LPTSTR p; - - LPTSTR lpOptions; - TCHAR Options[3]; - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szOptions[4]; - LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, (LPTSTR) Options,sizeof(Options)+sizeof(WCHAR)); - lpOptions = _T(Options); + LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, szOptions, 4); - LoadString( GetModuleHandle(NULL), STRING_COPY_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_COPY_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); - ConInString (inp, 10); - ConOutPuts (_T("")); + ConInString(inp, 10); + ConOutPuts(_T("")); _tcsupr (inp); for (p = inp; _istspace (*p); p++) ; - if (*p != lpOptions[0] && *p != lpOptions[2]) + if (*p != szOptions[0] && *p != szOptions[2]) return 0; - if (*p == lpOptions[2]) + if (*p == szOptions[2]) return 2; return 1; @@ -330,6 +326,7 @@ Overwrite (LPTSTR fn) int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; FILETIME srctime; HANDLE hFileSrc; HANDLE hFileDest; @@ -339,7 +336,6 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) DWORD dwWritten; DWORD i; BOOL bEof = FALSE; - WCHAR szMsg[RC_STRING_MAX_SIZE]; #ifdef _DEBUG DebugPrintf (_T("checking mode\n")); @@ -351,8 +347,8 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) NULL, OPEN_EXISTING, 0, NULL); if (hFileSrc == INVALID_HANDLE_VALUE) { - LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), source); + LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, source); return 0; } @@ -379,8 +375,8 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) { if (!_tcscmp (dest, source)) { - LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR2, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), source); + LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, source); CloseHandle (hFileSrc); return 0; @@ -456,8 +452,8 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) if (dwWritten != dwRead) { - LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR3, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); free (buffer); CloseHandle (hFileDest); @@ -633,12 +629,12 @@ SetupCopy (LPFILES sources, TCHAR **p, BOOL bMultiple, INT cmd_copy (LPTSTR first, LPTSTR rest) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR **p; TCHAR drive_d[_MAX_DRIVE]; TCHAR dir_d[_MAX_DIR]; TCHAR file_d[_MAX_FNAME]; TCHAR ext_d[_MAX_EXT]; - WCHAR szMsg[RC_STRING_MAX_SIZE]; int argc; int append; @@ -655,8 +651,8 @@ INT cmd_copy (LPTSTR first, LPTSTR rest) if (!_tcsncmp (rest, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_COPY_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_COPY_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 1; } @@ -728,8 +724,8 @@ INT cmd_copy (LPTSTR first, LPTSTR rest) } else if (bDestFound && bWildcards) { - LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR4, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR4, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); DeleteFileList (sources); freep (p); diff --git a/reactos/subsys/system/cmd/date.c b/reactos/subsys/system/cmd/date.c index 994614f2b50..3bffcbdedd7 100644 --- a/reactos/subsys/system/cmd/date.c +++ b/reactos/subsys/system/cmd/date.c @@ -47,24 +47,24 @@ static WORD awMonths[2][13] = static VOID PrintDateString (VOID) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; switch (nDateFormat) { case 0: /* mmddyy */ default: - LoadString( GetModuleHandle(NULL), STRING_DATE_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator, cDateSeparator); + LoadString(GetModuleHandle(NULL), STRING_DATE_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, cDateSeparator, cDateSeparator); break; case 1: /* ddmmyy */ - LoadString( GetModuleHandle(NULL), STRING_DATE_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator, cDateSeparator); + LoadString(GetModuleHandle(NULL), STRING_DATE_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, cDateSeparator, cDateSeparator); break; case 2: /* yymmdd */ - LoadString( GetModuleHandle(NULL), STRING_DATE_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator, cDateSeparator); + LoadString(GetModuleHandle(NULL), STRING_DATE_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, cDateSeparator, cDateSeparator); break; } } @@ -157,7 +157,7 @@ ParseDate (LPTSTR s) break; } - /* if only entered two digits: */ + /* if only entered two digits: */ /* assume 2000's if value less than 80 */ /* assume 1900's if value greater or equal 80 */ if (d.wYear <= 99) @@ -184,17 +184,17 @@ ParseDate (LPTSTR s) INT cmd_date (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR *arg; INT argc; INT i; BOOL bPrompt = TRUE; INT nDateString = -1; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_DATE_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_DATE_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -247,14 +247,15 @@ INT cmd_date (LPTSTR cmd, LPTSTR param) freep (arg); return 0; } - LoadString( GetModuleHandle(NULL), STRING_DATE_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPuts (_T((LPTSTR)szMsg)); - + + LoadString(GetModuleHandle(NULL), STRING_DATE_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); } freep (arg); return 0; } -#endif +#endif /* INCLUDE_CMD_DATE */ +/* EOF */ diff --git a/reactos/subsys/system/cmd/del.c b/reactos/subsys/system/cmd/del.c index aed01ad5583..09cf6fc8ca0 100644 --- a/reactos/subsys/system/cmd/del.c +++ b/reactos/subsys/system/cmd/del.c @@ -96,6 +96,7 @@ RemoveFile (LPTSTR lpFileName, DWORD dwFlags) INT CommandDelete (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szFullPath[MAX_PATH]; LPTSTR pFilePart; LPTSTR *arg = NULL; @@ -105,29 +106,14 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) INT nEvalArgs = 0; /* nunber of evaluated arguments */ DWORD dwFlags = 0; DWORD dwFiles = 0; - HANDLE hFile; WIN32_FIND_DATA f; - - LPTSTR lpOptions; - TCHAR Options[11]; - WCHAR szMsg[RC_STRING_MAX_SIZE]; LONG ch; - - - - LoadString( GetModuleHandle(NULL), STRING_DEL_OPTION, (LPTSTR) Options,sizeof(Options)+sizeof(WCHAR)); - lpOptions = _T(Options); if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_DEL_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg), - lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10], - lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10], - lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10], - lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10] - ); + LoadString(GetModuleHandle(NULL), STRING_DEL_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); return 0; } @@ -142,49 +128,39 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) { if (_tcslen (arg[i]) >= 2) { - - ch = _totupper (arg[i][1]); - - if (_totupper (lpOptions[2]) == ch) - { - dwFlags |= DEL_NOTHING; - } - - else if (_totupper (lpOptions[3]) == ch) - { - dwFlags |= DEL_PROMPT; - } - - else if (_totupper (lpOptions[4]) == ch) - { - dwFlags |= DEL_QUIET; - } - - else if (_totupper (lpOptions[5]) == ch) - { - dwFlags |= DEL_SUBDIR; - } - - else if (_totupper (lpOptions[6]) == ch) - { - dwFlags |= DEL_TOTAL; - } - - else if (_totupper (lpOptions[7]) == ch) - { - dwFlags |= DEL_WIPE; - } - - else if (_totupper (lpOptions[9]) == ch) - { - dwFlags |= DEL_YES; - } - - else if (_totupper (lpOptions[10]) == ch) - { - dwFlags |= DEL_ZAP; - } - + ch = _totupper (arg[i][1]); + if (ch == _T('N')) + { + dwFlags |= DEL_NOTHING; + } + else if (ch == _T('P')) + { + dwFlags |= DEL_PROMPT; + } + else if (ch == _T('Q')) + { + dwFlags |= DEL_QUIET; + } + else if (ch == _T('S')) + { + dwFlags |= DEL_SUBDIR; + } + else if (ch == _T('T')) + { + dwFlags |= DEL_TOTAL; + } + else if (ch == _T('W')) + { + dwFlags |= DEL_WIPE; + } + else if (ch == _T('Y')) + { + dwFlags |= DEL_YES; + } + else if (ch == _T('Z')) + { + dwFlags |= DEL_ZAP; + } } nEvalArgs++; @@ -211,11 +187,9 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) { if (!((dwFlags & DEL_YES) || (dwFlags & DEL_QUIET) || (dwFlags & DEL_PROMPT))) { - - LoadString( GetModuleHandle(NULL), STRING_DEL_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); - - res = FilePromptYN (_T( (LPTSTR) szMsg)); + LoadString( GetModuleHandle(NULL), STRING_DEL_HELP2, szMsg, RC_STRING_MAX_SIZE); + res = FilePromptYN (szMsg); if ((res == PROMPT_NO) || (res == PROMPT_BREAK)) break; } @@ -231,8 +205,7 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) { /* wildcards in filespec */ #ifdef _DEBUG - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + ConErrPrintf(_T("Wildcards!\n\n")); #endif GetFullPathName (arg[i], @@ -241,12 +214,8 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) &pFilePart); #ifdef _DEBUG - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR2, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), szFullPath); - - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), pFilePart); - + ConErrPrintf(_T("Full path: %s\n"), szFullPath); + ConErrPrintf(_T("File part: %s\n"), pFilePart); #endif hFile = FindFirstFile (szFullPath, &f); @@ -268,18 +237,17 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) _tcscpy (pFilePart, f.cFileName); #ifdef _DEBUG - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR4, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); - + ConErrPrintf(_T("Full filename: %s\n"), szFullPath); #endif + /* ask for deleting */ if (dwFlags & DEL_PROMPT) - { - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR5, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), szFullPath); + { + LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, szFullPath); - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR6, (LPTSTR) szMsg,sizeof(szMsg)); - res = FilePromptYN (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE); + res = FilePromptYN ((LPTSTR)szMsg); if ((res == PROMPT_NO) || (res == PROMPT_BREAK)) { @@ -288,10 +256,10 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) } if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL)) - { - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR7, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), szFullPath); - } + { + LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, szFullPath); + } /* delete the file */ if (!(dwFlags & DEL_NOTHING)) @@ -334,22 +302,22 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) { /* no wildcards in filespec */ #ifdef _DEBUG - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR8, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + ConErrPrintf(_T("No Wildcards!\n")); #endif GetFullPathName (arg[i], MAX_PATH, szFullPath, &pFilePart); - /*ask for deleting */ - if((dwFlags & DEL_PROMPT) && (FindFirstFile(szFullPath, &f) != INVALID_HANDLE_VALUE)) //Don't ask if the file doesn't exist, the following code will make the error-msg + /* ask for deleting */ + // Don't ask if the file doesn't exist, the following code will make the error-msg + if((dwFlags & DEL_PROMPT) && (FindFirstFile(szFullPath, &f) != INVALID_HANDLE_VALUE)) { - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR5, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), szFullPath); - - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR6, (LPTSTR) szMsg,sizeof(szMsg)); - res = FilePromptYN (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, szFullPath); + + LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE); + res = FilePromptYN ((LPTSTR)szMsg); if ((res == PROMPT_NO) || (res == PROMPT_BREAK)) { @@ -358,14 +326,13 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) } #ifdef _DEBUG - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), szFullPath); + ConErrPrintf(_T("Full path: %s\n"), szFullPath); #endif if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL)) - { - LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR7, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg), szFullPath); - } + { + LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, szFullPath); + } if (!(dwFlags & DEL_NOTHING)) { @@ -416,15 +383,15 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param) if (!(dwFlags & DEL_QUIET)) { if (dwFiles < 2) - { - LoadString( GetModuleHandle(NULL), STRING_DEL_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); - } + { + LoadString(GetModuleHandle(NULL), STRING_DEL_HELP3, szMsg, RC_STRING_MAX_SIZE); + } else - { - LoadString( GetModuleHandle(NULL), STRING_DEL_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); - } - - ConOutPrintf (_T((LPTSTR)szMsg), dwFiles); + { + LoadString(GetModuleHandle(NULL), STRING_DEL_HELP4, szMsg, RC_STRING_MAX_SIZE); + } + + ConOutPrintf(szMsg, dwFiles); } return 0; diff --git a/reactos/subsys/system/cmd/delay.c b/reactos/subsys/system/cmd/delay.c index 6848f29e136..00c2fe873b8 100644 --- a/reactos/subsys/system/cmd/delay.c +++ b/reactos/subsys/system/cmd/delay.c @@ -17,16 +17,15 @@ INT CommandDelay (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; DWORD val; DWORD mul=1000; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (_tcsncmp (param, _T("/?"), 2) == 0) { - LoadString( GetModuleHandle(NULL), STRING_DELAY_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - - return 0; + LoadString(GetModuleHandle(NULL), STRING_DELAY_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); + return 0; } if (*param==0) @@ -42,7 +41,7 @@ INT CommandDelay (LPTSTR cmd, LPTSTR param) } val = _ttoi(param); - Sleep(val*mul); + Sleep(val * mul); return 0; } diff --git a/reactos/subsys/system/cmd/dir.c b/reactos/subsys/system/cmd/dir.c index 84fd5296ac3..b1850ea4b9f 100644 --- a/reactos/subsys/system/cmd/dir.c +++ b/reactos/subsys/system/cmd/dir.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * DIR.C - dir internal command. * * @@ -115,7 +114,7 @@ * dir /s now works in deeper trees * * 28-Jan-2004 (Michael Fritscher ) - * Fix for /p, so it is working under Windows in GUI-mode, too. + * Fix for /p, so it is working under Windows in GUI-mode, too. * * 30-Apr-2004 (Filip Navara ) * Fix /w to print long names. @@ -125,7 +124,7 @@ * the ros dir very similar to windows dir. Major part of * the code is rewritten. /p is removed, to be rewriten in * the main cmd code. - * + * */ #include "precomp.h" @@ -154,7 +153,7 @@ enum EOrderBy }; /* The struct for holding the switches */ -typedef struct TDirSwitchesFlags +typedef struct _DirSwitchesFlags { BOOL bBareFormat; /* Bare Format */ BOOL bTSeperator; /* Thousands seperator */ @@ -188,7 +187,15 @@ typedef struct TDirSwitchesFlags BOOL bUnSet; /* A helper flag if "-" was given with the switch */ BOOL bParSetted; /* A helper flag if parameters of switch were given */ } stTimeField; /* The time field to display or use for sorting */ -}DIRSWITCHFLAGS, * LPDIRSWITCHFLAGS; +} DIRSWITCHFLAGS, *LPDIRSWITCHFLAGS; + + +typedef struct _DIRFINDLISTNODE +{ + WIN32_FIND_DATA stFindInfo; + struct _DIRFINDLISTNODE *ptrNext; +} DIRFINDLISTNODE, *PDIRFINDLISTNODE; + typedef BOOL STDCALL (*PGETFREEDISKSPACEEX)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); @@ -207,12 +214,11 @@ static ULARGE_INTEGER recurse_bytes; * displays help screen for dir * Rob Lake */ -static VOID - DirHelp (VOID) +static VOID DirHelp(VOID) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); } @@ -222,19 +228,18 @@ static VOID * * Parse the parameters and switches of the command line and exports them */ -static BOOL -DirReadParam (LPTSTR line, /* [IN] The line with the parameters & switches */ - LPTSTR *param, /* [OUT] The parameters after parsing */ - LPDIRSWITCHFLAGS lpFlags /* [IN/OUT] The flags after calculating switches */ - ) +static BOOL +DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & switches */ + LPTSTR *param, /* [OUT] The parameters after parsing */ + LPDIRSWITCHFLAGS lpFlags) /* [IN/OUT] The flags after calculating switches */ { -TCHAR cCurSwitch; /* The current switch */ -TCHAR cCurChar; /* Current examing character */ -TCHAR cCurUChar; /* Current upper examing character */ -BOOL bNegative; /* Negative switch */ -BOOL bPNegative; /* Negative switch parameter */ -BOOL bIntoQuotes; /* A flag showing if we are in quotes (") */ -LPTSTR ptrLast; /* A pointer to the last character of param */ + TCHAR cCurSwitch; /* The current switch */ + TCHAR cCurChar; /* Current examing character */ + TCHAR cCurUChar; /* Current upper examing character */ + BOOL bNegative; /* Negative switch */ + BOOL bPNegative; /* Negative switch parameter */ + BOOL bIntoQuotes; /* A flag showing if we are in quotes (") */ + LPTSTR ptrLast; /* A pointer to the last character of param */ /* Initialize variables; */ cCurSwitch = _T(' '); @@ -255,18 +260,18 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ /* Main Loop (see README_DIR.txt) */ /* scan the command line char per char, and we process its char */ - while (*line) + while (*Line) { /* we save current character as it is and its upper case */ - cCurChar = *line; - cCurUChar = _toupper(*line); + cCurChar = *Line; + cCurUChar = _toupper(*Line); /* 1st section (see README_DIR.txt) */ /* When a switch is expecting */ if (cCurSwitch == _T('/')) { if ((cCurUChar == _T('A')) ||(cCurUChar == _T('T')) || (cCurUChar == _T('O'))) - { + { cCurSwitch = cCurUChar; switch (cCurUChar) { @@ -284,38 +289,40 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ break; } } - else if (cCurUChar == _T('L')) + else if (cCurUChar == _T('L')) lpFlags->bLowerCase = ! bNegative; - else if (cCurUChar == _T('B')) + else if (cCurUChar == _T('B')) lpFlags->bBareFormat = ! bNegative; - else if (cCurUChar == _T('C')) + else if (cCurUChar == _T('C')) lpFlags->bTSeperator = ! bNegative; - else if (cCurUChar == _T('W')) - lpFlags->bWideList = ! bNegative; - else if (cCurUChar == _T('D')) - lpFlags->bWideListColSort = ! bNegative; - else if (cCurUChar == _T('N')) + else if (cCurUChar == _T('W')) + lpFlags->bWideList = ! bNegative; + else if (cCurUChar == _T('D')) + lpFlags->bWideListColSort = ! bNegative; + else if (cCurUChar == _T('N')) lpFlags->bNewLongList = ! bNegative; - else if (cCurUChar == _T('P')) + else if (cCurUChar == _T('P')) lpFlags->bPause = ! bNegative; - else if (cCurUChar == _T('Q')) + else if (cCurUChar == _T('Q')) lpFlags->bUser = ! bNegative; - else if (cCurUChar == _T('S')) + else if (cCurUChar == _T('S')) lpFlags->bRecursive = ! bNegative; - else if (cCurUChar == _T('X')) + else if (cCurUChar == _T('X')) lpFlags->bShortName = ! bNegative; else if (cCurChar == _T('4')) lpFlags->b4Digit = ! bNegative; - else if (cCurChar == _T('?')) + else if (cCurChar == _T('?')) { DirHelp(); - return FALSE; + return FALSE; } else if (cCurChar == _T('-')) - bNegative = TRUE; - else { - error_invalid_switch ((TCHAR)_totupper (*line)); + bNegative = TRUE; + } + else + { + error_invalid_switch ((TCHAR)_totupper (*Line)); return FALSE; } @@ -328,10 +335,11 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ cCurSwitch = _T(' '); } - /* 2nd section (see README_DIR.txt) */ - /* We are expecting parameter or the unknown */ else if ((cCurSwitch == _T(' ')) || (cCurSwitch == _T('P'))) { + /* 2nd section (see README_DIR.txt) */ + /* We are expecting parameter or the unknown */ + if (cCurChar == _T('/')) cCurSwitch = _T('/'); @@ -342,34 +350,34 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ { cCurSwitch = _T(' '); if ((*param) && !(ptrLast)) - ptrLast = line; - } - + ptrLast = Line; + } + } - /* Process a quote */ else if (cCurChar == _T('\"')) { + /* Process a quote */ bIntoQuotes = !bIntoQuotes; - if (!bIntoQuotes) ptrLast = line; + if (!bIntoQuotes) ptrLast = Line; } - /* Process a character for parameter */ - else + else { + /* Process a character for parameter */ if ((cCurSwitch == _T(' ')) && (*param)) { - error_too_many_parameters(line); + error_too_many_parameters(Line); return FALSE; } cCurSwitch = _T('P'); if (!(*param)) - *param = line; + *param = Line; } - } - /* 3rd section (see README_DIR.txt) */ - /* We are waiting for switch parameters */ else { + /* 3rd section (see README_DIR.txt) */ + /* We are waiting for switch parameters */ + /* Check if there are no more switch parameters */ if ((cCurChar == _T('/')) || ( cCurChar == _T(' '))) { @@ -431,7 +439,7 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ } else { - error_parameter_format((TCHAR)_totupper (*line)); + error_parameter_format((TCHAR)_totupper (*Line)); return FALSE; } break; @@ -451,7 +459,7 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ lpFlags->stTimeField.eTimeField= TF_MODIFIEDDATE ; else { - error_parameter_format((TCHAR)_totupper (*line)); + error_parameter_format((TCHAR)_totupper (*Line)); return FALSE; } break; @@ -497,7 +505,7 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ else { - error_parameter_format((TCHAR)_totupper (*line)); + error_parameter_format((TCHAR)_totupper (*Line)); return FALSE; } @@ -508,7 +516,7 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ bPNegative = FALSE; } - line++; + Line++; } /* Terminate the parameters */ if (ptrLast) *ptrLast = 0; @@ -548,6 +556,7 @@ LPTSTR ptrLast; /* A pointer to the last character of param */ return TRUE; } + /* * ExtendFilespec * @@ -691,7 +700,6 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec) } else { - *tmp = _T('\0'); /* change to this directory */ @@ -704,7 +712,8 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec) return 1; } } - /* get the full name of the directory */ + + /* get the full name of the directory */ if (!GetCurrentDirectory (MAX_PATH, szPath)) { *tmp = _T('\\'); @@ -726,32 +735,35 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec) * incline * * increment our line if paginating, display message at end of screen - *//*Maybe needed in future + */ +#if 0 static BOOL IncLine (LPINT pLine, LPDIRSWITCHFLAGS lpFlags) { - BOOL error; + BOOL bError; CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo; LONG WindowHeight; - error = GetConsoleScreenBufferInfo(hConsole, &lpConsoleScreenBufferInfo); - - WindowHeight= lpConsoleScreenBufferInfo.srWindow.Bottom - lpConsoleScreenBufferInfo.srWindow.Top; - //That prevents bad behave if WindowHeight couln't calc - if (!WindowHeight) + bError = GetConsoleScreenBufferInfo(hConsole, &lpConsoleScreenBufferInfo); + + WindowHeight = lpConsoleScreenBufferInfo.srWindow.Bottom - lpConsoleScreenBufferInfo.srWindow.Top; + + /* That prevents bad behiour if WindowHeight could not be calculated */ + if (!WindowHeight) { WindowHeight= 1000000; } + if (!(lpFlags->bPause)) return FALSE; (*pLine)++; - // Because I don't know if WindowsHeight - work under all cases, perhaps then maxy - is the right value - - if (*pLine >= (int)maxy - 2 || *pLine >= WindowHeight) + /* + * Because I don't know if WindowsHeight work in all cases, + * perhaps then maxy is the right value + */ + if (*pLine >= (int)maxy - 2 || *pLine >= WindowHeight) { *pLine = 0; return (PagePrompt () == PROMPT_BREAK); @@ -759,7 +771,7 @@ IncLine (LPINT pLine, LPDIRSWITCHFLAGS lpFlags) return FALSE; } -*/ +#endif /* * PrintDirectoryHeader @@ -767,16 +779,16 @@ IncLine (LPINT pLine, LPDIRSWITCHFLAGS lpFlags) * print the header for the dir command */ static BOOL -PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags) +PrintDirectoryHeader(LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szRootName[MAX_PATH]; TCHAR szVolName[80]; DWORD dwSerialNr; LPTSTR p; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (lpFlags->bBareFormat) - return(TRUE); + return TRUE; /* build usable root path */ if (szPath[1] == _T(':') && szPath[2] == _T('\\')) @@ -825,29 +837,24 @@ PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags) } /* print drive info */ - if (szVolName[0] != _T('\0')) - { - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg), szRootName[0], szVolName); - } + { + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf((LPTSTR)szMsg, szRootName[0], szVolName); + } else - { - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg), szRootName[0]); - } - - - + { + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, szRootName[0]); + } /* print the volume serial number if the return was successful */ - - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg), - HIWORD(dwSerialNr), - LOWORD(dwSerialNr)); + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP4, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf((LPTSTR)szMsg, + HIWORD(dwSerialNr), + LOWORD(dwSerialNr)); - return(TRUE); + return TRUE; } @@ -855,7 +862,9 @@ PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags) * convert * * insert commas into a number - *//* Maybe needed in future + * + */ +#if 0 static INT ConvertULong (ULONG num, LPTSTR des, INT len) { @@ -886,7 +895,7 @@ ConvertULong (ULONG num, LPTSTR des, INT len) return n; } -*/ +#endif static INT ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperator) @@ -908,7 +917,7 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperato { if ((((c + 1) % (nNumberGroups + 1)) == 0) && (bPutSeperator)) temp[30 - c++] = cThousandSeparator; - temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0'); + temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0'); num.QuadPart /= 10; } @@ -921,35 +930,37 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperato static VOID -DirPrintFileDateTime (TCHAR * lpDate, - TCHAR * lpTime, - LPWIN32_FIND_DATA lpFile, - LPDIRSWITCHFLAGS lpFlags) +DirPrintFileDateTime(TCHAR *lpDate, + TCHAR *lpTime, + LPWIN32_FIND_DATA lpFile, + LPDIRSWITCHFLAGS lpFlags) { -FILETIME ft; -SYSTEMTIME dt; -TCHAR szDate[30]; -TCHAR szTime[30]; -WORD wYear; + FILETIME ft; + SYSTEMTIME dt; + TCHAR szDate[30]; + TCHAR szTime[30]; + WORD wYear; /* Select the right time field */ switch (lpFlags->stTimeField.eTimeField) { - case TF_CREATIONDATE: - if (!FileTimeToLocalFileTime(&lpFile->ftCreationTime, &ft)) - return; - FileTimeToSystemTime(&ft, &dt); - break; - case TF_LASTACCESSEDDATE : - if (!FileTimeToLocalFileTime(&lpFile->ftLastAccessTime, &ft)) - return; - FileTimeToSystemTime(&ft, &dt); - break; - case TF_MODIFIEDDATE: - if (!FileTimeToLocalFileTime(&lpFile->ftLastWriteTime, &ft)) - return; - FileTimeToSystemTime(&ft, &dt); - break; + case TF_CREATIONDATE: + if (!FileTimeToLocalFileTime(&lpFile->ftCreationTime, &ft)) + return; + FileTimeToSystemTime(&ft, &dt); + break; + + case TF_LASTACCESSEDDATE : + if (!FileTimeToLocalFileTime(&lpFile->ftLastAccessTime, &ft)) + return; + FileTimeToSystemTime(&ft, &dt); + break; + + case TF_MODIFIEDDATE: + if (!FileTimeToLocalFileTime(&lpFile->ftLastWriteTime, &ft)) + return; + FileTimeToSystemTime(&ft, &dt); + break; } /* Format date */ @@ -958,7 +969,7 @@ WORD wYear; { case 0: /* mmddyy */ default: - _stprintf (szDate,_T("%02d%c%02d%c%0*d"), + _stprintf (szDate, _T("%02d%c%02d%c%0*d"), dt.wMonth, cDateSeparator, dt.wDay, cDateSeparator, lpFlags->b4Digit?4:2, wYear); @@ -984,7 +995,7 @@ WORD wYear; _stprintf (szTime,_T(" %02d%c%02u%c"), (dt.wHour == 0 ? 12 : (dt.wHour <= 12 ? dt.wHour : dt.wHour - 12)), cTimeSeparator, - dt.wMinute, (dt.wHour <= 11 ? 'a' : 'p')); + dt.wMinute, (dt.wHour <= 11 ? _T('a') : _T('p'))); break; case 1: /* 24 hour format */ @@ -1053,10 +1064,10 @@ PrintSummary(LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags) { -TCHAR szBuffer[64]; -ULARGE_INTEGER uliFree; -TCHAR szRoot[] = _T("A:\\"); -WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szBuffer[64]; + ULARGE_INTEGER uliFree; + TCHAR szRoot[] = _T("A:\\"); /* Here we check if we didn't find anything */ @@ -1065,6 +1076,7 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; error_file_not_found(); return 1; } + /* In bare format we don't print results */ if (lpFlags->bBareFormat) return 0; @@ -1072,20 +1084,20 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; /* Print recursive specific results */ if (lpFlags->bRecursive) { - ConvertULargeInteger (u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); - - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP5, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg),ulFiles, szBuffer); - } + ConvertULargeInteger(u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); + + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP5, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg,ulFiles, szBuffer); + } /* Print total directories and freespace */ szRoot[0] = szPath[0]; GetUserDiskFreeSpace(szRoot, &uliFree); - ConvertULargeInteger (uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP6, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg),ulDirs, szBuffer); + ConvertULargeInteger(uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP6, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf((LPTSTR)szMsg,ulDirs, szBuffer); - return 0; + return 0; } /* @@ -1095,9 +1107,9 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; */ TCHAR* getExt(const TCHAR* file) { - - TCHAR* tmp = _tcsrchr(file,'.'); - return tmp?tmp+1:""; + static TCHAR *NoExt = _T(""); + TCHAR* lastdot = _tcsrchr(file, _T('.')); + return (lastdot != NULL ? lastdot + 1 : NoExt); } /* @@ -1105,23 +1117,23 @@ TCHAR* getExt(const TCHAR* file) * * Get the name of the file without extension */ -TCHAR * getName(const TCHAR* file, TCHAR * dest) +static LPTSTR getName(const TCHAR* file, TCHAR * dest) { -int iLen; -TCHAR* end; - + int iLen; + LPTSTR end; + /* Check for "." and ".." folders */ - if ((_tcscmp(file, _T(".")) == 0) - || (_tcscmp(file, _T("..")) == 0)) + if ((_tcscmp(file, _T(".")) == 0) || + (_tcscmp(file, _T("..")) == 0)) { _tcscpy(dest,file); return dest; } - end = _tcsrchr(file,'.'); + end = _tcsrchr(file, _T('.')); if (!end) - iLen = _tcslen(file); - else + iLen = _tcslen(file); + else iLen = (end - file); @@ -1130,156 +1142,172 @@ TCHAR* end; return dest; } + + /* * DirPrintNewList * * The function that prints in new style */ -static int +static VOID DirPrintNewList(LPWIN32_FIND_DATA ptrFiles[], /* [IN]Files' Info */ - DWORD dwCount, /* [IN] The quantity of files */ - TCHAR * szCurPath, /* [IN] Full path of current directory */ - LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ + DWORD dwCount, /* [IN] The quantity of files */ + TCHAR *szCurPath, /* [IN] Full path of current directory */ + LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ { -DWORD i; /* An indexer for "for"s */ -TCHAR szSize[30]; /* The size of file */ -TCHAR szShortName[15]; /* The sort name */ -TCHAR szDate[20], szTime[20]; /* Date and time strings */ -int iSizeFormat; /* The format of size field */ -ULARGE_INTEGER u64FileSize; /* The file size */ + DWORD i; + TCHAR szSize[30]; + TCHAR szShortName[15]; + TCHAR szDate[20]; + TCHAR szTime[20]; + INT iSizeFormat; + ULARGE_INTEGER u64FileSize; - for(i = 0;i < dwCount;i++) - { + for (i = 0;i < dwCount;i++) + { + /* Calculate size */ + if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + /* Directory */ + iSizeFormat = -14; + _tcscpy(szSize, _T("")); + } + else + { + /* File */ + iSizeFormat = 14; + u64FileSize.HighPart = ptrFiles[i]->nFileSizeHigh; + u64FileSize.LowPart = ptrFiles[i]->nFileSizeLow; + ConvertULargeInteger(u64FileSize, szSize, 20, lpFlags->bTSeperator); + } - /* Calculate size */ - if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - /* Directory */ - { - iSizeFormat = -14; - _tcscpy(szSize, _T("")); - } - else - /* File */ - { - iSizeFormat = 14; - u64FileSize.HighPart = ptrFiles[i]->nFileSizeHigh; - u64FileSize.LowPart = ptrFiles[i]->nFileSizeLow; - ConvertULargeInteger(u64FileSize, szSize, 20,lpFlags->bTSeperator); - } - /* Calculate short name */ - szShortName[0] = _T('\0'); - if (lpFlags->bShortName) - _stprintf(szShortName," %-12s", ptrFiles[i]->cAlternateFileName); - - /* Format date and time */ - DirPrintFileDateTime(szDate,szTime,ptrFiles[i],lpFlags); + /* Calculate short name */ + szShortName[0] = _T('\0'); + if (lpFlags->bShortName) + _stprintf(szShortName, _T(" %-12s"), ptrFiles[i]->cAlternateFileName); - /* Print the line */ - ConOutPrintf("%10s %-8s %*s%s %s\n", - szDate, - szTime, - iSizeFormat, - szSize, - szShortName, - ptrFiles[i]->cFileName ); - - } - return 0; + /* Format date and time */ + DirPrintFileDateTime(szDate, szTime, ptrFiles[i], lpFlags); + + /* Print the line */ + ConOutPrintf(_T("%10s %-8s %*s%s %s\n"), + szDate, + szTime, + iSizeFormat, + szSize, + szShortName, + ptrFiles[i]->cFileName); + } } + + /* * DirPrintWideList * * The function that prints in wide list */ -static int +static VOID DirPrintWideList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */ - DWORD dwCount, /* [IN] The quantity of files */ - TCHAR * szCurPath, /* [IN] Full path of current directory */ - LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ + DWORD dwCount, /* [IN] The quantity of files */ + TCHAR *szCurPath, /* [IN] Full path of current directory */ + LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ { -DWORD i,j; /* An indexer for "for"s */ -short iScreenWidth; /* The screen width */ -short iColumns; /* The columns (used by wide list) */ -short iLines; /* The lines (used by the wide list /d) */ -int iBiggestName; /* The biggest name, used for wide list */ -TCHAR szTempFname[MAX_PATH]; /* Temporary string */ + SHORT iScreenWidth; + USHORT iColumns; + USHORT iLines; + INT iLongestName; + TCHAR szTempFname[MAX_PATH]; + DWORD i; + DWORD j; + DWORD temp; - /* Calculate biggest name */ - iBiggestName = 1; - for(i = 0;i < dwCount;i++) - { - if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - /* Directories need 2 additinal characters for brackets */ - if ((_tcslen(ptrFiles[i]->cFileName) + 2) > iBiggestName) - iBiggestName = _tcslen(ptrFiles[i]->cFileName) + 2; - } - else - { - if (_tcslen(ptrFiles[i]->cFileName) > iBiggestName) - iBiggestName = _tcslen(ptrFiles[i]->cFileName); - } - } - - /* Count the highest number of columns */ - GetScreenSize(&iScreenWidth, 0); - iColumns = iScreenWidth / iBiggestName; + /* Calculate longest name */ + iLongestName = 1; + for (i = 0; i < dwCount; i++) + { + if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + /* Directories need 2 additinal characters for brackets */ + if ((_tcslen(ptrFiles[i]->cFileName) + 2) > iLongestName) + iLongestName = _tcslen(ptrFiles[i]->cFileName) + 2; + } + else + { + if (_tcslen(ptrFiles[i]->cFileName) > iLongestName) + iLongestName = _tcslen(ptrFiles[i]->cFileName); + } + } - /* Check if there is enough space for spaces between names */ - if (((iBiggestName * iColumns) + iColumns) >= iScreenWidth) - iColumns --; - /* A last check at iColumns to avoid division by zero */ - if (!(iColumns)) iColumns = 1; + /* Count the highest number of columns */ + GetScreenSize(&iScreenWidth, 0); + iColumns = iScreenWidth / iLongestName; - /* Print Column sorted */ - if (lpFlags->bWideListColSort) - { - /* Calculate the lines that will be printed */ - iLines = ceil((float)dwCount/(float)iColumns); + /* Check if there is enough space for spaces between names */ + if (((iLongestName * iColumns) + iColumns) >= iScreenWidth) + iColumns --; - for (i = 0;i < iLines;i++) - { - for (j = 0;j < iColumns;j++) - { - DWORD temp = (j*iLines)+i; - if (temp >= dwCount) break; - if (ptrFiles[temp]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - _stprintf(szTempFname, "[%s]", ptrFiles[temp]->cFileName); - else - _stprintf(szTempFname, "%s", ptrFiles[temp]->cFileName); + /* A last check at iColumns to avoid division by zero */ + if (!(iColumns)) + iColumns = 1; - ConOutPrintf("%-*s",iBiggestName + 1 , szTempFname ); - } - ConOutPrintf("\n"); - } - } - /* Print Line sorted */ - else - { - for (i = 0;i < dwCount;i++) - { - if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - _stprintf(szTempFname, "[%s]", ptrFiles[i]->cFileName); - else - _stprintf(szTempFname, "%s", ptrFiles[i]->cFileName); + /* Print Column sorted */ + if (lpFlags->bWideListColSort) + { + /* Calculate the lines that will be printed */ +// iLines = ceil((float)dwCount/(float)iColumns); + iLines = dwCount / iColumns; - ConOutPrintf("%-*s", iBiggestName + 1, szTempFname ); - /* We print a new line at the end of each column - except for the case that it is the last item.*/ - if (!((i+1)%iColumns) && (i < (dwCount-1))) - ConOutPrintf("\n"); - } - /* Add a new line after the last item */ - ConOutPrintf("\n"); - } - return 0; + for (i = 0;i < iLines;i++) + { + for (j = 0; j < iColumns; j++) + { + temp = (j * iLines) + i; + if (temp >= dwCount) + break; + + if (ptrFiles[temp]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + _stprintf(szTempFname, _T("[%s]"), ptrFiles[temp]->cFileName); + else + _stprintf(szTempFname, _T("%s"), ptrFiles[temp]->cFileName); + + ConOutPrintf(_T("%-*s"), iLongestName + 1 , szTempFname); + } + + ConOutPrintf(_T("\n")); + } + } + else + { + /* Print Line sorted */ + for (i = 0; i < dwCount; i++) + { + if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + _stprintf(szTempFname, _T("[%s]"), ptrFiles[i]->cFileName); + else + _stprintf(szTempFname, _T("%s"), ptrFiles[i]->cFileName); + + ConOutPrintf(_T("%-*s"), iLongestName + 1, szTempFname ); + + /* + * We print a new line at the end of each column + * except for the case that it is the last item. + */ + if (!((i + 1) % iColumns) && (i < (dwCount - 1))) + ConOutPrintf(_T("\n")); + } + + /* Add a new line after the last item */ + ConOutPrintf(_T("\n")); + } } + + /* * DirPrintOldList * * The function that prints in old style */ -static int +static VOID DirPrintOldList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */ DWORD dwCount, /* [IN] The quantity of files */ TCHAR * szCurPath, /* [IN] Full path of current directory */ @@ -1329,7 +1357,7 @@ ULARGE_INTEGER u64FileSize; /* The file size */ DirPrintFileDateTime(szDate,szTime,ptrFiles[i],lpFlags); /* Print the line */ - ConOutPrintf("%-8s %-3s %*s %s %s\n", + ConOutPrintf(_T("%-8s %-3s %*s %s %s\n"), szName, /* The file's 8.3 name */ szExt, /* The file's 8.3 extension */ iSizeFormat, /* print format for size column */ @@ -1337,7 +1365,6 @@ ULARGE_INTEGER u64FileSize; /* The file size */ szDate, /* The date of file/dir */ szTime); /* The time of file/dir */ } - return 0; } /* @@ -1345,90 +1372,93 @@ ULARGE_INTEGER u64FileSize; /* The file size */ * * The function that prints in bare format */ -static int +static VOID DirPrintBareList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */ - DWORD dwCount, /* [IN] The quantity of files */ - TCHAR * szCurPath, /* [IN] Full path of current directory */ - LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ + DWORD dwCount, /* [IN] The number of files */ + LPTSTR lpCurPath, /* [IN] Full path of current directory */ + LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ { -DWORD i; /* An indexer for "for"s */ -TCHAR szFullName[MAX_PATH]; /* The fullpath name of file */ - - for(i = 0;i < dwCount;i++) + TCHAR szFullName[MAX_PATH]; + DWORD i; + + for (i = 0; i < dwCount; i++) { if ((_tcscmp(ptrFiles[i]->cFileName, _T(".")) == 0) || - (_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0)) + (_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0)) { - /* at bare format we don't print "." and ".." folder */ + /* at bare format we don't print "." and ".." folder */ continue; } - /* at recursive mode we print full path of file */ if (lpFlags->bRecursive) { - _tcscpy(szFullName, szCurPath); + /* at recursive mode we print full path of file */ + _tcscpy(szFullName, lpCurPath); _tcscat(szFullName, ptrFiles[i]->cFileName); - ConOutPrintf("%s\n", szFullName); + ConOutPrintf(_T("%s\n"), szFullName); } - /* if we are not in recursive mode we print the file names */ else - ConOutPrintf("%s\n",ptrFiles[i]->cFileName); + { + /* if we are not in recursive mode we print the file names */ + ConOutPrintf(_T("%s\n"),ptrFiles[i]->cFileName); + } } - return 0; } + /* * DirPrintFiles * * The functions that prints the files list */ -static int +static VOID DirPrintFiles(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */ - DWORD dwCount, /* [IN] The quantity of files */ - TCHAR * szCurPath, /* [IN] Full path of current directory */ - LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ + DWORD dwCount, /* [IN] The quantity of files */ + TCHAR *szCurPath, /* [IN] Full path of current directory */ + LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ { -TCHAR szTemp[MAX_PATH]; /* A buffer to format the directory header */ -WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szTemp[MAX_PATH]; /* A buffer to format the directory header */ /* Print directory header */ _tcscpy(szTemp, szCurPath); + /* We cut the trailing \ of the full path */ szTemp[_tcslen(szTemp)-1] = _T('\0'); + /* Condition to print header: We are not printing in bare format and if we are in recursive mode... we must have results */ if (!(lpFlags->bBareFormat ) && !((lpFlags->bRecursive) && (dwCount <= 0))) { - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP7, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T( (LPTSTR)szMsg), szTemp); + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP7, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, szTemp); } - /* Bare format */ if (lpFlags->bBareFormat) { + /* Bare format */ DirPrintBareList(ptrFiles, dwCount, szCurPath, lpFlags); } - /* New list style / Short names */ else if(lpFlags->bShortName) { + /* New list style / Short names */ DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags); } - /* Wide list */ else if(lpFlags->bWideListColSort || lpFlags->bWideList) { + /* Wide list */ DirPrintWideList(ptrFiles, dwCount, szCurPath, lpFlags); } - /* New list style*/ else if (lpFlags->bNewLongList ) { + /* New list style*/ DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags); } - /* If nothing is selected old list is the default */ else { + /* If nothing is selected old list is the default */ DirPrintOldList(ptrFiles, dwCount, szCurPath, lpFlags); } - return 0; } @@ -1438,16 +1468,15 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; * * Compares 2 files based on the order criteria */ -static int - CompareFiles( - LPWIN32_FIND_DATA lpFile1, /* [IN] A pointer to WIN32_FIND_DATA of file 1 */ - LPWIN32_FIND_DATA lpFile2, /* [IN] A pointer to WIN32_FIND_DATA of file 2 */ - LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags that we use to list */ +static BOOL +CompareFiles(LPWIN32_FIND_DATA lpFile1, /* [IN] A pointer to WIN32_FIND_DATA of file 1 */ + LPWIN32_FIND_DATA lpFile2, /* [IN] A pointer to WIN32_FIND_DATA of file 2 */ + LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags that we use to list */ { -/* u64 variables used to translate some broken 32bit info */ -ULARGE_INTEGER u64File1, u64File2; -int i; /* An indexer for "for"s */ -long iComp = 0; /* The comparison result */ + ULARGE_INTEGER u64File1; + ULARGE_INTEGER u64File2; + int i; + long iComp = 0; /* The comparison result */ /* Calculate critiries by order given from user */ for (i = 0;i < lpFlags->stOrderBy.sCriteriaCount;i++) @@ -1472,19 +1501,20 @@ long iComp = 0; /* The comparison result */ iComp = 0; break; - break; case ORDER_DIRECTORY: /* Order by directory attribute /o:g */ iComp = ((lpFile2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)- (lpFile1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)); break; - case ORDER_EXTENSION: /* Order by extension name /o:e */ - iComp = _stricmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName)); - break; - case ORDER_NAME: /* Order by filename /o:n */ - iComp = _stricmp(lpFile1->cFileName, lpFile2->cFileName); - break; - case ORDER_TIME: /* Order by file's time /o:t */ + case ORDER_EXTENSION: /* Order by extension name /o:e */ + iComp = _tcsicmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName)); + break; + + case ORDER_NAME: /* Order by filename /o:n */ + iComp = _tcsicmp(lpFile1->cFileName, lpFile2->cFileName); + break; + + case ORDER_TIME: /* Order by file's time /o:t */ /* We compare files based on the time field selected by /t */ switch(lpFlags->stTimeField.eTimeField) { @@ -1520,13 +1550,14 @@ long iComp = 0; /* The comparison result */ iComp = 0; break; } + /* Reverse if desired */ if (lpFlags->stOrderBy.bCriteriaRev[i]) iComp *= -1; /* If that criteria was enough for distinguishing the files/dirs,there is no need to calculate the others*/ - if (iComp != 0) break; + if (iComp != 0) break; } /* Translate the value of iComp to boolean */ @@ -1541,21 +1572,21 @@ long iComp = 0; /* The comparison result */ * * Sort files by the order criterias using quicksort method */ -static void -QsortFiles( - LPWIN32_FIND_DATA ptrArray[], /* [IN/OUT] The array with file info pointers */ - int i, /* [IN] The index of first item in array */ - int j, /* [IN] The index to last item in array */ - LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags that we will use to sort */ +static VOID +QsortFiles(LPWIN32_FIND_DATA ptrArray[], /* [IN/OUT] The array with file info pointers */ + int i, /* [IN] The index of first item in array */ + int j, /* [IN] The index to last item in array */ + LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags that we will use to sort */ { -LPWIN32_FIND_DATA lpTemp; /* A temporary pointer */ - /* used for exchangin pointers */ -int First, Last, Temp; -BOOL Way; + LPWIN32_FIND_DATA lpTemp; /* A temporary pointer */ + int First, Last, Temp; + BOOL Way; if (i < j) { - First = i, Last = j, Way = TRUE; + First = i; + Last = j; + Way = TRUE; while (i != j) { if (Way == CompareFiles(ptrArray[i], ptrArray[j], lpFlags)) @@ -1564,13 +1595,18 @@ BOOL Way; lpTemp = ptrArray[i]; ptrArray[i]= ptrArray[j]; ptrArray[j] = lpTemp; - /* Swap the indexers for inverting sorting */ - Temp = i, i=j,j =Temp; + + /* Swap the indexes for inverting sorting */ + Temp = i; + i = j; + j =Temp; + Way = !Way; } - j += (!Way - Way); + j += (!Way - Way); } + QsortFiles(ptrArray,First, i-1, lpFlags); QsortFiles(ptrArray,i+1,Last, lpFlags); } @@ -1583,25 +1619,18 @@ BOOL Way; * * The functions that does everything except for printing results */ -static INT DirList (LPTSTR szPath, /* [IN] The path that dir starts */ - LPTSTR szFilespec, /* [IN] The type of file that we are looking for */ - LPINT pLine, /* FIXME: Maybe used for paginating */ - LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags of the listing */ +static INT +DirList(LPTSTR szPath, /* [IN] The path that dir starts */ + LPTSTR szFilespec, /* [IN] The type of file that we are looking for */ + LPINT pLine, /* FIXME: Maybe used for paginating */ + LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags of the listing */ { - -/* Internal linked list */ -struct TDirFindListNode - { - WIN32_FIND_DATA stFindInfo; - struct TDirFindListNode * ptrNext; -}; - -HANDLE hSearch; /* The handle of the search */ -HANDLE hRecSearch; /* The handle for searching recursivly */ -WIN32_FIND_DATA wfdFileInfo; /* The info of file that found */ -LPWIN32_FIND_DATA * ptrFileArray; /* An array of pointers with all the files */ -struct TDirFindListNode * ptrStartNode; /* The pointer to the first node */ -struct TDirFindListNode * ptrNextNode; /* A pointer used for relatives refernces */ + HANDLE hSearch; /* The handle of the search */ + HANDLE hRecSearch; /* The handle for searching recursivly */ + WIN32_FIND_DATA wfdFileInfo; /* The info of file that found */ + LPWIN32_FIND_DATA * ptrFileArray; /* An array of pointers with all the files */ + PDIRFINDLISTNODE ptrStartNode; /* The pointer to the first node */ + PDIRFINDLISTNODE ptrNextNode; /* A pointer used for relatives refernces */ TCHAR szFullPath[MAX_PATH]; /* The full path that we are listing with trailing \ */ TCHAR szFullFileSpec[MAX_PATH]; /* The full path with file specs that we ll request\ */ TCHAR szBytes[20]; /* A string for converting ULARGE integer */ @@ -1610,7 +1639,7 @@ DWORD dwCountFiles; /* Counter for files */ DWORD dwCountDirs; /* Counter for directories */ ULARGE_INTEGER u64CountBytes; /* Counter for bytes */ ULARGE_INTEGER u64Temp; /* A temporary counter */ -WCHAR szMsg[RC_STRING_MAX_SIZE]; +TCHAR szMsg[RC_STRING_MAX_SIZE]; /* Initialize Variables */ ptrStartNode = NULL; @@ -1618,7 +1647,7 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; dwCount = 0; dwCountFiles = 0; dwCountDirs = 0; - u64CountBytes.QuadPart = 0; + u64CountBytes.QuadPart = 0; /* Create szFullPath and szFullFileSpec */ _tcscpy (szFullPath, szPath); @@ -1628,7 +1657,8 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; _tcscat (szFullFileSpec, szFilespec); /* Prepare the linked list, first node is allocated */ - if ((ptrStartNode = malloc(sizeof(struct TDirFindListNode))) == NULL) + ptrStartNode = malloc(sizeof(DIRFINDLISTNODE)); + if (ptrStartNode == NULL) { #ifdef _DEBUG ConErrPrintf("DEBUG: Cannot allocate memory for ptrStartNode!\n"); @@ -1638,7 +1668,7 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; ptrNextNode = ptrStartNode; /* Collect the results for the current folder */ - hSearch = FindFirstFile (szFullFileSpec, &wfdFileInfo); + hSearch = FindFirstFile(szFullFileSpec, &wfdFileInfo); do { if (hSearch != INVALID_HANDLE_VALUE) @@ -1647,15 +1677,31 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; if ((wfdFileInfo.dwFileAttributes & lpFlags->stAttribs.dwAttribMask ) == (lpFlags->stAttribs.dwAttribMask & lpFlags->stAttribs.dwAttribVal )) { - ptrNextNode->ptrNext = malloc(sizeof(struct TDirFindListNode)); + ptrNextNode->ptrNext = malloc(sizeof(DIRFINDLISTNODE)); + if (ptrNextNode->ptrNext == NULL) + { +#ifdef _DEBUG + ConErrPrintf("DEBUG: Cannot allocate memory for ptrNextNode->ptrNext!\n"); +#endif + while (ptrStartNode) + { + ptrNextNode = ptrStartNode->ptrNext; + free(ptrStartNode); + ptrStartNode = ptrNextNode; + dwCount --; + } + return 1; + } + /* If malloc fails we go to next file in hope it works, without braking the linked list! */ if (ptrNextNode->ptrNext) { /* Copy the info of search at linked list */ - memcpy((void *)&ptrNextNode->ptrNext->stFindInfo, - (void *)&wfdFileInfo,sizeof(WIN32_FIND_DATA)); - + memcpy(&ptrNextNode->ptrNext->stFindInfo, + &wfdFileInfo, + sizeof(WIN32_FIND_DATA)); + /* If lower case is selected do it here */ if (lpFlags->bLowerCase) { @@ -1676,37 +1722,45 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; else { /* File */ - dwCountFiles++; + dwCountFiles++; u64Temp.HighPart = wfdFileInfo.nFileSizeHigh; u64Temp.LowPart = wfdFileInfo.nFileSizeLow; u64CountBytes.QuadPart += u64Temp.QuadPart; - } + } } } - - } - }while(FindNextFile(hSearch,&wfdFileInfo)); + } + }while(FindNextFile(hSearch, &wfdFileInfo)); FindClose(hSearch); /* Terminate list */ ptrNextNode->ptrNext = NULL; /* Calculate and allocate space need for making an array of pointers */ - ptrFileArray = malloc(sizeof(LPWIN32_FIND_DATA)*dwCount); - if (!(ptrFileArray)) + ptrFileArray = malloc(sizeof(LPWIN32_FIND_DATA) * dwCount); + if (ptrFileArray == NULL) { #ifdef _DEBUG ConErrPrintf("DEBUG: Cannot allocate memory for ptrFileArray!\n"); #endif - goto _DirList_clear_n_exit; + while (ptrStartNode) + { + ptrNextNode = ptrStartNode->ptrNext; + free(ptrStartNode); + ptrStartNode = ptrNextNode; + dwCount --; + } + return 1; } - /* Create an array of pointers from the linked list - this will be used to sort and print data, rather than the list */ + /* + * Create an array of pointers from the linked list + * this will be used to sort and print data, rather than the list + */ ptrNextNode = ptrStartNode; dwCount = 0; - while(ptrNextNode->ptrNext) - { + while (ptrNextNode->ptrNext) + { *(ptrFileArray + dwCount) = &ptrNextNode->ptrNext->stFindInfo; ptrNextNode = ptrNextNode->ptrNext; dwCount++; @@ -1728,8 +1782,8 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!(lpFlags->bBareFormat) && (dwCount > 0)) { ConvertULargeInteger(u64CountBytes, szBytes, 20, lpFlags->bTSeperator); - LoadString( GetModuleHandle(NULL), STRING_DIR_HELP8, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPrintf (_T((LPTSTR)szMsg),dwCountFiles, szBytes); + LoadString(GetModuleHandle(NULL), STRING_DIR_HELP8, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg,dwCountFiles, szBytes); } /* Add statistics to recursive statistics*/ @@ -1751,9 +1805,9 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; if (hRecSearch != INVALID_HANDLE_VALUE) { /* We search for directories other than "." and ".." */ - if ((_stricmp(wfdFileInfo.cFileName, _T(".")) != 0) - && (_stricmp(wfdFileInfo.cFileName, _T("..")) != 0 ) - && (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + if ((_tcsicmp(wfdFileInfo.cFileName, _T(".")) != 0) && + (_tcsicmp(wfdFileInfo.cFileName, _T("..")) != 0 ) && + (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { /* Concat the path and the directory to do recursive */ _tcscpy(szFullFileSpec, szFullPath); @@ -1766,8 +1820,6 @@ WCHAR szMsg[RC_STRING_MAX_SIZE]; FindClose(hRecSearch); } -_DirList_clear_n_exit: -/* Deallocate memory */ /* Free linked list */ while (ptrStartNode) { @@ -1787,9 +1839,9 @@ _DirList_clear_n_exit: * * internal dir command */ -INT CommandDir (LPTSTR first, LPTSTR rest) +INT CommandDir(LPTSTR first, LPTSTR rest) { - TCHAR dircmd[256]; /* A variable to store the DIRCMD enviroment variable */ + TCHAR dircmd[256]; /* A variable to store the DIRCMD enviroment variable */ TCHAR szPath[MAX_PATH]; TCHAR szFilespec[MAX_PATH]; LPTSTR param; @@ -1822,9 +1874,9 @@ INT CommandDir (LPTSTR first, LPTSTR rest) stFlags.stOrderBy.bUnSet = FALSE; /* read the parameters from the DIRCMD environment variable */ - if (GetEnvironmentVariable (_T("DIRCMD"), dircmd, 256)) + if (GetEnvironmentVariable (_T("DIRCMD"), dircmd, 256)) if (!DirReadParam(dircmd, ¶m, &stFlags)) - return 1; + return 1; /* read the parameters */ if (!DirReadParam(rest, ¶m, &stFlags)) @@ -1869,7 +1921,7 @@ INT CommandDir (LPTSTR first, LPTSTR rest) if (DirList (szPath, szFilespec, &nLine, &stFlags)) return 1; - /* print the footer */ + /* print the footer */ PrintSummary(szPath, recurse_file_cnt, recurse_dir_cnt, diff --git a/reactos/subsys/system/cmd/dirstack.c b/reactos/subsys/system/cmd/dirstack.c index abe60d24694..b34d5027999 100644 --- a/reactos/subsys/system/cmd/dirstack.c +++ b/reactos/subsys/system/cmd/dirstack.c @@ -137,16 +137,15 @@ INT GetDirectoryStackDepth (VOID) */ INT CommandPushd (LPTSTR first, LPTSTR rest) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR curPath[MAX_PATH]; TCHAR newPath[MAX_PATH]; BOOL bChangePath = FALSE; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (rest, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - + LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -172,14 +171,13 @@ INT CommandPushd (LPTSTR first, LPTSTR rest) */ INT CommandPopd (LPTSTR first, LPTSTR rest) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szPath[MAX_PATH]; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp(rest, _T("/?"), 2)) - { - LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - + { + LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -200,14 +198,13 @@ INT CommandPopd (LPTSTR first, LPTSTR rest) */ INT CommandDirs (LPTSTR first, LPTSTR rest) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPDIRENTRY lpDir; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp(rest, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - + LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -216,9 +213,8 @@ INT CommandDirs (LPTSTR first, LPTSTR rest) if (lpDir == NULL) { - LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - + LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/echo.c b/reactos/subsys/system/cmd/echo.c index bddfcb088b8..c1ecc5fbddb 100644 --- a/reactos/subsys/system/cmd/echo.c +++ b/reactos/subsys/system/cmd/echo.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * ECHO.C - internal echo commands. * * @@ -22,26 +21,27 @@ * * 13-Jul-2000 (Eric Kohl ) * Implemented 'echo.' and 'echoerr.'. + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" INT CommandEcho (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + #ifdef _DEBUG DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays a message or switches command echoing on or off.\n" - "\n" - " ECHO [ON | OFF]\n" - " ECHO [message]\n" - " ECHO. prints an empty line\n" - "\n" - "Type ECHO without a parameter to display the current ECHO setting.")); + LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -61,23 +61,28 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param) else if (*param) ConOutPuts (param); else - ConOutPrintf (_T("ECHO is %s\n"), bEcho ? D_ON : D_OFF); + { + LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, bEcho ? D_ON : D_OFF); + } } return 0; } + INT CommandEchos (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + #ifdef _DEBUG DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Display a messages without trailing carridge return and line feed.\n" - "\n" - " ECHOS message")); + LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -90,16 +95,16 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param) INT CommandEchoerr (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + #ifdef _DEBUG DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays a message to the standard error.\n" - "\n" - " ECHOERR message\n" - " ECHOERR. prints an empty line")); + LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -118,17 +123,19 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param) return 0; } + INT CommandEchoserr (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + #ifdef _DEBUG DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Prints a messages to standard error output without trailing carridge return and line feed.\n" - "\n" - " ECHOSERR message")); + LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts((LPTSTR)szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/error.c b/reactos/subsys/system/cmd/error.c index 34ae60f7588..354e707cce3 100644 --- a/reactos/subsys/system/cmd/error.c +++ b/reactos/subsys/system/cmd/error.c @@ -15,11 +15,15 @@ * * 02-Feb-1999 (Eric Kohl ) * Use FormatMessage() for error reports. + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" - +/* #define PARAMETERF_ERROR _T("Parameter format not correct - %c\n") #define INVALID_SWITCH _T("Invalid switch - /%c\n") #define TOO_MANY_PARAMETERS _T("Too many parameters - %s\n") @@ -33,13 +37,16 @@ #define CANNOTPIPE _T("Error! Cannot pipe! Cannot open temporary file!\n") #define D_PAUSEMSG _T("Press any key to continue . . .") - +*/ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szMessage[1024]; +#ifndef __REACTOS__ LPTSTR szError; +#endif va_list arg_ptr; if (dwErrorCode == ERROR_SUCCESS) @@ -64,7 +71,8 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...) } else { - ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode); + LoadString(GetModuleHandle(NULL), STRING_ERROR_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, dwErrorCode); return; } @@ -73,111 +81,157 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...) switch (dwErrorCode) { case ERROR_FILE_NOT_FOUND: - szError = _T("File not found"); + LoadString(GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE); break; case ERROR_PATH_NOT_FOUND: - szError = _T("Path not found"); + LoadString(GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE); break; case ERROR_NOT_READY: - szError = _T("Drive not ready"); + LoadString(GetModuleHandle(NULL), STRING_ERROR_DRIVER_NOT_READY, szMsg, RC_STRING_MAX_SIZE); break; default: - ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode); + LoadString(GetModuleHandle(NULL), STRING_ERROR_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); return; } if (szFormat) - ConErrPrintf (_T("%s -- %s\n"), szError, szMessage); + ConErrPrintf (_T("%s -- %s\n"), szMsg, szMessage); else - ConErrPrintf (_T("%s\n"), szError); + ConErrPrintf (_T("%s\n"), szMsg); #endif } VOID error_parameter_format(TCHAR ch) { - ConErrPrintf (PARAMETERF_ERROR, ch); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_PARAMETERF_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, ch); } VOID error_invalid_switch (TCHAR ch) { - ConErrPrintf (INVALID_SWITCH, ch); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, ch); } VOID error_too_many_parameters (LPTSTR s) { - ConErrPrintf (TOO_MANY_PARAMETERS, s); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, s); } VOID error_path_not_found (VOID) { - ConErrPrintf (PATH_NOT_FOUND); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } VOID error_file_not_found (VOID) { - ConErrPrintf (FILE_NOT_FOUND); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } VOID error_sfile_not_found (LPTSTR f) { - ConErrPrintf (FILE_NOT_FOUND _T(" - %s\n"), f); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(_T("%s - %s\n"), szMsg, f); } VOID error_req_param_missing (VOID) { - ConErrPrintf (REQ_PARAM_MISSING); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_REQ_PARAM_MISSING, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } VOID error_invalid_drive (VOID) { - ConErrPrintf (INVALID_DRIVE); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_INVALID_DRIVE, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } VOID error_bad_command (VOID) { - ConErrPrintf (BADCOMMAND); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_BADCOMMAND, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } VOID error_no_pipe (VOID) { - ConErrPrintf (CANNOTPIPE); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_CANNOTPIPE, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } VOID error_out_of_memory (VOID) { - ConErrPrintf (OUT_OF_MEMORY); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_OUT_OF_MEMORY, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); } VOID error_invalid_parameter_format (LPTSTR s) { - ConErrPrintf (INVALID_PARAM_FORMAT, s); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, s); } VOID error_syntax (LPTSTR s) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_ERROR2, szMsg, RC_STRING_MAX_SIZE); + if (s) - ConErrPrintf (_T("Syntax error - %s\n"), s); + ConErrPrintf(_T("%s - %s\n"), szMsg, s); else - ConErrPrintf (_T("Syntax error.\n")); + ConErrPrintf(_T("%s.\n"), szMsg); } VOID msg_pause (VOID) { - ConOutPuts (D_PAUSEMSG); + TCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString(GetModuleHandle(NULL), STRING_ERROR_D_PAUSEMSG, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); } + +/* EOF */ diff --git a/reactos/subsys/system/cmd/for.c b/reactos/subsys/system/cmd/for.c index a646ad022cf..06f128fd11b 100644 --- a/reactos/subsys/system/cmd/for.c +++ b/reactos/subsys/system/cmd/for.c @@ -25,9 +25,13 @@ * 23-Feb-2001 (Carl Nettelblad ) * Implemented preservation of echo flag. Some other for related * code in other files fixed, too. + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" /* @@ -46,6 +50,7 @@ INT cmd_for (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPBATCH_CONTEXT lpNew; LPTSTR pp; TCHAR var; @@ -56,17 +61,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param) if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Runs a specified command for each file in a set of files\n" - "\n" - "FOR %variable IN (set) DO command [parameters]\n" - "\n" - " %variable Specifies a replaceable parameter.\n" - " (set) Specifies a set of one or more files. Wildcards may be used.\n" - " command Specifies the command to carry out for each file.\n" - " parameters Specifies parameters or switches for the specified command.\n" - "\n" - "To user the FOR comamnd in a batch program, specify %%variable instead of\n" - "%variable.")); + LoadString(GetModuleHandle(NULL), STRING_FOR_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -86,7 +82,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param) /* Check next element is 'IN' */ if ((_tcsnicmp (param, _T("in"), 2) != 0) || !_istspace (*(param + 2))) { - error_syntax (_T("'in' missing in for statement.")); + LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR1, szMsg, RC_STRING_MAX_SIZE); + error_syntax(szMsg); return 1; } @@ -97,7 +94,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param) /* Folowed by a '(', find also matching ')' */ if ((*param != _T('(')) || (NULL == (pp = _tcsrchr (param, _T(')'))))) { - error_syntax (_T("no brackets found.")); + LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR2, szMsg, RC_STRING_MAX_SIZE); + error_syntax(szMsg); return 1; } @@ -110,7 +108,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param) /* Check DO follows */ if ((_tcsnicmp (pp, _T("do"), 2) != 0) || !_istspace (*(pp + 2))) { - error_syntax (_T("'do' missing.")); + LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR3, szMsg, RC_STRING_MAX_SIZE); + error_syntax(szMsg); return 1; } @@ -121,7 +120,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param) /* Check that command tail is not empty */ if (*pp == _T('\0')) { - error_syntax (_T("no command after 'do'.")); + LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR4, szMsg, RC_STRING_MAX_SIZE); + error_syntax(szMsg); return 1; } diff --git a/reactos/subsys/system/cmd/free.c b/reactos/subsys/system/cmd/free.c index 1d346c1d002..44cf613aadc 100644 --- a/reactos/subsys/system/cmd/free.c +++ b/reactos/subsys/system/cmd/free.c @@ -6,9 +6,13 @@ * * 01-Sep-1999 (Eric Kohl) * Started. + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_FREE @@ -54,6 +58,7 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len) static VOID PrintDiskInfo (LPTSTR szDisk) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szRootPath[4] = _T("A:\\"); TCHAR szDrive[2] = _T("A"); TCHAR szVolume[64]; @@ -70,7 +75,8 @@ PrintDiskInfo (LPTSTR szDisk) if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':')) { - ConErrPrintf (_T("Invalid drive %s\n"), szDisk); + LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); return; } @@ -80,12 +86,17 @@ PrintDiskInfo (LPTSTR szDisk) if (!GetVolumeInformation (szRootPath, szVolume, 64, &dwSerial, NULL, NULL, NULL, 0)) { - ConErrPrintf (_T("Invalid drive %s:\n"), szDrive); + LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(_T("%s %s:\n"), szMsg, szDrive); return; } if (szVolume[0] == _T('\0')) - _tcscpy (szVolume, _T("unlabeled")); + { + + LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR2, szMsg, RC_STRING_MAX_SIZE); + _tcscpy (szVolume, szMsg); + } _stprintf (szSerial, _T("%04X-%04X"), @@ -95,7 +106,8 @@ PrintDiskInfo (LPTSTR szDisk) if (!GetDiskFreeSpace (szRootPath, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl)) { - ConErrPrintf (_T("Invalid drive %s:\n"), szDrive); + LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf (_T("%s %s:\n"), szMsg, szDrive); return; } @@ -108,18 +120,15 @@ PrintDiskInfo (LPTSTR szDisk) uliSize.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl; ConvertULargeInteger (uliSize, szFree, 40); - ConOutPrintf (_T("\n" - " Volume in drive %s is %-11s Serial number is %s\n" - " %16s bytes total disk space\n" - " %16s bytes used\n" - " %16s bytes free\n"), - szDrive, szVolume, szSerial, - szTotal, szUsed, szFree); + + LoadString(GetModuleHandle(NULL), STRING_FREE_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, szDrive, szVolume, szSerial, szTotal, szUsed, szFree); } INT CommandFree (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR szParam; TCHAR szDefPath[MAX_PATH]; INT argc, i; @@ -127,9 +136,8 @@ INT CommandFree (LPTSTR cmd, LPTSTR param) if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays drive information.\n" - "\n" - "FREE [drive: ...]")); + LoadString(GetModuleHandle(NULL), STRING_FREE_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/goto.c b/reactos/subsys/system/cmd/goto.c index 76f45597d91..c7ce8cbcf7a 100644 --- a/reactos/subsys/system/cmd/goto.c +++ b/reactos/subsys/system/cmd/goto.c @@ -21,9 +21,13 @@ * * 27-Jan-1999 (Eric Kohl ) * Added help text ("/?"). + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" /* @@ -35,6 +39,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR tmp; LONG lNewPosHigh; @@ -44,13 +49,8 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Directs CMD to a labeled line in a batch script.\n" - "\n" - "GOTO label\n" - "\n" - " label Specifies a text string used in a batch script as a label.\n" - "\n" - "You type a label on a line by itself, beginning with a colon.")); + LoadString(GetModuleHandle(NULL), STRING_GOTO_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -62,7 +62,8 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) if (*param == _T('\0')) { - ExitBatch (_T("No label specified for GOTO\n")); + LoadString(GetModuleHandle(NULL), STRING_GOTO_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ExitBatch(szMsg); return 1; } @@ -94,8 +95,11 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) return 0; } - ConErrPrintf (_T("Label '%s' not found\n"), param); - ExitBatch (NULL); + LoadString(GetModuleHandle(NULL), STRING_GOTO_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, param); + ExitBatch(NULL); return 1; } + +/* EOF */ diff --git a/reactos/subsys/system/cmd/history.c b/reactos/subsys/system/cmd/history.c index 345bb3fb2f6..9b7be8417d4 100644 --- a/reactos/subsys/system/cmd/history.c +++ b/reactos/subsys/system/cmd/history.c @@ -120,7 +120,7 @@ INT CommandHistory (LPTSTR cmd, LPTSTR param) } else { - for(h_tmp=Top->prev;h_tmp!=Bottom;h_tmp=h_tmp->prev) + for (h_tmp = Top->prev; h_tmp != Bottom; h_tmp = h_tmp->prev) ConErrPuts(h_tmp->string); } return 0; @@ -128,11 +128,9 @@ INT CommandHistory (LPTSTR cmd, LPTSTR param) VOID set_size(INT new_size) { - - while(new_sizeprev); - - + max_size=new_size; } @@ -140,19 +138,16 @@ VOID set_size(INT new_size) VOID InitHistory(VOID) { size=0; - - - Top = malloc(sizeof(HIST_ENTRY)); - Bottom = malloc(sizeof(HIST_ENTRY)); + Top = malloc(sizeof(HIST_ENTRY)); + Bottom = malloc(sizeof(HIST_ENTRY)); Top->prev = Bottom; Top->next = NULL; Top->string = NULL; - Bottom->prev = NULL; - Bottom->next = Top; + Bottom->next = Top; Bottom->string = NULL; curr_ptr=Bottom; @@ -163,49 +158,44 @@ VOID InitHistory(VOID) VOID CleanHistory(VOID) { - while (Bottom->next!=Top) del(Bottom->next); free(Top); free(Bottom); - } VOID History_del_current_entry(LPTSTR str) { LPHIST_ENTRY tmp; - - if (size==0) + + if (size == 0) return; - if(curr_ptr==Bottom) + if (curr_ptr == Bottom) curr_ptr=Bottom->next; - if(curr_ptr==Top) + if (curr_ptr == Top) curr_ptr=Top->prev; - tmp=curr_ptr; - curr_ptr=curr_ptr->prev; + tmp = curr_ptr; + curr_ptr = curr_ptr->prev; del(tmp); - History(-1,str); - + History(-1, str); } static VOID del(LPHIST_ENTRY item) { - - if( item==NULL || item==Top || item==Bottom ) + if (item==NULL || item==Top || item==Bottom) { #ifdef _DEBUG DebugPrintf(_T("del in " __FILE__ ": retrning\n" "item is 0x%08x (Bottom is0x%08x)\n"), - item, Bottom); - + item, Bottom); #endif return; } @@ -215,10 +205,6 @@ VOID del(LPHIST_ENTRY item) /*free string's mem*/ if (item->string) free(item->string); - - - - /*set links in prev and next item*/ item->next->prev=item->prev; @@ -227,17 +213,15 @@ VOID del(LPHIST_ENTRY item) free(item); size--; - } + #if 0 static VOID add_before_last(LPTSTR string) -{ - +{ LPHIST_ENTRY tmp,before,after; - /*delete first entry if maximum number of entries is reached*/ while(size>=max_size) del(Top->prev); @@ -248,14 +232,11 @@ VOID add_before_last(LPTSTR string) if (*string==_T('\0')) return; - - /*allocte entry and string*/ tmp=malloc(sizeof(HIST_ENTRY)); tmp->string=malloc((_tcslen(string)+1)*sizeof(TCHAR)); - _tcscpy(tmp->string,string); - - + _tcscpy(tmp->string,string); + /*set links*/ before=Bottom->next; after=before->next; @@ -266,12 +247,6 @@ VOID add_before_last(LPTSTR string) after->prev=tmp; before->next=tmp; - - - - - - /*set new size*/ size++; diff --git a/reactos/subsys/system/cmd/if.c b/reactos/subsys/system/cmd/if.c index 1032827c58d..b0a235b15ee 100644 --- a/reactos/subsys/system/cmd/if.c +++ b/reactos/subsys/system/cmd/if.c @@ -24,9 +24,14 @@ * * 17-Feb-2001 (ea) * IF DEFINED variable command + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc + * */ #include "precomp.h" +#include "resource.h" #define X_EXEC 1 @@ -34,6 +39,7 @@ INT cmd_if (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; INT x_flag = 0; /* when set cause 'then' clause to be executed */ LPTSTR pp; @@ -43,23 +49,8 @@ INT cmd_if (LPTSTR cmd, LPTSTR param) if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Performs conditional processing in batch programs.\n" - "\n" - " IF [NOT] ERRORLEVEL number command\n" - " IF [NOT] string1==string2 command\n" - " IF [NOT] EXIST filename command\n" - " IF [NOT] DEFINED variable command\n" - "\n" - "NOT Specifies that CMD should carry out the command only if\n" - " the condition is false\n" - "ERRORLEVEL number Specifies a true condition if the last program run returned\n" - " an exit code equal or greater than the number specified.\n" - "command Specifies the command to carry out if the condition is met.\n" - "string1==string2 Specifies a true condition if the specified text strings\n" - " match.\n" - "EXIST filename Specifies a true condition if the specified filename exists.\n" - "DEFINED variable Specifies a true condition if the specified variable is\n" - " defined.")); + LoadString(GetModuleHandle(NULL), STRING_IF_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -99,10 +90,9 @@ INT cmd_if (LPTSTR cmd, LPTSTR param) else return 0; } - - /* Check for 'defined' form */ else if (!_tcsnicmp (param, _T("defined"), 7) && _istspace (*(param + 7))) { + /* Check for 'defined' form */ TCHAR Value [1]; INT ValueSize = 0; @@ -130,10 +120,9 @@ INT cmd_if (LPTSTR cmd, LPTSTR param) else return 0; } - - /* Check for 'errorlevel' form */ else if (!_tcsnicmp (param, _T("errorlevel"), 10) && _istspace (*(param + 10))) { + /* Check for 'errorlevel' form */ INT n = 0; pp = param + 10; @@ -147,14 +136,12 @@ INT cmd_if (LPTSTR cmd, LPTSTR param) x_flag |= X_EMPTY; /* Syntax error if comd empty */ } - - /* Check that '==' is present, syntax error if not */ else if (NULL == (pp = _tcsstr (param, _T("==")))) { + /* Check that '==' is present, syntax error if not */ error_syntax (NULL); return 1; } - else { /* Change first '='to space to terminate comparison loop */ @@ -202,3 +189,5 @@ INT cmd_if (LPTSTR cmd, LPTSTR param) return 0; } + +/* EOF */ diff --git a/reactos/subsys/system/cmd/internal.c b/reactos/subsys/system/cmd/internal.c index 9d3bafe1e3e..9aa3b9da7f2 100644 --- a/reactos/subsys/system/cmd/internal.c +++ b/reactos/subsys/system/cmd/internal.c @@ -154,19 +154,19 @@ VOID FreeLastPath (VOID) */ INT cmd_chdir (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR dir; /* pointer to the directory to change to */ LPTSTR lpOldPath; LPTSTR endofstring; /* pointer to the null character in the directory to change to */ LPTSTR lastquote; /* pointer to the last quotation mark in the directory to change to */ - WCHAR szMsg[RC_STRING_MAX_SIZE]; /*Should we better declare a variable containing _tsclen(dir) ? It's used a few times, but on the other hand paths are generally not very long*/ if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString( GetModuleHandle(NULL), STRING_CD_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + { + LoadString(GetModuleHandle(NULL), STRING_CD_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -190,10 +190,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param) TCHAR szPath[MAX_PATH]; GetCurrentDirectory (MAX_PATH, szPath); - ConOutPuts (szPath); - - return 0; } @@ -275,17 +272,16 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param) */ INT cmd_mkdir (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR dir; /* pointer to the directory to change to */ LPTSTR place; /* used to search for the \ when no space is used */ LPTSTR *p = NULL; INT argc; - WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_MKDIR_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); - + LoadString(GetModuleHandle(NULL), STRING_MKDIR_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -321,7 +317,7 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param) if (!dir) { LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); + ConErrPrintf (szMsg); return 1; } @@ -351,21 +347,17 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param) */ INT cmd_rmdir (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR dir; /* pointer to the directory to change to */ LPTSTR place; /* used to search for the \ when no space is used */ LPTSTR *p = NULL; INT argc; - - WCHAR szMsg[RC_STRING_MAX_SIZE]; - if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_RMDIR_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - - ConOutPuts (_T((LPTSTR)szMsg)); - + LoadString(GetModuleHandle(NULL), STRING_RMDIR_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -399,9 +391,8 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param) if (!dir) { - LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); - ConErrPrintf (_T((LPTSTR)szMsg)); - + LoadString(GetModuleHandle(NULL), STRING_PARAM_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); return 1; } @@ -430,12 +421,12 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param) */ INT CommandExit (LPTSTR cmd, LPTSTR param) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_EXIT_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_EXIT_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -451,12 +442,12 @@ INT CommandExit (LPTSTR cmd, LPTSTR param) */ INT CommandRem (LPTSTR cmd, LPTSTR param) { - WCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - LoadString( GetModuleHandle(NULL), STRING_REM_HELP, (LPTSTR) szMsg,sizeof(szMsg)); - ConOutPuts (_T((LPTSTR)szMsg)); + LoadString(GetModuleHandle(NULL), STRING_REM_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); } return 0; diff --git a/reactos/subsys/system/cmd/label.c b/reactos/subsys/system/cmd/label.c index 1a5f7254c45..d71b379888d 100644 --- a/reactos/subsys/system/cmd/label.c +++ b/reactos/subsys/system/cmd/label.c @@ -12,15 +12,20 @@ * * 19-Jan-1998 (Eric Kohl ) * Unicode ready! + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_LABEL INT cmd_label (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szRootPath[] = _T("A:\\"); TCHAR szLabel[80]; TCHAR szOldLabel[80]; @@ -34,8 +39,8 @@ INT cmd_label (LPTSTR cmd, LPTSTR param) /* print help */ if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays or changes drive label.\n\n" - "LABEL [drive:][label]")); + LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); return 0; } @@ -82,32 +87,40 @@ INT cmd_label (LPTSTR cmd, LPTSTR param) return 1; } - GetVolumeInformation (szRootPath, szOldLabel, 80, &dwSerialNr, - NULL, NULL, NULL, 0); - - /* print drive info */ - ConOutPrintf (_T("Volume in drive %c:"), _totupper (szRootPath[0])); + GetVolumeInformation(szRootPath, szOldLabel, 80, &dwSerialNr, + NULL, NULL, NULL, 0); + /* print drive info */ if (szOldLabel[0] != _T('\0')) - ConOutPrintf (_T(" is %s\n"), szOldLabel); + { + LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, _totupper(szRootPath[0]), szOldLabel); + } else - ConOutPrintf (_T(" has no label\n")); + { + LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, _totupper(szRootPath[0])); + } /* print the volume serial number */ - ConOutPrintf (_T("Volume Serial Number is %04X-%04X\n"), - HIWORD(dwSerialNr), LOWORD(dwSerialNr)); + LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr)); if (szLabel[0] == _T('\0')) { - ConOutPrintf (_T("Drive label (11 Characters, ENTER if none)? ")); - ConInString (szLabel, 80); + LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP5, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); + + ConInString(szLabel, 80); } - SetVolumeLabel (szRootPath, szLabel); + SetVolumeLabel(szRootPath, szLabel); - freep (arg); + freep(arg); return 0; } #endif /* INCLUDE_CMD_LABEL */ + +/* EOF */ diff --git a/reactos/subsys/system/cmd/locale.c b/reactos/subsys/system/cmd/locale.c index e72f05204dd..3182b20f8b4 100644 --- a/reactos/subsys/system/cmd/locale.c +++ b/reactos/subsys/system/cmd/locale.c @@ -12,6 +12,7 @@ */ #include "precomp.h" +#include "resource.h" TCHAR cDateSeparator; @@ -20,158 +21,59 @@ TCHAR cThousandSeparator; TCHAR cDecimalSeparator; INT nDateFormat; INT nTimeFormat; -TCHAR aszDayNames[7][8]; INT nNumberGroups; VOID InitLocale (VOID) { -#ifdef LOCALE_WINDOWS TCHAR szBuffer[256]; - INT i; /* date settings */ - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDATE, szBuffer, 256); - CharToOem (szBuffer, szBuffer); + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDATE, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])); cDateSeparator = szBuffer[0]; - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDATE, szBuffer, 256); - nDateFormat = _ttoi (szBuffer); + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDATE | LOCALE_RETURN_NUMBER, (LPTSTR)&nDateFormat, sizeof(nDateFormat) / sizeof(TCHAR)); /* time settings */ - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STIME, szBuffer, 256); - CharToOem (szBuffer, szBuffer); + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STIME, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])); cTimeSeparator = szBuffer[0]; - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ITIME, szBuffer, 256); - nTimeFormat = _ttoi (szBuffer); + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ITIME | LOCALE_RETURN_NUMBER, (LPTSTR)&nTimeFormat, sizeof(nTimeFormat) / sizeof(TCHAR)); /* number settings */ - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szBuffer, 256); - CharToOem (szBuffer, szBuffer); + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])); cThousandSeparator = szBuffer[0]; - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szBuffer, 256); - CharToOem (szBuffer, szBuffer); + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])); cDecimalSeparator = szBuffer[0]; - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, 256); - nNumberGroups = _ttoi (szBuffer); - + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])); + nNumberGroups = _ttoi(szBuffer); +#if 0 /* days of week */ for (i = 0; i < 7; i++) { - GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, szBuffer, 256); - CharToOem (szBuffer, szBuffer); + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])); _tcscpy (aszDayNames[(i+1)%7], szBuffer); /* little hack */ } #endif - -#ifdef LOCALE_GERMAN - LPTSTR names [7] = {_T("So"), _T("Mo"), _T("Di"), _T("Mi"), _T("Do"), _T("Fr"), _T("Sa")}; - INT i; - - /* date settings */ - cDateSeparator = '.'; - nDateFormat = 1; /* ddmmyy */ - - /* time settings */ - cTimeSeparator = ':'; - nTimeFormat = 1; /* 24 hour */ - - /* number settings */ - cThousandSeparator = '.'; - cDecimalSeparator = ','; - nNumberGroups = 3; - - /* days of week */ - for (i = 0; i < 7; i++) - _tcscpy (aszDayNames[i], names[i]); -#endif - -#ifdef LOCALE_DEFAULT - LPTSTR names [7] = {_T("Sun"), _T("Mon"), _T("Tue"), _T("Wed"), _T("Thu"), _T("Fri"), _T("Sat")}; - INT i; - - /* date settings */ - cDateSeparator = '-'; - nDateFormat = 0; /* mmddyy */ - - /* time settings */ - cTimeSeparator = ':'; - nTimeFormat = 0; /* 12 hour */ - - /* number settings */ - cThousandSeparator = ','; - cDecimalSeparator = '.'; - nNumberGroups = 3; - - /* days of week */ - for (i = 0; i < 7; i++) - _tcscpy (aszDayNames[i], names[i]); -#endif } VOID PrintDate (VOID) { -#ifdef __REACTOS__ - SYSTEMTIME st; - - GetLocalTime (&st); - - switch (nDateFormat) - { - case 0: /* mmddyy */ - default: - ConOutPrintf (_T("%s %02d%c%02d%c%04d"), - aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear); - break; - - case 1: /* ddmmyy */ - ConOutPrintf (_T("%s %02d%c%02d%c%04d"), - aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear); - break; - - case 2: /* yymmdd */ - ConOutPrintf (_T("%s %04d%c%02d%c%02d"), - aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay); - break; - } -#else TCHAR szDate[32]; - GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, - szDate, sizeof (szDate)); - ConOutPrintf (_T("%s"), szDate); -#endif + GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, + szDate, sizeof (szDate)); + ConOutPrintf(_T("%s"), szDate); } VOID PrintTime (VOID) { -#ifdef __REACTOS__ - SYSTEMTIME st; + TCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szTime[32]; - GetLocalTime (&st); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL, + szTime, sizeof(szTime)); - switch (nTimeFormat) - { - case 0: /* 12 hour format */ - default: - ConOutPrintf (_T("Current time is %2d%c%02d%c%02d%c%02d%c\n"), - (st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)), - cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator, - st.wMilliseconds / 10, (st.wHour <= 11 ? 'a' : 'p')); - break; - - case 1: /* 24 hour format */ - ConOutPrintf (_T("Current time is %2d%c%02d%c%02d%c%02d\n"), - st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator, - st.wSecond, cDecimalSeparator, st.wMilliseconds / 10); - break; - } -#else - TCHAR szTime[32]; - - GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL, - szTime, sizeof (szTime)); - ConOutPrintf (_T("Current time is: %s\n"), szTime); -#endif + LoadString(GetModuleHandle(NULL), STRING_LOCALE_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(_T("%s: %s\n"), szMsg, szTime); } diff --git a/reactos/subsys/system/cmd/makefile b/reactos/subsys/system/cmd/makefile index 3b9cf42b398..41075aa5229 100644 --- a/reactos/subsys/system/cmd/makefile +++ b/reactos/subsys/system/cmd/makefile @@ -18,7 +18,7 @@ TARGET_PCH = precomp.h TARGET_INSTALLDIR = system32 TARGET_CFLAGS = -D__USE_W32API -DANONYMOUSUNIONS -Wall -Werror \ - -I$(PATH_TO_TOP)/include/wine -D_WIN32_WINNT=0x0501 + -I$(PATH_TO_TOP)/include/wine -D_WIN32_WINNT=0x0501 -DUNICODE -D_UNICODE TARGET_OBJECTS = \ cmd.o attrib.o alias.o batch.o beep.o call.o chcp.o choice.o \ diff --git a/reactos/subsys/system/cmd/memory.c b/reactos/subsys/system/cmd/memory.c index a7da82b06c4..de821a05222 100644 --- a/reactos/subsys/system/cmd/memory.c +++ b/reactos/subsys/system/cmd/memory.c @@ -6,9 +6,13 @@ * * 01-Sep-1999 (Eric Kohl) * Started. + * + * 28-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_MEMORY @@ -52,6 +56,7 @@ ConvertDWord (DWORD num, LPTSTR des, INT len, BOOL bSeparator) INT CommandMemory (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; MEMORYSTATUS ms; TCHAR szMemoryLoad[20]; TCHAR szTotalPhys[20]; @@ -63,9 +68,8 @@ INT CommandMemory (LPTSTR cmd, LPTSTR param) if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays the amount of system memory.\n" - "\n" - "MEMORY")); + LoadString(GetModuleHandle(NULL), STRING_MEMMORY_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -81,19 +85,10 @@ INT CommandMemory (LPTSTR cmd, LPTSTR param) ConvertDWord (ms.dwTotalVirtual, szTotalVirtual, 20, TRUE); ConvertDWord (ms.dwAvailVirtual, szAvailVirtual, 20, TRUE); - ConOutPrintf (_T("\n" - " %12s%% memory load.\n" - "\n" - " %13s bytes total physical RAM.\n" - " %13s bytes available physical RAM.\n" - "\n" - " %13s bytes total page file.\n" - " %13s bytes available page file.\n" - "\n" - " %13s bytes total virtual memory.\n" - " %13s bytes available virtual memory.\n"), - szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile, - szAvailPageFile, szTotalVirtual, szAvailVirtual); + LoadString(GetModuleHandle(NULL), STRING_MEMMORY_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, + szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile, + szAvailPageFile, szTotalVirtual, szAvailVirtual); return 0; } diff --git a/reactos/subsys/system/cmd/misc.c b/reactos/subsys/system/cmd/misc.c index 36fca266977..161dc4a6ed6 100644 --- a/reactos/subsys/system/cmd/misc.c +++ b/reactos/subsys/system/cmd/misc.c @@ -27,9 +27,13 @@ * * 06-Nov-1999 (Eric Kohl ) * Added PagePrompt() and FilePrompt(). + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" /* @@ -383,7 +387,7 @@ BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength) ReadFile (hFile, &ch, 1, &dwRead, NULL); break; } - lpString[len++] = ch; + lpString[len++] = ch; } if (!dwRead && !len) @@ -433,9 +437,11 @@ HWND GetConsoleWindow (VOID) INT PagePrompt (VOID) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; INPUT_RECORD ir; - ConOutPrintf (_T("Press a key to continue...\n")); + LoadString(GetModuleHandle(NULL), STRING_MISC_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); RemoveBreakHandler (); ConInDisable (); @@ -462,31 +468,34 @@ INT PagePrompt (VOID) INT FilePromptYN (LPTSTR szFormat, ...) { - TCHAR szOut[512]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szOut[512]; va_list arg_ptr; -// TCHAR cKey = 0; -// LPTSTR szKeys = _T("yna"); +// TCHAR cKey = 0; +// LPTSTR szKeys = _T("yna"); - TCHAR szIn[10]; + TCHAR szIn[10]; LPTSTR p; va_start (arg_ptr, szFormat); _vstprintf (szOut, szFormat, arg_ptr); va_end (arg_ptr); - ConOutPrintf (szFormat); + ConOutPrintf (szFormat); -/* preliminary fix */ - ConInString (szIn, 10); - ConOutPrintf (_T("\n")); + /* preliminary fix */ + ConInString (szIn, 10); + ConOutPrintf (_T("\n")); - _tcsupr (szIn); - for (p = szIn; _istspace (*p); p++) + _tcsupr (szIn); + for (p = szIn; _istspace (*p); p++) ; - if (*p == _T('Y')) + LoadString(GetModuleHandle(NULL), STRING_CHOICE_OPTION, szMsg, RC_STRING_MAX_SIZE); + + if (_tcsncmp(p, &szMsg[0], 1) == 0) return PROMPT_YES; - else if (*p == _T('N')) + else if (_tcsncmp(p, &szMsg[1], 1) == 0) return PROMPT_NO; #if 0 else if (*p == _T('\03')) @@ -496,7 +505,7 @@ INT FilePromptYN (LPTSTR szFormat, ...) return PROMPT_NO; -/* unfinished sollution */ + /* unfinished sollution */ #if 0 RemoveBreakHandler (); ConInDisable (); @@ -504,9 +513,9 @@ INT FilePromptYN (LPTSTR szFormat, ...) do { ConInKey (&ir); - cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar); - if (_tcschr (szKeys, cKey[0]) == NULL) - cKey = 0; + cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar); + if (_tcschr (szKeys, cKey[0]) == NULL) + cKey = 0; } @@ -529,34 +538,38 @@ INT FilePromptYN (LPTSTR szFormat, ...) INT FilePromptYNA (LPTSTR szFormat, ...) { - TCHAR szOut[512]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; + TCHAR szOut[512]; va_list arg_ptr; -// TCHAR cKey = 0; -// LPTSTR szKeys = _T("yna"); +// TCHAR cKey = 0; +// LPTSTR szKeys = _T("yna"); - TCHAR szIn[10]; + TCHAR szIn[10]; LPTSTR p; va_start (arg_ptr, szFormat); _vstprintf (szOut, szFormat, arg_ptr); va_end (arg_ptr); - ConOutPrintf (szFormat); + ConOutPrintf (szFormat); -/* preliminary fix */ - ConInString (szIn, 10); - ConOutPrintf (_T("\n")); + /* preliminary fix */ + ConInString (szIn, 10); + ConOutPrintf (_T("\n")); - _tcsupr (szIn); - for (p = szIn; _istspace (*p); p++) + _tcsupr (szIn); + for (p = szIn; _istspace (*p); p++) ; - if (*p == _T('Y')) + LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, szMsg, RC_STRING_MAX_SIZE); + + if (_tcsncmp(p, &szMsg[0], 1) == 0) return PROMPT_YES; - else if (*p == _T('N')) + else if (_tcsncmp(p, &szMsg[1], 1) == 0) return PROMPT_NO; - if (*p == _T('A')) + else if (_tcsncmp(p, &szMsg[2], 1) == 0) return PROMPT_ALL; + #if 0 else if (*p == _T('\03')) return PROMPT_BREAK; @@ -573,11 +586,9 @@ INT FilePromptYNA (LPTSTR szFormat, ...) do { ConInKey (&ir); - cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar); - if (_tcschr (szKeys, cKey[0]) == NULL) - cKey = 0; - - + cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar); + if (_tcschr (szKeys, cKey[0]) == NULL) + cKey = 0; } while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) || (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) || diff --git a/reactos/subsys/system/cmd/move.c b/reactos/subsys/system/cmd/move.c index 926194e13d5..9ad3684a705 100644 --- a/reactos/subsys/system/cmd/move.c +++ b/reactos/subsys/system/cmd/move.c @@ -20,9 +20,13 @@ * * 03-Feb-1999 (Eric Kohl ) * Added "/N" option. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_MOVE @@ -35,19 +39,21 @@ static INT Overwrite (LPTSTR fn) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR inp[10]; LPTSTR p; - ConOutPrintf (_T("Overwrite %s (Yes/No/All)? "), fn); - ConInString (inp, 10); + LoadString(GetModuleHandle(NULL), STRING_MOVE_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, fn); + ConInString(inp, 10); _tcsupr (inp); - for (p=inp; _istspace (*p); p++) + for (p = inp; _istspace(*p); p++) ; - if (*p != _T('Y') && *p != _T('A')) + if (*p != szMsg[0] && *p != szMsg[2]) return OVERWRITE_NO; - if (*p == _T('A')) + if (*p == szMsg[2]) return OVERWRITE_ALL; return OVERWRITE_YES; @@ -57,6 +63,7 @@ static INT Overwrite (LPTSTR fn) INT cmd_move (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR *arg; INT argc, i, nFiles; TCHAR szDestPath[MAX_PATH]; @@ -66,7 +73,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) WIN32_FIND_DATA findBuffer; HANDLE hFile; LPTSTR pszFile; - BOOL bNothing = FALSE; + BOOL bNothing = FALSE; if (!_tcsncmp (param, _T("/?"), 2)) { @@ -85,20 +92,8 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) " /-Y\n" "...")); #else - ConOutPuts (_T("Moves files and renames files and directories.\n\n" - "To move one or more files:\n" - "MOVE [/N][drive:][path]filename1[,...] destination\n" - "\n" - "To rename a directory:\n" - "MOVE [/N][drive:][path]dirname1 dirname2\n" - "\n" - " [drive:][path]filename1 Specifies the location and name of the file\n" - " or files you want to move.\n" - " /N Nothing. Don everthing but move files or direcories.\n" - "\n" - "Current limitations:\n" - " - You can't move a file or directory from one drive to another.\n" - )); + LoadString(GetModuleHandle(NULL), STRING_MOVE_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #endif return 0; } @@ -124,7 +119,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) { if (_totupper (*p) == _T('Y')) bPrompt = FALSE; - else if (_totupper (*p) == _T('N')) + else if (_totupper (*p) == _T('N')) bNothing = TRUE; } nFiles--; @@ -197,9 +192,10 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) if (!bNothing) { if (MoveFile (szSrcPath, szFullDestPath)) - ConOutPrintf (_T("[OK]\n")); + LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE); else - ConOutPrintf (_T("[Error]\n")); + LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); } } else @@ -219,9 +215,10 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) if (!bNothing) { if (MoveFile (szSrcPath, szDestPath)) - ConOutPrintf (_T("[OK]\n")); + LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE); else - ConOutPrintf (_T("[Error]\n")); + LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); } } } @@ -238,9 +235,10 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) if (!bNothing) { if (MoveFile (szSrcPath, szFullDestPath)) - ConOutPrintf (_T("[OK]\n")); + LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE); else - ConOutPrintf (_T("[Error]\n")); + LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); } } } diff --git a/reactos/subsys/system/cmd/msgbox.c b/reactos/subsys/system/cmd/msgbox.c index ccf4555ca22..fd9cc65f450 100644 --- a/reactos/subsys/system/cmd/msgbox.c +++ b/reactos/subsys/system/cmd/msgbox.c @@ -5,9 +5,13 @@ * * 25 Aug 1999 * started - Paolo Pantaleo + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_MSGBOX @@ -21,6 +25,8 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + //used to parse command line LPTSTR tmp; @@ -30,31 +36,17 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) TCHAR buff[128]; //these are MessabeBox() parameters - LPTSTR title, prompt=""; - UINT uType=U_TYPE_INIT; + LPTSTR title, prompt = ""; + UINT uType = U_TYPE_INIT; - //set default title to window title - GetConsoleTitle(buff,128); + /* set default title to window title */ + GetConsoleTitle(buff, 128); title = buff; if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts(_T( - "display a message box and return user responce\n" - "\n" - "MSGBOX type [\"title\"] prompt\n" - "\n" - "type button displayed\n" - " possible values are: OK, OKCANCEL,\n" - " YESNO, YESNOCANCEL\n" - "title title of message box\n" - "prompt text displayed by the message box\n" - "\n" - "\n" - "ERRORLEVEL is set according the button pressed:\n" - "\n" - "YES : 10 | NO : 11\n" - "OK : 10 | CANCEL : 12\n")); + LoadString(GetModuleHandle(NULL), STRING_MSGBOX_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -65,27 +57,28 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) param++; //search for type of messagebox (ok, okcancel, ...) - if (_tcsnicmp(param, _T("ok "),3 ) == 0) - { + if (_tcsnicmp(param, _T("ok "), 3) == 0) + { uType |= MB_ICONEXCLAMATION | MB_OK; - param+=3; + param += 3; } - else if (_tcsnicmp(param, _T("okcancel "),9 ) == 0) + else if (_tcsnicmp(param, _T("okcancel "), 9) == 0) { uType |= MB_ICONQUESTION | MB_OKCANCEL; - param+=9; + param += 9; } - else if (_tcsnicmp(param, _T("yesno "),6 ) == 0) + else if (_tcsnicmp(param, _T("yesno "), 6) == 0) { uType |= MB_ICONQUESTION | MB_YESNO; - param+=6; + param += 6; } - else if (_tcsnicmp(param, _T("yesnocancel "), 12 ) == 0) + else if (_tcsnicmp(param, _T("yesnocancel "), 12) == 0) { uType |= MB_ICONQUESTION | MB_YESNOCANCEL; - param+=12; + param += 12; } - else{ + else + { #ifdef _SYNTAX_CHECK error_req_param_missing (); return 1; @@ -102,7 +95,7 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) #ifdef _SYNTAX_CHECK //if reached end of string //it is an error becuase we do not yet have prompt - if ( *param == 0) + if (*param == 0) { error_req_param_missing (); return 1; @@ -112,24 +105,25 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) //search for "title" tmp = param; - if(*param == '"') + if (*param == '"') { - tmp = _tcschr(param+1,'"'); + tmp = _tcschr(param + 1, '"'); if (tmp) { *tmp = 0; - title = param+1; - tmp++; - param = tmp; + title = param + 1; + tmp++; + param = tmp; } } //skip spaces while(_istspace(*param)) param++; + #ifdef _SYNTAX_CHECK //get prompt - if ( *param == 0) + if (*param == 0) { error_req_param_missing (); return 1; @@ -139,28 +133,28 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) prompt = param; hWnd=GetConsoleWindow (); -// DebugPrintf("FindWindow hWnd = %d\n",hWnd); - ConErrPrintf("FindWindow hWnd = %d\n",hWnd); +// DebugPrintf("FindWindow hWnd = %d\n",hWnd); +// ConErrPrintf("FindWindow hWnd = %d\n",hWnd); - switch ( - MessageBox(hWnd,prompt,title,uType) - ) + switch (MessageBox(hWnd, prompt, title, uType)) { - case IDYES: - case IDOK: - nErrorLevel = 10; - break; + case IDYES: + case IDOK: + nErrorLevel = 10; + break; - case IDNO: - nErrorLevel = 11; - break; + case IDNO: + nErrorLevel = 11; + break; - case IDCANCEL: - nErrorLevel = 12; - break; + case IDCANCEL: + nErrorLevel = 12; + break; } return 0; } #endif /* INCLUDE_CMD_MSGBOX */ + +/* EOF */ diff --git a/reactos/subsys/system/cmd/path.c b/reactos/subsys/system/cmd/path.c index 4f11d522754..d737bf880e3 100644 --- a/reactos/subsys/system/cmd/path.c +++ b/reactos/subsys/system/cmd/path.c @@ -21,8 +21,12 @@ * * 24-Jan-1999 (Eric Kohl ) * Fixed Win32 environment handling. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_PATH @@ -32,13 +36,12 @@ INT cmd_path (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays or sets a search path for executable files.\n\n" - "PATH [[drive:]path[;...]]\nPATH ;\n\n" - "Type PATH ; to clear all search-path settings and direct the command shell\n" - "to search only in the current directory.\n" - "Type PATH without parameters to display the current path.\n")); + LoadString(GetModuleHandle(NULL), STRING_PATH_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -52,7 +55,8 @@ INT cmd_path (LPTSTR cmd, LPTSTR param) dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE); if (dwBuffer == 0) { - ConErrPrintf (_T("CMD: Not in environment \"PATH\"\n")); + LoadString(GetModuleHandle(NULL), STRING_PATH_ERROR, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg); return 0; } else if (dwBuffer > ENV_BUFFER_SIZE) @@ -79,3 +83,5 @@ INT cmd_path (LPTSTR cmd, LPTSTR param) } #endif + +/* EOF */ diff --git a/reactos/subsys/system/cmd/pause.c b/reactos/subsys/system/cmd/pause.c index c12362f268c..faa3d6789b1 100644 --- a/reactos/subsys/system/cmd/pause.c +++ b/reactos/subsys/system/cmd/pause.c @@ -18,6 +18,7 @@ */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_PAUSE @@ -29,19 +30,23 @@ * * ?? Extend to include functionality of CHOICE if switch chars * specified. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ INT cmd_pause (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + #ifdef _DEBUG DebugPrintf (_T("cmd_pause: \'%s\' : \'%s\')\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Stops the execution of a batch file and shows the following message:\n" - "\"Press any key to continue...\" or a user defined message.\n\n" - "PAUSE [message]")); + LoadString(GetModuleHandle(NULL), STRING_PAUSE_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -56,3 +61,5 @@ INT cmd_pause (LPTSTR cmd, LPTSTR param) } #endif + +/* EOF */ diff --git a/reactos/subsys/system/cmd/prompt.c b/reactos/subsys/system/cmd/prompt.c index 007cccff2c5..2d6e2b5789b 100644 --- a/reactos/subsys/system/cmd/prompt.c +++ b/reactos/subsys/system/cmd/prompt.c @@ -42,12 +42,15 @@ * * 24-Jan-1999 (Eric Kohl ) * Fixed Win32 environment handling. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" /* * print the command-line prompt - * */ VOID PrintPrompt(VOID) { @@ -178,32 +181,19 @@ VOID PrintPrompt(VOID) INT cmd_prompt (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Changes the command prompt.\n\n" - "PROMPT [text]\n\n" - " text Specifies a new command prompt.\n\n" - "Prompt can be made up of normal characters and the following special codes:\n\n" - " $A & (Ampersand)\n" - " $B | (pipe)\n" - " $C ( (Left parenthesis)\n" - " $D Current date\n" - " $E Escape code (ASCII code 27)\n" - " $F ) (Right parenthesis)\n" - " $G > (greater-than sign)\n" - " $H Backspace (erases previous character)\n" - " $L < (less-than sign)\n" - " $N Current drive\n" - " $P Current drive and path\n" - " $Q = (equal sign)\n" - " $T Current time\n" - " $V OS version number\n" - " $_ Carriage return and linefeed\n" - " $$ $ (dollar sign)")); + LoadString(GetModuleHandle(NULL), STRING_PROMPT_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); + #ifdef FEATURE_DIRECTORY_STACK - ConOutPuts (_T(" $+ Displays the current depth of the directory stack")); + LoadString(GetModuleHandle(NULL), STRING_PROMPT_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); #endif - ConOutPuts (_T("\nType PROMPT without parameters to reset the prompt to the default setting.")); + LoadString(GetModuleHandle(NULL), STRING_PROMPT_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -214,3 +204,5 @@ INT cmd_prompt (LPTSTR cmd, LPTSTR param) return 0; } #endif + +/* EOF */ diff --git a/reactos/subsys/system/cmd/ren.c b/reactos/subsys/system/cmd/ren.c index 344cbd5f162..848f5a90e47 100644 --- a/reactos/subsys/system/cmd/ren.c +++ b/reactos/subsys/system/cmd/ren.c @@ -15,9 +15,13 @@ * * 17-Oct-2001 (Eric Kohl * Implemented basic rename code. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_RENAME @@ -39,6 +43,7 @@ enum */ INT cmd_rename (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR *arg = NULL; INT args = 0; INT nEvalArgs = 0; /* nunber of evaluated arguments */ @@ -56,24 +61,11 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) WIN32_FIND_DATA f; if (!_tcsncmp(param, _T("/?"), 2)) - { - ConOutPuts(_T("Renames a file/directory or files/directories.\n" - "\n" - "RENAME [/E /N /P /Q /S /T] old_name ... new_name\n" - "REN [/E /N /P /Q /S /T] old_name ... new_name\n" - "\n" - " /E No eror messages.\n" - " /N Nothing.\n" - " /P Prompts for confirmation before renaming each file.\n" - " (Not implemented yet!)\n" - " /Q Quiet.\n" - " /S Rename subdirectories.\n" - " /T Display total number of renamed files.\n" - "\n" - "Note that you cannot specify a new drive or path for your destination. Use\n" - "the MOVE command for that purpose.")); - return(0); - } + { + LoadString(GetModuleHandle(NULL), STRING_REN_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); + return 0; + } /* split the argument list */ arg = split(param, &args, FALSE); @@ -83,7 +75,7 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) if (!(dwFlags & REN_ERROR)) error_req_param_missing(); freep(arg); - return(1); + return 1; } /* read options */ @@ -134,7 +126,7 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) if (!(dwFlags & REN_ERROR)) error_req_param_missing(); freep(arg); - return(1); + return 1; } /* get destination pattern */ @@ -245,7 +237,10 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) else { if (!(dwFlags & REN_ERROR)) - ConErrPrintf(_T("MoveFile() failed. Error: %lu\n"), GetLastError()); + { + LoadString(GetModuleHandle(NULL), STRING_REN_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, GetLastError()); + } } } } @@ -254,18 +249,17 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) } if (!(dwFlags & REN_QUIET)) - { - if (dwFiles == 1) - ConOutPrintf(_T(" %lu file renamed\n"), - dwFiles); - else - ConOutPrintf(_T(" %lu files renamed\n"), - dwFiles); - } + { + if (dwFiles == 1) + LoadString( GetModuleHandle(NULL), STRING_REN_HELP2, szMsg, RC_STRING_MAX_SIZE); + else + LoadString( GetModuleHandle(NULL), STRING_REN_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf((LPTSTR)szMsg,dwFiles); + } freep(arg); - return(0); + return 0; } #endif diff --git a/reactos/subsys/system/cmd/resource.h b/reactos/subsys/system/cmd/resource.h index 5a8814c55f2..820b5d079a4 100644 --- a/reactos/subsys/system/cmd/resource.h +++ b/reactos/subsys/system/cmd/resource.h @@ -1,12 +1,26 @@ #define RC_STRING_MAX_SIZE 2048 + +#define STRING_ERROR_PARAMETERF_ERROR 100 +#define STRING_ERROR_INVALID_SWITCH 101 +#define STRING_ERROR_TOO_MANY_PARAMETERS 102 +#define STRING_ERROR_PATH_NOT_FOUND 103 +#define STRING_ERROR_FILE_NOT_FOUND 104 +#define STRING_ERROR_REQ_PARAM_MISSING 105 +#define STRING_ERROR_INVALID_DRIVE 106 +#define STRING_ERROR_INVALID_PARAM_FORMAT 107 +#define STRING_ERROR_BADCOMMAND 108 +#define STRING_ERROR_OUT_OF_MEMORY 109 +#define STRING_ERROR_CANNOTPIPE 110 +#define STRING_ERROR_D_PAUSEMSG 111 +#define STRING_ERROR_DRIVER_NOT_READY 112 + #define STRING_CHOICE_OPTION 200 #define STRING_COPY_OPTION 201 -#define STRING_DEL_OPTION 202 #define STRING_ALIAS_ERROR 300 #define STRING_BATCH_ERROR 301 -#define STRING_CHCP_ERROR1 302 +#define STRING_CHCP_ERROR1 302 #define STRING_CHCP_ERROR2 303 #define STRING_CHCP_ERROR3 304 #define STRING_CHCP_ERROR4 305 @@ -28,68 +42,168 @@ #define STRING_COPY_ERROR3 321 #define STRING_COPY_ERROR4 322 #define STRING_DATE_ERROR 323 -#define STRING_DEL_ERROR1 324 -#define STRING_DEL_ERROR2 325 -#define STRING_DEL_ERROR3 326 -#define STRING_DEL_ERROR4 327 #define STRING_DEL_ERROR5 328 #define STRING_DEL_ERROR6 329 #define STRING_DEL_ERROR7 330 -#define STRING_DEL_ERROR8 331 -#define STRING_PARAM_ERROR 332 - -#define STRING_ATTRIB_HELP 400 -#define STRING_ALIAS_HELP 401 -#define STRING_BEEP_HELP 402 -#define STRING_CALL_HELP 403 -#define STRING_CD_HELP 404 -#define STRING_CHCP_HELP 405 -#define STRING_CHOICE_HELP 406 -#define STRING_CLS_HELP 407 -#define STRING_CMD_HELP1 408 -#define STRING_CMD_HELP2 409 -#define STRING_CMD_HELP3 410 -#define STRING_CMD_HELP4 411 -#define STRING_CMD_HELP5 412 -#define STRING_CMD_HELP6 413 -#define STRING_CMD_HELP7 414 -#define STRING_CMD_HELP8 415 -#define STRING_COLOR_HELP1 416 -#define STRING_COPY_HELP1 417 -#define STRING_COPY_HELP2 418 -#define STRING_DATE_HELP1 419 -#define STRING_DATE_HELP2 420 -#define STRING_DATE_HELP3 421 -#define STRING_DATE_HELP4 422 -#define STRING_DEL_HELP1 423 -#define STRING_DEL_HELP2 424 -#define STRING_DEL_HELP3 425 -#define STRING_DEL_HELP4 426 -#define STRING_DELAY_HELP 427 - -#define STRING_DIR_HELP1 428 -#define STRING_DIR_HELP2 429 -#define STRING_DIR_HELP3 430 -#define STRING_DIR_HELP4 431 -#define STRING_DIR_HELP5 432 -#define STRING_DIR_HELP6 433 -#define STRING_DIR_HELP7 434 -#define STRING_DIR_HELP8 435 - -#define STRING_DIRSTACK_HELP1 436 -#define STRING_DIRSTACK_HELP2 437 -#define STRING_DIRSTACK_HELP3 438 -#define STRING_DIRSTACK_HELP4 439 - -#define STRING_EXIT_HELP 440 -#define STRING_MKDIR_HELP 441 -#define STRING_RMDIR_HELP 442 -#define STRING_REM_HELP 443 +#define STRING_ERROR_ERROR1 332 +#define STRING_ERROR_ERROR2 333 +#define STRING_FOR_ERROR1 334 +#define STRING_FOR_ERROR2 335 +#define STRING_FOR_ERROR3 336 +#define STRING_FOR_ERROR4 337 +#define STRING_FREE_ERROR1 338 +#define STRING_FREE_ERROR2 339 +#define STRING_GOTO_ERROR1 340 +#define STRING_GOTO_ERROR2 341 +#define STRING_MOVE_ERROR1 342 +#define STRING_MOVE_ERROR2 343 +#define STRING_PARAM_ERROR 344 +#define STRING_PATH_ERROR 345 +#define STRING_REN_ERROR1 346 +#define STRING_START_ERROR1 347 +#define STRING_TIME_ERROR1 348 +#define STRING_TYPE_ERROR1 349 +#define STRING_WINDOW_ERROR1 350 - +#define STRING_ATTRIB_HELP 600 +#define STRING_ALIAS_HELP 601 +#define STRING_BEEP_HELP 602 +#define STRING_CALL_HELP 603 +#define STRING_CD_HELP 604 +#define STRING_CHCP_HELP 605 +#define STRING_CHOICE_HELP 606 +#define STRING_CLS_HELP 607 +#define STRING_CMD_HELP1 608 +#define STRING_CMD_HELP2 609 +#define STRING_CMD_HELP3 610 +#define STRING_CMD_HELP4 611 +#define STRING_CMD_HELP5 612 +#define STRING_CMD_HELP6 613 +#define STRING_CMD_HELP7 614 +#define STRING_CMD_HELP8 615 +#define STRING_COLOR_HELP1 616 +#define STRING_COPY_HELP1 617 +#define STRING_COPY_HELP2 618 +#define STRING_DATE_HELP1 619 +#define STRING_DATE_HELP2 620 +#define STRING_DATE_HELP3 621 +#define STRING_DATE_HELP4 622 +#define STRING_DEL_HELP1 623 +#define STRING_DEL_HELP2 624 +#define STRING_DEL_HELP3 625 +#define STRING_DEL_HELP4 626 +#define STRING_DELAY_HELP 627 +#define STRING_DIR_HELP1 628 +#define STRING_DIR_HELP2 629 +#define STRING_DIR_HELP3 630 +#define STRING_DIR_HELP4 631 +#define STRING_DIR_HELP5 632 +#define STRING_DIR_HELP6 633 +#define STRING_DIR_HELP7 634 +#define STRING_DIR_HELP8 635 +#define STRING_DIRSTACK_HELP1 636 +#define STRING_DIRSTACK_HELP2 637 +#define STRING_DIRSTACK_HELP3 638 +#define STRING_DIRSTACK_HELP4 639 +#define STRING_ECHO_HELP1 640 +#define STRING_ECHO_HELP2 641 +#define STRING_ECHO_HELP3 642 +#define STRING_ECHO_HELP4 643 +#define STRING_ECHO_HELP5 644 +#define STRING_EXIT_HELP 645 + +#define STRING_FOR_HELP1 646 + +#define STRING_FREE_HELP1 647 +#define STRING_FREE_HELP2 648 + +#define STRING_IF_HELP1 650 + +#define STRING_GOTO_HELP1 651 + +#define STRING_LABEL_HELP1 652 +#define STRING_LABEL_HELP2 653 +#define STRING_LABEL_HELP3 654 +#define STRING_LABEL_HELP4 655 +#define STRING_LABEL_HELP5 656 + +#define STRING_LOCALE_HELP1 657 + +#define STRING_MKDIR_HELP 658 + +#define STRING_MEMMORY_HELP1 659 +#define STRING_MEMMORY_HELP2 660 + +#define STRING_MISC_HELP1 661 + +#define STRING_MOVE_HELP1 662 +#define STRING_MOVE_HELP2 663 + +#define STRING_MSGBOX_HELP 664 + +#define STRING_PATH_HELP1 665 + +#define STRING_PAUSE_HELP1 666 + +#define STRING_PROMPT_HELP1 667 +#define STRING_PROMPT_HELP2 668 +#define STRING_PROMPT_HELP3 669 + +#define STRING_REM_HELP 670 + +#define STRING_REN_HELP1 671 +#define STRING_REN_HELP2 672 +#define STRING_REN_HELP3 673 + +#define STRING_RMDIR_HELP 672 + +#define STRING_SCREEN_HELP 673 + +#define STRING_SHIFT_HELP 674 + +#define STRING_SET_HELP 675 + +#define STRING_START_HELP1 676 + +#define STRING_TITLE_HELP 677 + +#define STRING_TIME_HELP1 678 +#define STRING_TIME_HELP2 679 + +#define STRING_TIMER_HELP1 680 +#define STRING_TIMER_HELP2 681 +#define STRING_TIMER_HELP3 682 + +#define STRING_TYPE_HELP1 683 + +#define STRING_VERIFY_HELP1 684 +#define STRING_VERIFY_HELP2 685 +#define STRING_VERIFY_HELP3 686 + +#define STRING_VERSION_HELP1 687 +#define STRING_VERSION_HELP2 688 +#define STRING_VERSION_HELP3 689 +#define STRING_VERSION_HELP4 690 +#define STRING_VERSION_HELP5 691 +#define STRING_VERSION_HELP6 692 +#define STRING_VERSION_HELP7 693 + +#define STRING_VOL_HELP1 694 +#define STRING_VOL_HELP2 695 +#define STRING_VOL_HELP3 696 +#define STRING_VOL_HELP4 697 + +#define STRING_WINDOW_HELP1 698 +#define STRING_WINDOW_HELP2 699 + +/* These strings are language independent (cmd.rc) */ +#define STRING_FREEDOS_DEV 800 +#define STRING_REACTOS_DEV 801 + +/* EOF */ diff --git a/reactos/subsys/system/cmd/screen.c b/reactos/subsys/system/cmd/screen.c index 102b3440b42..5693fae1a76 100644 --- a/reactos/subsys/system/cmd/screen.c +++ b/reactos/subsys/system/cmd/screen.c @@ -6,28 +6,27 @@ * 30 Aug 1999 * started - Paolo Pantaleo * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc * */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_SCREEN INT CommandScreen (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; SHORT x,y; BOOL bSkipText = FALSE; if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts(_T( - "move cursor and optionally print text\n" - "\n" - "SCREEN row col [text]\n" - "\n" - " row row to wich move the cursor\n" - " col column to wich move the cursor")); + LoadString(GetModuleHandle(NULL), STRING_SCREEN_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/set.c b/reactos/subsys/system/cmd/set.c index 6a77b383f2b..1ff7c166587 100644 --- a/reactos/subsys/system/cmd/set.c +++ b/reactos/subsys/system/cmd/set.c @@ -29,9 +29,13 @@ * * 25-Feb-1999 (Eric Kohl ) * Fixed little bug. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_SET @@ -42,15 +46,13 @@ INT cmd_set (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR p; if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays, sets, or removes environment variables.\n\n" - "SET [variable[=][string]]\n\n" - " variable Specifies the environment-variable name.\n" - " string Specifies a series of characters to assign to the variable.\n\n" - "Type SET without parameters to display the current environment variables.\n")); + LoadString(GetModuleHandle(NULL), STRING_SET_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/shift.c b/reactos/subsys/system/cmd/shift.c index 7eae2e476bb..e18a1b5f41c 100644 --- a/reactos/subsys/system/cmd/shift.c +++ b/reactos/subsys/system/cmd/shift.c @@ -18,9 +18,13 @@ * * 20-Jan-1999 (Eric Kohl ) * Unicode and redirection safe! + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" /* @@ -30,18 +34,21 @@ * * FREEDOS extension : optional parameter DOWN to allow shifting * parameters backwards. + * */ INT cmd_shift (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + #ifdef _DEBUG DebugPrintf (_T("cmd_shift: (\'%s\', \'%s\')\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Changes the position of replaceable parameters in a batch file.\n\n" - "SHIFT [DOWN]")); + LoadString(GetModuleHandle(NULL), STRING_SHIFT_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -61,3 +68,5 @@ INT cmd_shift (LPTSTR cmd, LPTSTR param) return 0; } + +/* EOF */ diff --git a/reactos/subsys/system/cmd/start.c b/reactos/subsys/system/cmd/start.c index 023b46b3994..2065459c4cd 100644 --- a/reactos/subsys/system/cmd/start.c +++ b/reactos/subsys/system/cmd/start.c @@ -6,26 +6,28 @@ * * 24-Jul-1999 (Eric Kohl ) * Started. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_START INT cmd_start (LPTSTR first, LPTSTR rest) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szFullName[MAX_PATH]; BOOL bWait = FALSE; TCHAR *param; if (_tcsncmp (rest, _T("/?"), 2) == 0) { - ConOutPuts (_T("Starts a command.\n\n" - "START command \n\n" - " command Specifies the command to run.\n\n" - "At the moment all commands are started asynchronously.\n")); - + LoadString(GetModuleHandle(NULL), STRING_START_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -43,11 +45,13 @@ INT cmd_start (LPTSTR first, LPTSTR rest) return 0; } + if( !*rest ) { // FIXME: use comspec instead rest = _T("cmd"); } + /* get the PATH environment variable and parse it */ /* search the PATH environment variable for the binary */ param = _tcschr( rest, _T(' ') ); // skip program name to reach parameters @@ -56,19 +60,23 @@ INT cmd_start (LPTSTR first, LPTSTR rest) *param = 0; param++; } + if (!SearchForExecutable (rest, szFullName)) { error_bad_command (); return 1; } + /* check if this is a .BAT or .CMD file */ if (!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".bat")) || - !_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd"))) + !_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd"))) { #ifdef _DEBUG DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest); #endif - ConErrPuts (_T("No batch support at the moment!")); + + LoadString(GetModuleHandle(NULL), STRING_START_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); } else { @@ -95,7 +103,7 @@ INT cmd_start (LPTSTR first, LPTSTR rest) stui.wShowWindow = SW_SHOWDEFAULT; if (CreateProcess (szFullName, szFullCmdLine, NULL, NULL, FALSE, - CREATE_NEW_CONSOLE, NULL, NULL, &stui, &prci)) + CREATE_NEW_CONSOLE, NULL, NULL, &stui, &prci)) { if (bWait) { @@ -109,8 +117,8 @@ INT cmd_start (LPTSTR first, LPTSTR rest) } else { - ErrorMessage (GetLastError (), - _T("Error executing CreateProcess()!!\n")); + ErrorMessage(GetLastError (), + _T("Error executing CreateProcess()!!\n")); } } diff --git a/reactos/subsys/system/cmd/strtoclr.c b/reactos/subsys/system/cmd/strtoclr.c index 3f08c67035c..5aee0c10326 100644 --- a/reactos/subsys/system/cmd/strtoclr.c +++ b/reactos/subsys/system/cmd/strtoclr.c @@ -174,11 +174,11 @@ static WORD txt_clr(LPTSTR str) { INT i; - - for(i=0;*(clrtable[i].name);i++) - if( _tcsnicmp(str,clrtable[i].name,_tcslen(clrtable[i].name)) == 0) + + for(i = 0; *(clrtable[i].name); i++) + if (_tcsnicmp(str, clrtable[i].name, _tcslen(clrtable[i].name)) == 0) return clrtable[i].val; - + return (WORD)-1; } @@ -188,37 +188,35 @@ WORD txt_clr(LPTSTR str) static WORD str_to_color(LPTSTR* arg_str) { - LPTSTR str; + LPTSTR str; BOOL bBri; WORD tmp_clr,ret_clr; str = *arg_str; - - - if(!(*str)) + if (!(*str)) return (WORD)-1; /*foreground*/ - bBri = FALSE; + bBri = FALSE; - if(_tcsnicmp(str,_T("bri"),3) == 0 ) + if (_tcsnicmp(str,_T("bri"),3) == 0) { bBri = TRUE; - if(chop_blank(&str)) + if (chop_blank(&str)) return (WORD)-1; } - if( (tmp_clr = txt_clr(str)) == (WORD)-1 ) + if ((tmp_clr = txt_clr(str)) == (WORD)-1) { return (WORD)-1; } - /*skip spaces and "on"*/ - if ( chop_blank(&str) || chop_blank(&str) ) + /*skip spaces and "on"*/ + if (chop_blank(&str) || chop_blank(&str)) return (WORD)-1; ret_clr = tmp_clr | (bBri << 3); diff --git a/reactos/subsys/system/cmd/time.c b/reactos/subsys/system/cmd/time.c index 160b59a8a81..3a9e99c2003 100644 --- a/reactos/subsys/system/cmd/time.c +++ b/reactos/subsys/system/cmd/time.c @@ -19,9 +19,13 @@ * * 04-Feb-1999 (Eric Kohl ) * Fixed time input bug. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc. */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_TIME @@ -128,6 +132,7 @@ static BOOL ParseTime (LPTSTR s) INT cmd_time (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR *arg; INT argc; INT i; @@ -136,14 +141,8 @@ INT cmd_time (LPTSTR cmd, LPTSTR param) if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays or sets the system time.\n" - "\n" - "TIME [/T][time]\n" - "\n" - " /T display only\n" - "\n" - "Type TIME with no parameters to display the current time setting and a prompt\n" - "for a new one. Press ENTER to keep the same time.")); + LoadString(GetModuleHandle(NULL), STRING_TIME_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -175,7 +174,8 @@ INT cmd_time (LPTSTR cmd, LPTSTR param) { TCHAR s[40]; - ConOutPrintf (_T("Enter new time: ")); + LoadString(GetModuleHandle(NULL), STRING_TIME_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); ConInString (s, 40); @@ -203,7 +203,9 @@ INT cmd_time (LPTSTR cmd, LPTSTR param) /* force input the next time around. */ nTimeString = -1; } - ConErrPuts (_T("Invalid time.")); + + LoadString(GetModuleHandle(NULL), STRING_TIME_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); } freep (arg); diff --git a/reactos/subsys/system/cmd/timer.c b/reactos/subsys/system/cmd/timer.c index cea50c0e7f0..84b1217d03b 100644 --- a/reactos/subsys/system/cmd/timer.c +++ b/reactos/subsys/system/cmd/timer.c @@ -8,6 +8,7 @@ */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_TIMER @@ -36,7 +37,7 @@ static VOID PrintElapsedTime (DWORD time,INT format) { - + TCHAR szMsg[RC_STRING_MAX_SIZE]; DWORD h,m,s,ms; #ifdef _DEBUG @@ -46,7 +47,8 @@ PrintElapsedTime (DWORD time,INT format) switch (format) { case 0: - ConOutPrintf(_T("Elapsed %d msecs\n"),time); + LoadString(GetModuleHandle(NULL), STRING_TIMER_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, time); break; case 1: @@ -54,12 +56,13 @@ PrintElapsedTime (DWORD time,INT format) time /= 1000; s = time % 60; time /=60; - m = time % 60; + m = time % 60; h = time / 60; - ConOutPrintf(_T("Elapsed %02d%c%02d%c%02d%c%02d\n"), - h,cTimeSeparator, - m,cTimeSeparator, - s,cDecimalSeparator,ms/10); + LoadString( GetModuleHandle(NULL), STRING_TIMER_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, + h, cTimeSeparator, + m, cTimeSeparator, + s, cDecimalSeparator, ms/10); break; } } @@ -67,6 +70,8 @@ PrintElapsedTime (DWORD time,INT format) INT CommandTimer (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + // all timers are kept static DWORD clksT[10]; @@ -99,29 +104,8 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param) if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPrintf(_T( - "allow the use of ten stopwaches.\n" - "\n" - "TIMER [ON|OFF] [/S] [/n] [/Fn]\n" - "\n" - " ON set stopwach ON\n" - " OFF set stopwach OFF\n" - " /S Split time. Return stopwach split\n" - " time without changing its value\n" - " /n Specifiy the stopwach number.\n" - " Stopwaches avaliable are 0 to 10\n" - " If it is not specified default is 1\n" - " /Fn Format for output\n" - " n can be:\n" - " 0 milliseconds\n" - " 1 hh%cmm%css%cdd\n" - "\n"), - cTimeSeparator,cTimeSeparator,cDecimalSeparator); - - ConOutPrintf(_T( - "if none of ON, OFF or /S is specified the command\n" - "will toggle stopwach state\n" - "\n")); + LoadString(GetModuleHandle(NULL), STRING_TIMER_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, cTimeSeparator, cTimeSeparator, cDecimalSeparator); return 0; } @@ -148,7 +132,6 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param) // other options if (p[i][0] == _T('/')) { - // set timer number if (_istdigit(p[i][1]) && bCanNSet) { @@ -165,7 +148,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param) } // specify format - if(_totupper(p[i][1]) == _T('F')) + if (_totupper(p[i][1]) == _T('F')) { iFormat = p[i][2] - _T('0'); continue; @@ -200,9 +183,10 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param) return 0; } - if(NewClkStatus == NCS_NOT_SPECIFIED) - { - if(cS){ + if (NewClkStatus == NCS_NOT_SPECIFIED) + { + if (cS) + { cS=FALSE; PS; PrintElapsedTime(GetTickCount()-cT, iFormat); @@ -218,9 +202,9 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param) } - if(NewClkStatus == NCS_OFF) + if (NewClkStatus == NCS_OFF) { - if(cS) + if (cS) { cS=FALSE; PS; diff --git a/reactos/subsys/system/cmd/title.c b/reactos/subsys/system/cmd/title.c index 853919efd72..93eb9e92524 100644 --- a/reactos/subsys/system/cmd/title.c +++ b/reactos/subsys/system/cmd/title.c @@ -4,15 +4,21 @@ * * History: * 1999-02-11 Emanuele Aliberti + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_TITLE INT cmd_title (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + /* Do nothing if no args */ if (*param == _T('\0')) return 0; @@ -20,11 +26,8 @@ INT cmd_title (LPTSTR cmd, LPTSTR param) /* Asking help? */ if (!_tcsncmp(param, _T("/?"), 2)) { - ConOutPuts (_T("Sets the window title for the command prompt window.\n" - "\n" - "TITLE [string]\n" - "\n" - " string Specifies the title for the command prompt window.")); + LoadString(GetModuleHandle(NULL), STRING_TITLE_HELP, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/type.c b/reactos/subsys/system/cmd/type.c index e5cac811090..a187f798887 100644 --- a/reactos/subsys/system/cmd/type.c +++ b/reactos/subsys/system/cmd/type.c @@ -21,15 +21,20 @@ * * 19-Jan-1999 (Paolo Pantaleo ) * Added multiple file support (copied from y.c) + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_TYPE INT cmd_type (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR buff[256]; HANDLE hFile, hConsoleOut; DWORD dwRead; @@ -38,13 +43,13 @@ INT cmd_type (LPTSTR cmd, LPTSTR param) INT argc,i; LPTSTR *argv; LPTSTR errmsg; - + hConsoleOut=GetStdHandle (STD_OUTPUT_HANDLE); if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays the contents of text files.\n\n" - "TYPE [drive:][path]filename")); + LoadString(GetModuleHandle(NULL), STRING_TYPE_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -60,9 +65,11 @@ INT cmd_type (LPTSTR cmd, LPTSTR param) { if (_T('/') == argv[i][0]) { - ConErrPrintf(_T("Invalid option \"%S\"\n"), argv[i] + 1); + LoadString(GetModuleHandle(NULL), STRING_TYPE_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPrintf(szMsg, argv[i] + 1); continue; } + hFile = CreateFile(argv[i], GENERIC_READ, FILE_SHARE_READ,NULL, @@ -95,8 +102,8 @@ INT cmd_type (LPTSTR cmd, LPTSTR param) } while(dwRead>0 && bRet); CloseHandle(hFile); - } - + } + freep (argv); return 0; diff --git a/reactos/subsys/system/cmd/ver.c b/reactos/subsys/system/cmd/ver.c index 4cc70c70fe6..1f250dde45e 100644 --- a/reactos/subsys/system/cmd/ver.c +++ b/reactos/subsys/system/cmd/ver.c @@ -22,6 +22,7 @@ */ #include "precomp.h" +#include "resource.h" VOID ShortVersion (VOID) @@ -62,32 +63,26 @@ VOID ShortVersion (VOID) */ INT cmd_ver (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; INT i; if (_tcsstr (param, _T("/?")) != NULL) { - ConOutPuts (_T("Displays shell version information\n" - "\n" - "VER [/C][/R][/W]\n" - "\n" - " /C Displays credits.\n" - " /R Displays redistribution information.\n" - " /W Displays warranty information.")); + LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } ShortVersion(); ConOutPuts (_T("Copyright (C) 1994-1998 Tim Norman and others.")); - ConOutPuts (_T("Copyright (C) 1998-2001 Eric Kohl and others.")); + ConOutPuts (_T("Copyright (C) 1998-2005 Eric Kohl and others.")); /* Basic copyright notice */ if (param[0] == _T('\0')) { - ConOutPuts (_T("\n"SHELLINFO - " comes with ABSOLUTELY NO WARRANTY; for details\n" - "type: `ver /w'. This is free software, and you are welcome to redistribute\n" - "it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n" - "listing of credits.")); + ConOutPuts(_T("\n"SHELLINFO)); + LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); } else { @@ -111,34 +106,26 @@ INT cmd_ver (LPTSTR cmd, LPTSTR param) if (_totupper (param[i]) == _T('W')) { /* Warranty notice */ - ConOutPuts (_T("\n This program is distributed in the hope that it will be useful,\n" - " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - " GNU General Public License for more details.")); + LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); } else if (_totupper (param[i]) == _T('R')) { /* Redistribution notice */ - ConOutPuts (_T("\n This program is free software; you can redistribute it and/or modify\n" - " it under the terms of the GNU General Public License as published by\n" - " the Free Software Foundation; either version 2 of the License, or\n" - " (at your option) any later version.")); + LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); } else if (_totupper (param[i]) == _T('C')) { /* Developer listing */ - ConOutPuts (_T("\n" - "FreeDOS version written by:\n" - " Tim Norman Matt Rains\n" - " Evan Jeffrey Steffen Kaiser\n" - " Svante Frey Oliver Mueller\n" - " Aaron Kaufman Marc Desrochers\n" - " Rob Lake John P Price\n" - " Hans B Pufal\n" - "\n" - "ReactOS version written by:\n" - " Eric Kohl Emanuele Aliberti\n" - " Paolo Pantaleo Phillip Susi\n")); + LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP6, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); + LoadString(GetModuleHandle(NULL), STRING_FREEDOS_DEV, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); + LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP7, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); + LoadString(GetModuleHandle(NULL), STRING_REACTOS_DEV, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg); } else { @@ -148,9 +135,8 @@ INT cmd_ver (LPTSTR cmd, LPTSTR param) } } - ConOutPuts (_T("\n" - "Send bug reports to .\n" - "Updates are available at: http://www.reactos.com")); + LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP5, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/verify.c b/reactos/subsys/system/cmd/verify.c index aed1da86e77..0ac13efe257 100644 --- a/reactos/subsys/system/cmd/verify.c +++ b/reactos/subsys/system/cmd/verify.c @@ -13,9 +13,13 @@ * * 20-Jan-1999 (Eric Kohl ) * Unicode and redirection ready! + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_VERIFY @@ -26,24 +30,29 @@ static BOOL bVerify = FALSE; INT cmd_verify (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("This command is just a dummy!!\n" - "Sets whether to verify that your files are written correctly to a\n" - "disk.\n\n" - "VERIFY [ON | OFF]\n\n" - "Type VERIFY without a parameter to display the current VERIFY setting.")); + LoadString(GetModuleHandle(NULL), STRING_VERIFY_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } if (!*param) - ConOutPrintf (_T("VERIFY is %s.\n"), bVerify ? D_ON : D_OFF); + { + LoadString(GetModuleHandle(NULL), STRING_VERIFY_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf((LPTSTR)szMsg, bVerify ? D_ON : D_OFF); + } else if (_tcsicmp (param, D_OFF) == 0) bVerify = FALSE; else if (_tcsicmp (param, D_ON) == 0) bVerify = TRUE; else - ConOutPuts (_T("Must specify ON or OFF.")); + { + LoadString(GetModuleHandle(NULL), STRING_VERIFY_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); + } return 0; } diff --git a/reactos/subsys/system/cmd/vol.c b/reactos/subsys/system/cmd/vol.c index 9d17d11ead8..45bf0f4cdd8 100644 --- a/reactos/subsys/system/cmd/vol.c +++ b/reactos/subsys/system/cmd/vol.c @@ -21,6 +21,7 @@ */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_VOL @@ -28,6 +29,7 @@ static INT PrintVolumeHeader (LPTSTR pszRootPath) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szVolName[80]; DWORD dwSerialNr; @@ -46,31 +48,34 @@ PrintVolumeHeader (LPTSTR pszRootPath) } /* print drive info */ - ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]); - if (szVolName[0] != '\0') - ConOutPrintf (_T(" is %s\n"), - szVolName); + { + LoadString(GetModuleHandle(NULL), STRING_VOL_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, pszRootPath[0],szVolName); + } else - ConOutPrintf (_T(" has no label\n")); + { + LoadString(GetModuleHandle(NULL), STRING_VOL_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, pszRootPath[0]); + } /* print the volume serial number */ - ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"), - HIWORD(dwSerialNr), - LOWORD(dwSerialNr)); + LoadString(GetModuleHandle(NULL), STRING_VOL_HELP3, szMsg, RC_STRING_MAX_SIZE); + ConOutPrintf(szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr)); return 0; } INT cmd_vol (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szRootPath[] = _T("A:\\"); TCHAR szPath[MAX_PATH]; if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays the disk volume label and serial number, if they exist.\n\n" - "VOL [drive:]")); + LoadString(GetModuleHandle(NULL), STRING_VOL_HELP4, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/where.c b/reactos/subsys/system/cmd/where.c index 30396afede0..ec2a37eaebd 100644 --- a/reactos/subsys/system/cmd/where.c +++ b/reactos/subsys/system/cmd/where.c @@ -233,29 +233,29 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName) DebugPrintf (_T("SearchForExecutable(): Loaded PATHEXT: %s\n"), pszBuffer); #endif - pExt = _tcsrchr(pFileName, _T('.')); + pExt = _tcsrchr(pFileName, _T('.')); if (pExt != NULL) { - LPTSTR pszBuffer2; - pszBuffer2 = _tcsdup(pszBuffer); - if (pszBuffer2) - { - pCh = _tcstok(pszBuffer2, _T(";")); - while (pCh) - { - if (0 == _tcsicmp(pCh, pExt)) - { + LPTSTR pszBuffer2; + pszBuffer2 = _tcsdup(pszBuffer); + if (pszBuffer2) + { + pCh = _tcstok(pszBuffer2, _T(";")); + while (pCh) + { + if (0 == _tcsicmp(pCh, pExt)) + { free(pszBuffer); free(pszBuffer2); - return SearchForExecutableSingle(pFileName, pFullName, NULL); - } - pCh = _tcstok(NULL, _T(";")); - } - free(pszBuffer2); - } + return SearchForExecutableSingle(pFileName, pFullName, NULL); + } + pCh = _tcstok(NULL, _T(";")); + } + free(pszBuffer2); + } } - pCh = _tcstok(pszBuffer, _T(";")); + pCh = _tcstok(pszBuffer, _T(";")); while (pCh) { if (SearchForExecutableSingle(pFileName, pFullName, pCh)) @@ -269,3 +269,5 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName) free(pszBuffer); return FALSE; } + +/* EOF */ diff --git a/reactos/subsys/system/cmd/window.c b/reactos/subsys/system/cmd/window.c index a7926c67b6b..5c3254d0940 100644 --- a/reactos/subsys/system/cmd/window.c +++ b/reactos/subsys/system/cmd/window.c @@ -10,10 +10,14 @@ * 29 Sep 1999 (Paolo Pantaleo) * activate and window in a single file using mainly the same code * (nice size optimization :) + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #if ( defined(INCLUDE_CMD_WINDOW) || defined(INCLUDE_CMD_ACTIVATE) ) @@ -33,53 +37,52 @@ */ -static -INT ServiceActivate (LPTSTR param, HWND hWnd) +static INT ServiceActivate (LPTSTR param, HWND hWnd) { - LPTSTR *p=0,p_tmp; - INT argc=0,i; - INT iAction=0; - LPTSTR title=0; + LPTSTR *p = 0, p_tmp; + INT argc = 0, i; + INT iAction = 0; + LPTSTR title = 0; WINDOWPLACEMENT wp; RECT pos; LPTSTR tmp; - if(*param) - p=split(param,&argc); + if (*param) + p = split(param, &argc); - for(i = 0; i < argc; i++) + for (i = 0; i < argc; i++) { - p_tmp=p[i]; + p_tmp = p[i]; if (*p_tmp == _T('/')) p_tmp++; - if (_tcsicmp(p_tmp,_T("min"))==0) + if (_tcsicmp(p_tmp, _T("min")) == 0) { iAction |= A_MIN; continue; } - if (_tcsicmp(p_tmp,_T("max"))==0) + if (_tcsicmp(p_tmp, _T("max")) == 0) { iAction |= A_MAX; continue; } - if (_tcsicmp(p_tmp,_T("restore"))==0) + if (_tcsicmp(p_tmp, _T("restore")) == 0) { iAction |= A_RESTORE; continue; } - if (_tcsicmp(p_tmp,_T("close"))==0) + if (_tcsicmp(p_tmp, _T("close")) == 0) { iAction |= A_CLOSE; continue; } - if (_tcsnicmp(p_tmp,_T("pos"),3)==0) + if (_tcsnicmp(p_tmp, _T("pos"), 3) == 0) { iAction |= A_POS; tmp = p_tmp+3; @@ -87,7 +90,7 @@ INT ServiceActivate (LPTSTR param, HWND hWnd) tmp++; pos.left= _ttoi(tmp); - if(!(tmp=_tcschr(tmp,_T(',')))) + if(!(tmp=_tcschr(tmp, _T(',')))) { error_invalid_parameter_format(p[i]); freep(p); @@ -95,15 +98,15 @@ INT ServiceActivate (LPTSTR param, HWND hWnd) } pos.top = _ttoi (++tmp); - if(!(tmp=_tcschr(tmp,_T(',')))) + if(!(tmp=_tcschr(tmp, _T(',')))) { error_invalid_parameter_format(p[i]); freep(p); return 1; } - pos.right = _ttoi(++tmp)+pos.left; - if(!(tmp=_tcschr(tmp,_T(',')))) + pos.right = _ttoi(++tmp) + pos.left; + if (!(tmp = _tcschr(tmp, _T(',')))) { error_invalid_parameter_format(p[i]); freep(p); @@ -113,13 +116,13 @@ INT ServiceActivate (LPTSTR param, HWND hWnd) continue; } - if (_tcsnicmp(p_tmp,_T("size"),4)==0) + if (_tcsnicmp(p_tmp, _T("size"), 4)==0) { iAction |=A_SIZE; continue; } - /*none of them=window title*/ + /* none of them=window title */ if (title) { error_invalid_parameter_format(p[i]); @@ -129,39 +132,39 @@ INT ServiceActivate (LPTSTR param, HWND hWnd) if (p_tmp[0] == _T('"')) { - title = (p_tmp+1); - *_tcschr(p_tmp+1,_T('"'))=0; + title = (p_tmp + 1); + *_tcschr(p_tmp + 1, _T('"')) = 0; continue; } title = p_tmp; } - if(title) - SetWindowText(hWnd,title); + if (title) + SetWindowText(hWnd, title); - wp.length=sizeof(WINDOWPLACEMENT); - GetWindowPlacement(hWnd,&wp); + wp.length = sizeof(WINDOWPLACEMENT); + GetWindowPlacement(hWnd, &wp); - if(iAction & A_POS) - wp.rcNormalPosition = pos; + if (iAction & A_POS) + wp.rcNormalPosition = pos; - if(iAction & A_MIN) - wp.showCmd=SW_MINIMIZE; + if (iAction & A_MIN) + wp.showCmd = SW_MINIMIZE; - if(iAction & A_MAX) - wp.showCmd=SW_SHOWMAXIMIZED; + if (iAction & A_MAX) + wp.showCmd = SW_SHOWMAXIMIZED; /*if no actions are specified default is SW_RESTORE*/ - if( (iAction & A_RESTORE) || (!iAction) ) - wp.showCmd=SW_RESTORE; + if ((iAction & A_RESTORE) || (!iAction)) + wp.showCmd = SW_RESTORE; - if(iAction & A_CLOSE) + if (iAction & A_CLOSE) ConErrPrintf(_T("!!!FIXME: CLOSE Not implemented!!!\n")); - wp.length=sizeof(WINDOWPLACEMENT); - SetWindowPlacement(hWnd,&wp); + wp.length = sizeof(WINDOWPLACEMENT); + SetWindowPlacement(hWnd, &wp); - if(p) + if (p) freep(p); return 0; @@ -172,46 +175,32 @@ INT ServiceActivate (LPTSTR param, HWND hWnd) INT CommandWindow (LPTSTR cmd, LPTSTR param) { - HWND h; + TCHAR szMsg[RC_STRING_MAX_SIZE]; + HWND hwnd; if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts(_T("change console window aspect\n" - "\n" - "WINDOW [/POS[=]left,top,width,heigth]\n" - " [MIN|MAX|RESTORE] [\"title\"]\n" - "\n" - "/POS specify window placement and dimensions\n" - "MIN minimize the window\n" - "MAX maximize the window\n" - "RESTORE restore the window")); + LoadString(GetModuleHandle(NULL), STRING_WINDOW_HELP1, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } h = GetConsoleWindow(); Sleep(0); - return ServiceActivate(param,h); + return ServiceActivate(param, hwnd); } INT CommandActivate (LPTSTR cmd, LPTSTR param) { + TCHAR szMsg[RC_STRING_MAX_SIZE]; LPTSTR str; - HWND h; + HWND hwnd; if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts(_T("change console window aspect\n" - "\n" - "ACTIAVTE \"window\" [/POS[=]left,top,width,heigth]\n" - " [MIN|MAX|RESTORE] [\"title\"]\n" - "\n" - "window tile of window on wich perform actions\n" - "/POS specify window placement and dimensions\n" - "MIN minimize the window\n" - "MAX maximize the window\n" - "RESTORE restore the window\n" - "title new title")); + LoadString(GetModuleHandle(NULL), STRING_WINDOW_HELP2, szMsg, RC_STRING_MAX_SIZE); + ConOutPuts(szMsg); return 0; } @@ -228,14 +217,15 @@ INT CommandActivate (LPTSTR cmd, LPTSTR param) else str = ""; - h=FindWindow(NULL, param); - if (!h) + hwnd = FindWindow(NULL, param); + if (hwnd == NULL) { - ConErrPuts("window not found"); + LoadString(GetModuleHandle(NULL), STRING_WINDOW_ERROR1, szMsg, RC_STRING_MAX_SIZE); + ConErrPuts(szMsg); return 1; } - return ServiceActivate(str,h); + return ServiceActivate(str, hwnd); } #endif /* ( defined(INCLUDE_CMD_WINDOW) || defined(INCLUDE_CMD_ACTIVATE) ) */ diff --git a/reactos/subsys/system/dhcp/Makefile b/reactos/subsys/system/dhcp/Makefile index 34974ee379f..a6147d92c68 100644 --- a/reactos/subsys/system/dhcp/Makefile +++ b/reactos/subsys/system/dhcp/Makefile @@ -10,11 +10,14 @@ TARGET_NAME = dhcp TARGET_CFLAGS = -D__REACTOS__ -D_WIN32_WINNT=0x0501 -D__USE_W32API -Iinclude -TARGET_OBJECTS = adapter.o alloc.o compat.o dhclient.o dispatch.o hash.o \ - options.o privsep.o socket.o tables.o timer.o util.o +TARGET_OBJECTS = adapter.o alloc.o api.o compat.o dhclient.o dispatch.o \ + hash.o options.o pipe.o privsep.o socket.o tables.o timer.o \ + util.o TARGET_SDKLIBS = iphlpapi.a ws2_32.a ntdll.a +TARGET_INSTALLDIR = system32 + TARGET_RC_SRCS = dhcp.rc TARGET_RC_BINSRC = diff --git a/reactos/subsys/system/dhcp/adapter.c b/reactos/subsys/system/dhcp/adapter.c index 9edbfc2f137..ff3f80c4d26 100644 --- a/reactos/subsys/system/dhcp/adapter.c +++ b/reactos/subsys/system/dhcp/adapter.c @@ -1,39 +1,222 @@ #include "rosdhcp.h" +static SOCKET DhcpSocket = INVALID_SOCKET; static LIST_ENTRY AdapterList; static WSADATA wsd; extern struct interface_info *ifi; -DWORD GetAddress( PDHCP_ADAPTER Adapter ) { - PMIB_IPADDRTABLE AddressTable = NULL; - ULONG i, Size = 0, NumAddressRows; - DWORD Error = GetIpAddrTable( AddressTable, &Size, FALSE ); +PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { + int i = 0; + DWORD Error; + HKEY MainKey; + PCHAR *Out, OutKeyName; + DWORD CharTotal = 0, ThisKey, AppendLen = 1 + strlen(Append); + DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; - while( Error == ERROR_INSUFFICIENT_BUFFER ) { - free( AddressTable ); - AddressTable = malloc( Size ); - if( AddressTable ) - Error = GetIpAddrTable( AddressTable, &Size, FALSE ); - } - if( Error != ERROR_SUCCESS ) { - free( AddressTable ); - return Error; + Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); + + if( Error ) return NULL; + + Error = RegQueryInfoKey + ( MainKey, + NULL, NULL, NULL, + &MaxSubKeys, &MaxSubKeyLen, + NULL, NULL, NULL, NULL, NULL, NULL ); + + DH_DbgPrint(MID_TRACE,("MaxSubKeys: %d, MaxSubKeyLen %d\n", + MaxSubKeys, MaxSubKeyLen)); + + CharTotal = (sizeof(PCHAR) + MaxSubKeyLen + AppendLen) * (MaxSubKeys + 1); + + DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n", + AppendLen, CharTotal)); + + Out = malloc( CharTotal ); + OutKeyName = ((PCHAR)&Out[MaxSubKeys+1]); + + if( !Out ) { RegCloseKey( MainKey ); return NULL; } + + i = 0; + do { + Out[i] = OutKeyName; + Error = RegEnumKey( MainKey, i, OutKeyName, MaxSubKeyLen ); + if( !Error ) { + strcat( OutKeyName, Append ); + DH_DbgPrint(MID_TRACE,("[%d]: %s\n", i, OutKeyName)); + OutKeyName += strlen(OutKeyName) + 1; + i++; + } else Out[i] = 0; + } while( Error == ERROR_SUCCESS ); + + RegCloseKey( MainKey ); + + return Out; +} + +PCHAR RegReadString( HKEY Root, PCHAR Subkey, PCHAR Value ) { + PCHAR SubOut = NULL; + DWORD SubOutLen = 0, Error = 0; + HKEY ValueKey = NULL; + + DH_DbgPrint(MID_TRACE,("Looking in %x:%s:%s\n", Root, Subkey, Value )); + + if( Subkey && strlen(Subkey) ) { + if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS ) + goto regerror; + } else ValueKey = Root; + + DH_DbgPrint(MID_TRACE,("Got Key %x\n", ValueKey)); + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s has size %d\n", Value, SubOutLen)); + + if( !(SubOut = malloc(SubOutLen)) ) + goto regerror; + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s is %s\n", Value, SubOut)); + + goto cleanup; + +regerror: + if( SubOut ) free( SubOut ); +cleanup: + if( ValueKey && ValueKey != Root ) { + DH_DbgPrint(MID_TRACE,("Closing key %x\n", ValueKey)); + RegCloseKey( ValueKey ); } - NumAddressRows = Size / sizeof(MIB_IPADDRTABLE); - for( i = 0; i < AddressTable->dwNumEntries; i++ ) { - DH_DbgPrint(MID_TRACE, - ("Finding address for adapter %d: (%d -> %x)\n", - Adapter->IfMib.dwIndex, - AddressTable->table[i].dwIndex, - AddressTable->table[i].dwAddr)); - if( Adapter->IfMib.dwIndex == AddressTable->table[i].dwIndex ) { - memcpy( &Adapter->IfAddr, &AddressTable->table[i], - sizeof( MIB_IPADDRROW ) ); + DH_DbgPrint(MID_TRACE,("Returning %x with error %d\n", SubOut, Error)); + + return SubOut; +} + +HKEY FindAdapterKey( PDHCP_ADAPTER Adapter ) { + int i = 0; + PCHAR EnumKeyName = + "SYSTEM\\CurrentControlSet\\Control\\Class\\" + "{4D36E972-E325-11CE-BFC1-08002BE10318}"; + PCHAR TargetKeyNameStart = + "SYSTEM\\CurrentControlSet\\Services\\"; + PCHAR TargetKeyNameEnd = "\\Parameters\\Tcpip"; + PCHAR TargetKeyName = NULL; + PCHAR *EnumKeysLinkage = GetSubkeyNames( EnumKeyName, "\\Linkage" ); + PCHAR *EnumKeysTop = GetSubkeyNames( EnumKeyName, "" ); + PCHAR RootDevice = NULL, DriverDesc = NULL; + HKEY EnumKey, OutKey = NULL; + DWORD Error = ERROR_SUCCESS; + + if( !EnumKeysLinkage || !EnumKeysTop ) goto cleanup; + + Error = RegOpenKey( HKEY_LOCAL_MACHINE, EnumKeyName, &EnumKey ); + + if( Error ) goto cleanup; + + for( i = 0; EnumKeysLinkage[i]; i++ ) { + RootDevice = RegReadString + ( EnumKey, EnumKeysLinkage[i], "RootDevice" ); + DriverDesc = RegReadString + ( EnumKey, EnumKeysTop[i], "DriverDesc" ); + + if( DriverDesc && + !strcmp( DriverDesc, Adapter->DhclientInfo.name ) ) { + TargetKeyName = + malloc( strlen( TargetKeyNameStart ) + + strlen( RootDevice ) + + strlen( TargetKeyNameEnd ) + 1 ); + if( !TargetKeyName ) goto cleanup; + sprintf( TargetKeyName, "%s%s%s", + TargetKeyNameStart, RootDevice, TargetKeyNameEnd ); + Error = RegOpenKey( HKEY_LOCAL_MACHINE, TargetKeyName, &OutKey ); + break; + } else { + free( RootDevice ); RootDevice = 0; + free( DriverDesc ); DriverDesc = 0; } } + +cleanup: + if( RootDevice ) free( RootDevice ); + if( DriverDesc ) free( DriverDesc ); + if( EnumKeysLinkage ) free( EnumKeysLinkage ); + if( EnumKeysTop ) free( EnumKeysTop ); + if( TargetKeyName ) free( TargetKeyName ); + + return OutKey; } +BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) { + HKEY AdapterKey = NULL; + PCHAR IPAddress = NULL, Netmask = NULL, DefaultGateway = NULL; + NTSTATUS Status = STATUS_SUCCESS; + DWORD Error = ERROR_SUCCESS; + MIB_IPFORWARDROW DefGatewayRow; + + Adapter->DhclientState.config = &Adapter->DhclientConfig; + strncpy(Adapter->DhclientInfo.name, (char*)Adapter->IfMib.bDescr, + sizeof(Adapter->DhclientInfo.name)); + + AdapterKey = FindAdapterKey( Adapter ); + if( AdapterKey ) + IPAddress = RegReadString( AdapterKey, NULL, "IPAddress" ); + + if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) { + /* Non-automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus, + IPAddress)); + + Adapter->DhclientState.state = S_STATIC; + + Netmask = RegReadString( AdapterKey, NULL, "Subnetmask" ); + if( !Netmask ) Netmask = "255.255.255.0"; + + Status = AddIPAddress( inet_addr( IPAddress ), + inet_addr( Netmask ), + Adapter->IfMib.dwIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + + DefaultGateway = RegReadString( AdapterKey, NULL, "DefaultGateway" ); + + if( DefaultGateway ) { + DefGatewayRow.dwForwardDest = 0; + DefGatewayRow.dwForwardMask = 0; + DefGatewayRow.dwForwardMetric1 = 1; + DefGatewayRow.dwForwardNextHop = inet_addr(DefaultGateway); + Error = CreateIpForwardEntry( &DefGatewayRow ); + if( Error ) + warning("Failed to set default gateway %s: %d\n", + DefaultGateway, Error); + } + + if( DefaultGateway ) free( DefaultGateway ); + if( Netmask ) free( Netmask ); + } else { + /* Automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (dynamic)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus)); + } + + if( IPAddress ) free( IPAddress ); + + return TRUE; +} + +/* + * XXX Figure out the way to bind a specific adapter to a socket. + */ + void AdapterInit() { PMIB_IFTABLE Table = malloc(sizeof(MIB_IFTABLE)); DWORD Error, Size, i; @@ -57,31 +240,42 @@ void AdapterInit() { DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries)); for( i = 0; i < Table->dwNumEntries; i++ ) { - DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n", i)); + DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n", + Table->table[i].dwIndex)); Adapter = calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 ); - if( Adapter ) { + if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET ) { memcpy( &Adapter->IfMib, &Table->table[i], sizeof(Adapter->IfMib) ); - GetAddress( Adapter ); - InsertTailList( &AdapterList, &Adapter->ListEntry ); - Adapter->DhclientInfo.next = ifi; Adapter->DhclientInfo.client = &Adapter->DhclientState; Adapter->DhclientInfo.rbuf = Adapter->recv_buf; Adapter->DhclientInfo.rbuf_max = Table->table[i].dwMtu; Adapter->DhclientInfo.rbuf_len = Adapter->DhclientInfo.rbuf_offset = 0; - Adapter->DhclientInfo.rfdesc = - Adapter->DhclientInfo.wfdesc = - socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); - Adapter->ListenAddr.sin_family = AF_INET; - Adapter->ListenAddr.sin_port = htons(LOCAL_PORT); - Adapter->BindStatus = - (bind( Adapter->DhclientInfo.rfdesc, - (struct sockaddr *)&Adapter->ListenAddr, - sizeof(Adapter->ListenAddr) ) == 0) ? - 0 : WSAGetLastError(); - Adapter->DhclientState.config = &Adapter->DhclientConfig; + memcpy(Adapter->DhclientInfo.hw_address.haddr, + Adapter->IfMib.bPhysAddr, + Adapter->IfMib.dwPhysAddrLen); + Adapter->DhclientInfo.hw_address.hlen = + Adapter->IfMib.dwPhysAddrLen; + + if( DhcpSocket == INVALID_SOCKET ) { + DhcpSocket = + Adapter->DhclientInfo.rfdesc = + Adapter->DhclientInfo.wfdesc = + socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); + Adapter->ListenAddr.sin_family = AF_INET; + Adapter->ListenAddr.sin_port = htons(LOCAL_PORT); + Adapter->BindStatus = + (bind( Adapter->DhclientInfo.rfdesc, + (struct sockaddr *)&Adapter->ListenAddr, + sizeof(Adapter->ListenAddr) ) == 0) ? + 0 : WSAGetLastError(); + } else { + Adapter->DhclientInfo.rfdesc = + Adapter->DhclientInfo.wfdesc = DhcpSocket; + } + + Adapter->DhclientConfig.timeout = DHCP_PANIC_TIMEOUT; Adapter->DhclientConfig.initial_interval = DHCP_DISCOVER_INTERVAL; Adapter->DhclientConfig.retry_interval = DHCP_DISCOVER_INTERVAL; Adapter->DhclientConfig.select_interval = 1; @@ -89,13 +283,17 @@ void AdapterInit() { Adapter->DhclientConfig.backoff_cutoff = DHCP_BACKOFF_MAX; Adapter->DhclientState.interval = Adapter->DhclientConfig.retry_interval; - strncpy(Adapter->DhclientInfo.name, Adapter->IfMib.bDescr, - sizeof(Adapter->DhclientInfo.name)); - DH_DbgPrint(MID_TRACE,("Adapter Name: [%s] (Bind Status %x)\n", - Adapter->DhclientInfo.name, - Adapter->BindStatus)); - ifi = &Adapter->DhclientInfo; - } + + if( PrepareAdapterForService( Adapter ) ) { + Adapter->DhclientInfo.next = ifi; + ifi = &Adapter->DhclientInfo; + InsertTailList( &AdapterList, &Adapter->ListEntry ); + } else { free( Adapter ); Adapter = 0; } + } else { free( Adapter ); Adapter = 0; } + + if( !Adapter ) + DH_DbgPrint(MID_TRACE,("Adapter %d was rejected\n", + Table->table[i].dwIndex)); } DH_DbgPrint(MID_TRACE,("done with AdapterInit\n")); @@ -143,6 +341,20 @@ PDHCP_ADAPTER AdapterFindName( const WCHAR *name ) { return NULL; } +PDHCP_ADAPTER AdapterFindInfo( struct interface_info *ip ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for( ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink ) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if( ip == &Adapter->DhclientInfo ) return Adapter; + } + + return NULL; +} + PDHCP_ADAPTER AdapterGetFirst() { if( IsListEmpty( &AdapterList ) ) return NULL; else { return CONTAINING_RECORD diff --git a/reactos/subsys/system/dhcp/api.c b/reactos/subsys/system/dhcp/api.c new file mode 100644 index 00000000000..bf4be82f125 --- /dev/null +++ b/reactos/subsys/system/dhcp/api.c @@ -0,0 +1,142 @@ +/* $Id: $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: subsys/system/dhcp/api.c + * PURPOSE: DHCP client api handlers + * PROGRAMMER: arty + */ + +#include +#include +#include "rosdhcp.h" + +static CRITICAL_SECTION ApiCriticalSection; + +VOID ApiInit() { + InitializeCriticalSection( &ApiCriticalSection ); +} + +VOID ApiLock() { + EnterCriticalSection( &ApiCriticalSection ); +} + +VOID ApiUnlock() { + LeaveCriticalSection( &ApiCriticalSection ); +} + +/* This represents the service portion of the DHCP client API */ + +DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + add_protocol( Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, got_one, + &Adapter->DhclientInfo ); + Adapter->DhclientInfo.client->state = S_INIT; + state_reboot(&Adapter->DhclientInfo); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.QueryHWInfo.AdapterIndex = Req->AdapterIndex; + Reply.QueryHWInfo.MediaType = Adapter->IfMib.dwType; + Reply.QueryHWInfo.Mtu = Adapter->IfMib.dwMtu; + Reply.QueryHWInfo.Speed = Adapter->IfMib.dwSpeed; + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + DeleteIPAddress( Adapter->NteContext ); + remove_protocol( find_protocol_by_adapter( &Adapter->DhclientInfo ) ); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( !Adapter || Adapter->DhclientState.state != S_BOUND ) { + Reply.Reply = 0; + return Send( &Reply ); + } + + Adapter->DhclientState.state = S_BOUND; + + send_discover( &Adapter->DhclientInfo ); + state_bound( &Adapter->DhclientInfo ); + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + NTSTATUS Status; + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + DeleteIPAddress( Adapter->NteContext ); + Adapter->DhclientState.state = S_STATIC; + remove_protocol( find_protocol_by_adapter( &Adapter->DhclientInfo ) ); + Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress, + Req->Body.StaticRefreshParams.Netmask, + Req->AdapterIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + Reply.Reply = NT_SUCCESS(Status); + } + + ApiUnlock(); + + return Send( &Reply ); +} diff --git a/reactos/subsys/system/dhcp/dhclient.c b/reactos/subsys/system/dhcp/dhclient.c index 9ead8b89419..1976130c84e 100644 --- a/reactos/subsys/system/dhcp/dhclient.c +++ b/reactos/subsys/system/dhcp/dhclient.c @@ -85,6 +85,7 @@ int privfd; struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; struct in_addr inaddr_any; struct sockaddr_in sockaddr_broadcast; +unsigned long old_default_route = 0; /* * ASSERT_STATE() does nothing now; it used to be @@ -107,6 +108,7 @@ int ipv4addrs(char * buf); int res_hnok(const char *dn); char *option_as_string(unsigned int code, unsigned char *data, int len); int fork_privchld(int, int); +int check_arp( struct interface_info *ip, struct client_lease *lp ); #define ROUNDUP(a) \ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) @@ -114,143 +116,11 @@ int fork_privchld(int, int); time_t scripttime; -#if 0 - -int -findproto(char *cp, int n) -{ - struct sockaddr *sa; - int i; - - if (n == 0) - return -1; - for (i = 1; i; i <<= 1) { - if (i & n) { - sa = (struct sockaddr *)cp; - switch (i) { - case RTA_IFA: - case RTA_DST: - case RTA_GATEWAY: - case RTA_NETMASK: - if (sa->sa_family == AF_INET) - return AF_INET; - if (sa->sa_family == AF_INET6) - return AF_INET6; - break; - case RTA_IFP: - break; - } - ADVANCE(cp, sa); - } - } - return (-1); +/* XXX Implement me */ +int check_arp( struct interface_info *ip, struct client_lease *lp ) { + return 1; } - -struct sockaddr * -get_ifa(char *cp, int n) -{ - struct sockaddr *sa; - int i; - - if (n == 0) - return (NULL); - for (i = 1; i; i <<= 1) - if (i & n) { - sa = (struct sockaddr *)cp; - if (i == RTA_IFA) - return (sa); - ADVANCE(cp, sa); - } - - return (NULL); -} -struct iaddr defaddr = { 4 }; - -/* ARGSUSED */ -void -routehandler(struct protocol *p) -{ - char msg[2048]; - struct rt_msghdr *rtm; - struct if_msghdr *ifm; - struct ifa_msghdr *ifam; - struct if_announcemsghdr *ifan; - struct client_lease *l; - time_t t = time(NULL); - struct sockaddr *sa; - struct iaddr a; - ssize_t n; - - n = read(routefd, &msg, sizeof(msg)); - rtm = (struct rt_msghdr *)msg; - if (n < sizeof(rtm->rtm_msglen) || n < rtm->rtm_msglen || - rtm->rtm_version != RTM_VERSION) - return; - - switch (rtm->rtm_type) { - case RTM_NEWADDR: - ifam = (struct ifa_msghdr *)rtm; - if (ifam->ifam_index != ifi->index) - break; - if (findproto((char *)(ifam + 1), ifam->ifam_addrs) != AF_INET) - break; - if (ifi == NULL) - goto die; - sa = get_ifa((char *)(ifam + 1), ifam->ifam_addrs); - if (sa == NULL) - goto die; - - if ((a.len = sizeof(struct in_addr)) > sizeof(a.iabuf)) - error("king bula sez: len mismatch"); - memcpy(a.iabuf, &((struct sockaddr_in *)sa)->sin_addr, a.len); - if (addr_eq(a, defaddr)) - break; - - for (l = ifi->client->active; l != NULL; l = l->next) - if (addr_eq(a, l->address)) - break; - - if (l != NULL) /* new addr is the one we set */ - break; - - goto die; - case RTM_DELADDR: - ifam = (struct ifa_msghdr *)rtm; - if (ifam->ifam_index != ifi->index) - break; - if (findproto((char *)(ifam + 1), ifam->ifam_addrs) != AF_INET) - break; - if (scripttime == 0 || t < scripttime + 10) - break; - goto die; - case RTM_IFINFO: - ifm = (struct if_msghdr *)rtm; - if (ifm->ifm_index != ifi->index) - break; - if ((rtm->rtm_flags & RTF_UP) == 0) - goto die; - break; - case RTM_IFANNOUNCE: - ifan = (struct if_announcemsghdr *)rtm; - if (ifan->ifan_what == IFAN_DEPARTURE && - ifan->ifan_index == ifi->index) - goto die; - break; - default: - break; - } - return; - -die: - script_init("FAIL", NULL); - if (ifi->client->alias) - script_write_params("alias_", ifi->client->alias); - script_go(); - exit(1); -} -#endif - int main(int argc, char *argv[]) { @@ -259,7 +129,9 @@ main(int argc, char *argv[]) int pipe_fd[2]; struct passwd *pw; + ApiInit(); AdapterInit(); + PipeInit(); tzset(); time(&cur_time); @@ -289,15 +161,16 @@ main(int argc, char *argv[]) DH_DbgPrint(MID_TRACE,("Discover Interfaces\n")); - /* set up the interface */ - discover_interfaces(ifi); + /* If no adapters were found, just idle for now ... If any show up, + * then we'll start it later */ + if( ifi ) { + /* set up the interface */ + discover_interfaces(ifi); - DH_DbgPrint - (MID_TRACE, - ("Setting init state and restarting interface %p\n",ifi)); - - ifi->client->state = S_INIT; - state_reboot(ifi); + DH_DbgPrint + (MID_TRACE, + ("Setting init state and restarting interface %p\n",ifi)); + } bootp_packet_handler = do_packet; @@ -435,20 +308,9 @@ state_selecting(void *ipp) /* Check to see if we got an ARPREPLY for the address in this particular lease. */ if (!picked) { - script_init("ARPCHECK", lp->medium); - script_write_params("check_", lp); - - /* If the ARPCHECK code detects another - machine using the offered address, it exits - nonzero. We need to send a DHCPDECLINE and - toss the lease. */ - if (script_go()) { - make_decline(ip, lp); - send_decline(ip); - goto freeit; - } - picked = lp; - picked->next = NULL; + if( !check_arp(ip,lp) ) goto freeit; + picked = lp; + picked->next = NULL; } else { freeit: free_client_lease(lp); @@ -578,42 +440,131 @@ dhcpack(struct packet *packet) bind_lease(ip); } +void set_name_servers( struct client_lease *new_lease ) { + if( new_lease->options[DHO_DOMAIN_NAME_SERVERS].len ) { + HKEY RegKey; + struct iaddr nameserver; + char *nsbuf; + int i, addrs = + new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG); + + /* XXX I'm setting addrs to 1 until we are ready up the chain */ + addrs = 1; + nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) ); + nsbuf[0] = 0; + + if( nsbuf && !RegOpenKeyEx + ( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + 0, KEY_WRITE, &RegKey ) ) { + for( i = 0; i < addrs; i++ ) { + nameserver.len = sizeof(ULONG); + memcpy( nameserver.iabuf, + new_lease->options[DHO_DOMAIN_NAME_SERVERS].data + + (i * sizeof(ULONG)), sizeof(ULONG) ); + strcat( nsbuf, piaddr(nameserver) ); + if( i != addrs-1 ) strcat( nsbuf, "," ); + } + + DH_DbgPrint(MID_TRACE,("Setting Nameservers: %s\n", nsbuf)); + + /* XXX Fixme: I think this may be wrong and that we might have + * a problem somewhere else (in iphlpapi for example). + * + * Recheck the +1 below. + */ + RegSetValueEx( RegKey, "NameServer", 0, REG_SZ, + (LPBYTE)nsbuf, strlen(nsbuf) + 1 ); + + free( nsbuf ); + } + } +} + +void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { + struct iaddr netmask; + + if( Adapter->NteContext ) + DeleteIPAddress( Adapter->NteContext ); + + /* Set up our default router if we got one from the DHCP server */ + if( new_lease->options[DHO_SUBNET_MASK].len ) { + NTSTATUS Status; + + memcpy( netmask.iabuf, + new_lease->options[DHO_SUBNET_MASK].data, + new_lease->options[DHO_SUBNET_MASK].len ); + + Status = AddIPAddress + ( *((ULONG*)new_lease->address.iabuf), + *((ULONG*)netmask.iabuf), + Adapter->IfMib.dwIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + + if( !NT_SUCCESS(Status) ) + warning("AddIPAddress: %x\n", Status); + } + + if( new_lease->options[DHO_ROUTERS].len ) { + MIB_IPFORWARDROW RouterMib; + NTSTATUS Status; + + RouterMib.dwForwardDest = 0; /* Default route */ + RouterMib.dwForwardMask = 0; + RouterMib.dwForwardMetric1 = 1; + + if( old_default_route ) { + /* If we set a default route before, delete it before continuing */ + RouterMib.dwForwardDest = old_default_route; + DeleteIpForwardEntry( &RouterMib ); + } + + RouterMib.dwForwardNextHop = + *((ULONG*)new_lease->options[DHO_ROUTERS].data); + + Status = CreateIpForwardEntry( &RouterMib ); + + if( !NT_SUCCESS(Status) ) + warning("CreateIpForwardEntry: %x\n", Status); + else + old_default_route = RouterMib.dwForwardNextHop; + } +} + + void bind_lease(struct interface_info *ip) { - /* Remember the medium. */ - ip->client->new->medium = ip->client->medium; + PDHCP_ADAPTER Adapter; + struct client_lease *new_lease = ip->client->new; - /* Write out the new lease. */ - write_client_lease(ip, ip->client->new, 0); + /* Remember the medium. */ + ip->client->new->medium = ip->client->medium; + ip->client->active = ip->client->new; + ip->client->new = NULL; - /* Run the client script with the new parameters. */ - script_init((ip->client->state == S_REQUESTING ? "BOUND" : - (ip->client->state == S_RENEWING ? "RENEW" : - (ip->client->state == S_REBOOTING ? "REBOOT" : "REBIND"))), - ip->client->new->medium); - if (ip->client->active && ip->client->state != S_REBOOTING) - script_write_params("old_", ip->client->active); - script_write_params("new_", ip->client->new); - if (ip->client->alias) - script_write_params("alias_", ip->client->alias); - script_go(); + /* Set up a timeout to start the renewal process. */ + /* Timeout of zero means no timeout (some implementations seem to use + * one day). + */ + if( ip->client->active->renewal - cur_time ) + add_timeout(ip->client->active->renewal, state_bound, ip); - /* Replace the old active lease with the new one. */ - if (ip->client->active) - free_client_lease(ip->client->active); - ip->client->active = ip->client->new; - ip->client->new = NULL; + note("bound to %s -- renewal in %d seconds.", + piaddr(ip->client->active->address), + ip->client->active->renewal - cur_time); - /* Set up a timeout to start the renewal process. */ - add_timeout(ip->client->active->renewal, state_bound, ip); + ip->client->state = S_BOUND; + + Adapter = AdapterFindInfo( ip ); - note("bound to %s -- renewal in %d seconds.", - piaddr(ip->client->active->address), - ip->client->active->renewal - cur_time); - ip->client->state = S_BOUND; - reinitialize_interfaces(); -// go_daemon(); + if( Adapter ) setup_adapter( Adapter, new_lease ); + else warning("Could not find adapter for info %p\n", ip); + + set_name_servers( new_lease ); + + reinitialize_interfaces(); } /* @@ -717,8 +668,8 @@ dhcpoffer(struct packet *packet) /* If we're not receptive to an offer right now, or if the offer has an unrecognizable transaction id, then just drop it. */ if (ip->client->state != S_SELECTING || - packet->interface->client->xid != packet->raw->xid || - (packet->interface->hw_address.hlen != packet->raw->hlen) || + packet->interface->client->xid != packet->raw->xid || + (packet->interface->hw_address.hlen != packet->raw->hlen) || (memcmp(packet->interface->hw_address.haddr, packet->raw->chaddr, packet->raw->hlen))) return; @@ -762,14 +713,10 @@ dhcpoffer(struct packet *packet) lease->medium = ip->client->medium; /* Send out an ARP Request for the offered IP address. */ - script_init("ARPSEND", lease->medium); - script_write_params("check_", lease); - /* If the script can't send an ARP request without waiting, - we'll be waiting when we do the ARPCHECK, so don't wait now. */ - if (script_go()) - arp_timeout_needed = 0; - else - arp_timeout_needed = 2; + if( !check_arp( ip, lease ) ) { + note("Arp check failed\n"); + return; + } /* Figure out when we're supposed to stop selecting. */ stop_selecting = @@ -984,9 +931,7 @@ again: note("Trying medium \"%s\" %d", ip->client->medium->string, increase); - script_init("MEDIUM", ip->client->medium); - if (script_go()) - goto again; + /* XXX Support other media types eventually */ } /* @@ -1082,25 +1027,22 @@ state_panic(void *ipp) /* If the old lease is still good and doesn't yet need renewal, go into BOUND state and timeout at the renewal time. */ - if (!script_go()) { - if (cur_time < - ip->client->active->renewal) { - ip->client->state = S_BOUND; - note("bound: renewal in %d seconds.", - ip->client->active->renewal - - cur_time); - add_timeout( - ip->client->active->renewal, - state_bound, ip); - } else { - ip->client->state = S_BOUND; - note("bound: immediate renewal."); - state_bound(ip); - } - reinitialize_interfaces(); - //go_daemon(); - return; - } + if (cur_time < + ip->client->active->renewal) { + ip->client->state = S_BOUND; + note("bound: renewal in %d seconds.", + ip->client->active->renewal - + cur_time); + add_timeout( + ip->client->active->renewal, + state_bound, ip); + } else { + ip->client->state = S_BOUND; + note("bound: immediate renewal."); + state_bound(ip); + } + reinitialize_interfaces(); + return; } /* If there are no other leases, give up. */ @@ -1134,14 +1076,10 @@ activate_next: tell the shell script that we failed to allocate an address, and try again later. */ note("No working leases in persistent database - sleeping.\n"); - script_init("FAIL", NULL); - if (ip->client->alias) - script_write_params("alias_", ip->client->alias); - script_go(); ip->client->state = S_INIT; add_timeout(cur_time + ip->client->config->retry_interval, state_init, ip); -// go_daemon(); + /* XXX Take any failure actions necessary */ } void @@ -1183,8 +1121,7 @@ cancel: script_init("MEDIUM", ip->client->active->medium); /* If the medium we chose won't fly, go to INIT state. */ - if (script_go()) - goto cancel; + /* XXX Nothing for now */ /* Record the medium. */ ip->client->medium = ip->client->active->medium; @@ -1194,23 +1131,18 @@ cancel: to the INIT state. */ if (ip->client->state != S_REQUESTING && cur_time > ip->client->active->expiry) { - /* Run the client script with the new parameters. */ - script_init("EXPIRE", NULL); - script_write_params("old_", ip->client->active); - if (ip->client->alias) - script_write_params("alias_", ip->client->alias); - script_go(); + PDHCP_ADAPTER Adapter = AdapterFindInfo( ip ); + /* Run the client script with the new parameters. */ + /* No script actions necessary in the expiry case */ + /* Now do a preinit on the interface so that we can + discover a new address. */ - /* Now do a preinit on the interface so that we can - discover a new address. */ - script_init("PREINIT", NULL); - if (ip->client->alias) - script_write_params("alias_", ip->client->alias); - script_go(); - - ip->client->state = S_INIT; - state_init(ip); - return; + if( Adapter ) + DeleteIPAddress( Adapter->NteContext ); + + ip->client->state = S_INIT; + state_init(ip); + return; } /* Do the exponential backoff... */ @@ -1586,8 +1518,6 @@ rewrite_client_leases(void) write_client_lease(ifi, ifi->client->active, 1); fflush(leaseFile); -// ftruncate(fileno(leaseFile), ftello(leaseFile)); -// fsync(fileno(leaseFile)); } void @@ -1888,158 +1818,6 @@ script_write_params(char *prefix, struct client_lease *lease) error("buf_close: %m"); } -int -script_go(void) -{ - struct imsg_hdr hdr; - struct buf *buf; - int ret; - - scripttime = time(NULL); - - hdr.code = IMSG_SCRIPT_GO; - hdr.len = sizeof(struct imsg_hdr); - - if ((buf = buf_open(hdr.len)) == NULL) - error("buf_open: %m"); - - if (buf_add(buf, &hdr, sizeof(hdr))) - error("buf_add: %m"); - - if (buf_close(privfd, buf) == -1) - error("buf_close: %m"); - - memset(&hdr, 0, sizeof(hdr)); - //bzero(&hdr, sizeof(hdr)); - buf_read(privfd, &hdr, sizeof(hdr)); - if (hdr.code != IMSG_SCRIPT_GO_RET) - error("unexpected msg type %u", hdr.code); - if (hdr.len != sizeof(hdr) + sizeof(int)) - error("received corrupted message"); - buf_read(privfd, &ret, sizeof(ret)); - - return (ret); -} - -#if 0 -int -priv_script_go(void) -{ - char *scriptName, *argv[2], **envp, *epp[3], reason[] = "REASON=NBI"; - static char client_path[] = CLIENT_PATH; - struct interface_info *ip = ifi; - int pid, wpid, wstatus; - - scripttime = time(NULL); - - if (ip) { - scriptName = ip->client->config->script_name; - envp = ip->client->scriptEnv; - } else { - scriptName = top_level_config.script_name; - epp[0] = reason; - epp[1] = client_path; - epp[2] = NULL; - envp = epp; - } - - argv[0] = scriptName; - argv[1] = NULL; - - pid = fork(); - if (pid < 0) { - error("fork: %m"); - wstatus = 0; - } else if (pid) { - do { - wpid = wait(&wstatus); - } while (wpid != pid && wpid > 0); - if (wpid < 0) { - error("wait: %m"); - wstatus = 0; - } - } else { - execve(scriptName, argv, envp); - error("execve (%s, ...): %m", scriptName); - } - - if (ip) - script_flush_env(ip->client); - - return (wstatus & 0xff); -} -#endif - -#if 0 -void -script_set_env(struct client_state *client, const char *prefix, - const char *name, const char *value) -{ - int i, j, namelen; - - namelen = strlen(name); - - for (i = 0; client->scriptEnv[i]; i++) - if (strncmp(client->scriptEnv[i], name, namelen) == 0 && - client->scriptEnv[i][namelen] == '=') - break; - - if (client->scriptEnv[i]) - /* Reuse the slot. */ - free(client->scriptEnv[i]); - else { - /* New variable. Expand if necessary. */ - if (i >= client->scriptEnvsize - 1) { - char **newscriptEnv; - int newscriptEnvsize = client->scriptEnvsize + 50; - - newscriptEnv = realloc(client->scriptEnv, - newscriptEnvsize); - if (newscriptEnv == NULL) { - free(client->scriptEnv); - client->scriptEnv = NULL; - client->scriptEnvsize = 0; - error("script_set_env: no memory for variable"); - } - client->scriptEnv = newscriptEnv; - client->scriptEnvsize = newscriptEnvsize; - } - /* need to set the NULL pointer at end of array beyond - the new slot. */ - client->scriptEnv[i + 1] = NULL; - } - /* Allocate space and format the variable in the appropriate slot. */ - client->scriptEnv[i] = malloc(strlen(prefix) + strlen(name) + 1 + - strlen(value) + 1); - if (client->scriptEnv[i] == NULL) - error("script_set_env: no memory for variable assignment"); - - /* No `` or $() command substitution allowed in environment values! */ - for (j=0; j < strlen(value); j++) - switch (value[j]) { - case '`': - case '$': - error("illegal character (%c) in value '%s'", value[j], - value); - /* not reached */ - } - snprintf(client->scriptEnv[i], strlen(prefix) + strlen(name) + - 1 + strlen(value) + 1, "%s%s=%s", prefix, name, value); -} - -void -script_flush_env(struct client_state *client) -{ - int i; - - for (i = 0; client->scriptEnv[i]; i++) { - free(client->scriptEnv[i]); - client->scriptEnv[i] = NULL; - } - client->scriptEnvsize = 0; -} -#endif - int dhcp_option_ev_name(char *buf, size_t buflen, struct dhcp_option *option) { @@ -2120,7 +1898,7 @@ check_option(struct client_lease *l, int option) case DHO_FONT_SERVERS: case DHO_DHCP_SERVER_IDENTIFIER: if (!ipv4addrs(opbuf)) { - warning("Invalid IP address in option: %s", opbuf); + warning("Invalid IP address in option(%d): %s", option, opbuf); return (0); } return (1) ; @@ -2215,19 +1993,20 @@ res_hnok(const char *dn) int ipv4addrs(char * buf) { - struct in_addr jnk; - int count = 0; + char *tmp; + struct in_addr jnk; + int i = 0; + + note("Input: %s\n", buf); - while (inet_aton(buf, &jnk) == 1){ - count++; - while (periodchar(*buf) || digitchar(*buf)) - buf++; - if (*buf == '\0') - return (count); - while (*buf == ' ') - buf++; - } - return (0); + do { + tmp = strtok(buf, " "); + note("got %s\n", tmp); + if( tmp && inet_aton(tmp, &jnk) ) i++; + buf = NULL; + } while( tmp ); + + return (i); } diff --git a/reactos/subsys/system/dhcp/dispatch.c b/reactos/subsys/system/dhcp/dispatch.c index 19f806a7b73..121daa9937b 100644 --- a/reactos/subsys/system/dhcp/dispatch.c +++ b/reactos/subsys/system/dhcp/dispatch.c @@ -63,120 +63,21 @@ static int interface_status(struct interface_info *ifinfo); * register that interface with the network I/O software, figure out * what subnet it's on, and add it to the list of interfaces. */ -#if 0 -void -discover_interfaces(struct interface_info *iface) -{ - struct ifaddrs *ifap, *ifa; - struct sockaddr_in foo; - struct ifreq *tif; - - if (getifaddrs(&ifap) != 0) - error("getifaddrs failed"); - - for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { - if ((ifa->ifa_flags & IFF_LOOPBACK) || - (ifa->ifa_flags & IFF_POINTOPOINT) || - (!(ifa->ifa_flags & IFF_UP))) - continue; - - - if (strcmp(iface->name, ifa->ifa_name)) - continue; - - /* - * If we have the capability, extract link information - * and record it in a linked list. - */ - if (ifa->ifa_addr->sa_family == AF_LINK) { - struct sockaddr_dl *foo = - (struct sockaddr_dl *)ifa->ifa_addr; - - iface->index = foo->sdl_index; - iface->hw_address.hlen = foo->sdl_alen; - iface->hw_address.htype = HTYPE_ETHER; /* XXX */ - memcpy(iface->hw_address.haddr, - LLADDR(foo), foo->sdl_alen); - } else if (ifa->ifa_addr->sa_family == AF_INET) { - struct iaddr addr; - - memcpy(&foo, ifa->ifa_addr, sizeof(foo)); - if (foo.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) - continue; - if (!iface->ifp) { - int len = IFNAMSIZ + ifa->ifa_addr->sa_len; - if ((tif = malloc(len)) == NULL) - error("no space to remember ifp"); - strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ); - memcpy(&tif->ifr_addr, ifa->ifa_addr, - ifa->ifa_addr->sa_len); - iface->ifp = tif; - iface->primary_address = foo.sin_addr; - } - addr.len = 4; - memcpy(addr.iabuf, &foo.sin_addr.s_addr, addr.len); - } - } - - if (!iface->ifp) - error("%s: not found", iface->name); - - /* Register the interface... */ - if_register_receive(iface); - if_register_send(iface); - add_protocol(iface->name, iface->rfdesc, got_one, iface); - freeifaddrs(ifap); -} -#else void discover_interfaces(struct interface_info *iface) { NTSTATUS Status; - ULONG dim; - char TmpName [IFNAMSIZ]; + PDHCP_ADAPTER Adapter = AdapterFindInfo( iface ); - PIP_ADAPTER_INFO pAdapterInfo; - PIP_ADAPTER_INFO pAdapter = NULL; + if_register_receive(iface); + if_register_send(iface); - pAdapterInfo = malloc(sizeof(IP_ADAPTER_INFO)); - dim = sizeof(IP_ADAPTER_INFO); - - if (GetAdaptersInfo( pAdapterInfo, &dim) != ERROR_SUCCESS) { - free(pAdapterInfo); - pAdapterInfo = (IP_ADAPTER_INFO *) malloc (dim); - } - - if ((Status = GetAdaptersInfo( pAdapterInfo, &dim)) != NO_ERROR) { - note("Error %x", Status); - free (pAdapterInfo); - return; - } - - for (pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) { - /* we only do ethernet */ - note("found: %s %x\n", pAdapter->AdapterName, pAdapter->Address); - if (pAdapter->Type != MIB_IF_TYPE_ETHERNET) { - continue; - } - note ("found ethernet\n"); - - iface->hw_address.hlen = pAdapter->AddressLength; - iface->hw_address.htype = HTYPE_ETHER; - memcpy (&iface->hw_address.haddr[0], - pAdapter->Address, iface->hw_address.hlen); - - if (pAdapter->IpAddressList.IpAddress.String) - iface->primary_address.S_un.S_addr = inet_addr(pAdapter->IpAddressList.IpAddress.String); - - } - if (iface) { - if_register_receive(iface); - if_register_send(iface); + if( Adapter->DhclientState.state != S_STATIC ) { add_protocol(iface->name, iface->rfdesc, got_one, iface); + iface->client->state = S_INIT; + state_reboot(iface); } - free (pAdapterInfo); } -#endif void reinitialize_interfaces(void) @@ -199,32 +100,23 @@ dispatch(void) time_t howlong; struct timeval timeval; + ApiLock(); + for (l = protocols; l; l = l->next) nfds++; FD_ZERO(&fds); -// fds = malloc(nfds * sizeof(struct pollfd)); -// if (fds == NULL) -// error("Can't allocate poll structures."); - do { - DH_DbgPrint(MID_TRACE,("Cycling dispatch()\n")); /* * Call any expired timeouts, and then if there's still * a timeout registered, time out the select call then. */ another: if (timeouts) { - DH_DbgPrint(MID_TRACE,("Some timeouts are available\n")); - struct timeout *t; if (timeouts->when <= cur_time) { - DH_DbgPrint(MID_TRACE,("Calling timeout %x %p %x\n", - timeouts->when, - timeouts->func, - timeouts->what)); t = timeouts; timeouts = timeouts->next; (*(t->func))(t->what); @@ -251,26 +143,43 @@ dispatch(void) struct interface_info *ip = l->local; if (ip && (l->handler != got_one || !ip->dead)) { - DH_DbgPrint(MID_TRACE,("l->fd %d\n", l->fd)); - FD_SET(l->fd, &fds); -// fds[i].fd = l->fd; -// fds[i].events = POLLIN; -// fds[i].revents = 0; i++; } } - if (i == 0) - error("No live interfaces to poll on - exiting."); + if (i == 0) { + /* No interfaces for now, set the select timeout reasonably so + * we can recover from that condition later. */ + timeval.tv_sec = 5; + timeval.tv_usec = 0; + } else { + /* Wait for a packet or a timeout... XXX */ + timeval.tv_sec = to_msec / 1000; + timeval.tv_usec = (to_msec % 1000) * 1000; + } + + ApiUnlock(); - /* Wait for a packet or a timeout... XXX */ - timeval.tv_sec = to_msec / 1000; - timeval.tv_usec = (to_msec % 1000) * 1000; - DH_DbgPrint(MID_TRACE,("select(%d,%d.%03d) =>\n", - nfds,timeval.tv_sec,timeval.tv_usec/1000)); count = select(nfds, &fds, NULL, NULL, &timeval); - DH_DbgPrint(MID_TRACE,(" => %d\n", count)); + + DH_DbgPrint(MID_TRACE,("Select: %d\n", count)); + + /* Review poll output */ + for (i = 0, l = protocols; l; l = l->next) { + struct interface_info *ip = l->local; + + if (ip && (l->handler != got_one || !ip->dead)) { + DH_DbgPrint + (MID_TRACE, + ("set(%d) -> %s\n", + l->fd, FD_ISSET(l->fd, &fds) ? "true" : "false")); + i++; + } + } + + + ApiLock(); /* Not likely to be transitory... */ if (count == SOCKET_ERROR) { @@ -288,9 +197,7 @@ dispatch(void) for (l = protocols; l; l = l->next) { struct interface_info *ip; ip = l->local; - if (!FD_ISSET(l->fd, &fds)) { -//.revents & (POLLIN | POLLHUP))) { -// fds[i].revents = 0; + if (FD_ISSET(l->fd, &fds)) { if (ip && (l->handler != got_one || !ip->dead)) { DH_DbgPrint(MID_TRACE,("Handling %x\n", l)); @@ -302,8 +209,9 @@ dispatch(void) } interfaces_invalidated = 0; } - DH_DbgPrint(MID_TRACE,("Done\n")); } while (1); + + ApiUnlock(); /* Not reached currently */ } void @@ -544,6 +452,18 @@ remove_protocol(struct protocol *proto) } } +struct protocol * +find_protocol_by_adapter(struct interface_info *info) +{ + struct protocol *p; + + for( p = protocols; p; p = p->next ) { + if( p->local == (void *)info ) return p; + } + + return NULL; +} + int interface_link_status(char *ifname) { diff --git a/reactos/subsys/system/dhcp/include/dhcpd.h b/reactos/subsys/system/dhcp/include/dhcpd.h index 7754d6d0aca..1434021afe1 100644 --- a/reactos/subsys/system/dhcp/include/dhcpd.h +++ b/reactos/subsys/system/dhcp/include/dhcpd.h @@ -93,33 +93,17 @@ struct udphdr { #define USE_SOCKET_SEND #include - -//#include -//#include #include #include -//#include -//#include - -//#include -//#include -//#include - -//#include -//#include - #include #include #include #include -//#include -//#include #include #include #include #include #include -//#include #include #include @@ -187,7 +171,8 @@ enum dhcp_state { S_REQUESTING, S_BOUND, S_RENEWING, - S_REBINDING + S_REBINDING, + S_STATIC }; struct client_config { @@ -358,6 +343,7 @@ void add_timeout(time_t, void (*)(void *), void *); void cancel_timeout(void (*)(void *), void *); void add_protocol(char *, int, void (*)(struct protocol *), void *); void remove_protocol(struct protocol *); +struct protocol *find_protocol_by_adapter( struct interface_info * ); int interface_link_status(char *); /* hash.c */ diff --git a/reactos/subsys/system/dhcp/include/rosdhcp.h b/reactos/subsys/system/dhcp/include/rosdhcp.h index 6c093ecbe3f..70b0bf8e0b2 100644 --- a/reactos/subsys/system/dhcp/include/rosdhcp.h +++ b/reactos/subsys/system/dhcp/include/rosdhcp.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include "stdint.h" @@ -20,9 +21,10 @@ #undef PREFER #define DHCP_DISCOVER_INTERVAL 15 #define DHCP_REBOOT_TIMEOUT 300 +#define DHCP_PANIC_TIMEOUT DHCP_REBOOT_TIMEOUT * 3 #define DHCP_BACKOFF_MAX 300 #define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid" - +#define RRF_RT_REG_SZ 2 typedef void *VOIDPTR; #define NTOS_MODE_USER @@ -41,15 +43,30 @@ typedef struct _DHCP_ADAPTER { MIB_IFROW IfMib; MIB_IPADDRROW IfAddr; SOCKADDR Address; + ULONG NteContext,NteInstance; struct interface_info DhclientInfo; struct client_state DhclientState; struct client_config DhclientConfig; struct sockaddr_in ListenAddr; unsigned int BindStatus; - char recv_buf[1]; + unsigned char recv_buf[1]; } DHCP_ADAPTER, *PDHCP_ADAPTER; +#include + +typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply ); + #define random rand #define srandom srand +extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); +extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); +extern VOID ApiInit(); +extern VOID ApiLock(); +extern VOID ApiUnlock(); +extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); + #endif/*ROSDHCP_H*/ diff --git a/reactos/subsys/system/dhcp/pipe.c b/reactos/subsys/system/dhcp/pipe.c new file mode 100644 index 00000000000..dc843017475 --- /dev/null +++ b/reactos/subsys/system/dhcp/pipe.c @@ -0,0 +1,90 @@ +/* $Id: $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: subsys/system/dhcp/pipe.c + * PURPOSE: DHCP client pipe + * PROGRAMMER: arty + */ + +#include + +static HANDLE CommPipe = INVALID_HANDLE_VALUE, CommThread; +DWORD CommThrId; + +#define COMM_PIPE_OUTPUT_BUFFER sizeof(COMM_DHCP_REQ) +#define COMM_PIPE_INPUT_BUFFER sizeof(COMM_DHCP_REPLY) +#define COMM_PIPE_DEFAULT_TIMEOUT 1000 + +DWORD PipeSend( COMM_DHCP_REPLY *Reply ) { + DWORD Written = 0; + BOOL Success = + WriteFile( CommPipe, + Reply, + sizeof(*Reply), + &Written, + NULL ); + return Success ? Written : -1; +} + +DWORD WINAPI PipeThreadProc( LPVOID Parameter ) { + DWORD BytesRead, BytesWritten; + COMM_DHCP_REQ Req; + BOOL Result; + HANDLE Connection; + + while( (Connection = ConnectNamedPipe( CommPipe, NULL )) ) { + Result = ReadFile( Connection, &Req, sizeof(Req), &BytesRead, NULL ); + if( Result ) { + switch( Req.Type ) { + case DhcpReqQueryHWInfo: + BytesWritten = DSQueryHWInfo( PipeSend, &Req ); + break; + + case DhcpReqLeaseIpAddress: + BytesWritten = DSLeaseIpAddress( PipeSend, &Req ); + break; + + case DhcpReqReleaseIpAddress: + BytesWritten = DSReleaseIpAddressLease( PipeSend, &Req ); + break; + + case DhcpReqRenewIpAddress: + BytesWritten = DSRenewIpAddressLease( PipeSend, &Req ); + break; + } + } + CloseHandle( Connection ); + } +} + +HANDLE PipeInit() { + CommPipe = CreateNamedPipe + ( DHCP_PIPE_NAME, + PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + 1, + COMM_PIPE_OUTPUT_BUFFER, + COMM_PIPE_INPUT_BUFFER, + COMM_PIPE_DEFAULT_TIMEOUT, + NULL ); + + if( CommPipe == INVALID_HANDLE_VALUE ) { + DbgPrint("DHCP: Could not create named pipe\n"); + return CommPipe; + } + + CommThread = CreateThread( NULL, 0, PipeThreadProc, NULL, 0, &CommThrId ); + + if( !CommThread ) { + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; + } + + return CommPipe; +} + +VOID PipeDestroy() { + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; +} diff --git a/reactos/subsys/system/dhcp/util.c b/reactos/subsys/system/dhcp/util.c index 22d3948f920..0af5a501def 100644 --- a/reactos/subsys/system/dhcp/util.c +++ b/reactos/subsys/system/dhcp/util.c @@ -2,8 +2,9 @@ #include "rosdhcp.h" char *piaddr( struct iaddr addr ) { - struct sockaddr_in *sa = (struct sockaddr_in *)addr.iabuf; - return inet_ntoa( sa->sin_addr ); + struct sockaddr_in sa; + memcpy(&sa.sin_addr,addr.iabuf,sizeof(sa.sin_addr)); + return inet_ntoa( sa.sin_addr ); } int note( char *format, ... ) { @@ -69,19 +70,19 @@ void error( char *format, ... ) { } int16_t getShort( unsigned char *data ) { - return 0; + return (int16_t) ntohs(*(int16_t*) data); } u_int16_t getUShort( unsigned char *data ) { - return 0; + return (u_int16_t) ntohs(*(u_int16_t*) data); } int32_t getLong( unsigned char *data ) { - return 0; + return (int32_t) ntohl(*(u_int32_t*) data); } u_int32_t getULong( unsigned char *data ) { - return 0; + return ntohl(*(u_int32_t*)data); } int addr_eq( struct iaddr a, struct iaddr b ) { @@ -92,6 +93,7 @@ void *dmalloc( int size, char *name ) { return malloc( size ); } void dfree( void *v, char *name ) { free( v ); } int read_client_conf(void) { + error("util.c read_client_conf not implemented!"); return 0; } diff --git a/reactos/subsys/system/explorer/Make-rosshell.MinGW b/reactos/subsys/system/explorer/Make-rosshell.MinGW new file mode 100644 index 00000000000..73ed02d8a5a --- /dev/null +++ b/reactos/subsys/system/explorer/Make-rosshell.MinGW @@ -0,0 +1,92 @@ +# +# ReactOS shell +# +# Makefile.PCH +# +# MinGW Makefile with precompiled header support +# + +CC = gcc +CXX = g++ +LINK = g++ + +CFLAGS = -DWIN32 -DROSSHELL -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -DWINVER=0x0500 -fexceptions -Wall -I. -I$(EXPAT_INC) +RCFLAGS = -DWIN32 -DROSSHELL -D__WINDRES__ +LFLAGS = -Wl,--subsystem,windows + +ifdef DEBUG +CFLAGS += -D_DEBUG -g +RCFLAGS += -D_DEBUG +LFLAGS += -g +else +CFLAGS += -DNDEBUG -Os -march=pentium4 +RCFLAGS += -DNDEBUG +LFLAGS += -s +endif + +ifndef UNICODE +UNICODE = 1 +endif + +ifeq ($(UNICODE),1) +CFLAGS += -DUNICODE +# LFLAGS+= -Wl,--entry,_wWinMain@16 +RCFLAGS += -DUNICODE +endif + +CXXFLAGS = $(CFLAGS) + +EXEC_SUFFIX = .exe +RES_SUFFIX = .coff + +VPATH = shell utility taskbar desktop dialogs services + +PROGRAM = rosshell + +TARGET = $(PROGRAM)$(EXEC_SUFFIX) + +OBJECTS = \ + startup.o \ + shellclasses.o \ + utility.o \ + window.o \ + dragdropimpl.o \ + shellbrowserimpl.o \ + explorer.o \ + entries.o \ + winfs.o \ + shellfs.o \ + pane.o \ + desktop.o \ + desktopbar.o \ + taskbar.o \ + startmenu.o \ + shellservices.o \ + traynotify.o \ + quicklaunch.o \ + favorites.o \ + searchprogram.o \ + settings.o \ + i386-stub-win32.o \ + xmlstorage.o + +LIBS = gdi32 comctl32 msimg32 ole32 uuid +DELAYIMPORTS = oleaut32 wsock32 + +all: precomp.h.gch $(TARGET) + +precomp.h.gch: *.h utility/*.h shell/*.h desktop/*.h + $(CXX) $(CFLAGS) precomp.h + +$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) notifyhook.dll libexpat.dll + $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) $(addprefix -l,$(DELAYIMPORTS)) + +$(PROGRAM)$(RES_SUFFIX): explorer_intres.rc res/*.bmp res/*.ico + windres $(RCFLAGS) -o $@ explorer_intres.rc + +notifyhook.dll: notifyhook/notifyhook.c notifyhook/notifyhook.h + $(CC) -D_WIN32_IE=0x0600 -Wall -D_NOTIFYHOOK_IMPL -Os -s notifyhook/notifyhook.c -shared -o $@ + +clean: + rm -f $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) precomp.h.gch \ + desktop/*.o dialogs/*.o shell/*.o taskbar/*.o utility/*.o diff --git a/reactos/subsys/system/explorer/Make-rosshell.mak b/reactos/subsys/system/explorer/Make-rosshell.mak new file mode 100644 index 00000000000..fa428b1acc1 --- /dev/null +++ b/reactos/subsys/system/explorer/Make-rosshell.mak @@ -0,0 +1,68 @@ +# +# ReactOS shell +# +# Makefile +# + +PATH_TO_TOP := ../../.. + +TARGET_TYPE := program + +TARGET_APPTYPE := windows + +TARGET_NAME := rosshell + +TARGET_INSTALLDIR := . + +TARGET_CFLAGS := \ + -D__USE_W32API -DWIN32 -D_ROS_ \ + -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -DWINVER=0x0500 \ + -DUNICODE -fexceptions -Wall -g \ + -I../../../include/expat + +TARGET_CPPFLAGS := $(TARGET_CFLAGS) + +TARGET_RCFLAGS := -D__USE_W32API -DWIN32 -D_ROS_ -D__WINDRES__ + +TARGET_SDKLIBS := \ + gdi32.a user32.a comctl32.a ole32.a oleaut32.a shell32.a expat.a \ + notifyhook.a ws2_32.a msimg32.a + +TARGET_GCCLIBS := stdc++ uuid + +TARGET_OBJECTS := \ + explorer.o \ + i386-stub-win32.o \ + desktop/desktop.o \ + dialogs/searchprogram.o \ + dialogs/settings.o \ + shell/entries.o \ + shell/shellfs.o \ + shell/pane.o \ + shell/winfs.o \ + services/startup.o \ + services/shellservices.o \ + taskbar/desktopbar.o \ + taskbar/taskbar.o \ + taskbar/startmenu.o \ + taskbar/traynotify.o \ + taskbar/quicklaunch.o \ + taskbar/favorites.o \ + utility/shellclasses.o \ + utility/utility.o \ + utility/window.o \ + utility/dragdropimpl.o \ + utility/shellbrowserimpl.o \ + utility/xmlstorage.o + +TARGET_CPPAPP := yes + +TARGET_PCH := precomp.h + +SUBDIRS := notifyhook + +DEP_OBJECTS := $(TARGET_OBJECTS) + +include $(PATH_TO_TOP)/rules.mak +include $(TOOLS_PATH)/helper.mk +include $(TOOLS_PATH)/depend.mk diff --git a/reactos/subsys/system/explorer/Makefile.MinGW b/reactos/subsys/system/explorer/Makefile.MinGW index a75dc2de0e6..678fe28ae8d 100644 --- a/reactos/subsys/system/explorer/Makefile.MinGW +++ b/reactos/subsys/system/explorer/Makefile.MinGW @@ -85,7 +85,7 @@ all: $(TARGET) $(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) notifyhook.dll libexpat.dll $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) $(addprefix -l,$(DELAYIMPORTS)) -explorer$(RES_SUFFIX): $(PROGRAM)_intres.rc res/*.bmp res/*.ico +$(PROGRAM)$(RES_SUFFIX): $(PROGRAM)_intres.rc res/*.bmp res/*.ico windres $(RCFLAGS) -o $@ $(PROGRAM)_intres.rc notifyhook.dll: notifyhook/notifyhook.c notifyhook/notifyhook.h diff --git a/reactos/subsys/system/explorer/Makefile.PCH b/reactos/subsys/system/explorer/Makefile.PCH index 496831bf539..6032ffd7dd1 100644 --- a/reactos/subsys/system/explorer/Makefile.PCH +++ b/reactos/subsys/system/explorer/Makefile.PCH @@ -89,8 +89,8 @@ precomp.h.gch: *.h utility/*.h shell/*.h desktop/*.h $(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) notifyhook.dll libexpat.dll $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) $(addprefix -l,$(DELAYIMPORTS)) -explorer$(RES_SUFFIX): $(PROGRAM)_intres.rc res/*.bmp res/*.ico - windres $(RCFLAGS) -o $@ $(PROGRAM)_intres.rc +$(PROGRAM)$(RES_SUFFIX): explorer_intres.rc res/*.bmp res/*.ico + windres $(RCFLAGS) -o $@ explorer_intres.rc notifyhook.dll: notifyhook/notifyhook.c notifyhook/notifyhook.h $(CC) -D_WIN32_IE=0x0600 -Wall -D_NOTIFYHOOK_IMPL -Os -s notifyhook/notifyhook.c -shared -o $@ diff --git a/reactos/subsys/system/explorer/desktop/desktop.cpp b/reactos/subsys/system/explorer/desktop/desktop.cpp index 2c0cbad51b6..3d346be1c0b 100644 --- a/reactos/subsys/system/explorer/desktop/desktop.cpp +++ b/reactos/subsys/system/explorer/desktop/desktop.cpp @@ -467,8 +467,10 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) HRESULT DesktopWindow::OnDefaultCommand(LPIDA pida) { +#ifndef ROSSHELL // in shell-only-mode fall through and let shell32 handle the command if (MainFrameBase::OpenShellFolders(pida, 0)) return S_OK; +#endif return E_NOTIMPL; } @@ -641,7 +643,8 @@ HRESULT DesktopShellView::DoDesktopContextMenu(int x, int y) hr = pcm->InvokeCommand(&cmi); } - } + } else + _cm_ifs.reset(); } pcm->Release(); diff --git a/reactos/subsys/system/explorer/explorer.cpp b/reactos/subsys/system/explorer/explorer.cpp index e2e0b94a2ba..435fb2342bc 100644 --- a/reactos/subsys/system/explorer/explorer.cpp +++ b/reactos/subsys/system/explorer/explorer.cpp @@ -56,11 +56,15 @@ ExplorerGlobals g_Globals; ExplorerGlobals::ExplorerGlobals() { _hInstance = 0; - _hframeClass = 0; _cfStrFName = 0; + +#ifndef ROSSHELL + _hframeClass = 0; _hMainWnd = 0; - _prescan_nodes = false; _desktop_mode = false; + _prescan_nodes = false; +#endif + _log = NULL; #ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003) _SHRestricted = 0; @@ -528,6 +532,8 @@ ResBitmap::ResBitmap(UINT nid) } +#ifndef ROSSHELL + void explorer_show_frame(int cmdshow, LPTSTR lpCmdLine) { if (g_Globals._hMainWnd) { @@ -553,6 +559,18 @@ void explorer_show_frame(int cmdshow, LPTSTR lpCmdLine) MainFrameBase::Create(lpCmdLine, mdi, cmdshow); } +#else + +void explorer_show_frame(int cmdshow, LPTSTR lpCmdLine) +{ + if (!lpCmdLine) + lpCmdLine = TEXT("explorer.exe"); + + launch_file(GetDesktopWindow(), lpCmdLine, cmdshow); +} + +#endif + PopupMenu::PopupMenu(UINT nid) { @@ -637,6 +655,7 @@ static void InitInstance(HINSTANCE hInstance) setlocale(LC_COLLATE, ""); // set collating rules to local settings for compareName +#ifndef ROSSHELL // register frame window class g_Globals._hframeClass = IconWindowClass(CLASSNAME_FRAME,IDI_EXPLORER); @@ -645,6 +664,7 @@ static void InitInstance(HINSTANCE hInstance) // register tree window class WindowClass(CLASSNAME_WINEFILETREE, CS_CLASSDC|CS_DBLCLKS|CS_VREDRAW).Register(); +#endif g_Globals._cfStrFName = RegisterClipboardFormat(CFSTR_FILENAME); } @@ -664,6 +684,7 @@ int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdshow) return -1; } +#ifndef ROSSHELL if (cmdshow != SW_HIDE) { /* // don't maximize if being called from the ROS desktop if (cmdshow == SW_SHOWNORMAL) @@ -673,6 +694,7 @@ int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdshow) explorer_show_frame(cmdshow, lpCmdLine); } +#endif return Window::MessageLoop(); } @@ -798,12 +820,14 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL // If there is given the command line option "-desktop", create desktop window anyways if (_tcsstr(lpCmdLine,TEXT("-desktop"))) startup_desktop = TRUE; +#ifndef ROSSHELL else if (_tcsstr(lpCmdLine,TEXT("-nodesktop"))) startup_desktop = FALSE; // Don't display cabinet window in desktop mode if (startup_desktop && !_tcsstr(lpCmdLine,TEXT("-explorer"))) nShowCmd = SW_HIDE; +#endif if (_tcsstr(lpCmdLine,TEXT("-noautostart"))) autostart = false; @@ -832,6 +856,11 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL if (!SetShellReadyEvent(TEXT("msgina: ShellReadyEvent"))) SetShellReadyEvent(TEXT("Global\\msgina: ShellReadyEvent")); } +#ifdef ROSSHELL + else + return 0; // no shell to launch, so exit immediatelly +#endif + if (!any_desktop_running) { // launch the shell DDE server @@ -882,9 +911,6 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL #endif } - if (g_Globals._hwndDesktop) - g_Globals._desktop_mode = true; - Thread* pSSOThread = NULL; if (startup_desktop) { @@ -899,11 +925,17 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL startup(2, argv); } +#ifndef ROSSHELL + if (g_Globals._hwndDesktop) + g_Globals._desktop_mode = true; + /**TODO fix command line handling */ if (*lpCmdLine=='"' && lpCmdLine[_tcslen(lpCmdLine)-1]=='"') { ++lpCmdLine; lpCmdLine[_tcslen(lpCmdLine)-1] = '\0'; } +#endif + int ret = explorer_main(hInstance, lpCmdLine, nShowCmd); diff --git a/reactos/subsys/system/explorer/explorer.h b/reactos/subsys/system/explorer/explorer.h index 4531393b92c..4704e654a0f 100644 --- a/reactos/subsys/system/explorer/explorer.h +++ b/reactos/subsys/system/explorer/explorer.h @@ -31,9 +31,12 @@ #include "shell/entries.h" #include "shell/winfs.h" -#include "shell/unixfs.h" #include "shell/shellfs.h" +#ifndef ROSSHELL +#include "shell/unixfs.h" +#endif + #include "utility/window.h" @@ -68,4 +71,7 @@ #include "shell/pane.h" #include "shell/filechild.h" #include "shell/shellbrowser.h" + +#ifndef ROSSHELL #include "shell/mainframe.h" +#endif diff --git a/reactos/subsys/system/explorer/explorer_intres.rc b/reactos/subsys/system/explorer/explorer_intres.rc index e52dea5750c..7e38de50aed 100644 --- a/reactos/subsys/system/explorer/explorer_intres.rc +++ b/reactos/subsys/system/explorer/explorer_intres.rc @@ -126,7 +126,6 @@ BEGIN IDS_TITLE "ReactOS Explorer" IDS_START "Începe" IDS_LOGOFF "Închide sesiunea ..." - IDS_TERMINATE "Închide sesiunea" IDS_SHUTDOWN "Oprire calculator ..." IDS_LAUNCH "Pornire ..." IDS_START_HELP "Ajutor" @@ -141,6 +140,24 @@ BEGIN IDS_ADMIN "Administrare" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU "Startmenu" + IDS_MINIMIZE_ALL "mimimize all windows" + IDS_DESKTOP_NUM "Desktop %d" + IDS_VOLUME "Volume" + IDS_ITEMS_CUR "current items" + IDS_ITEMS_CONFIGURED "configuration" + IDS_ITEMS_VISIBLE "visible" + IDS_ITEMS_HIDDEN "hidden" + IDS_NOTIFY_SHOW "show" + IDS_NOTIFY_HIDE "hide" + IDS_NOTIFY_AUTOHIDE "autohide" + IDS_SHOW_HIDDEN_ICONS "Show hidden icons" + IDS_HIDE_ICONS "Hide icons" + IDS_TERMINATE "Închide sesiunea" +END + STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Reþea" @@ -162,23 +179,6 @@ BEGIN IDS_TASKBAR "Taskbar" END -STRINGTABLE DISCARDABLE -BEGIN - IDS_STARTMENU "Startmenu" - IDS_MINIMIZE_ALL "mimimize all windows" - IDS_DESKTOP_NUM "Desktop %d" - IDS_VOLUME "Volume" - IDS_ITEMS_CUR "current items" - IDS_ITEMS_CONFIGURED "configuration" - IDS_ITEMS_VISIBLE "visible" - IDS_ITEMS_HIDDEN "hidden" - IDS_NOTIFY_SHOW "show" - IDS_NOTIFY_HIDE "hide" - IDS_NOTIFY_AUTOHIDE "autohide" - IDS_SHOW_HIDDEN_ICONS "Show hidden icons" - IDS_HIDE_ICONS "Hide icons" -END - #endif // Romanian resources ///////////////////////////////////////////////////////////////////////////// @@ -197,8 +197,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Bitmap // -IDB_IMAGES BITMAP DISCARDABLE "res/images.bmp" -IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp" IDB_DRIVEBAR BITMAP DISCARDABLE "res/drivebar.bmp" IDB_LOGOV BITMAP DISCARDABLE "res/logov.bmp" IDB_LOGOV256 BITMAP DISCARDABLE "res/logov256.bmp" @@ -349,7 +347,7 @@ BEGIN MENUITEM "&Suchen...\tF1", ID_HELP MENUITEM "Hilfe &verwenden\tF1", ID_HELP_USING MENUITEM SEPARATOR - MENUITEM "&Info about ReactOS Explorer...", ID_ABOUT_WINEFILE + MENUITEM "&Info about ReactOS Explorer...", ID_ABOUT_WINEFILE END END @@ -387,8 +385,8 @@ BEGIN POPUP "&Hilfe" BEGIN MENUITEM "Explorer &FAQ...", ID_EXPLORER_FAQ - MENUITEM "&Über ReactOS Explorer...", ID_ABOUT_EXPLORER - MENUITEM "Über React&OS...", ID_ABOUT_WINDOWS + MENUITEM "&Über ReactOS Explorer...", ID_ABOUT_EXPLORER + MENUITEM "Über React&OS...", ID_ABOUT_WINDOWS END END @@ -449,7 +447,7 @@ FONT 10, "MS Sans Serif" BEGIN LTEXT "ReactOS Explorer",IDC_ROS_EXPLORER,91,13,104,11 LTEXT "V 0.9",IDC_VERSION_TXT,91,27,104,8 - LTEXT "(c) 2003/2004 Martin Fuchs",IDC_STATIC,91,42,104,8 + LTEXT "(c) 2003-2005 Martin Fuchs",IDC_STATIC,91,42,104,8 LTEXT "",IDC_WIN_VERSION,91,58,98,22 LTEXT "http://www.sky.franken.de/explorer/",IDC_WWW,17,84,129, 8 @@ -475,25 +473,6 @@ IDB_ICON_ALIGN_8 BITMAP DISCARDABLE "res/icoalig8.bmp" IDB_ICON_ALIGN_9 BITMAP DISCARDABLE "res/icoalig9.bmp" IDB_ICON_ALIGN_10 BITMAP DISCARDABLE "res/icoali10.bmp" -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_ABOUT_EXPLORER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 192 - TOPMARGIN, 7 - BOTTOMMARGIN, 102 - END -END -#endif // APSTUDIO_INVOKED - - #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // @@ -513,6 +492,10 @@ END 3 TEXTINCLUDE DISCARDABLE BEGIN + "#ifndef ROSSHELL\r\n" + "IDB_IMAGES BITMAP DISCARDABLE ""res/images.bmp""\r\n" + "IDB_TOOLBAR BITMAP DISCARDABLE ""res/toolbar.bmp""\r\n" + "#endif\r\n" "#ifndef _ROS_\r\n" "LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\r\n" "STRINGTABLE DISCARDABLE \r\n" @@ -584,7 +567,6 @@ BEGIN IDS_TITLE "Reactos Explorer" IDS_START "Start" IDS_LOGOFF "Abmelden..." - IDS_TERMINATE "ROS Explorer beenden" IDS_SHUTDOWN "Herunterfahren..." IDS_LAUNCH "Starten..." IDS_START_HELP "Hilfe" @@ -599,6 +581,24 @@ BEGIN IDS_ADMIN "Verwaltung" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU "Startmenü" + IDS_MINIMIZE_ALL "alle Fenster minimieren" + IDS_DESKTOP_NUM "Desktop %d" + IDS_VOLUME "Lautstärke" + IDS_ITEMS_CUR "aktuelle Icons" + IDS_ITEMS_CONFIGURED "Konfiguratrion" + IDS_ITEMS_VISIBLE "sichtbar" + IDS_ITEMS_HIDDEN "unsichtbar" + IDS_NOTIFY_SHOW "sichtbar" + IDS_NOTIFY_HIDE "versteckt" + IDS_NOTIFY_AUTOHIDE "automatisch" + IDS_SHOW_HIDDEN_ICONS "Zeige versteckte Icons" + IDS_HIDE_ICONS "Verstecke Icons" + IDS_TERMINATE "ROS Explorer beenden" +END + STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Netzwerk" @@ -620,23 +620,6 @@ BEGIN IDS_TASKBAR "Taskbar" END -STRINGTABLE DISCARDABLE -BEGIN - IDS_STARTMENU "Startmenü" - IDS_MINIMIZE_ALL "alle Fenster minimieren" - IDS_DESKTOP_NUM "Desktop %d" - IDS_VOLUME "Lautstärke" - IDS_ITEMS_CUR "aktuelle Icons" - IDS_ITEMS_CONFIGURED "Konfiguratrion" - IDS_ITEMS_VISIBLE "sichtbar" - IDS_ITEMS_HIDDEN "unsichtbar" - IDS_NOTIFY_SHOW "sichtbar" - IDS_NOTIFY_HIDE "versteckt" - IDS_NOTIFY_AUTOHIDE "automatisch" - IDS_SHOW_HIDDEN_ICONS "Zeige versteckte Icons" - IDS_HIDE_ICONS "Verstecke Icons" -END - #endif // German (Germany) resources ///////////////////////////////////////////////////////////////////////////// @@ -775,8 +758,8 @@ BEGIN MENUITEM "&Status Bar", ID_VIEW_STATUSBAR, CHECKED MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN MENUITEM SEPARATOR - MENUITEM "&Symbol after Running", 65535 - MENUITEM "&Save Changes on Exit", 511 + MENUITEM "&Symbol after Running", 65535 + MENUITEM "&Save Changes on Exit", 511 END POPUP "&Security" BEGIN @@ -962,7 +945,7 @@ STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW CAPTION "Configure Notification Icons" -FONT 8, "MS Sans Serif" +FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31 @@ -1008,65 +991,6 @@ BEGIN END -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_SEARCH_PROGRAM, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 193 - TOPMARGIN, 7 - BOTTOMMARGIN, 58 - END - - IDD_DESKBAR_DESKTOP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 205 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_DESKBAR_TASKBAR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_DESKBAR_STARTMENU, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_NOTIFYAREA, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 201 - TOPMARGIN, 7 - BOTTOMMARGIN, 167 - END - - IDD_MDI_SDI, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 181 - TOPMARGIN, 7 - BOTTOMMARGIN, 119 - END -END -#endif // APSTUDIO_INVOKED - - ///////////////////////////////////////////////////////////////////////////// // // String Table @@ -1077,7 +1001,6 @@ BEGIN IDS_TITLE "Reactos Explorer" IDS_START "Start" IDS_LOGOFF "Log Off..." - IDS_TERMINATE "Terminate ROS Explorer" IDS_SHUTDOWN "Turn Off..." IDS_LAUNCH "Run..." IDS_START_HELP "Help" @@ -1092,6 +1015,24 @@ BEGIN IDS_ADMIN "Administration" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU "Startmenu" + IDS_MINIMIZE_ALL "mimimize all windows" + IDS_DESKTOP_NUM "Desktop %d" + IDS_VOLUME "Volume" + IDS_ITEMS_CUR "current items" + IDS_ITEMS_CONFIGURED "configuration" + IDS_ITEMS_VISIBLE "visible" + IDS_ITEMS_HIDDEN "hidden" + IDS_NOTIFY_SHOW "show" + IDS_NOTIFY_HIDE "hide" + IDS_NOTIFY_AUTOHIDE "autohide" + IDS_SHOW_HIDDEN_ICONS "Show hidden icons" + IDS_HIDE_ICONS "Hide icons" + IDS_TERMINATE "Terminate ROS Explorer" +END + STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Network" @@ -1113,23 +1054,6 @@ BEGIN IDS_TASKBAR "Taskbar" END -STRINGTABLE DISCARDABLE -BEGIN - IDS_STARTMENU "Startmenu" - IDS_MINIMIZE_ALL "mimimize all windows" - IDS_DESKTOP_NUM "Desktop %d" - IDS_VOLUME "Volume" - IDS_ITEMS_CUR "current items" - IDS_ITEMS_CONFIGURED "configuration" - IDS_ITEMS_VISIBLE "visible" - IDS_ITEMS_HIDDEN "hidden" - IDS_NOTIFY_SHOW "show" - IDS_NOTIFY_HIDE "hide" - IDS_NOTIFY_AUTOHIDE "autohide" - IDS_SHOW_HIDDEN_ICONS "Show hidden icons" - IDS_HIDE_ICONS "Hide icons" -END - #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// @@ -1452,7 +1376,7 @@ STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW CAPTION "Configure Notification Icons" -FONT 8, "MS Sans Serif" +FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31 @@ -1480,57 +1404,6 @@ BEGIN END -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_SEARCH_PROGRAM, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 193 - TOPMARGIN, 7 - BOTTOMMARGIN, 58 - END - - IDD_DESKBAR_DESKTOP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 205 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_DESKBAR_TASKBAR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_DESKBAR_STARTMENU, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_NOTIFYAREA, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 201 - TOPMARGIN, 7 - BOTTOMMARGIN, 167 - END -END -#endif // APSTUDIO_INVOKED - - ///////////////////////////////////////////////////////////////////////////// // // String Table @@ -1541,7 +1414,6 @@ BEGIN IDS_TITLE "Reactos Explorer" IDS_START "Iniciar" IDS_LOGOFF "Salir..." - IDS_TERMINATE "Salir" IDS_SHUTDOWN "Apagar..." IDS_LAUNCH "Ejecutar..." IDS_START_HELP "Ayuda" @@ -1556,6 +1428,24 @@ BEGIN IDS_ADMIN "Administracion" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU "Menu Inicio" + IDS_MINIMIZE_ALL "mimimizar todas las ventanas" + IDS_DESKTOP_NUM "Escritorio %d" + IDS_VOLUME "Volumen" + IDS_ITEMS_CUR "Objetos Actuales" + IDS_ITEMS_CONFIGURED "configuracion" + IDS_ITEMS_VISIBLE "visible" + IDS_ITEMS_HIDDEN "oculto" + IDS_NOTIFY_SHOW "mostrar" + IDS_NOTIFY_HIDE "ocultar" + IDS_NOTIFY_AUTOHIDE "autoocultar" + IDS_SHOW_HIDDEN_ICONS "Show hidden icons" + IDS_HIDE_ICONS "Hide icons" + IDS_TERMINATE "Salir" +END + STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Res" @@ -1577,23 +1467,6 @@ BEGIN IDS_TASKBAR "Barra de Tareas" END -STRINGTABLE DISCARDABLE -BEGIN - IDS_STARTMENU "Menu Inicio" - IDS_MINIMIZE_ALL "mimimizar todas las ventanas" - IDS_DESKTOP_NUM "Escritorio %d" - IDS_VOLUME "Volumen" - IDS_ITEMS_CUR "Objetos Actuales" - IDS_ITEMS_CONFIGURED "configuracion" - IDS_ITEMS_VISIBLE "visible" - IDS_ITEMS_HIDDEN "oculto" - IDS_NOTIFY_SHOW "mostrar" - IDS_NOTIFY_HIDE "ocultar" - IDS_NOTIFY_AUTOHIDE "autoocultar" - IDS_SHOW_HIDDEN_ICONS "Show hidden icons" - IDS_HIDE_ICONS "Hide icons" -END - #endif // Spanish (Castilian) resources ///////////////////////////////////////////////////////////////////////////// @@ -1712,7 +1585,6 @@ BEGIN IDS_TITLE "Explorateur Reactos" IDS_START "Démarrer" IDS_LOGOFF "Déconnexion ..." - IDS_TERMINATE "Déconnexion" IDS_SHUTDOWN "Arrêter..." IDS_LAUNCH "Exécuter..." IDS_START_HELP "Aide" @@ -1727,6 +1599,24 @@ BEGIN IDS_ADMIN "Administration" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU "Startmenu" + IDS_MINIMIZE_ALL "mimimize all windows" + IDS_DESKTOP_NUM "Bureau %d" + IDS_VOLUME "Volume" + IDS_ITEMS_CUR "current items" + IDS_ITEMS_CONFIGURED "configuration" + IDS_ITEMS_VISIBLE "visible" + IDS_ITEMS_HIDDEN "hidden" + IDS_NOTIFY_SHOW "show" + IDS_NOTIFY_HIDE "hide" + IDS_NOTIFY_AUTOHIDE "autohide" + IDS_SHOW_HIDDEN_ICONS "Show hidden icons" + IDS_HIDE_ICONS "Hide icons" + IDS_TERMINATE "Déconnexion" +END + STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Réseaux" @@ -1748,24 +1638,439 @@ BEGIN IDS_TASKBAR "Taskbar" END -STRINGTABLE DISCARDABLE +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Swedish resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE) +#ifdef _WIN32 +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDM_MDIFRAME MENU PRELOAD DISCARDABLE BEGIN - IDS_STARTMENU "Startmenu" - IDS_MINIMIZE_ALL "mimimize all windows" - IDS_DESKTOP_NUM "Bureau %d" - IDS_VOLUME "Volume" - IDS_ITEMS_CUR "current items" - IDS_ITEMS_CONFIGURED "configuration" - IDS_ITEMS_VISIBLE "visible" - IDS_ITEMS_HIDDEN "hidden" - IDS_NOTIFY_SHOW "show" - IDS_NOTIFY_HIDE "hide" - IDS_NOTIFY_AUTOHIDE "autohide" - IDS_SHOW_HIDDEN_ICONS "Show hidden icons" - IDS_HIDE_ICONS "Hide icons" + POPUP "&Arkiv" + BEGIN + MENUITEM "&Avsluta", ID_FILE_EXIT + END + POPUP "&Visa" + BEGIN + MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR + MENUITEM "&Extrafält", ID_VIEW_EXTRA_BAR + MENUITEM "E&nhetsfält", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "S&idfält", ID_VIEW_SIDE_BAR + MENUITEM "&Statusfält", ID_VIEW_STATUSBAR + MENUITEM SEPARATOR + MENUITEM "&Uppdatera\tF5", ID_REFRESH + MENUITEM "F&ullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "SDI", ID_VIEW_SDI + END + POPUP "&Fönster" + BEGIN + MENUITEM "Nytt &fönster", ID_WINDOW_NEW + MENUITEM "Överlappande\tShift+F5", ID_WINDOW_CASCADE + MENUITEM "Ordna &horizontellt", ID_WINDOW_TILE_HORZ + MENUITEM "Ordna &vertikalt\tShift+F4", ID_WINDOW_TILE_VERT + MENUITEM "Ordna automatiskt", ID_WINDOW_AUTOSORT + MENUITEM "Ordna &symboler", ID_WINDOW_ARRANGE + END + POPUP "&Verktyg" + BEGIN + MENUITEM "&Alternativ", ID_TOOLS_OPTIONS + END + POPUP "&Hjälp" + BEGIN + MENUITEM "Explorer &FAQ...", ID_EXPLORER_FAQ + MENUITEM "Om &Explorer...", ID_ABOUT_EXPLORER + MENUITEM "Om &OS...", ID_ABOUT_WINDOWS + END END -#endif // French (France) resources +IDM_WINEFILE MENU FIXED IMPURE +BEGIN + POPUP "&Arkiv" + BEGIN + MENUITEM "&Öppna\tEnter", 101 + MENUITEM "&Flytta...\tF7", 106 + MENUITEM "&Kopiera...\tF8", 107 + MENUITEM "&I urklipp...\tF9", 118 + MENUITEM "&Ta bort\tDel", 108 + MENUITEM "&Byt namn...", 109 + MENUITEM "&Egenskaper...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Komprimera...", 119 + MENUITEM "Packa &upp...", 120 + MENUITEM SEPARATOR + MENUITEM "&Kör...", ID_EXECUTE + MENUITEM "&Skriv ut...", 102 + MENUITEM "Associera...", 103 + MENUITEM SEPARATOR + MENUITEM "Skapa mapp...", ID_EXECUTE + MENUITEM "&Sök...", 104 + MENUITEM "&Välj filer...", 116 + MENUITEM SEPARATOR + MENUITEM "&Avsluta\tAlt+X", ID_FILE_EXIT + END + POPUP "&Disk" + BEGIN + MENUITEM "&Kopiera disk...", 201 + MENUITEM "&Namnge disk...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatera disk...", 203 + MENUITEM SEPARATOR + MENUITEM "Anslut &Nätverksenhet", 252 + MENUITEM "&Koppla ifrån Nätverksenhet", 253 + MENUITEM SEPARATOR + MENUITEM "Dela ut...", 254 + MENUITEM "&Ta bort utdelning...", 255 + MENUITEM SEPARATOR + MENUITEM "&Välj enhet...", 251 + END + POPUP "&Mappar" + BEGIN + MENUITEM "&Nästa nivå\t+", 301 + MENUITEM "Utöka &träd\t*", 302 + MENUITEM "Utöka &alla\tCtrl+*", 303 + MENUITEM "Kollapsa &träd\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Markera undermappar", 505 + END + POPUP "&Visa" + BEGIN + MENUITEM "&Träd och mapp", 413 + MENUITEM "Bara tr&äd", 411 + MENUITEM "Bara &mapp", 412 + MENUITEM SEPARATOR + MENUITEM "De&la", 414 + MENUITEM SEPARATOR + MENUITEM "&Namn", ID_VIEW_NAME + MENUITEM "&Alla Fildetaljer", ID_VIEW_ALL_ATTRIBUTES + , CHECKED + MENUITEM "&Vissa detaljer...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Sortera efter namn", 404 + MENUITEM "Sortera efter t&yp", 405 + MENUITEM "Sortera efter st&orlek", 406 + MENUITEM "Sortera efter &datum", 407 + MENUITEM SEPARATOR + MENUITEM "Sortera efter &...", 409 + END + POPUP "&Inställningar" + BEGIN + MENUITEM "&Bekräftelse...", 65535 + MENUITEM "&Teckensnitt...", 65535 + MENUITEM "&Konfigurera verktygsfält...", 65535 + MENUITEM SEPARATOR + MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Enhetsfält", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Sidfält", ID_VIEW_SIDE_BAR + MENUITEM "St&atusfält", ID_VIEW_STATUSBAR, CHECKED + MENUITEM "F&ullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM SEPARATOR + MENUITEM "&Symbol efter körning", 65535 + MENUITEM "&Spara ändringar vid stängning", 511 + END + POPUP "&Säkerhet" + BEGIN + MENUITEM "&Åtkomst...", 605 + MENUITEM "&Loggning...", 606 + MENUITEM "&Ägare...", 607 + END + POPUP "&Fönster" + BEGIN + MENUITEM "Nytt &fönster", ID_WINDOW_NEW + MENUITEM "Överlappande\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Ordna &horizontellt", ID_WINDOW_TILE_HORZ + MENUITEM "Ordna &vertikalt\tCtrl+F4", ID_WINDOW_TILE_VERT + MENUITEM "Ordna automatiskt", ID_WINDOW_AUTOSORT + MENUITEM "Ordna &symboler", ID_WINDOW_ARRANGE + MENUITEM "&Uppdatera\tF5", ID_REFRESH + END + POPUP "&?" + BEGIN + MENUITEM "&Hjälpavsnitt\tF1", ID_HELP + MENUITEM "Hjälp &sök...\tF1", ID_HELP + MENUITEM "&Använda hjälpen\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "Information om &Winefile...", ID_ABOUT_WINEFILE + END +END + +IDM_DESKTOPBAR MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "&Inställningar...", ID_DESKTOPBAR_SETTINGS + MENUITEM "&Aktivitetshanteraren...", ID_TASKMGR + MENUITEM SEPARATOR + MENUITEM "&Om Explorer...", ID_ABOUT_EXPLORER + END +END + +IDM_VOLUME MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "Öppna volymkontroll", ID_TRAY_VOLUME + MENUITEM "Justera ljudinställningar", ID_VOLUME_PROPERTIES + END +END + +IDM_NOTIFYAREA MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "&Visa dolda ikoner", ID_SHOW_HIDDEN_ICONS + MENUITEM "Visa &ikonknapp", ID_SHOW_ICON_BUTTON + MENUITEM "&Konfigurera meddelanden...", ID_CONFIG_NOTIFYAREA + MENUITEM "Justera &datum och &tid...", ID_CONFIG_TIME + MENUITEM SEPARATOR + MENUITEM "&Om Explorer...", ID_ABOUT_EXPLORER + END +END + +IDM_SDIFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&Arkiv" + BEGIN + MENUITEM "&Avsluta", ID_FILE_EXIT + END + POPUP "&Visa" + BEGIN + MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR + MENUITEM "&Sidfält", ID_VIEW_SIDE_BAR, GRAYED + MENUITEM "&Statusfält", ID_VIEW_STATUSBAR + MENUITEM SEPARATOR + MENUITEM "&Uppdatera\tF5", ID_REFRESH + MENUITEM "&Fullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "&MDI", ID_VIEW_MDI + END + POPUP "&Verktyg" + BEGIN + MENUITEM "&Alternativ", ID_TOOLS_OPTIONS + END + POPUP "&Hjälp" + BEGIN + MENUITEM "Explorer &FAQ...", ID_EXPLORER_FAQ + MENUITEM "&Om Explorer...", ID_ABOUT_EXPLORER + MENUITEM "Om &operativsystemet...", ID_ABOUT_WINDOWS + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Kör" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "",101,"Static",SS_SIMPLE | SS_NOPREFIX,3,6,162,10 + CONTROL "&Kommando:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3, + 18,60,10 + EDITTEXT 201,3,29,134,12,ES_AUTOHSCROLL + CONTROL "&Som symbol",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 3,45,71,12 + DEFPUSHBUTTON "&OK",1,158,6,47,14 + PUSHBUTTON "&Avbryt",2,158,23,47,14 + PUSHBUTTON "&Hjälp",254,158,43,47,14 +END + +IDD_SEARCH_PROGRAM DIALOGEX 0, 0, 200, 65 +STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_APPWINDOW +CAPTION "Sök program på startmenyn" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + LTEXT "&Filter:",IDC_STATIC,7,9,18,8 + EDITTEXT IDC_FILTER,34,7,100,14,ES_AUTOHSCROLL + CONTROL "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | + WS_TABSTOP,7,25,186,33 + PUSHBUTTON "&Kontrollera poster",IDC_CHECK_ENTRIES,143,7,50,14 +END + +IDD_DESKBAR_DESKTOP DIALOG DISCARDABLE 0, 0, 212, 194 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Skrivbordsinställningar" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Välj från vilket hörn och åt vilket håll du föredrar att rada upp ikonerna:", + IDC_STATIC,7,7,166,8 + CONTROL "vä. och neråt",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,7,25,46,44 + CONTROL "övre åt hö.",IDC_ICON_ALIGN_1,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,57,25,46,44 + CONTROL "övre åt vä.",IDC_ICON_ALIGN_2,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,110,25,46,44 + CONTROL "hö. och neråt",IDC_ICON_ALIGN_3,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,159,25,46,44 + CONTROL "vä. och uppåt",IDC_ICON_ALIGN_4,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,7,73,46,44 + CONTROL "nedre åt hö.",IDC_ICON_ALIGN_5,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,57,73,46,44 + CONTROL "nedre åt vä.",IDC_ICON_ALIGN_6,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,110,73,46,44 + CONTROL "hö. och uppåt",IDC_ICON_ALIGN_7,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,159,73,46,44 + CONTROL "sidor och ner",IDC_ICON_ALIGN_8,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,7,121,46,44 + CONTROL "kanter",IDC_ICON_ALIGN_9,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,57,121,46,44 + CONTROL "runt om",IDC_ICON_ALIGN_10,"Button",BS_OWNERDRAW | + BS_BOTTOM | WS_TABSTOP,110,121,46,44 + CONTROL "",IDC_ICON_ALIGN_11,"Button",BS_OWNERDRAW | BS_BOTTOM | + WS_TABSTOP,159,121,46,44 + CONTROL "Visa &versionsnummer",ID_DESKTOP_VERSION,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,177,91,10 +END + +IDD_DESKBAR_TASKBAR DIALOG DISCARDABLE 0, 0, 210, 194 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Aktivitetsfältsinställningar" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "visa &klockan",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,152,52,10 + CONTROL "&Göm inaktiva meddelandeikoner",ID_HIDE_INACTIVE_ICONS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,174,111,10 + PUSHBUTTON "&Meddelanden...",ID_CONFIG_NOTIFYAREA,153,173,50,14 +END + +IDD_DESKBAR_STARTMENU DIALOG DISCARDABLE 0, 0, 210, 194 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Startmenyinställningar" +FONT 8, "MS Sans Serif" +BEGIN +END + +IDD_NOTIFYAREA DIALOGEX 0, 0, 208, 174 +STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_APPWINDOW +CAPTION "Inställningar för meddelandeikoner" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES | + TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31 + LTEXT "&Hjälptext:",IDC_LABEL1,7,44,40,8 + EDITTEXT IDC_NOTIFY_TOOLTIP,58,42,143,14,ES_AUTOHSCROLL + LTEXT "&Fönstertitel:",IDC_LABEL2,7,63,44,8 + EDITTEXT IDC_NOTIFY_TITLE,58,60,143,14,ES_AUTOHSCROLL + LTEXT "&Modulsökväg:",IDC_LABEL3,7,81,43,8 + EDITTEXT IDC_NOTIFY_MODULE,58,78,143,14,ES_AUTOHSCROLL + GROUPBOX "&Visningsläge",IDC_LABEL4,7,96,157,28 + CONTROL "v&isa",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,15,108,33,10 + CONTROL "&dölj",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66, + 108,29,10 + CONTROL "dölj a&utomatiskt",IDC_NOTIFY_AUTOHIDE,"Button", + BS_AUTORADIOBUTTON,112,108,43,10 + ICON "",IDC_PICTURE,173,101,21,20 + LTEXT "&Senast ändrad:",IDC_LABEL6,7,132,43,8 + EDITTEXT IDC_LAST_CHANGE,59,129,105,14,ES_AUTOHSCROLL | + ES_READONLY + CONTROL "visa d&olda",ID_SHOW_HIDDEN_ICONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,154,56,10 + DEFPUSHBUTTON "&OK",IDOK,91,153,50,14,WS_GROUP + PUSHBUTTON "&Avbryt",IDCANCEL,151,153,50,14 +END + +IDD_MDI_SDI DIALOGEX 0, 0, 188, 126 +STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_APPWINDOW +CAPTION "Välj MDI / SDI Läge" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + LTEXT "Välj det gränssnitt du föredrar:",IDC_STATIC,7,7,160,8 + CONTROL "&MDI (multiple document interface)",IDC_MDI,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,30,121,10 + CONTROL "&SDI (single document interface)",IDC_SDI,"Button", + BS_AUTORADIOBUTTON,7,53,115,10 + LTEXT "Den här inställningen kommer att gälla som standard i alla nya explorer-fönster.", + IDC_STATIC,7,76,174,22 + DEFPUSHBUTTON "&OK",IDOK,29,105,50,14,WS_GROUP + PUSHBUTTON "&Avbryt",IDCANCEL,106,105,50,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TITLE "Reactos Explorer" + IDS_START "Start" + IDS_LOGOFF "Logga ut..." + IDS_SHUTDOWN "Stäng av..." + IDS_LAUNCH "Kör..." + IDS_START_HELP "Hjälp" + IDS_SEARCH_FILES "Sök..." + IDS_DOCUMENTS "Dokument" + IDS_FAVORITES "Favoriter" + IDS_PROGRAMS "Program" + IDS_SETTINGS "Inställningar" + IDS_EXPLORE "Utforska" + IDS_EMPTY "(tom)" + IDS_RECENT "Senaste dokumenten" + IDS_ADMIN "Administration" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU "Startmeny" + IDS_MINIMIZE_ALL "minimera alla fönster" + IDS_DESKTOP_NUM "Skrivbord %d" + IDS_VOLUME "Volym" + IDS_ITEMS_CUR "aktuella meddelanden" + IDS_ITEMS_CONFIGURED "konfiguration" + IDS_ITEMS_VISIBLE "synlig" + IDS_ITEMS_HIDDEN "dold" + IDS_NOTIFY_SHOW "visa" + IDS_NOTIFY_HIDE "dölj" + IDS_NOTIFY_AUTOHIDE "dölj automatiskt" + IDS_SHOW_HIDDEN_ICONS "Visa dolda ikoner" + IDS_HIDE_ICONS "Dölj ikoner" + IDS_TERMINATE "Logga ut" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_NETWORK "Nätverk" + IDS_CONNECTIONS "Nätverksanslutningar" + IDS_DRIVES "Enheter" + IDS_SEARCH_COMPUTER "Sök dator..." + IDS_SETTINGS_MENU "Inställningsmeny" + IDS_CONTROL_PANEL "Kontrollpanelen" + IDS_PRINTERS "Skrivare" + IDS_BROWSE "Utforska filer" + IDS_SEARCH_PRG "Sök program..." + IDS_ALL_USERS "Alla användare\\" + IDS_SEARCH "Sök" + IDS_ABOUT_EXPLORER "&Om Explorer..." + IDS_LAUNCH_MANY_PROGRAMS + "Du har valt fler än ett program.\nÄr du säker på att du vill öppna dem alla?" + IDS_DESKTOPBAR_SETTINGS "Skrivbordsinställningar" + IDS_DESKTOP "Skrivbord" + IDS_TASKBAR "Aktivitetsfält" +END + +#endif // Swedish resources ///////////////////////////////////////////////////////////////////////////// @@ -1926,7 +2231,6 @@ BEGIN IDS_TITLE "Explorador do Reactos" IDS_START "Iniciar" IDS_LOGOFF "Terminar sessão..." - IDS_TERMINATE "Terminar ROS Explorador" IDS_SHUTDOWN "Desligar..." IDS_LAUNCH "Executar..." IDS_START_HELP "Ajuda" @@ -1941,6 +2245,24 @@ BEGIN IDS_ADMIN "Administrar" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU "Startmenu" + IDS_MINIMIZE_ALL "mimimize all windows" + IDS_DESKTOP_NUM "Desktop %d" + IDS_VOLUME "Volume" + IDS_ITEMS_CUR "current items" + IDS_ITEMS_CONFIGURED "configuration" + IDS_ITEMS_VISIBLE "visible" + IDS_ITEMS_HIDDEN "hidden" + IDS_NOTIFY_SHOW "show" + IDS_NOTIFY_HIDE "hide" + IDS_NOTIFY_AUTOHIDE "autohide" + IDS_SHOW_HIDDEN_ICONS "Show hidden icons" + IDS_HIDE_ICONS "Hide icons" + IDS_TERMINATE "Terminar ROS Explorador" +END + STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Rede" @@ -1962,517 +2284,9 @@ BEGIN IDS_TASKBAR "Taskbar" END -STRINGTABLE DISCARDABLE -BEGIN - IDS_STARTMENU "Startmenu" - IDS_MINIMIZE_ALL "mimimize all windows" - IDS_DESKTOP_NUM "Desktop %d" - IDS_VOLUME "Volume" - IDS_ITEMS_CUR "current items" - IDS_ITEMS_CONFIGURED "configuration" - IDS_ITEMS_VISIBLE "visible" - IDS_ITEMS_HIDDEN "hidden" - IDS_NOTIFY_SHOW "show" - IDS_NOTIFY_HIDE "hide" - IDS_NOTIFY_AUTOHIDE "autohide" - IDS_SHOW_HIDDEN_ICONS "Show hidden icons" - IDS_HIDE_ICONS "Hide icons" -END - #endif // Portuguese (Portugal) resources ///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Swedish (SE) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SWE) -#ifdef _WIN32 -LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH -#pragma code_page(850) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDM_MDIFRAME MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&Arkiv" - BEGIN - MENUITEM "&Avsluta", ID_FILE_EXIT - END - POPUP "&Visa" - BEGIN - MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR - MENUITEM "&Extrafält", ID_VIEW_EXTRA_BAR - MENUITEM "E&nhetsfält", ID_VIEW_DRIVE_BAR, CHECKED - MENUITEM "S&idfält", ID_VIEW_SIDE_BAR - MENUITEM "&Statusfält", ID_VIEW_STATUSBAR - MENUITEM SEPARATOR - MENUITEM "&Uppdatera\tF5", ID_REFRESH - MENUITEM "F&ullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN - MENUITEM "SDI", ID_VIEW_SDI - END - POPUP "&Fönster" - BEGIN - MENUITEM "Nytt &fönster", ID_WINDOW_NEW - MENUITEM "Överlappande\tShift+F5", ID_WINDOW_CASCADE - MENUITEM "Ordna &horizontellt", ID_WINDOW_TILE_HORZ - MENUITEM "Ordna &vertikalt\tShift+F4", ID_WINDOW_TILE_VERT - MENUITEM "Ordna automatiskt", ID_WINDOW_AUTOSORT - MENUITEM "Ordna &symboler", ID_WINDOW_ARRANGE - END - POPUP "&Verktyg" - BEGIN - MENUITEM "&Alternativ", ID_TOOLS_OPTIONS - END - POPUP "&Hjälp" - BEGIN - MENUITEM "Explorer &FAQ...", ID_EXPLORER_FAQ - MENUITEM "&Om Explorer...", ID_ABOUT_EXPLORER - MENUITEM "Om &OS...", ID_ABOUT_WINDOWS - END -END - -IDM_WINEFILE MENU FIXED IMPURE -BEGIN - POPUP "&Arkiv" - BEGIN - MENUITEM "&Öppna\tEnter", 101 - MENUITEM "&Flytta...\tF7", 106 - MENUITEM "&Kopiera...\tF8", 107 - MENUITEM "&I urklipp...\tF9", 118 - MENUITEM "&Ta bort\tDel", 108 - MENUITEM "&Byt namn...", 109 - MENUITEM "&Egenskaper...\tAlt+Enter", ID_EDIT_PROPERTIES - MENUITEM SEPARATOR - MENUITEM "&Komprimera...", 119 - MENUITEM "Packa &upp...", 120 - MENUITEM SEPARATOR - MENUITEM "&Kör...", ID_EXECUTE - MENUITEM "&Skriv ut...", 102 - MENUITEM "Associera...", 103 - MENUITEM SEPARATOR - MENUITEM "Skapa mapp...", ID_EXECUTE - MENUITEM "&Sök...", 104 - MENUITEM "&Välj filer...", 116 - MENUITEM SEPARATOR - MENUITEM "&Avsluta\tAlt+X", ID_FILE_EXIT - END - POPUP "&Disk" - BEGIN - MENUITEM "&Kopiera disk...", 201 - MENUITEM "&Namnge disk...", 202 - MENUITEM SEPARATOR - MENUITEM "&Formatera disk...", 203 - MENUITEM SEPARATOR - MENUITEM "Anslut &Nätverksenhet", 252 - MENUITEM "&Koppla ifrån Nätverksenhet", 253 - MENUITEM SEPARATOR - MENUITEM "Dela ut...", 254 - MENUITEM "&Ta bort utdelning...", 255 - MENUITEM SEPARATOR - MENUITEM "&Välj enhet...", 251 - END - POPUP "&Mappar" - BEGIN - MENUITEM "&Nästa nivå\t+", 301 - MENUITEM "Utöka &träd\t*", 302 - MENUITEM "Utöka &alla\tCtrl+*", 303 - MENUITEM "Kollapsa &träd\t-", 304 - MENUITEM SEPARATOR - MENUITEM "&Markera undermappar", 505 - END - POPUP "&Visa" - BEGIN - MENUITEM "&Träd och mapp", 413 - MENUITEM "Bara tr&äd", 411 - MENUITEM "Bara &mapp", 412 - MENUITEM SEPARATOR - MENUITEM "De&la", 414 - MENUITEM SEPARATOR - MENUITEM "&Namn", ID_VIEW_NAME - MENUITEM "&Alla Fildetaljer", ID_VIEW_ALL_ATTRIBUTES - , CHECKED - MENUITEM "&Vissa detaljer...", ID_VIEW_SELECTED_ATTRIBUTES - MENUITEM SEPARATOR - MENUITEM "&Sortera efter namn", 404 - MENUITEM "Sortera efter t&yp", 405 - MENUITEM "Sortera efter st&orlek", 406 - MENUITEM "Sortera efter &datum", 407 - MENUITEM SEPARATOR - MENUITEM "Sortera efter &...", 409 - END - POPUP "&Inställningar" - BEGIN - MENUITEM "&Bekräftelse...", 65535 - MENUITEM "&Teckensnitt...", 65535 - MENUITEM "&Konfigurera verktygsfält...", 65535 - MENUITEM SEPARATOR - MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR, CHECKED - MENUITEM "&Enhetsfält", ID_VIEW_DRIVE_BAR, CHECKED - MENUITEM "&Sidfält", ID_VIEW_SIDE_BAR - MENUITEM "St&atusfält", ID_VIEW_STATUSBAR, CHECKED - MENUITEM "F&ullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN - MENUITEM SEPARATOR - MENUITEM "&Symbol efter körning", 65535 - MENUITEM "&Spara ändringar vid stängning", 511 - END - POPUP "&Säkerhet" - BEGIN - MENUITEM "&Åtkomst...", 605 - MENUITEM "&Loggning...", 606 - MENUITEM "&Ägare...", 607 - END - POPUP "&Fönster" - BEGIN - MENUITEM "Nytt &fönster", ID_WINDOW_NEW - MENUITEM "Överlappande\tCtrl+F5", ID_WINDOW_CASCADE - MENUITEM "Ordna &horizontellt", ID_WINDOW_TILE_HORZ - MENUITEM "Ordna &vertikalt\tCtrl+F4", ID_WINDOW_TILE_VERT - MENUITEM "Ordna automatiskt", ID_WINDOW_AUTOSORT - MENUITEM "Ordna &symboler", ID_WINDOW_ARRANGE - MENUITEM "&Uppdatera\tF5", ID_REFRESH - END - POPUP "&?" - BEGIN - MENUITEM "&Hjälpavsnitt\tF1", ID_HELP - MENUITEM "Hjälp &sök...\tF1", ID_HELP - MENUITEM "&Använda hjälpen\tF1", ID_HELP_USING - MENUITEM SEPARATOR - MENUITEM "Information om &Winefile...", ID_ABOUT_WINEFILE - END -END - -IDM_DESKTOPBAR MENU DISCARDABLE -BEGIN - POPUP "" - BEGIN - MENUITEM "&Inställningar...", ID_DESKTOPBAR_SETTINGS - MENUITEM "&Aktivitetshanteraren...", ID_TASKMGR - MENUITEM SEPARATOR - MENUITEM "&Om Explorer...", ID_ABOUT_EXPLORER - END -END - -IDM_VOLUME MENU DISCARDABLE -BEGIN - POPUP "" - BEGIN - MENUITEM "Öppna volymkontroll", ID_TRAY_VOLUME - MENUITEM "Justera ljudinställningar", ID_VOLUME_PROPERTIES - END -END - -IDM_NOTIFYAREA MENU DISCARDABLE -BEGIN - POPUP "" - BEGIN - MENUITEM "&Visa dolda ikoner", ID_SHOW_HIDDEN_ICONS - MENUITEM "Visa &ikonknapp", ID_SHOW_ICON_BUTTON - MENUITEM "&Konfigurera meddelanden...", ID_CONFIG_NOTIFYAREA - MENUITEM "Justera &datum och &tid...", ID_CONFIG_TIME - MENUITEM SEPARATOR - MENUITEM "&Om Explorer...", ID_ABOUT_EXPLORER - END -END - -IDM_SDIFRAME MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&Arkiv" - BEGIN - MENUITEM "&Avsluta", ID_FILE_EXIT - END - POPUP "&Visa" - BEGIN - MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR - MENUITEM "&Sidfält", ID_VIEW_SIDE_BAR, GRAYED - MENUITEM "&Statusfält", ID_VIEW_STATUSBAR - MENUITEM SEPARATOR - MENUITEM "&Uppdatera\tF5", ID_REFRESH - MENUITEM "&Fullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN - MENUITEM "&MDI", ID_VIEW_MDI - END - POPUP "&Verktyg" - BEGIN - MENUITEM "&Alternativ", ID_TOOLS_OPTIONS - END - POPUP "&Hjälp" - BEGIN - MENUITEM "Explorer &FAQ...", ID_EXPLORER_FAQ - MENUITEM "&Om Explorer...", ID_ABOUT_EXPLORER - MENUITEM "Om &OS...", ID_ABOUT_WINDOWS - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Kör" -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "",101,"Static",SS_SIMPLE | SS_NOPREFIX,3,6,162,10 - CONTROL "&Kommando:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3, - 18,60,10 - EDITTEXT 201,3,29,134,12,ES_AUTOHSCROLL - CONTROL "&Som symbol",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 45,71,12 - DEFPUSHBUTTON "&OK",1,158,6,47,14 - PUSHBUTTON "&Avbryt",2,158,23,47,14 - PUSHBUTTON "&Hjälp",254,158,43,47,14 -END - -IDD_SEARCH_PROGRAM DIALOGEX 0, 0, 200, 65 -STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU | WS_THICKFRAME -EXSTYLE WS_EX_APPWINDOW -CAPTION "Sök program på startmenyn" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - LTEXT "&Filter:",IDC_STATIC,7,9,18,8 - EDITTEXT IDC_FILTER,34,7,100,14,ES_AUTOHSCROLL - CONTROL "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT | - LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | - WS_TABSTOP,7,25,186,33 - PUSHBUTTON "&Kontrollera poster",IDC_CHECK_ENTRIES,143,7,50,14 -END - -IDD_DESKBAR_DESKTOP DIALOG DISCARDABLE 0, 0, 212, 194 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Skrivbordsinställningar" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Välj från vilket hörn ock åt vilket håll du föredrar att rada upp ikonerna:", - IDC_STATIC,7,7,166,8 - CONTROL "vä. och neråt",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,7,25,46,44 - CONTROL "övre åt hö.",IDC_ICON_ALIGN_1,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,57,25,46,44 - CONTROL "övre åt vä.",IDC_ICON_ALIGN_2,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,110,25,46,44 - CONTROL "hö. och neråt",IDC_ICON_ALIGN_3,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,159,25,46,44 - CONTROL "vä. och uppåt",IDC_ICON_ALIGN_4,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,7,73,46,44 - CONTROL "nedre åt hö.",IDC_ICON_ALIGN_5,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,57,73,46,44 - CONTROL "nedre åt vä.",IDC_ICON_ALIGN_6,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,110,73,46,44 - CONTROL "hö. och uppåt",IDC_ICON_ALIGN_7,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,159,73,46,44 - CONTROL "sidor och ner",IDC_ICON_ALIGN_8,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,7,121,46,44 - CONTROL "kanter",IDC_ICON_ALIGN_9,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,57,121,46,44 - CONTROL "runt om",IDC_ICON_ALIGN_10,"Button",BS_OWNERDRAW | - BS_BOTTOM | WS_TABSTOP,110,121,46,44 - CONTROL "",IDC_ICON_ALIGN_11,"Button",BS_OWNERDRAW | BS_BOTTOM | - WS_TABSTOP,159,121,46,44 - CONTROL "Visa &versionsnummer",ID_DESKTOP_VERSION,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,177,91,10 -END - -IDD_DESKBAR_TASKBAR DIALOG DISCARDABLE 0, 0, 210, 194 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Aktivitetsfältsinställningar" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "visa &klockan",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,152,52,10 - CONTROL "&Göm inaktiva meddelandeikoner", - ID_HIDE_INACTIVE_ICONS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,174,111,10 - PUSHBUTTON "&Meddelanden...",ID_CONFIG_NOTIFYAREA,153,173,50,14 -END - -IDD_DESKBAR_STARTMENU DIALOG DISCARDABLE 0, 0, 210, 194 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Startmenyinställningar" -FONT 8, "MS Sans Serif" -BEGIN -END - -IDD_NOTIFYAREA DIALOGEX 0, 0, 208, 174 -STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU | WS_THICKFRAME -EXSTYLE WS_EX_APPWINDOW -CAPTION "Inställningar för meddelandeikoner" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES | - TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31 - LTEXT "&Hjälptext:",IDC_LABEL1,7,44,40,8 - EDITTEXT IDC_NOTIFY_TOOLTIP,58,42,143,14,ES_AUTOHSCROLL - LTEXT "&Fönstertitel:",IDC_LABEL2,7,63,44,8 - EDITTEXT IDC_NOTIFY_TITLE,58,60,143,14,ES_AUTOHSCROLL - LTEXT "&Modulsökväg:",IDC_LABEL3,7,81,43,8 - EDITTEXT IDC_NOTIFY_MODULE,58,78,143,14,ES_AUTOHSCROLL - GROUPBOX "&Visningsläge",IDC_LABEL4,7,96,157,28 - CONTROL "v&isa",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,15,108,33,10 - CONTROL "&dölj",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66, - 108,29,10 - CONTROL "dölj a&utomatiskt",IDC_NOTIFY_AUTOHIDE,"Button", - BS_AUTORADIOBUTTON,112,108,43,10 - ICON "",IDC_PICTURE,173,101,21,20 - LTEXT "&Senast ändrad:",IDC_LABEL6,7,132,43,8 - EDITTEXT IDC_LAST_CHANGE,59,129,105,14,ES_AUTOHSCROLL | - ES_READONLY - CONTROL "visa d&olda",ID_SHOW_HIDDEN_ICONS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,154,56,10 - DEFPUSHBUTTON "&OK",IDOK,91,153,50,14,WS_GROUP - PUSHBUTTON "&Avbryt",IDCANCEL,151,153,50,14 -END - -IDD_MDI_SDI DIALOGEX 0, 0, 188, 126 -STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -EXSTYLE WS_EX_APPWINDOW -CAPTION "Välj MDI / SDI Läge" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - LTEXT "Välj det gränssnitt du föredrar:", - IDC_STATIC,7,7,160,8 - CONTROL "&MDI (multiple document interface)",IDC_MDI,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,30,121,10 - CONTROL "&SDI (single document interface)",IDC_SDI,"Button", - BS_AUTORADIOBUTTON,7,53,115,10 - LTEXT "Den här inställningen kommer att gälla som standard i alla nya explorer-fönster.", - IDC_STATIC,7,76,174,22 - DEFPUSHBUTTON "&OK",IDOK,29,105,50,14,WS_GROUP - PUSHBUTTON "&Avbryt",IDCANCEL,106,105,50,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_SEARCH_PROGRAM, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 193 - TOPMARGIN, 7 - BOTTOMMARGIN, 58 - END - - IDD_DESKBAR_DESKTOP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 205 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_DESKBAR_TASKBAR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_DESKBAR_STARTMENU, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END - - IDD_NOTIFYAREA, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 201 - TOPMARGIN, 7 - BOTTOMMARGIN, 167 - END - - IDD_MDI_SDI, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 181 - TOPMARGIN, 7 - BOTTOMMARGIN, 119 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_TITLE "Reactos Explorer" - IDS_START "Start" - IDS_LOGOFF "Logga ut..." - IDS_TERMINATE "Logga ut" - IDS_SHUTDOWN "Stäng av..." - IDS_LAUNCH "Kör..." - IDS_START_HELP "Hjälp" - IDS_SEARCH_FILES "Sök..." - IDS_DOCUMENTS "Dokument" - IDS_FAVORITES "Favoriter" - IDS_PROGRAMS "Program" - IDS_SETTINGS "Inställningar" - IDS_EXPLORE "Utforska" - IDS_EMPTY "(tom)" - IDS_RECENT "Senaste dokumenten" - IDS_ADMIN "Administration" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_NETWORK "Nätverk" - IDS_CONNECTIONS "Nätverksanslutningar" - IDS_DRIVES "Enheter" - IDS_SEARCH_COMPUTER "Sök dator..." - IDS_SETTINGS_MENU "Inställningsmeny" - IDS_CONTROL_PANEL "Kontrollpanelen" - IDS_PRINTERS "Skrivare" - IDS_BROWSE "Utforska filer" - IDS_SEARCH_PRG "Sök program..." - IDS_ALL_USERS "Alla användare\\" - IDS_SEARCH "Sök" - IDS_ABOUT_EXPLORER "&Om Explorer..." - IDS_LAUNCH_MANY_PROGRAMS - "Du har valt fler än ett program.\nÄr du säker på att du vill öppna dem alla?" - IDS_DESKTOPBAR_SETTINGS "Skrivbordsinställningar" - IDS_DESKTOP "Skrivbord" - IDS_TASKBAR "Aktivitetsfält" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STARTMENU "Startmeny" - IDS_MINIMIZE_ALL "minimera alla fönster" - IDS_DESKTOP_NUM "Skrivbord %d" - IDS_VOLUME "Volym" - IDS_ITEMS_CUR "aktuella meddelanden" - IDS_ITEMS_CONFIGURED "konfiguration" - IDS_ITEMS_VISIBLE "synlig" - IDS_ITEMS_HIDDEN "dold" - IDS_NOTIFY_SHOW "visa" - IDS_NOTIFY_HIDE "dölj" - IDS_NOTIFY_AUTOHIDE "dölj automatiskt" - IDS_SHOW_HIDDEN_ICONS "Visa dolda ikoner" - IDS_HIDE_ICONS "Dölj ikoner" -END - -#endif // Swedish (SE) resources -///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED @@ -2480,6 +2294,10 @@ END // // Generated from the TEXTINCLUDE 3 resource. // +#ifndef ROSSHELL +IDB_IMAGES BITMAP DISCARDABLE "res/images.bmp" +IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp" +#endif #ifndef _ROS_ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE diff --git a/reactos/subsys/system/explorer/globals.h b/reactos/subsys/system/explorer/globals.h index 5cc9371657c..e28a9c3b2f8 100644 --- a/reactos/subsys/system/explorer/globals.h +++ b/reactos/subsys/system/explorer/globals.h @@ -239,11 +239,14 @@ extern struct ExplorerGlobals XMLPos get_cfg(const char* path); HINSTANCE _hInstance; - ATOM _hframeClass; UINT _cfStrFName; + +#ifndef ROSSHELL + ATOM _hframeClass; HWND _hMainWnd; - bool _prescan_nodes; bool _desktop_mode; + bool _prescan_nodes; +#endif FILE* _log; diff --git a/reactos/subsys/system/explorer/make_rosshell.dsp b/reactos/subsys/system/explorer/make_rosshell.dsp new file mode 100644 index 00000000000..b6787e30993 --- /dev/null +++ b/reactos/subsys/system/explorer/make_rosshell.dsp @@ -0,0 +1,155 @@ +# Microsoft Developer Studio Project File - Name="make_rosshell" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=make_rosshell - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "make_rosshell.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "make_rosshell.mak" CFG="make_rosshell - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "make_rosshell - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "make_rosshell - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE "make_rosshell - Win32 Unicode Debug" (based on "Win32 (x86) External Target") +!MESSAGE "make_rosshell - Win32 Unicode Release" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "make_rosshell - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Cmd_Line "NMAKE /f make_rosshell.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "make_rosshell.exe" +# PROP BASE Bsc_Name "make_rosshell.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Make-rosshell.MinGW UNICODE=0" +# PROP Rebuild_Opt "clean all" +# PROP Target_File "rosshell.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "make_rosshell - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Cmd_Line "NMAKE /f make_rosshell.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "make_rosshell.exe" +# PROP BASE Bsc_Name "make_rosshell.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Make-rosshell.MinGW UNICODE=0 DEBUG=1" +# PROP Rebuild_Opt "clean all" +# PROP Target_File "rosshell.exe" +# PROP Bsc_Name "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile.MinGW UNICODE=0 DEBUG=1" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "make_rosshell - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "UDebug" +# PROP BASE Intermediate_Dir "UDebug" +# PROP BASE Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile.MinGW UNICODE=1 DEBUG=1" +# PROP BASE Rebuild_Opt "clean all" +# PROP BASE Target_File "rosshell.exe" +# PROP BASE Bsc_Name "" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "UDebug" +# PROP Intermediate_Dir "UDebug" +# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile.MinGW UNICODE=1 DEBUG=1" +# PROP Rebuild_Opt "clean all" +# PROP Target_File "rosshell.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "make_rosshell - Win32 Unicode Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "URelease" +# PROP BASE Intermediate_Dir "URelease" +# PROP BASE Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile.MinGW UNICODE=1" +# PROP BASE Rebuild_Opt "clean all" +# PROP BASE Target_File "rosshell.exe" +# PROP BASE Bsc_Name "" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "URelease" +# PROP Intermediate_Dir "URelease" +# PROP Cmd_Line "msdevfilt -gcc make -f Make-rosshell.MinGW UNICODE=1" +# PROP Rebuild_Opt "clean all" +# PROP Target_File "rosshell.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "make_rosshell - Win32 Release" +# Name "make_rosshell - Win32 Debug" +# Name "make_rosshell - Win32 Unicode Debug" +# Name "make_rosshell - Win32 Unicode Release" + +!IF "$(CFG)" == "make_rosshell - Win32 Release" + +!ELSEIF "$(CFG)" == "make_rosshell - Win32 Debug" + +!ELSEIF "$(CFG)" == "make_rosshell - Win32 Unicode Debug" + +!ELSEIF "$(CFG)" == "make_rosshell - Win32 Unicode Release" + +!ENDIF + +# Begin Source File + +SOURCE=.\Jamfile +# End Source File +# Begin Source File + +SOURCE=".\Make-rosshell.MinGW" +# End Source File +# Begin Source File + +SOURCE=.\Makefile +# End Source File +# Begin Source File + +SOURCE=.\Makefile.MinGW +# End Source File +# Begin Source File + +SOURCE=.\Makefile.Wine +# End Source File +# End Target +# End Project diff --git a/reactos/subsys/system/explorer/rosshell.dsp b/reactos/subsys/system/explorer/rosshell.dsp new file mode 100644 index 00000000000..1e2f959089e --- /dev/null +++ b/reactos/subsys/system/explorer/rosshell.dsp @@ -0,0 +1,608 @@ +# Microsoft Developer Studio Project File - Name="rosshell" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rosshell - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "rosshell.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "rosshell.mak" CFG="rosshell - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "rosshell - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rosshell - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "rosshell - Win32 Debug Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rosshell - Win32 Unicode Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rosshell - Win32 Unicode Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rosshell - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /O1 /D "NDEBUG" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /D "ROSSHELL" /Yu"precomp.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /machine:I386 /libpath:"Release" /delayload:oleaut32.dll /delayload:wsock32.dll +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "rosshell - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /D "ROSSHELL" /FR /Yu"precomp.h" /FD /GZ /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"Debug" /delayload:oleaut32.dll /delayload:wsock32.dll +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "rosshell - Win32 Debug Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "DRelease" +# PROP BASE Intermediate_Dir "DRelease" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "DRelease" +# PROP Intermediate_Dir "DRelease" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_ROS_" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /D "ROSSHELL" /FR /Yu"precomp.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /debug /machine:I386 /delayload:oleaut32.dll /delayload:wsock32.dll +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "rosshell - Win32 Unicode Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "URelease" +# PROP BASE Intermediate_Dir "URelease" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "URelease" +# PROP Intermediate_Dir "URelease" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /D "ROSSHELL" /Yu"precomp.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /machine:I386 /libpath:"Release" /delayload:oleaut32.dll /delayload:wsock32.dll +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "rosshell - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "UDebug" +# PROP BASE Intermediate_Dir "UDebug" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "UDebug" +# PROP Intermediate_Dir "UDebug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /FR /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /D "ROSSHELL" /FR /Yu"precomp.h" /FD /GZ /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"Debug" /delayload:oleaut32.dll /delayload:wsock32.dll +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "rosshell - Win32 Release" +# Name "rosshell - Win32 Debug" +# Name "rosshell - Win32 Debug Release" +# Name "rosshell - Win32 Unicode Release" +# Name "rosshell - Win32 Unicode Debug" +# Begin Group "utility" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\utility\dragdropimpl.cpp +# End Source File +# Begin Source File + +SOURCE=.\utility\dragdropimpl.h +# End Source File +# Begin Source File + +SOURCE=.\utility\shellbrowserimpl.cpp +# End Source File +# Begin Source File + +SOURCE=.\utility\shellbrowserimpl.h +# End Source File +# Begin Source File + +SOURCE=.\utility\shellclasses.cpp +# End Source File +# Begin Source File + +SOURCE=.\utility\shellclasses.h +# End Source File +# Begin Source File + +SOURCE=.\utility\treedroptarget.h +# End Source File +# Begin Source File + +SOURCE=.\utility\utility.cpp +# End Source File +# Begin Source File + +SOURCE=.\utility\utility.h +# End Source File +# Begin Source File + +SOURCE=.\utility\window.cpp +# End Source File +# Begin Source File + +SOURCE=.\utility\window.h +# End Source File +# Begin Source File + +SOURCE=.\utility\xmlstorage.cpp +# End Source File +# Begin Source File + +SOURCE=.\utility\xmlstorage.h +# End Source File +# End Group +# Begin Group "resources" + +# PROP Default_Filter "bmp,ico" +# Begin Source File + +SOURCE=.\res\action.ico +# End Source File +# Begin Source File + +SOURCE=.\res\appicon.ico +# End Source File +# Begin Source File + +SOURCE=.\res\apps.ico +# End Source File +# Begin Source File + +SOURCE=.\res\arrow.ico +# End Source File +# Begin Source File + +SOURCE=.\res\arrow_dwn.ico +# End Source File +# Begin Source File + +SOURCE=.\res\arrow_up.ico +# End Source File +# Begin Source File + +SOURCE=.\res\arrowsel.ico +# End Source File +# Begin Source File + +SOURCE=.\res\computer.ico +# End Source File +# Begin Source File + +SOURCE=.\res\config.ico +# End Source File +# Begin Source File + +SOURCE=.\res\documents.ico +# End Source File +# Begin Source File + +SOURCE=.\res\dot.ico +# End Source File +# Begin Source File + +SOURCE=.\res\dot_red.ico +# End Source File +# Begin Source File + +SOURCE=.\res\dot_trans.ico +# End Source File +# Begin Source File + +SOURCE=.\res\drivebar.bmp +# End Source File +# Begin Source File + +SOURCE=".\explorer-jp.rc" +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\res\explorer.ico +# End Source File +# Begin Source File + +SOURCE=.\explorer_intres.h +# End Source File +# Begin Source File + +SOURCE=.\explorer_intres.rc +# End Source File +# Begin Source File + +SOURCE=.\res\favorites.ico +# End Source File +# Begin Source File + +SOURCE=.\res\floating.ico +# End Source File +# Begin Source File + +SOURCE=.\res\folder.ico +# End Source File +# Begin Source File + +SOURCE=.\res\icoali10.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig0.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig1.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig2.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig3.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig4.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig5.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig6.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig7.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig8.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icoalig9.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\images.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\info.ico +# End Source File +# Begin Source File + +SOURCE=.\res\logoff.ico +# End Source File +# Begin Source File + +SOURCE=.\res\logov.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\logov16.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\logov256.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\network.ico +# End Source File +# Begin Source File + +SOURCE=.\res\notify_l.ico +# End Source File +# Begin Source File + +SOURCE=.\res\notify_r.ico +# End Source File +# Begin Source File + +SOURCE=.\res\printer.ico +# End Source File +# Begin Source File + +SOURCE=.\res\reactos.ico +# End Source File +# Begin Source File + +SOURCE=".\res\ros-big.ico" +# End Source File +# Begin Source File + +SOURCE=".\res\search-doc.ico" +# End Source File +# Begin Source File + +SOURCE=.\res\search.ico +# End Source File +# Begin Source File + +SOURCE=.\res\speaker.ico +# End Source File +# Begin Source File + +SOURCE=.\res\startmenu.ico +# End Source File +# End Group +# Begin Group "taskbar" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\taskbar\desktopbar.cpp +# End Source File +# Begin Source File + +SOURCE=.\taskbar\desktopbar.h +# End Source File +# Begin Source File + +SOURCE=.\taskbar\favorites.cpp +# End Source File +# Begin Source File + +SOURCE=.\taskbar\favorites.h +# End Source File +# Begin Source File + +SOURCE=.\notifyhook\notifyhook.h +# End Source File +# Begin Source File + +SOURCE=.\taskbar\quicklaunch.cpp +# End Source File +# Begin Source File + +SOURCE=.\taskbar\quicklaunch.h +# End Source File +# Begin Source File + +SOURCE=.\taskbar\startmenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\taskbar\startmenu.h +# End Source File +# Begin Source File + +SOURCE=.\taskbar\taskbar.cpp +# End Source File +# Begin Source File + +SOURCE=.\taskbar\taskbar.h +# End Source File +# Begin Source File + +SOURCE=.\taskbar\traynotify.cpp +# End Source File +# Begin Source File + +SOURCE=.\taskbar\traynotify.h +# End Source File +# End Group +# Begin Group "desktop" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\desktop\desktop.cpp +# End Source File +# Begin Source File + +SOURCE=.\desktop\desktop.h +# End Source File +# End Group +# Begin Group "shell" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\shell\entries.cpp +# End Source File +# Begin Source File + +SOURCE=.\shell\entries.h +# End Source File +# Begin Source File + +SOURCE=.\shell\filechild.h +# End Source File +# Begin Source File + +SOURCE=.\shell\pane.cpp +# End Source File +# Begin Source File + +SOURCE=.\shell\pane.h +# End Source File +# Begin Source File + +SOURCE=.\shell\shellbrowser.h +# End Source File +# Begin Source File + +SOURCE=.\shell\shellfs.cpp +# End Source File +# Begin Source File + +SOURCE=.\shell\shellfs.h +# End Source File +# Begin Source File + +SOURCE=.\shell\winfs.cpp +# End Source File +# Begin Source File + +SOURCE=.\shell\winfs.h +# End Source File +# End Group +# Begin Group "dialogs" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\dialogs\searchprogram.cpp +# End Source File +# Begin Source File + +SOURCE=.\dialogs\searchprogram.h +# End Source File +# Begin Source File + +SOURCE=.\dialogs\settings.cpp +# End Source File +# Begin Source File + +SOURCE=.\dialogs\settings.h +# End Source File +# End Group +# Begin Group "main" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\explorer.cpp +# End Source File +# Begin Source File + +SOURCE=.\explorer.h +# End Source File +# Begin Source File + +SOURCE=.\externals.h +# End Source File +# Begin Source File + +SOURCE=.\globals.h +# End Source File +# Begin Source File + +SOURCE=".\i386-stub-win32.c" +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\precomp.cpp +# ADD CPP /Yc"precomp.h" +# End Source File +# Begin Source File + +SOURCE=.\precomp.h +# End Source File +# End Group +# Begin Group "services" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\services\shellservices.cpp +# End Source File +# Begin Source File + +SOURCE=.\services\shellservices.h +# End Source File +# Begin Source File + +SOURCE=.\services\startup.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# End Group +# End Target +# End Project diff --git a/reactos/subsys/system/explorer/rosshell.dsw b/reactos/subsys/system/explorer/rosshell.dsw new file mode 100644 index 00000000000..a4b210436b6 --- /dev/null +++ b/reactos/subsys/system/explorer/rosshell.dsw @@ -0,0 +1,56 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rosshell"=.\rosshell.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name notifyhook + End Project Dependency +}}} + +############################################################################### + +Project: "make_rosshell"=.\make_rosshell.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "notifyhook"=.\notifyhook\notifyhook.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/reactos/subsys/system/explorer/shell/entries.cpp b/reactos/subsys/system/explorer/shell/entries.cpp index 3dfff9ea5cc..ab75f9d4a04 100644 --- a/reactos/subsys/system/explorer/shell/entries.cpp +++ b/reactos/subsys/system/explorer/shell/entries.cpp @@ -141,6 +141,7 @@ void Entry::read_directory_base(SORT_ORDER sortOrder, int scan_flags) // call into subclass read_directory(scan_flags); +#ifndef ROSSHELL if (g_Globals._prescan_nodes) { //@todo _prescan_nodes should not be used for reading the start menu. for(Entry*entry=_down; entry; entry=entry->_next) if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { @@ -148,6 +149,7 @@ void Entry::read_directory_base(SORT_ORDER sortOrder, int scan_flags) entry->sort_directory(sortOrder); } } +#endif sort_directory(sortOrder); } diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp index be20039d0b8..89b4cd36c92 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp @@ -69,7 +69,7 @@ HWND DesktopBar::Create() RECT rect; - rect.left = -2; // hide left border + rect.left = -2; // hide left border #ifdef TASKBAR_AT_TOP rect.top = -2; // hide top border #else @@ -105,7 +105,7 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs) // create task bar _hwndTaskBar = TaskBar::Create(_hwnd); -#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003) +#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003) if (!g_Globals._SHRestricted || !SHRestricted(REST_NOTRAYITEMSDISPLAY)) #endif // create tray notification area @@ -222,6 +222,10 @@ LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) Resize(LOWORD(lparam), HIWORD(lparam)); break; + case WM_SIZING: + ControlResize(wparam, lparam); + break; + case PM_RESIZE_CHILDREN: { ClientRect size(_hwnd); Resize(size.right, size.bottom); @@ -336,7 +340,7 @@ int DesktopBar::Command(int id, int code) g_Globals._desktops.SwitchToDesktop(desktop_idx); - if (_hwndQuickLaunch) + if (_hwndQuickLaunch) PostMessage(_hwndQuickLaunch, PM_UPDATE_DESKTOP, desktop_idx, 0); break;} @@ -391,6 +395,35 @@ LRESULT DesktopBar::ProcessCopyData(COPYDATASTRUCT* pcd) } +void DesktopBar::ControlResize(WPARAM wparam, LPARAM lparam) +{ + PRECT dragRect = (PRECT) lparam; + //int screenWidth = GetSystemMetrics(SM_CXSCREEN); + int screenHeight = GetSystemMetrics(SM_CYSCREEN); + + ///@todo write code for taskbar being at sides or top. + + switch(wparam) { + case WMSZ_BOTTOM: //@todo Taskbar is at the top of the screen + break; + + case WMSZ_TOP: // Taskbar is at the bottom of the screen + dragRect->top = screenHeight - (((screenHeight - dragRect->top) + DESKTOPBARBAR_HEIGHT/2) / DESKTOPBARBAR_HEIGHT) * DESKTOPBARBAR_HEIGHT; + if (dragRect->top < screenHeight / 2) + dragRect->top = screenHeight - (screenHeight/2 / DESKTOPBARBAR_HEIGHT * DESKTOPBARBAR_HEIGHT); + else if (dragRect->top > screenHeight - 5) + dragRect->top = screenHeight - 5; + break; + + case WMSZ_RIGHT: //@todo Taskbar is at the left of the screen + break; + + case WMSZ_LEFT: //@todo Taskbar is at the right of the screen + break; + } +} + + #ifdef _ROS_ void DesktopBar::AddTrayIcons() @@ -403,7 +436,7 @@ void DesktopBar::TrayClick(UINT id, int btn) switch(id) { case ID_TRAY_VOLUME: if (btn == TRAYBUTTON_LEFT) - SetTimer(_hwnd, ID_TRAY_VOLUME, 500, NULL); // wait a bit to correctly handle double clicks + SetTimer(_hwnd, ID_TRAY_VOLUME, 500, NULL); // wait a bit to correctly handle double clicks else { PopupMenu menu(IDM_VOLUME); SetMenuDefaultItem(menu, 0, MF_BYPOSITION); diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.h b/reactos/subsys/system/explorer/taskbar/desktopbar.h index c0d8e1c8cbb..5c187c7056b 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.h +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.h @@ -92,6 +92,7 @@ protected: int Command(int id, int code); void Resize(int cx, int cy); + void ControlResize(WPARAM wparam, LPARAM lparam); void RegisterHotkeys(); void ProcessHotKey(int id_hotkey); void ShowStartMenu(); diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.cpp b/reactos/subsys/system/explorer/taskbar/startmenu.cpp index bb3664c39c4..dda431f248b 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.cpp +++ b/reactos/subsys/system/explorer/taskbar/startmenu.cpp @@ -41,6 +41,11 @@ #include "../dialogs/settings.h" +#define SHELLPATH_CONTROL_PANEL TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}") +#define SHELLPATH_PRINTERS TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}") +#define SHELLPATH_NET_CONNECTIONS TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}") + + StartMenu::StartMenu(HWND hwnd) : super(hwnd) { @@ -214,25 +219,52 @@ void StartMenu::AddEntries() #endif } - AddShellEntries(dir, -1, smd._subfolders); + AddShellEntries(dir, -1, smd._ignore); } } -void StartMenu::AddShellEntries(const ShellDirectory& dir, int max, bool subfolders) +static LPTSTR trim_path_slash(LPTSTR path) { - int cnt = 0; + LPTSTR p = path; + while(*p) + ++p; + + if (p>path && (p[-1]=='\\' || p[-1]=='/')) + *--p = '\0'; + + return path; +} + +void StartMenu::AddShellEntries(const ShellDirectory& dir, int max, const String& ignore) +{ + TCHAR ignore_path[MAX_PATH], ignore_dir[MAX_PATH], ignore_name[_MAX_FNAME], ignore_ext[_MAX_EXT]; + TCHAR dir_path[MAX_PATH]; + + if (!ignore.empty()) { + _tsplitpath(ignore, ignore_path, ignore_dir, ignore_name, ignore_ext); + + _tcscat(ignore_path, ignore_dir); + _tcscat(ignore_name, ignore_ext); + + dir.get_path(dir_path); + + if (_tcsicmp(trim_path_slash(dir_path), trim_path_slash(ignore_path))) + *ignore_name = '\0'; + } else + *ignore_name = '\0'; + + int cnt = 0; for(Entry*entry=dir._down; entry; entry=entry->_next) { // hide files like "desktop.ini" if (entry->_shell_attribs & SFGAO_HIDDEN) //not appropriate for drive roots: if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) continue; - // hide subfolders if requested - if (!subfolders) - if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - continue; + // hide "Programs" subfolders if requested + if (*ignore_name && !_tcsicmp(entry->_data.cFileName, ignore_name)) + continue; // only 'max' entries shall be added. if (++cnt == max) @@ -1489,7 +1521,7 @@ StartMenuRoot::StartMenuRoot(HWND hwnd) try { // insert directory "All Users\Start Menu" ShellDirectory cmn_startmenu(GetDesktopFolder(), SpecialFolderPath(CSIDL_COMMON_STARTMENU, _hwnd), _hwnd); - _dirs.push_back(StartMenuDirectory(cmn_startmenu, false)); // don't add subfolders + _dirs.push_back(StartMenuDirectory(cmn_startmenu, (LPCTSTR)SpecialFolderFSPath(CSIDL_COMMON_PROGRAMS, _hwnd))); } catch(COMException&) { // ignore exception and don't show additional shortcuts } @@ -1498,7 +1530,7 @@ StartMenuRoot::StartMenuRoot(HWND hwnd) // insert directory "\Start Menu" ShellDirectory usr_startmenu(GetDesktopFolder(), SpecialFolderPath(CSIDL_STARTMENU, _hwnd), _hwnd); - _dirs.push_back(StartMenuDirectory(usr_startmenu, false)); // don't add subfolders + _dirs.push_back(StartMenuDirectory(usr_startmenu, (LPCTSTR)SpecialFolderFSPath(CSIDL_PROGRAMS, _hwnd))); } catch(COMException&) { // ignore exception and don't show additional shortcuts } @@ -1856,6 +1888,7 @@ int StartMenuHandler::Command(int id, int code) case IDC_CONTROL_PANEL: { CloseStartMenu(id); +#ifndef ROSSHELL #ifndef _NO_MDI XMLPos explorer_options = g_Globals.get_cfg("general/explorer"); bool mdi = XMLBool(explorer_options, "mdi", true); @@ -1865,6 +1898,9 @@ int StartMenuHandler::Command(int id, int code) else #endif SDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"), 0); +#else + launch_file(_hwnd, SHELLPATH_CONTROL_PANEL); +#endif break;} case IDC_SETTINGS_MENU: @@ -1873,6 +1909,8 @@ int StartMenuHandler::Command(int id, int code) case IDC_PRINTERS: { CloseStartMenu(id); + +#ifndef ROSSHELL #ifdef _ROS_ // to be removed when printer folder will be implemented MessageBox(0, TEXT("printer folder not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK); #else @@ -1885,6 +1923,9 @@ int StartMenuHandler::Command(int id, int code) else #endif SDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}"), 0); +#endif +#else + launch_file(_hwnd, SHELLPATH_PRINTERS); #endif break;} @@ -1901,14 +1942,26 @@ int StartMenuHandler::Command(int id, int code) break; case IDC_ADMIN: +#ifndef ROSSHELL CreateSubmenu(id, CSIDL_COMMON_ADMINTOOLS, CSIDL_ADMINTOOLS, ResString(IDS_ADMIN)); + //CloseStartMenu(id); + //MainFrame::Create(SpecialFolderPath(CSIDL_COMMON_ADMINTOOLS, _hwnd), OWM_PIDL); +#else + launch_file(_hwnd, SpecialFolderFSPath(CSIDL_COMMON_ADMINTOOLS, _hwnd)); +#endif break; case IDC_CONNECTIONS: +#ifndef ROSSHELL #ifdef _ROS_ // to be removed when RAS will be implemented MessageBox(0, TEXT("RAS folder not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK); #else CreateSubmenu(id, CSIDL_CONNECTIONS, ResString(IDS_CONNECTIONS)); + //CloseStartMenu(id); + //MainFrame::Create(SpecialFolderPath(CSIDL_CONNECTIONS, _hwnd), OWM_PIDL); +#endif +#else + launch_file(_hwnd, SHELLPATH_NET_CONNECTIONS); #endif break; @@ -2030,7 +2083,7 @@ void SettingsMenu::AddEntries() { super::AddEntries(); -#ifdef _ROS_ // to be removed when printer/network will be implemented +#if defined(ROSSHELL) || defined(_ROS_) // _ROS_ to be removed when printer/network will be implemented AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, false, IDC_PRINTERS_MENU); AddButton(ResString(IDS_CONNECTIONS), ICID_NETWORK, false, IDC_CONNECTIONS); #else @@ -2061,7 +2114,7 @@ void BrowseMenu::AddEntries() #ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003) if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ? #endif -#ifdef _ROS_ // to be removed when printer/network will be implemented +#if defined(ROSSHELL) || defined(_ROS_) // _ROS_ to be removed when printer/network will be implemented AddButton(ResString(IDS_NETWORK), ICID_NETWORK, false, IDC_NETWORK); #else AddButton(ResString(IDS_NETWORK), ICID_NETWORK, true, IDC_NETWORK); @@ -2102,7 +2155,7 @@ void RecentStartMenu::AddEntries() } dir.sort_directory(SORT_DATE); - AddShellEntries(dir, RECENT_DOCS_COUNT, smd._subfolders); + AddShellEntries(dir, RECENT_DOCS_COUNT, smd._ignore); ///@todo read max. count of entries from registry } } diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.h b/reactos/subsys/system/explorer/taskbar/startmenu.h index 1840bc9f7f3..43307556fb9 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.h +++ b/reactos/subsys/system/explorer/taskbar/startmenu.h @@ -56,8 +56,8 @@ /// StartMenuDirectory is used to store the base directory of start menus. struct StartMenuDirectory { - StartMenuDirectory(const ShellDirectory& dir, bool subfolders=true) - : _dir(dir), _subfolders(subfolders) + StartMenuDirectory(const ShellDirectory& dir, const String& ignore="") + : _dir(dir), _ignore(ignore) { } @@ -67,7 +67,7 @@ struct StartMenuDirectory } ShellDirectory _dir; - bool _subfolders; + String _ignore; }; typedef list StartMenuShellDirs; @@ -280,7 +280,7 @@ protected: ShellEntryMap::iterator AddEntry(const ShellFolder folder, ShellEntry* entry); ShellEntryMap::iterator AddEntry(const ShellFolder folder, Entry* entry); - void AddShellEntries(const ShellDirectory& dir, int max=-1, bool subfolders=true); + void AddShellEntries(const ShellDirectory& dir, int max=-1, const String& ignore=""); void AddButton(LPCTSTR title, ICON_ID icon_id=ICID_NONE, bool hasSubmenu=false, int id=-1, bool enabled=true); void AddSeparator(); diff --git a/reactos/subsys/system/explorer/utility/shellclasses.cpp b/reactos/subsys/system/explorer/utility/shellclasses.cpp index bbe52b3ffa6..1070e853333 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.cpp +++ b/reactos/subsys/system/explorer/utility/shellclasses.cpp @@ -509,7 +509,7 @@ IContextMenu* CtxMenuInterfaces::query_interfaces(IContextMenu* pcm1) _pctxmenu3 = (LPCONTEXTMENU3)pcm; else #endif - if (pcm1->QueryInterface (IID_IContextMenu2, (void**)&pcm) == NOERROR) + if (pcm1->QueryInterface(IID_IContextMenu2, (void**)&pcm) == NOERROR) _pctxmenu2 = (LPCONTEXTMENU2)pcm; if (pcm) { @@ -556,7 +556,8 @@ HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParent, int hr = pcm->InvokeCommand(&cmi); } - } + } else + cm_ifs.reset(); } pcm->Release(); diff --git a/reactos/subsys/system/explorer/utility/utility.h b/reactos/subsys/system/explorer/utility/utility.h index db8af0f91bf..51c7cf188a5 100644 --- a/reactos/subsys/system/explorer/utility/utility.h +++ b/reactos/subsys/system/explorer/utility/utility.h @@ -199,9 +199,9 @@ using namespace _com_util; // launch a program or document file -extern BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters=NULL); +extern BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow=SW_SHOWNORMAL, LPCTSTR parameters=NULL); #ifdef UNICODE -extern BOOL launch_fileA(HWND hwnd, LPSTR cmd, UINT nCmdShow, LPCSTR parameters=NULL); +extern BOOL launch_fileA(HWND hwnd, LPSTR cmd, UINT nCmdShow=SW_SHOWNORMAL, LPCSTR parameters=NULL); #else #define launch_fileA launch_file #endif diff --git a/reactos/subsys/system/ibrowser/ibrowser_intres.rc b/reactos/subsys/system/ibrowser/ibrowser_intres.rc index 6ca68b90b4c..32d82281d32 100644 --- a/reactos/subsys/system/ibrowser/ibrowser_intres.rc +++ b/reactos/subsys/system/ibrowser/ibrowser_intres.rc @@ -375,6 +375,64 @@ END ///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +// Swedish (SE) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SWE) +#ifdef _WIN32 +LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDM_SDIFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&Arkiv" + BEGIN + MENUITEM "&Öppna", ID_FILE_OPEN + MENUITEM "&Avsluta", ID_FILE_EXIT + END + POPUP "&Visa" + BEGIN + MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR + MENUITEM "S&idfält", ID_VIEW_SIDE_BAR, GRAYED + MENUITEM "&Statusfält", ID_VIEW_STATUSBAR + MENUITEM SEPARATOR + MENUITEM "&Uppdatera\tF5", ID_REFRESH + MENUITEM "&Fullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + END + POPUP "&Hjälp" + BEGIN + MENUITEM "IBrowser &FAQ...", ID_IBROWSER_FAQ + MENUITEM "Om &IBrowser...", ID_ABOUT_IBROWSER + MENUITEM "Om &operativsystemet...", ID_ABOUT_WINDOWS + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TITLE "ReactOS webbläsare" + IDS_EMPTY "(Tom)" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ABOUT_IBROWSER "&Om..." +END + +#endif // Swedish (SE) resources +///////////////////////////////////////////////////////////////////////////// + #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// diff --git a/reactos/subsys/system/reactos/Cz.rc b/reactos/subsys/system/reactos/Cz.rc new file mode 100644 index 00000000000..6fee9b4b2d8 --- /dev/null +++ b/reactos/subsys/system/reactos/Cz.rc @@ -0,0 +1,13 @@ +/* $Id: En.rc 12852 2005-01-06 13:58:04Z denzil $ */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +/* String Tables */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_CAPTION "Instalace ReactOS" + IDS_TEXT "ReactOS nelze instalovat pøímo z tohoto CD!\n\n"\ + "Prosím restartujte poèítaè z tohoto CD aby jste nainstalovali ReactOS." +END + +/* EOF */ diff --git a/reactos/subsys/system/reactos/reactos.rc b/reactos/subsys/system/reactos/reactos.rc index 018699c382f..bc5a22cb435 100644 --- a/reactos/subsys/system/reactos/reactos.rc +++ b/reactos/subsys/system/reactos/reactos.rc @@ -16,8 +16,9 @@ IDI_MAIN ICON "res/reactos.ico" /* Language-specific resources */ -#include "De.rc" #include "En.rc" +#include "Cz.rc" +#include "De.rc" #include "Sv.rc" /* EOF */ diff --git a/reactos/subsys/system/regedit/Cz.rc b/reactos/subsys/system/regedit/Cz.rc new file mode 100644 index 00000000000..95a0c10d943 --- /dev/null +++ b/reactos/subsys/system/regedit/Cz.rc @@ -0,0 +1,364 @@ +/* + * Regedit resources + * + * Copyright 2002 Robert Dickenson + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +/* + * Menu + */ + +IDC_REGEDIT MENU DISCARDABLE +BEGIN + POPUP "&Soubor" + BEGIN + MENUITEM "U&konèit", ID_REGISTRY_EXIT + END + POPUP "&Nápovìda" + BEGIN + MENUITEM "&O editoru registru ...", ID_HELP_ABOUT + END +END + +IDR_REGEDIT_MENU MENU DISCARDABLE +BEGIN + POPUP "&Registry" + BEGIN + MENUITEM "&Importovat soubor registru...", ID_REGISTRY_IMPORTREGISTRYFILE + + MENUITEM "&Exportovat do souboru registru...", ID_REGISTRY_EXPORTREGISTRYFILE + + MENUITEM SEPARATOR + MENUITEM "&Pøipojit síový registr...", + ID_REGISTRY_CONNECTNETWORKREGISTRY + , GRAYED + MENUITEM "&Odpojit síový registr...", + ID_REGISTRY_DISCONNECTNETWORKREGISTRY + , GRAYED + MENUITEM SEPARATOR + MENUITEM "&Tisk\tCtrl+P", ID_REGISTRY_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "U&konèit", ID_REGISTRY_EXIT + END + POPUP "&Úpravy" + BEGIN + MENUITEM "&Zmìnit hodnotu", ID_EDIT_MODIFY + MENUITEM SEPARATOR + POPUP "&Nový" + BEGIN + MENUITEM "&Klíè", ID_EDIT_NEW_KEY + MENUITEM SEPARATOR + MENUITEM "&Øetìzec", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Binární hodnota", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&Hodnota DWORD", ID_EDIT_NEW_DWORDVALUE + END + MENUITEM SEPARATOR + MENUITEM "&Oprávnìní...", ID_EDIT_PERMISSIONS + MENUITEM SEPARATOR + MENUITEM "&Odstranit\tDel", ID_EDIT_DELETE + MENUITEM "&Pøejmenovat", ID_EDIT_RENAME + MENUITEM SEPARATOR + MENUITEM "Z&kopírovat název klíèe", ID_EDIT_COPYKEYNAME + MENUITEM SEPARATOR + MENUITEM "&Hledat\tCtrl+F", ID_EDIT_FIND, GRAYED + MENUITEM "Hledat &další\tF3", ID_EDIT_FINDNEXT, GRAYED + END + POPUP "&Zobrazit" + BEGIN + MENUITEM "&Stavový øádek", ID_VIEW_STATUSBAR + MENUITEM SEPARATOR + MENUITEM "&Rozdìlit", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Aktualizovat\tF5", ID_VIEW_REFRESH + END + POPUP "&Oblíbené" + BEGIN + MENUITEM "&Pøidat k oblíbeným", ID_FAVOURITES_ADDTOFAVOURITES + , GRAYED + MENUITEM "&Odebrat z oblíbených", ID_FAVOURITES_REMOVEFAVOURITE + , GRAYED + END + POPUP "&Nápovìda" + BEGIN + MENUITEM "&Témata nápovìdy\tF1", ID_HELP_HELPTOPICS + MENUITEM SEPARATOR + MENUITEM "&O editoru registru", ID_HELP_ABOUT + END +END + +IDR_POPUP_MENUS MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "&Upravit", ID_EDIT_MODIFY + MENUITEM "Upravit &binární data", ID_EDIT_MODIFY_BIN + MENUITEM SEPARATOR + MENUITEM "&Odstranit\tDel", ID_EDIT_DELETE + MENUITEM "&Pøejmenovat", ID_EDIT_RENAME + END + POPUP "" + BEGIN + POPUP "&Nový" + BEGIN + MENUITEM "&Klíè", ID_EDIT_NEW_KEY + MENUITEM SEPARATOR + MENUITEM "&Øetìzec", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Binární hodnota", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&Hodnota DWORD", ID_EDIT_NEW_DWORDVALUE + END + END +END + + +/* + * Dialog + */ + +IDD_EDIT_STRING DIALOG 32, 24, 252, 84 +STYLE DS_SETFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_3DLOOK | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Úprava øetìzce" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Název:",IDC_STATIC,6,6,134,8 + EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "&Data:",IDC_STATIC,6,35,161,8 + EDITTEXT IDC_VALUE_DATA,6,46,240,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,142,64,50,14 + PUSHBUTTON "Storno",IDCANCEL,196,64,50,14 +END + +IDD_EDIT_MULTI_STRING DIALOG 32, 24, 252, 174 +STYLE DS_SETFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_3DLOOK | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Úprava více-øetìzce" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Název:",IDC_STATIC,6,6,134,8 + EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "&Data:",IDC_STATIC,6,35,161,8 + EDITTEXT IDC_VALUE_DATA,6,46,240,102,ES_AUTOHSCROLL | ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL + DEFPUSHBUTTON "OK",IDOK,142,154,50,14 + PUSHBUTTON "Storno",IDCANCEL,196,154,50,14 +END + +IDD_EDIT_BIN_DATA DIALOG 32, 24, 252, 174 +STYLE DS_SETFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_3DLOOK | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Úprava binární hodnoty" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Název:",IDC_STATIC,6,6,134,8 + EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "&Data:",IDC_STATIC,6,35,161,8 + CONTROL "",IDC_VALUE_DATA,"HexEdit32",WS_VSCROLL | WS_BORDER | WS_TABSTOP,6,46,240,102 + DEFPUSHBUTTON "OK",IDOK,142,154,50,14 + PUSHBUTTON "Storno",IDCANCEL,196,154,50,14 +END + + +IDD_EDIT_DWORD DIALOG 32, 24, 252, 104 +STYLE DS_SETFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_3DLOOK | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Úprava DWORD" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Název:",IDC_STATIC,6,6,134,8 + EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "&Data:",IDC_STATIC,6,35,161,8 + EDITTEXT IDC_VALUE_DATA,6,46,116,12,ES_AUTOHSCROLL + GROUPBOX "Soustava",IDC_STATIC,130,35,116,39 + AUTORADIOBUTTON "&Šestnáctková",IDC_FORMAT_HEX,141,46,60,10,WS_GROUP + AUTORADIOBUTTON "&Desítková",IDC_FORMAT_DEC,141,59,60,10 + DEFPUSHBUTTON "OK",IDOK,142,82,50,14 + PUSHBUTTON "Storno",IDCANCEL,196,82,50,14 +END + +/* + * String Table + */ + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LIST_COLUMN_NAME "Název" + IDS_LIST_COLUMN_TYPE "Typ" + IDS_LIST_COLUMN_DATA "Data" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Editor registru" + IDC_REGEDIT "REGEDIT" + IDC_REGEDIT_FRAME "REGEDIT_FRAME" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_REGISTRY_MENU "Obsahuje pøíkazy pro práci s celým registrem" + ID_EDIT_MENU "Obsahuje pøíkazy pro úpravu hodnot a klíèù" + ID_VIEW_MENU "Obsahuje pøíkazy pro pøizpùsobení okna registru" + ID_FAVOURITES_MENU "Obsahuje pøíkazy pro pøístup k èasto používaným klíèùm" + ID_HELP_MENU "Obsahuje pøíkazy pro zobrazení nápovìdy a informací o editoru registru" + ID_EDIT_NEW_MENU "Obsahuje pøíkazy pro vytváøení nových klíèù a hodnot" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_MODIFY "Upravuje data položky" + ID_EDIT_NEW_KEY "Pøidá nový klíè" + ID_EDIT_NEW_STRINGVALUE "Pøidá novou položku ve formì øetìzce" + ID_EDIT_NEW_BINARYVALUE "Pøidá novou položku s binární hodnotou" + ID_EDIT_NEW_DWORDVALUE "Pøidá novou DWORD položku" + ID_REGISTRY_IMPORTREGISTRYFILE "Importuje textový soubor do registru" + ID_REGISTRY_EXPORTREGISTRYFILE + "Exportuje všechny èásti registru do textového souboru" + ID_REGISTRY_CONNECTNETWORKREGISTRY + "Pøipojí se ke vzdálenému registru jiného poèítaèe" + ID_REGISTRY_DISCONNECTNETWORKREGISTRY + "Odpojí se od vzdálenému registru jiného poèítaèe" + ID_REGISTRY_PRINT "Vytiskne všechny èásti registru" +/* ID_HELP_HELPTOPICS "Otevøe témata nápovìdy pro editor registru" */ + ID_HELP_ABOUT "Zobrazí informace o aplikaci, verzi a copyright" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_REGISTRY_EXIT "Ukonèí editor registru" + ID_FAVOURITES_ADDTOFAVOURITES "Pøidá klíè do seznamu oblíbených" + ID_FAVOURITES_REMOVEFAVOURITE "Odebere klíè ze seznamu oblíbených" + ID_VIEW_STATUSBAR "Zobrazí nebo skryje stavový øádek" + ID_VIEW_SPLIT "Upravuje polohu rozdìlovaèe obou panelù" + ID_VIEW_REFRESH "Obnoví okno" + ID_EDIT_DELETE "Smaže výbìr" + ID_EDIT_RENAME "Pøejmenuje výbìr" + ID_EDIT_COPYKEYNAME "Zkopíruje název klíèe do schránky" + ID_EDIT_FIND "Hledá textový øetìzec v klíèi, položkách, nebo datech" + ID_EDIT_FINDNEXT "Hledá další výskyt textu zadaného v pøedchozím hledání" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERROR "Chyba" + IDS_WARNING "Upozornìní" + IDS_BAD_VALUE "Nelze se dotázat položky '%s'" + IDS_UNSUPPORTED_TYPE "Nelze upravovat klíèe tohoto typu (%ld)" + IDS_TOO_BIG_VALUE "Položka je pøíliš velká (%ld)" + IDS_MULTI_SZ_EMPTY_STRING "Položky typu REG_MULTI_SZ nemohou obsahovat prázdné øetezce.\nPrázdné øetìzce byly odebrány ze seznamu." + IDS_QUERY_DELETE_ONE "Opravdu chcete odstranit tuto položku?" + IDS_QUERY_DELETE_MORE "Opravdu chcete odstranit tyto položky?" + IDS_QUERY_DELETE_CONFIRM "Potvrzení odstranìní položky" + IDS_ERR_DELVAL_CAPTION "Chyba pøi odstraòování položek" + IDS_ERR_DELETEVALUE "Nelze odstranit všechny vybrané položky!" + IDS_ERR_RENVAL_CAPTION "Chyba pøi pøejmenování položky" + IDS_ERR_RENVAL_TOEMPTY "Nelze pøejmenovat %s. Vybraná položka je prázdná. Vyzkoušejte jiný název." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BINARY_EMPTY "(binární položka nulové hodnoty)" + IDS_DEFAULT_VALUE_NAME "(Výchozí)" + IDS_VALUE_NOT_SET "(Hodnota nezadána)" + IDS_UNKNOWN_TYPE "Neznámý typ: (0x%lx)" + IDS_MY_COMPUTER "Tento poèítaè" + IDS_IMPORT_REG_FILE "Importovat soubor registru" + IDS_EXPORT_REG_FILE "Exportovat do souboru registru" + IDS_INVALID_DWORD "(Neplatná hodnota DWORD)" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_FLT_REGFILES "Soubory registru" + IDS_FLT_REGFILES_FLT "*.reg" + IDS_FLT_REGEDIT4 "Soubory registru Win9x/NT4 (REGEDIT4)" + IDS_FLT_REGEDIT4_FLT "*.reg" + IDS_FLT_ALLFILES "Všechny soubory (*.*)" + IDS_FLT_ALLFILES_FLT "*.*" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ACCESS_FULLCONTROL "Úplné oprávnìní" + IDS_ACCESS_READ "Ètení" + IDS_ACCESS_QUERYVALUE "Dotaz na hodnotu" + IDS_ACCESS_SETVALUE "Nastavení hodnoty" + IDS_ACCESS_CREATESUBKEY "Vytvoøit podklíè" + IDS_ACCESS_ENUMERATESUBKEYS "Zjistit poèet podklíèù" + IDS_ACCESS_NOTIFY "Upozornit" + IDS_ACCESS_CREATELINK "Vytvoøit odkaz" + IDS_ACCESS_DELETE "Odstranit" + IDS_ACCESS_WRITEDAC "Zapsat DAC" + IDS_ACCESS_WRITEOWNER "Zapsat vlastníka" + IDS_ACCESS_READCONTROL "Oprávnìní ke ètení" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INHERIT_THISKEYONLY "Pouze tento klíè" + IDS_INHERIT_THISKEYANDSUBKEYS "Tento klíè a jeho podklíèe" + IDS_INHERIT_SUBKEYSONLY "Pouze podklíèe" +END + +/*****************************************************************/ + + +/* + * Dialog + */ + +IDD_DIALOG1 DIALOG DISCARDABLE 50, 50, 268, 98 +STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | + WS_BORDER +FONT 8, "MS Sans Serif" +BEGIN +END + +IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 187, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,130,7,50,14 + PUSHBUTTON "Storno",IDCANCEL,130,24,50,14 +END + + +/* + * TEXTINCLUDE + */ + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + + + +/* + * String Table + */ + +/* + *STRINGTABLE DISCARDABLE + *BEGIN + * ID_HELP_HELPTOPICS "Otevøe nápovìdu pro editor registru." + * ID_HELP_ABOUT "Zobrazí informace o aplikaci, verzi a copyright." + *END + */ + +/*****************************************************************/ diff --git a/reactos/subsys/system/regedit/rsrc.rc b/reactos/subsys/system/regedit/rsrc.rc index f9ed3b88ee1..ebb2460b5bf 100644 --- a/reactos/subsys/system/regedit/rsrc.rc +++ b/reactos/subsys/system/regedit/rsrc.rc @@ -27,6 +27,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* include localised resources */ +#include "Cz.rc" #include "De.rc" #include "En.rc" #include "Fr.rc" diff --git a/reactos/subsys/system/services/database.c b/reactos/subsys/system/services/database.c index 1835dca4cb1..7cf99e2bd92 100644 --- a/reactos/subsys/system/services/database.c +++ b/reactos/subsys/system/services/database.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * service control manager * @@ -53,25 +53,6 @@ typedef struct _SERVICE_GROUP } SERVICE_GROUP, *PSERVICE_GROUP; -typedef struct _SERVICE -{ - LIST_ENTRY ServiceListEntry; - UNICODE_STRING ServiceName; - UNICODE_STRING RegistryPath; - UNICODE_STRING ServiceGroup; - - ULONG Start; - ULONG Type; - ULONG ErrorControl; - ULONG Tag; - - BOOLEAN ServiceRunning; - BOOLEAN ServiceVisited; - - HANDLE ControlPipeHandle; - ULONG ProcessId; - ULONG ThreadId; -} SERVICE, *PSERVICE; /* GLOBALS *******************************************************************/ @@ -82,6 +63,35 @@ LIST_ENTRY ServiceListHead; /* FUNCTIONS *****************************************************************/ +PSERVICE +ScmGetServiceEntryByName(PUNICODE_STRING ServiceName) +{ + PLIST_ENTRY ServiceEntry; + PSERVICE CurrentService; + + DPRINT("ScmGetServiceEntryByName() called\n"); + + ServiceEntry = ServiceListHead.Flink; + while (ServiceEntry != &ServiceListHead) + { + CurrentService = CONTAINING_RECORD(ServiceEntry, + SERVICE, + ServiceListEntry); + if (RtlEqualUnicodeString(&CurrentService->ServiceName, ServiceName, TRUE)) + { + DPRINT("Found service: '%wZ'\n", &CurrentService->ServiceName); + return CurrentService; + } + + ServiceEntry = ServiceEntry->Flink; + } + + DPRINT("Couldn't find a matching service\n"); + + return NULL; +} + + static NTSTATUS STDCALL CreateGroupOrderListRoutine(PWSTR ValueName, ULONG ValueType, @@ -277,6 +287,13 @@ CreateServiceListEntry(PUNICODE_STRING ServiceName) InsertTailList(&ServiceListHead, &Service->ServiceListEntry); + Service->CurrentState = SERVICE_STOPPED; + Service->ControlsAccepted = 0; + Service->Win32ExitCode = 0; + Service->ServiceSpecificExitCode = 0; + Service->CheckPoint = 0; + Service->WaitHint = 2000; /* 2 seconds */ + return STATUS_SUCCESS; } @@ -461,7 +478,7 @@ ScmCheckDriver(PSERVICE Service) DPRINT("Found: '%wZ' '%wZ'\n", &Service->ServiceName, &DirInfo->ObjectName); /* Mark service as 'running' */ - Service->ServiceRunning = TRUE; + Service->CurrentState = SERVICE_RUNNING; /* Find the driver's group and mark it as 'running' */ if (Service->ServiceGroup.Buffer != NULL) @@ -767,7 +784,7 @@ ScmStartService(PSERVICE Service, { Group->ServicesRunning = TRUE; } - Service->ServiceRunning = TRUE; + Service->CurrentState = SERVICE_RUNNING; } #if 0 else diff --git a/reactos/subsys/system/services/makefile b/reactos/subsys/system/services/makefile index 37442872d85..e109909b31f 100644 --- a/reactos/subsys/system/services/makefile +++ b/reactos/subsys/system/services/makefile @@ -10,14 +10,29 @@ TARGET_NAME = services TARGET_INSTALLDIR = system32 -TARGET_SDKLIBS = ntdll.a kernel32.a user32.a +TARGET_SDKLIBS = ntdll.a kernel32.a user32.a rpcrt4.a -TARGET_OBJECTS = $(TARGET_NAME).o database.o +TARGET_OBJECTS = svcctl_s.o database.o services.o rpcserver.o -TARGET_CFLAGS = -D__USE_W32API -Wall -Werror +TARGET_CFLAGS = -Wall -Werror -fno-builtin \ + -D__USE_W32API \ + -D_WIN32_IE=0x0500 \ + -D_WIN32_WINNT=0x501 \ + -DWINVER=0x600 \ + -DUNICODE \ + -D_UNICODE + +TARGET_CLEAN = svcctl_s.c svcctl_s.h + +DEP_OBJECTS = $(TARGET_OBJECTS) include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk +include $(TOOLS_PATH)/depend.mk + +svcctl_s.c svcctl_s.h: $(PATH_TO_TOP)/include/idl/svcctl.idl + $(WIDL) -o -h -H svcctl_s.h -s -S svcctl_s.c $(PATH_TO_TOP)/include/idl/svcctl.idl + # EOF diff --git a/reactos/subsys/system/services/rpcserver.c b/reactos/subsys/system/services/rpcserver.c new file mode 100644 index 00000000000..42c172e66d7 --- /dev/null +++ b/reactos/subsys/system/services/rpcserver.c @@ -0,0 +1,693 @@ +/* + + */ + +/* INCLUDES ****************************************************************/ + +#define NTOS_MODE_USER +#include +#include +#include + +#include "services.h" +#include "svcctl_s.h" + +#define NDEBUG +#include + + +/* GLOBALS *****************************************************************/ + +#define MANAGER_TAG 0x72674D68 /* 'hMgr' */ +#define SERVICE_TAG 0x63765368 /* 'hSvc' */ + +typedef struct _SCMGR_HANDLE +{ + DWORD Tag; + DWORD RefCount; + DWORD DesiredAccess; +} SCMGR_HANDLE; + + +typedef struct _MANAGER_HANDLE +{ + SCMGR_HANDLE Handle; + + /* FIXME: Insert more data here */ + + WCHAR DatabaseName[1]; +} MANAGER_HANDLE, *PMANAGER_HANDLE; + + +typedef struct _SERVICE_HANDLE +{ + SCMGR_HANDLE Handle; + + DWORD DesiredAccess; + PSERVICE ServiceEntry; + + /* FIXME: Insert more data here */ + +} SERVICE_HANDLE, *PSERVICE_HANDLE; + + +#define SC_MANAGER_READ \ + (STANDARD_RIGHTS_READ | \ + SC_MANAGER_QUERY_LOCK_STATUS | \ + SC_MANAGER_ENUMERATE_SERVICE) + +#define SC_MANAGER_WRITE \ + (STANDARD_RIGHTS_WRITE | \ + SC_MANAGER_MODIFY_BOOT_CONFIG | \ + SC_MANAGER_CREATE_SERVICE) + +#define SC_MANAGER_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE | \ + SC_MANAGER_LOCK | \ + SC_MANAGER_ENUMERATE_SERVICE | \ + SC_MANAGER_CONNECT | \ + SC_MANAGER_CREATE_SERVICE) + + +#define SERVICE_READ \ + (STANDARD_RIGHTS_READ | \ + SERVICE_INTERROGATE | \ + SERVICE_ENUMERATE_DEPENDENTS | \ + SERVICE_QUERY_STATUS | \ + SERVICE_QUERY_CONFIG) + +#define SERVICE_WRITE \ + (STANDARD_RIGHTS_WRITE | \ + SERVICE_CHANGE_CONFIG) + +#define SERVICE_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE | \ + SERVICE_USER_DEFINED_CONTROL | \ + SERVICE_PAUSE_CONTINUE | \ + SERVICE_STOP | \ + SERVICE_START) + + +/* VARIABLES ***************************************************************/ + +static GENERIC_MAPPING +ScmManagerMapping = {SC_MANAGER_READ, + SC_MANAGER_WRITE, + SC_MANAGER_EXECUTE, + SC_MANAGER_ALL_ACCESS}; + +static GENERIC_MAPPING +ScmServiceMapping = {SERVICE_READ, + SERVICE_WRITE, + SERVICE_EXECUTE, + SC_MANAGER_ALL_ACCESS}; + + +/* FUNCTIONS ***************************************************************/ + +VOID +ScmStartRpcServer(VOID) +{ + RPC_STATUS Status; + + DPRINT("ScmStartRpcServer() called"); + + Status = RpcServerUseProtseqEp(L"ncacn_np", + 10, + L"\\pipe\\ntsvcs", + NULL); + if (Status != RPC_S_OK) + { + DPRINT1("RpcServerUseProtseqEp() failed (Status %lx)\n", Status); + return; + } + + Status = RpcServerRegisterIf(svcctl_ServerIfHandle, + NULL, + NULL); + if (Status != RPC_S_OK) + { + DPRINT1("RpcServerRegisterIf() failed (Status %lx)\n", Status); + return; + } + + Status = RpcServerListen(1, 20, TRUE); + if (Status != RPC_S_OK) + { + DPRINT1("RpcServerListen() failed (Status %lx)\n", Status); + return; + } + + DPRINT("ScmStartRpcServer() done"); +} + + +static DWORD +ScmCreateManagerHandle(LPWSTR lpDatabaseName, + SC_HANDLE *Handle) +{ + PMANAGER_HANDLE Ptr; + + Ptr = GlobalAlloc(GPTR, + sizeof(MANAGER_HANDLE) + wcslen(lpDatabaseName) * sizeof(WCHAR)); + if (Ptr == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + Ptr->Handle.Tag = MANAGER_TAG; + Ptr->Handle.RefCount = 1; + + /* FIXME: initialize more data here */ + + wcscpy(Ptr->DatabaseName, lpDatabaseName); + + *Handle = (SC_HANDLE)Ptr; + + return ERROR_SUCCESS; +} + + +static DWORD +ScmCreateServiceHandle(PSERVICE lpServiceEntry, + SC_HANDLE *Handle) +{ + PSERVICE_HANDLE Ptr; + + Ptr = GlobalAlloc(GPTR, + sizeof(SERVICE_HANDLE)); + if (Ptr == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + Ptr->Handle.Tag = SERVICE_TAG; + Ptr->Handle.RefCount = 1; + + /* FIXME: initialize more data here */ + Ptr->ServiceEntry = lpServiceEntry; + + *Handle = (SC_HANDLE)Ptr; + + return ERROR_SUCCESS; +} + + +static DWORD +ScmCheckAccess(SC_HANDLE Handle, + DWORD dwDesiredAccess) +{ + PMANAGER_HANDLE hMgr; + + hMgr = (PMANAGER_HANDLE)Handle; + if (hMgr->Handle.Tag == MANAGER_TAG) + { + RtlMapGenericMask(&dwDesiredAccess, + &ScmManagerMapping); + + hMgr->Handle.DesiredAccess = dwDesiredAccess; + + return ERROR_SUCCESS; + } + else if (hMgr->Handle.Tag == SERVICE_TAG) + { + RtlMapGenericMask(&dwDesiredAccess, + &ScmServiceMapping); + + hMgr->Handle.DesiredAccess = dwDesiredAccess; + + return ERROR_SUCCESS; + } + + return ERROR_INVALID_HANDLE; +} + + +/* Function 0 */ +unsigned long +ScmrCloseServiceHandle(handle_t BindingHandle, + unsigned int hScObject) +{ + PMANAGER_HANDLE hManager; + + DPRINT("ScmrCloseServiceHandle() called\n"); + + DPRINT("hScObject = %X\n", hScObject); + + if (hScObject == 0) + return ERROR_INVALID_HANDLE; + + hManager = (PMANAGER_HANDLE)hScObject; + if (hManager->Handle.Tag == MANAGER_TAG) + { + DPRINT("Found manager handle\n"); + + hManager->Handle.RefCount--; + if (hManager->Handle.RefCount == 0) + { + /* FIXME: add cleanup code */ + + GlobalFree(hManager); + } + + DPRINT("ScmrCloseServiceHandle() done\n"); + return ERROR_SUCCESS; + } + else if (hManager->Handle.Tag == SERVICE_TAG) + { + DPRINT("Found service handle\n"); + + hManager->Handle.RefCount--; + if (hManager->Handle.RefCount == 0) + { + /* FIXME: add cleanup code */ + + GlobalFree(hManager); + } + + DPRINT("ScmrCloseServiceHandle() done\n"); + return ERROR_SUCCESS; + } + + DPRINT1("Invalid handle tag (Tag %lx)\n", hManager->Handle.Tag); + + return ERROR_INVALID_HANDLE; +} + + +/* Function 1 */ +unsigned long +ScmrControlService(handle_t BindingHandle, + unsigned int hService, + unsigned long dwControl, + LPSERVICE_STATUS lpServiceStatus) +{ + PSERVICE_HANDLE hSvc; + PSERVICE lpService; + + DPRINT1("ScmrControlService() called\n"); + + hSvc = (PSERVICE_HANDLE)hService; + if (hSvc->Handle.Tag != SERVICE_TAG) + { + DPRINT1("Invalid handle tag!\n"); + return ERROR_INVALID_HANDLE; + } + + + /* FIXME: Check access rights */ + + + lpService = hSvc->ServiceEntry; + if (lpService == NULL) + { + DPRINT1("lpService == NULL!\n"); + return ERROR_INVALID_HANDLE; + } + + + /* FIXME: Send control code to the service */ + + + /* Return service status information */ + lpServiceStatus->dwServiceType = lpService->Type; + lpServiceStatus->dwCurrentState = lpService->CurrentState; + lpServiceStatus->dwControlsAccepted = lpService->ControlsAccepted; + lpServiceStatus->dwWin32ExitCode = lpService->Win32ExitCode; + lpServiceStatus->dwServiceSpecificExitCode = lpService->ServiceSpecificExitCode; + lpServiceStatus->dwCheckPoint = lpService->CheckPoint; + lpServiceStatus->dwWaitHint = lpService->WaitHint; + + return ERROR_SUCCESS; +} + + +/* Function 2 */ +unsigned long +ScmrDeleteService(handle_t BindingHandle, + unsigned int hService) +{ + PSERVICE_HANDLE hSvc; + PSERVICE lpService; + + DPRINT1("ScmrDeleteService() called\n"); + + hSvc = (PSERVICE_HANDLE)hService; + if (hSvc->Handle.Tag != SERVICE_TAG) + return ERROR_INVALID_HANDLE; + + if (!RtlAreAllAccessesGranted(hSvc->Handle.DesiredAccess, + STANDARD_RIGHTS_REQUIRED)) + return ERROR_ACCESS_DENIED; + + lpService = hSvc->ServiceEntry; + if (lpService == NULL) + { + DPRINT1("lpService == NULL!\n"); + return ERROR_INVALID_HANDLE; + } + + /* FIXME: Mark service for delete */ + + return ERROR_SUCCESS; +} + + +/* Function 3 */ +unsigned long +ScmrLockServiceDatabase(handle_t BindingHandle, + unsigned int hSCManager, + unsigned int *hLock) +{ + PMANAGER_HANDLE hMgr; + + DPRINT("ScmrLockServiceDatabase() called\n"); + + *hLock = 0; + + hMgr = (PMANAGER_HANDLE)hSCManager; + if (hMgr->Handle.Tag != MANAGER_TAG) + return ERROR_INVALID_HANDLE; + + if (!RtlAreAllAccessesGranted(hMgr->Handle.DesiredAccess, + SC_MANAGER_LOCK)) + return ERROR_ACCESS_DENIED; + + /* FIXME: Lock the database */ + *hLock = 0x12345678; /* Dummy! */ + + return ERROR_SUCCESS; +} + + +/* Function 4 */ +unsigned long +ScmrQueryServiceObjectSecurity(handle_t BindingHandle) +{ + DPRINT1("ScmrQueryServiceSecurity() is unimplemented\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + + +/* Function 5 */ +unsigned long +ScmrSetServiceObjectSecurity(handle_t BindingHandle) +{ + DPRINT1("ScmrSetServiceSecurity() is unimplemented\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + + +/* Function 6 */ +unsigned long +ScmrQueryServiceStatus(handle_t BindingHandle, + unsigned int hService, + LPSERVICE_STATUS lpServiceStatus) +{ + PSERVICE_HANDLE hSvc; + PSERVICE lpService; + + DPRINT("ScmrQueryServiceStatus() called\n"); + + hSvc = (PSERVICE_HANDLE)hService; + if (hSvc->Handle.Tag != SERVICE_TAG) + { + DPRINT1("Invalid handle tag!\n"); + return ERROR_INVALID_HANDLE; + } + + if (!RtlAreAllAccessesGranted(hSvc->Handle.DesiredAccess, + SERVICE_QUERY_STATUS)) + { + DPRINT1("Insufficient access rights! 0x%lx\n", hSvc->Handle.DesiredAccess); + return ERROR_ACCESS_DENIED; + } + + lpService = hSvc->ServiceEntry; + if (lpService == NULL) + { + DPRINT1("lpService == NULL!\n"); + return ERROR_INVALID_HANDLE; + } + + /* Return service status information */ + lpServiceStatus->dwServiceType = lpService->Type; + lpServiceStatus->dwCurrentState = lpService->CurrentState; + lpServiceStatus->dwControlsAccepted = lpService->ControlsAccepted; + lpServiceStatus->dwWin32ExitCode = lpService->Win32ExitCode; + lpServiceStatus->dwServiceSpecificExitCode = lpService->ServiceSpecificExitCode; + lpServiceStatus->dwCheckPoint = lpService->CheckPoint; + lpServiceStatus->dwWaitHint = lpService->WaitHint; + + return ERROR_SUCCESS; +} + + +/* Function 7 */ +unsigned long +ScmrSetServiceStatus(handle_t BindingHandle) +{ + DPRINT1("ScmrSetServiceStatus() is unimplemented\n"); + /* FIXME */ + return ERROR_CALL_NOT_IMPLEMENTED; +} + + +/* Function 8 */ +unsigned long +ScmrUnlockServiceDatabase(handle_t BindingHandle, + unsigned int hLock) +{ + DPRINT1("ScmrUnlockServiceDatabase() called\n"); + /* FIXME */ + return ERROR_SUCCESS; +} + + +/* Function 9 */ +unsigned long +ScmrNotifyBootConfigStatus(handle_t BindingHandle, + unsigned long BootAcceptable) +{ + DPRINT1("ScmrNotifyBootConfigStatus() called\n"); + /* FIXME */ + return ERROR_SUCCESS; +} + + + +/* Function 12 */ +#if 0 +unsigned long +ScmrCreateServiceW(handle_t BindingHandle, + unsigned int hSCManager, + wchar_t *lpServiceName, + wchar_t *lpDisplayName, + unsigned long dwDesiredAccess, + unsigned long dwServiceType, + unsigned long dwStartType, + unsigned long dwErrorControl, + wchar_t *lpBinaryPathName, + wchar_t *lpLoadOrderGroup, + unsigned long *lpdwTagId, + wchar_t *lpDependencies, + wchar_t *lpServiceStartName, + wchar_t *lpPassword) +{ + DPRINT1("ScmrCreateServiceW() called\n"); + if (lpdwTagId != NULL) + *lpdwTagId = 0; + return ERROR_SUCCESS; +} +#endif + + +/* Function 15 */ +unsigned long +ScmrOpenSCManagerW(handle_t BindingHandle, + wchar_t *lpMachineName, + wchar_t *lpDatabaseName, + unsigned long dwDesiredAccess, + unsigned int *hScm) +{ + DWORD dwError; + SC_HANDLE hHandle; + + DPRINT("ScmrOpenSCManagerW() called\n"); + DPRINT("lpMachineName = %p\n", lpMachineName); + DPRINT("lpMachineName: %S\n", lpMachineName); + DPRINT("lpDataBaseName = %p\n", lpDatabaseName); + DPRINT("lpDataBaseName: %S\n", lpDatabaseName); + DPRINT("dwDesiredAccess = %x\n", dwDesiredAccess); + + dwError = ScmCreateManagerHandle(lpDatabaseName, + &hHandle); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmCreateManagerHandle() failed (Error %lu)\n", dwError); + return dwError; + } + + /* Check the desired access */ + dwError = ScmCheckAccess(hHandle, + dwDesiredAccess | SC_MANAGER_CONNECT); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError); + GlobalFree(hHandle); + return dwError; + } + + *hScm = (unsigned int)hHandle; + DPRINT("*hScm = %x\n", *hScm); + + DPRINT("ScmrOpenSCManagerW() done\n"); + + return ERROR_SUCCESS; +} + + +/* Function 16 */ +unsigned int +ScmrOpenServiceW(handle_t BindingHandle, + unsigned int hSCManager, + wchar_t *lpServiceName, + unsigned long dwDesiredAccess, + unsigned int *hService) +{ + UNICODE_STRING ServiceName; + PSERVICE lpService; + PMANAGER_HANDLE hManager; + SC_HANDLE hHandle; + DWORD dwError; + + DPRINT("ScmrOpenServiceW() called\n"); + DPRINT("hSCManager = %x\n", hSCManager); + DPRINT("lpServiceName = %p\n", lpServiceName); + DPRINT("lpServiceName: %S\n", lpServiceName); + DPRINT("dwDesiredAccess = %x\n", dwDesiredAccess); + + hManager = (PMANAGER_HANDLE)hSCManager; + if (hManager->Handle.Tag != MANAGER_TAG) + { + DPRINT1("Invalid manager handle!\n"); + return ERROR_INVALID_HANDLE; + } + + /* FIXME: Lock the service list */ + + /* Get service database entry */ + RtlInitUnicodeString(&ServiceName, + lpServiceName); + + lpService = ScmGetServiceEntryByName(&ServiceName); + if (lpService == NULL) + { + DPRINT1("Could not find a service!\n"); + return ERROR_SERVICE_DOES_NOT_EXIST; + } + + /* Create a service handle */ + dwError = ScmCreateServiceHandle(lpService, + &hHandle); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmCreateServiceHandle() failed (Error %lu)\n", dwError); + return dwError; + } + + /* Check the desired access */ + dwError = ScmCheckAccess(hHandle, + dwDesiredAccess); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError); + GlobalFree(hHandle); + return dwError; + } + + *hService = (unsigned int)hHandle; + DPRINT("*hService = %x\n", *hService); + + DPRINT("ScmrOpenServiceW() done\n"); + + return ERROR_SUCCESS; +} + + + +/* Function 27 */ +unsigned long +ScmrOpenSCManagerA(handle_t BindingHandle, + char *lpMachineName, + char *lpDatabaseName, + unsigned long dwDesiredAccess, + unsigned int *hScm) +{ + UNICODE_STRING MachineName; + UNICODE_STRING DatabaseName; + DWORD dwError; + + DPRINT("ScmrOpenSCManagerA() called\n"); + + if (lpMachineName) + RtlCreateUnicodeStringFromAsciiz(&MachineName, + lpMachineName); + + if (lpDatabaseName) + RtlCreateUnicodeStringFromAsciiz(&DatabaseName, + lpDatabaseName); + + dwError = ScmrOpenSCManagerW(BindingHandle, + lpMachineName ? MachineName.Buffer : NULL, + lpDatabaseName ? DatabaseName.Buffer : NULL, + dwDesiredAccess, + hScm); + + if (lpMachineName) + RtlFreeUnicodeString(&MachineName); + + if (lpDatabaseName) + RtlFreeUnicodeString(&DatabaseName); + + return dwError; +} + + +/* Function 28 */ +unsigned int +ScmrOpenServiceA(handle_t BindingHandle, + unsigned int hSCManager, + char *lpServiceName, + unsigned long dwDesiredAccess, + unsigned int *hService) +{ + UNICODE_STRING ServiceName; + DWORD dwError; + + DPRINT("ScmrOpenServiceA() called\n"); + + RtlCreateUnicodeStringFromAsciiz(&ServiceName, + lpServiceName); + + dwError = ScmrOpenServiceW(BindingHandle, + hSCManager, + ServiceName.Buffer, + dwDesiredAccess, + hService); + + RtlFreeUnicodeString(&ServiceName); + + return dwError; +} + + + +void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +{ + return GlobalAlloc(GPTR, len); +} + + +void __RPC_USER midl_user_free(void __RPC_FAR * ptr) +{ + GlobalFree(ptr); +} + +/* EOF */ diff --git a/reactos/subsys/system/services/services.c b/reactos/subsys/system/services/services.c index 1a70ef11f3f..b8f6ed6db2f 100644 --- a/reactos/subsys/system/services/services.c +++ b/reactos/subsys/system/services/services.c @@ -50,18 +50,18 @@ int WINAPI RegisterServicesProcess(DWORD ServicesProcessId); /* FUNCTIONS *****************************************************************/ -void -PrintString(char* fmt,...) +VOID +PrintString(LPCSTR fmt, ...) { #ifdef DBG - char buffer[512]; - va_list ap; + CHAR buffer[512]; + va_list ap; - va_start(ap, fmt); - vsprintf(buffer, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(buffer, fmt, ap); + va_end(ap); - OutputDebugStringA(buffer); + OutputDebugStringA(buffer); #endif } @@ -69,45 +69,50 @@ PrintString(char* fmt,...) BOOL ScmCreateStartEvent(PHANDLE StartEvent) { - HANDLE hEvent; + HANDLE hEvent; - hEvent = CreateEvent(NULL, - TRUE, + hEvent = CreateEvent(NULL, + TRUE, + FALSE, + _T("SvcctrlStartEvent_A3725DX")); + if (hEvent == NULL) + { + if (GetLastError() == ERROR_ALREADY_EXISTS) + { + hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, _T("SvcctrlStartEvent_A3725DX")); - if (hEvent == NULL) { - if (GetLastError() == ERROR_ALREADY_EXISTS) { - hEvent = OpenEvent(EVENT_ALL_ACCESS, - FALSE, - _T("SvcctrlStartEvent_A3725DX")); - if (hEvent == NULL) { - return FALSE; - } - } else { - return FALSE; - } + if (hEvent == NULL) + { + return FALSE; + } } - *StartEvent = hEvent; - return TRUE; + else + { + return FALSE; + } + } + + *StartEvent = hEvent; + + return TRUE; } BOOL -ScmNamedPipeHandleRequest( - PVOID Request, - DWORD RequestSize, - PVOID Reply, - LPDWORD ReplySize) +ScmNamedPipeHandleRequest(PVOID Request, + DWORD RequestSize, + PVOID Reply, + LPDWORD ReplySize) { - DbgPrint("SCM READ: %s\n", Request); + DbgPrint("SCM READ: %s\n", Request); - *ReplySize = 0; - return FALSE; + *ReplySize = 0; + return FALSE; } -DWORD -WINAPI +DWORD WINAPI ScmNamedPipeThread(LPVOID Context) { CHAR chRequest[PIPE_BUFSIZE]; @@ -121,7 +126,7 @@ ScmNamedPipeThread(LPVOID Context) hPipe = (HANDLE)Context; DPRINT("ScmNamedPipeThread(%x) - Accepting SCM commands through named pipe\n", hPipe); - + for (;;) { fSuccess = ReadFile(hPipe, &chRequest, @@ -150,7 +155,9 @@ ScmNamedPipeThread(LPVOID Context) return ERROR_SUCCESS; } -BOOL ScmCreateNamedPipe(VOID) + +BOOL +ScmCreateNamedPipe(VOID) { DWORD dwThreadId; BOOL fConnected; @@ -159,7 +166,7 @@ BOOL ScmCreateNamedPipe(VOID) DPRINT("ScmCreateNamedPipe() - CreateNamedPipe(\"\\\\.\\pipe\\Ntsvcs\")\n"); - hPipe = CreateNamedPipe("\\\\.\\pipe\\Ntsvcs", + hPipe = CreateNamedPipe(_T("\\\\.\\pipe\\Ntsvcs"), PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, @@ -202,8 +209,8 @@ BOOL ScmCreateNamedPipe(VOID) return TRUE; } -DWORD -WINAPI + +DWORD WINAPI ScmNamedPipeListenerThread(LPVOID Context) { // HANDLE hPipe; @@ -225,49 +232,56 @@ ScmNamedPipeListenerThread(LPVOID Context) return ERROR_SUCCESS; } -BOOL StartScmNamedPipeThreadListener(void) + +BOOL +StartScmNamedPipeThreadListener(VOID) { - DWORD dwThreadId; - HANDLE hThread; + DWORD dwThreadId; + HANDLE hThread; - hThread = CreateThread(NULL, - 0, - ScmNamedPipeListenerThread, - NULL, /*(LPVOID)hPipe,*/ - 0, - &dwThreadId); + hThread = CreateThread(NULL, + 0, + ScmNamedPipeListenerThread, + NULL, /*(LPVOID)hPipe,*/ + 0, + &dwThreadId); + if (!hThread) + { + DPRINT1("SERVICES: Could not create thread (Status %lx)\n", GetLastError()); + return FALSE; + } - if (!hThread) { - DPRINT1("SERVICES: Could not create thread (Status %lx)\n", GetLastError()); - return FALSE; - } - return TRUE; + return TRUE; } + VOID FASTCALL AcquireLoadDriverPrivilege(VOID) { - HANDLE hToken; - TOKEN_PRIVILEGES tkp; + HANDLE hToken; + TOKEN_PRIVILEGES tkp; - /* Get a token for this process. */ - if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { - /* Get the LUID for the debug privilege. */ - LookupPrivilegeValue(NULL, SE_LOAD_DRIVER_NAME, &tkp.Privileges[0].Luid); + /* Get a token for this process */ + if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) + { + /* Get the LUID for the debug privilege */ + LookupPrivilegeValue(NULL, SE_LOAD_DRIVER_NAME, &tkp.Privileges[0].Luid); - tkp.PrivilegeCount = 1; /* one privilege to set */ - tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + /* One privilege to set */ + tkp.PrivilegeCount = 1; + tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - /* Get the debug privilege for this process. */ - AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); - } + /* Get the debug privilege for this process */ + AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); + } } + int STDCALL WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nShowCmd) + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nShowCmd) { HANDLE hScmStartEvent; HANDLE hEvent; @@ -280,57 +294,44 @@ WinMain(HINSTANCE hInstance, /* Create start event */ if (!ScmCreateStartEvent(&hScmStartEvent)) - { - DPRINT1("SERVICES: Failed to create start event\n"); - ExitThread(0); - } + { + DPRINT1("SERVICES: Failed to create start event\n"); + ExitThread(0); + } DPRINT("SERVICES: created start event with handle %x.\n", hScmStartEvent); +// ScmInitThreadManager(); + /* FIXME: more initialization */ /* Create the service database */ Status = ScmCreateServiceDataBase(); if (!NT_SUCCESS(Status)) - { - DPRINT1("SERVICES: failed to create SCM database (Status %lx)\n", Status); - ExitThread(0); - } + { + DPRINT1("SERVICES: failed to create SCM database (Status %lx)\n", Status); + ExitThread(0); + } /* Update service database */ ScmGetBootAndSystemDriverState(); -#if 0 - DPRINT("SERVICES: Attempting to create named pipe...\n"); - /* Create named pipe */ - if (!ScmCreateNamedPipe()) { - DPRINT1("SERVICES: Failed to create named pipe\n"); - ExitThread(0); - } - DPRINT("SERVICES: named pipe created successfully.\n"); -#else - DPRINT("SERVICES: Attempting to create named pipe listener...\n"); - if (!StartScmNamedPipeThreadListener()) { - DPRINT1("SERVICES: Failed to create named pipe listener thread.\n"); - ExitThread(0); - } - DPRINT("SERVICES: named pipe listener thread created.\n"); -#endif - /* FIXME: create listener thread for pipe */ - + /* Start the RPC server */ + ScmStartRpcServer(); /* Register service process with CSRSS */ - RegisterServicesProcess(GetCurrentProcessId()); +// RegisterServicesProcess(GetCurrentProcessId()); DPRINT("SERVICES: Initialized.\n"); /* Signal start event */ SetEvent(hScmStartEvent); +#if 0 /* FIXME: register event handler (used for system shutdown) */ -// SetConsoleCtrlHandler(...); - + SetConsoleCtrlHandler(...); +#endif /* Start auto-start services */ ScmAutoStartServices(); @@ -344,16 +345,17 @@ WinMain(HINSTANCE hInstance, hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); WaitForSingleObject(hEvent, INFINITE); #else - for (;;) - { + for (;;) + { NtYieldExecution(); - } + } #endif DPRINT("SERVICES: Finished.\n"); ExitThread(0); - return(0); + + return 0; } /* EOF */ diff --git a/reactos/subsys/system/services/services.h b/reactos/subsys/system/services/services.h index 443ac04e98e..05f1a94e2ca 100644 --- a/reactos/subsys/system/services/services.h +++ b/reactos/subsys/system/services/services.h @@ -2,10 +2,36 @@ * services.h */ +typedef struct _SERVICE +{ + LIST_ENTRY ServiceListEntry; + UNICODE_STRING ServiceName; + UNICODE_STRING RegistryPath; + UNICODE_STRING ServiceGroup; + + ULONG Start; + ULONG Type; + ULONG ErrorControl; + ULONG Tag; + + ULONG CurrentState; + ULONG ControlsAccepted; + ULONG Win32ExitCode; + ULONG ServiceSpecificExitCode; + ULONG CheckPoint; + ULONG WaitHint; + + BOOLEAN ServiceVisited; + + HANDLE ControlPipeHandle; + ULONG ProcessId; + ULONG ThreadId; +} SERVICE, *PSERVICE; + /* services.c */ -void PrintString(char* fmt,...); +VOID PrintString(LPCSTR fmt, ...); /* database.c */ @@ -14,6 +40,14 @@ NTSTATUS ScmCreateServiceDataBase(VOID); VOID ScmGetBootAndSystemDriverState(VOID); VOID ScmAutoStartServices(VOID); +PSERVICE +ScmGetServiceEntryByName(PUNICODE_STRING ServiceName); + + +/* rpcserver.c */ + +VOID ScmStartRpcServer(VOID); + /* EOF */ diff --git a/reactos/subsys/system/services/services.xml b/reactos/subsys/system/services/services.xml index 46004e193ef..8073ff8bf28 100644 --- a/reactos/subsys/system/services/services.xml +++ b/reactos/subsys/system/services/services.xml @@ -1,11 +1,17 @@ . + include/idl + + + scm_server ntdll kernel32 user32 advapi32 - services.c + rpcrt4 database.c + rpcserver.c + services.c services.rc diff --git a/reactos/subsys/system/sm/makefile b/reactos/subsys/system/sm/makefile new file mode 100644 index 00000000000..5a35b960927 --- /dev/null +++ b/reactos/subsys/system/sm/makefile @@ -0,0 +1,28 @@ +# $Id$ +# +# ReactOS Win32 SM Query Tool +# +PATH_TO_TOP = ../../.. +TOOLS_PATH = $(PATH_TO_TOP)/tools + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = sm + +TARGET_INSTALLDIR = system32 + +TARGET_CFLAGS = -D__USE_W32API -DANONYMOUSUNIONS -Wall -Werror + +TARGET_OBJECTS = $(TARGET_NAME).o + +TARGET_SDKLIBS = smdll.a ntdll.a + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +include $(TOOLS_PATH)/depend.mk + +# EOF diff --git a/reactos/subsys/system/sm/sm.c b/reactos/subsys/system/sm/sm.c new file mode 100644 index 00000000000..507da336e8a --- /dev/null +++ b/reactos/subsys/system/sm/sm.c @@ -0,0 +1,271 @@ +/* + * ReactOS Win32 Applications + * Copyright (C) 2005 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id$ + * + * COPYRIGHT : See COPYING in the top level directory + * PROJECT : ReactOS/Win32 Session Manager Control Tool + * FILE : subsys/system/sm/sm.c + * PROGRAMMER: Emanuele Aliberti (ea@reactos.com) + */ +#include +#include +#include + +#define NTOS_MODE_USER +#include +#include + +#define SM_CMD(n) cmd_##n +#define SM_CMD_DECL(n) int SM_CMD(n)(int argc, char * argv[]) +#define SM_CMD_CALL(n,c,v) SM_CMD(n)((c),(v)) + +HANDLE hSmApiPort = (HANDLE) 0; + +typedef struct _SM_CMD_DESCRIPTOR +{ + const char * Name; + int (*EntryPoint)(int,char**); + const char * Synopsis; + const char * Description; + +} SM_CMD_DESCRIPTOR, *PSM_CMD_DESCRIPTOR; + +SM_CMD_DECL(boot); +SM_CMD_DECL(help); +SM_CMD_DECL(info); +SM_CMD_DECL(reboot); +SM_CMD_DECL(shutdown); + +/* internal commands directory */ +SM_CMD_DESCRIPTOR Command [] = +{ + {"boot", SM_CMD(boot), "boot subsystem_name", "bootstrap an optional environment subsystem;"}, + {"help", SM_CMD(help), "help [command]", "print help for command;"}, + {"info", SM_CMD(info), "info [subsystem_id]", "print information about a booted subsystem\n" + "if subsystem_id is omitted, a list of booted\n" + "environment subsystems is printed."}, + {"reboot", SM_CMD(reboot), "reboot subsystem_id", "reboot an optional environment subsystem;"}, + {"shutdown", SM_CMD(shutdown), "shutdown subsystem_id", "shutdown an optional environment subsystem;"}, +}; + +PSM_CMD_DESCRIPTOR LookupCommand (const char * CommandName) +{ + int i; + const int command_count = (sizeof Command / sizeof Command[0]); + + /* parse the command... */ + + for (i=0; (i < command_count); i ++) + { + if (0 == strcmp(CommandName, Command[i].Name)) + { + break; + } + } + if (i == command_count) + { + fprintf(stderr, "Unknown command '%s'.\n", CommandName); + return NULL; + } + return & Command [i]; +} + +/* user commands */ + +SM_CMD_DECL(boot) +{ + int rc = EXIT_SUCCESS; + ANSI_STRING ProgramA; + UNICODE_STRING ProgramW; + NTSTATUS Status = STATUS_SUCCESS; + + if (3 == argc) + { + RtlInitAnsiString (& ProgramA, argv[2]); + RtlAnsiStringToUnicodeString (& ProgramW, & ProgramA, TRUE); + Status = SmExecuteProgram (hSmApiPort, & ProgramW); + RtlFreeUnicodeString (& ProgramW); + if (STATUS_SUCCESS != Status) + { + printf ("Status 0x%08lx\n", Status); + } + } + else + { + argv[2]="boot"; + return SM_CMD_CALL(help,3,argv); + } + return rc; +} + +SM_CMD_DECL(help) +{ + int i = 0; + PSM_CMD_DESCRIPTOR cmd = NULL; + int rc = EXIT_SUCCESS; + + switch (argc) + { + case 2: + for (i=0; (i < (sizeof Command / sizeof Command[0])); i ++) + { + printf("%s\n", Command[i].Synopsis); + } + break; + case 3: + cmd = LookupCommand (argv[2]); + if (NULL == cmd) + { + rc = EXIT_FAILURE; + break; + } + printf("%s\n%s\n\n%s\n", + cmd->Name, + cmd->Synopsis, + cmd->Description); + break; + } + return rc; +} + +SM_CMD_DECL(info) +{ + int rc = EXIT_SUCCESS; + NTSTATUS Status = STATUS_SUCCESS; + SM_INFORMATION_CLASS InformationClass = SmBasicInformation; + union { + SM_BASIC_INFORMATION bi; + SM_SUBSYSTEM_INFORMATION ssi; + } Info; + ULONG DataLength = 0; + ULONG ReturnDataLength = 0; + INT i = 0; + + RtlZeroMemory (& Info, sizeof Info); + switch (argc) + { + case 2: /* sm info */ + InformationClass = SmBasicInformation; + DataLength = sizeof Info.bi; + break; + case 3: /* sm info id */ + InformationClass = SmSubSystemInformation; + DataLength = sizeof Info.ssi; + Info.ssi.SubSystemId = atol(argv[2]); + break; + default: + return EXIT_FAILURE; + break; + } + Status = SmQueryInformation (hSmApiPort, + InformationClass, + & Info, + DataLength, + & ReturnDataLength); + if (STATUS_SUCCESS != Status) + { + printf ("Status 0x%08lx\n", Status); + return EXIT_FAILURE; + } + switch (argc) + { + case 2: + printf ("SM SubSystem Directory\n\n"); + printf ("SSID PID Flags\n"); + printf ("---- -------- ------------\n"); + for (i = 0; i < Info.bi.SubSystemCount; i ++) + { + printf ("%04x %08lx %04x\n", + Info.bi.SubSystem[i].Id, + Info.bi.SubSystem[i].ProcessId, + Info.bi.SubSystem[i].Flags); + } + break; + case 3: + printf ("SubSystem ID: %d\n", Info.ssi.SubSystemId); + printf (" Flags: %04x\n", Info.ssi.Flags); + printf (" Process ID: %ld\n", Info.ssi.ProcessId); + wprintf(L" NSRootNode: '%s'\n", Info.ssi.NameSpaceRootNode); + break; + default: + break; + } + return rc; +} + +SM_CMD_DECL(shutdown) +{ + int rc = EXIT_SUCCESS; + + fprintf(stderr,"not implemented\n"); + return rc; +} + +SM_CMD_DECL(reboot) +{ + int rc = SM_CMD(shutdown)(argc,argv); + if(EXIT_SUCCESS == rc) + { + rc = SM_CMD(boot)(argc,argv); + } + return rc; +} + +/* print command's synopsys */ +int print_synopsys (int argc, char *argv[]) +{ + fprintf (stderr, "ReactOS/Win32 Session Manager Control Tool\n\n"); + printf ("Usage:\n" + "\tsm\n" + "\tsm help [command]\n" + "\tsm command [arguments]\n\n" + "'sm help' will print the list of valid commands.\n"); + return EXIT_SUCCESS; +} + +/* parse and execute */ +int pande (int argc, char *argv[]) +{ + PSM_CMD_DESCRIPTOR Command = NULL; + NTSTATUS Status = STATUS_SUCCESS; + + /* Lookup the user command... */ + Command = LookupCommand (argv[1]); + if (NULL == Command) + { + return EXIT_FAILURE; + } + /* Connect to the SM in non-registering mode. */ + Status = SmConnectApiPort (0, 0, 0, & hSmApiPort); + if (STATUS_SUCCESS == Status) + { + /* ...and execute it */ + return Command->EntryPoint (argc, argv); + } + fprintf (stderr, "Failed to connect to the Session Manager! (Status=0x%08lx)\n", Status); + return EXIT_FAILURE; +} + +int main (int argc, char *argv[]) +{ + return (1==argc) + ? print_synopsys (argc, argv) + : pande (argc, argv); +} +/* EOF */ diff --git a/reactos/subsys/system/sm/sm.rc b/reactos/subsys/system/sm/sm.rc new file mode 100644 index 00000000000..0de4b780892 --- /dev/null +++ b/reactos/subsys/system/sm/sm.rc @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS/Win32 Session Manager Control Tool\0" +#define REACTOS_STR_INTERNAL_NAME "sm\0" +#define REACTOS_STR_ORIGINAL_FILENAME "sm.exe\0" +#include diff --git a/reactos/subsys/system/sndvol32/Cz.rc b/reactos/subsys/system/sndvol32/Cz.rc new file mode 100644 index 00000000000..204c7693021 --- /dev/null +++ b/reactos/subsys/system/sndvol32/Cz.rc @@ -0,0 +1,41 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDM_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "&Nastavení" + BEGIN + MENUITEM "&Možnosti", IDC_PROPERTIES + MENUITEM "&Rozšíøené nastevení", IDC_ADVANCED_CONTROLS + MENUITEM SEPARATOR + MENUITEM "&Konec", IDC_EXIT + END + POPUP "&Pomoc" + BEGIN + MENUITEM "&Témata nápovìdy", IDC_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "&O ovládání hlasitosti ...", IDC_ABOUT + END +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SNDVOL32 "Ovládání hlasitosti" + IDS_NOMIXERDEVICES "Nejsou dostupné žádné smìšovací zaøízení! Aplikace se nyní ukonèí." +END + +IDD_PREFERENCES DIALOGEX 0, 0, 224, 250 +STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Možnosti" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Smìšovací zaøízení:", -1, 7,8,48,9 + COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP + GROUPBOX "Upravit hlasitost pro:", -1, 7,25,211,77 + PUSHBUTTON "&Pøehrávání", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Záznam", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Jiné:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED + COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED + + PUSHBUTTON "OK", IDOK, 114,226,50,14 + PUSHBUTTON "Zrušit", IDCANCEL, 168,226,50,14 +END diff --git a/reactos/subsys/system/sndvol32/Fr.rc b/reactos/subsys/system/sndvol32/Fr.rc new file mode 100644 index 00000000000..e16a345038b --- /dev/null +++ b/reactos/subsys/system/sndvol32/Fr.rc @@ -0,0 +1,42 @@ +LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT + +IDM_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "O&ptions" + BEGIN + MENUITEM "P&ropriétés", IDC_PROPERTIES + MENUITEM "&Contrôles avancés", IDC_ADVANCED_CONTROLS + MENUITEM SEPARATOR + MENUITEM "Q&uitter", IDC_EXIT + END + POPUP "&?" + BEGIN + MENUITEM "&Aide", IDC_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "A &propos ...", IDC_ABOUT + END +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SNDVOL32 "Contrôle du volume" + IDS_NOMIXERDEVICES "Il n'y a pas de périphérique de mixage disponible ! L'application va se terminer." +END + +IDD_PREFERENCES DIALOGEX 0, 0, 224, 250 +STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Propriétés" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Périphérique de mixage :", -1, 7,8,48,9 + COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP + GROUPBOX "Ajuster le volume pour :", -1, 7,25,211,77 + PUSHBUTTON "&Lecture", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Enregistrement", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Autre :", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED + COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED + + PUSHBUTTON "OK", IDOK, 114,226,50,14 + PUSHBUTTON "Annuler", IDCANCEL, 168,226,50,14 +END + diff --git a/reactos/subsys/system/sndvol32/Sv.rc b/reactos/subsys/system/sndvol32/Sv.rc index 867d6f19567..c8f31d7a2da 100644 --- a/reactos/subsys/system/sndvol32/Sv.rc +++ b/reactos/subsys/system/sndvol32/Sv.rc @@ -1,61 +1,61 @@ -///////////////////////////////////////////////////////////////////////////// -// Swedish (SE) resources -/* - * Copyright 2005 David Nordenberg - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT - -IDM_MAINMENU MENU DISCARDABLE -BEGIN - POPUP "&Alternativ" - BEGIN - MENUITEM "&Inställningar", IDC_PROPERTIES - MENUITEM "A&vancerade kontroller", IDC_ADVANCED_CONTROLS - MENUITEM SEPARATOR - MENUITEM "&Avsluta", IDC_EXIT - END - POPUP "&Hjälp" - BEGIN - MENUITEM "&Hjälpavsnitt", IDC_HELP_TOPICS - MENUITEM SEPARATOR - MENUITEM "&Om ...", IDC_ABOUT - END -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_SNDVOL32 "Volymkontroll" - IDS_NOMIXERDEVICES "Det finns inga ljudmixningsenheter tillgängliga! Programmet kommer nu att avslutas." -END - -IDD_PREFERENCES DIALOGEX 0, 0, 224, 250 -STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Inställningar" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "&Mixerenhet:", -1, 7,8,48,9 - COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP - GROUPBOX "Justera volymen för:", -1, 7,25,211,77 - PUSHBUTTON "&Uppspelning", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON - PUSHBUTTON "&Inspelning", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON - PUSHBUTTON "&Andra:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED - COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED - - PUSHBUTTON "OK", IDOK, 114,226,50,14 - PUSHBUTTON "Avbryt", IDCANCEL, 168,226,50,14 -END +///////////////////////////////////////////////////////////////////////////// +// Swedish (SE) resources +/* + * Copyright 2005 David Nordenberg + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +IDM_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "&Alternativ" + BEGIN + MENUITEM "&Inställningar", IDC_PROPERTIES + MENUITEM "A&vancerade kontroller", IDC_ADVANCED_CONTROLS + MENUITEM SEPARATOR + MENUITEM "&Avsluta", IDC_EXIT + END + POPUP "&Hjälp" + BEGIN + MENUITEM "&Hjälpavsnitt", IDC_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "&Om ...", IDC_ABOUT + END +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SNDVOL32 "Volymkontroll" + IDS_NOMIXERDEVICES "Det finns inga ljudmixningsenheter tillgängliga! Programmet kommer nu att avslutas." +END + +IDD_PREFERENCES DIALOGEX 0, 0, 224, 250 +STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Inställningar" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Mixerenhet:", -1, 7,8,48,9 + COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP + GROUPBOX "Justera volymen för:", -1, 7,25,211,77 + PUSHBUTTON "&Uppspelning", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Inspelning", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Andra:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED + COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED + + PUSHBUTTON "OK", IDOK, 114,226,50,14 + PUSHBUTTON "Avbryt", IDCANCEL, 168,226,50,14 +END diff --git a/reactos/subsys/system/sndvol32/sndvol32.rc b/reactos/subsys/system/sndvol32/sndvol32.rc index addf9df702a..ea62a4891a6 100644 --- a/reactos/subsys/system/sndvol32/sndvol32.rc +++ b/reactos/subsys/system/sndvol32/sndvol32.rc @@ -15,5 +15,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US IDI_MAINAPP ICON DISCARDABLE resources/sndvol32.ico #include "En.rc" +#include "Fr.rc" +#include "Cz.rc" #include "De.rc" #include "Sv.rc" diff --git a/reactos/subsys/system/taskmgr/Cz.rc b/reactos/subsys/system/taskmgr/Cz.rc new file mode 100644 index 00000000000..2de26088272 --- /dev/null +++ b/reactos/subsys/system/taskmgr/Cz.rc @@ -0,0 +1,684 @@ +///////////////////////////////////////////////////////////////////////////// +// Czech resource files + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT +#pragma code_page(1250) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_TASKMANAGER MENU DISCARDABLE +BEGIN + POPUP "&Soubor" + BEGIN + MENUITEM "&Nová úloha (Spustit...)", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "U&zavøít správce úloh", ID_FILE_EXIT + END + POPUP "&Volby" + BEGIN + MENUITEM "&Vždy navrchu", ID_OPTIONS_ALWAYSONTOP + , CHECKED + MENUITEM "&Minimalizovat pøi použití", ID_OPTIONS_MINIMIZEONUSE + , CHECKED + MENUITEM "&Skrýt pøi minimalizaci", ID_OPTIONS_HIDEWHENMINIMIZED + , CHECKED + MENUITEM "&Zobrazit 16-bitové úlohy", ID_OPTIONS_SHOW16BITTASKS + , CHECKED + END + POPUP "&Zobrazit" + BEGIN + MENUITEM "&Aktualizovat", ID_VIEW_REFRESH + POPUP "&Rychlost aktualizace" + BEGIN + MENUITEM "&Vysoká", ID_VIEW_UPDATESPEED_HIGH + MENUITEM "&Normální", ID_VIEW_UPDATESPEED_NORMAL + , CHECKED + MENUITEM "&Nízká", ID_VIEW_UPDATESPEED_LOW + MENUITEM "&Zastavit", ID_VIEW_UPDATESPEED_PAUSED + + END + MENUITEM SEPARATOR + MENUITEM "&Velké ikony", ID_VIEW_LARGE + MENUITEM "&Malé ikony", ID_VIEW_SMALL + MENUITEM "&Detaily", ID_VIEW_DETAILS, CHECKED + MENUITEM "&Vybrat sloupce...", ID_VIEW_SELECTCOLUMNS + POPUP "&Historie CPU" + BEGIN + MENUITEM "&Jeden graf, všechny procesory", ID_VIEW_CPUHISTORY_ONEGRAPHALL + + MENUITEM "&Jeden graf, jeden procesor", ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU + , CHECKED + END + MENUITEM "&Zobrazit èasy jádra", ID_VIEW_SHOWKERNELTIMES + END + POPUP "&Okna" + BEGIN + MENUITEM "Vyrovnat &horizontálnì", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "Vyrovnat &vertikálnì", ID_WINDOWS_TILEVERTICALLY + MENUITEM "&Minimalizovat", ID_WINDOWS_MINIMIZE + MENUITEM "Ma&ximalizovat", ID_WINDOWS_MAXIMIZE + MENUITEM "&Kaskáda", ID_WINDOWS_CASCADE + MENUITEM "&Pøenést do popøedí", ID_WINDOWS_BRINGTOFRONT + END + POPUP "&Nápovìda" + BEGIN + MENUITEM "&Nápovìda pro správce úloh", ID_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "&O správci úloh", ID_HELP_ABOUT + END +END + +IDR_WINDOWSMENU MENU DISCARDABLE +BEGIN + MENUITEM "Vyrovnat &horizontálnì", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "Vyrovnat &vertikálnì", ID_WINDOWS_TILEVERTICALLY + MENUITEM "&Minimalizovat", ID_WINDOWS_MINIMIZE + MENUITEM "Ma&ximalizovat", ID_WINDOWS_MAXIMIZE + MENUITEM "&Kaskáda", ID_WINDOWS_CASCADE + MENUITEM "&Pøenést do popøedí", ID_WINDOWS_BRINGTOFRONT +END + +IDR_APPLICATION_PAGE_CONTEXT1 MENU DISCARDABLE +BEGIN + POPUP "DUMMY" + BEGIN + MENUITEM "&Nová úloha (Spustit...)", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "&Velké ikony", ID_VIEW_LARGE + MENUITEM "&Malé ikony", ID_VIEW_SMALL + MENUITEM "&Detaily", ID_VIEW_DETAILS, CHECKED + END +END + +IDR_APPLICATION_PAGE_CONTEXT2 MENU DISCARDABLE +BEGIN + POPUP "DUMMY" + BEGIN + MENUITEM "&Pøepnout do", ID_APPLICATION_PAGE_SWITCHTO + MENUITEM "&Pøenést do popøedí", ID_WINDOWS_BRINGTOFRONT + MENUITEM SEPARATOR + MENUITEM "Vyrovnat &horizontálnì", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "Vyrovnat &Vertikálnì", ID_WINDOWS_TILEVERTICALLY + MENUITEM "&Minimalizovat", ID_WINDOWS_MINIMIZE + MENUITEM "Ma&ximalizovat", ID_WINDOWS_MAXIMIZE + MENUITEM "&Kaskáda", ID_WINDOWS_CASCADE + MENUITEM SEPARATOR + MENUITEM "&Ukonèit úlohu", ID_APPLICATION_PAGE_ENDTASK + MENUITEM "&Pøejít k procesu", ID_APPLICATION_PAGE_GOTOPROCESS + + END +END + +IDR_TRAY_POPUP MENU DISCARDABLE +BEGIN + POPUP "DUMMY" + BEGIN + MENUITEM "&Obnovit", ID_RESTORE + MENUITEM "&Uzavøít", ID_FILE_EXIT + MENUITEM SEPARATOR + MENUITEM "&Vždy navrchu", ID_OPTIONS_ALWAYSONTOP + END +END + +IDR_PROCESS_PAGE_CONTEXT MENU DISCARDABLE +BEGIN + POPUP "DUMMY" + BEGIN + MENUITEM "&Ukonèit proces", ID_PROCESS_PAGE_ENDPROCESS + MENUITEM "Ukonèit &strom procesu", ID_PROCESS_PAGE_ENDPROCESSTREE + + MENUITEM "&Ladit", ID_PROCESS_PAGE_DEBUG + MENUITEM SEPARATOR + POPUP "&Priorita" + BEGIN + MENUITEM "&Realtime", ID_PROCESS_PAGE_SETPRIORITY_REALTIME + + MENUITEM "&Vysoká", ID_PROCESS_PAGE_SETPRIORITY_HIGH + + MENUITEM "&Nadprùmìrná", ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL + + MENUITEM "Nor&mální", ID_PROCESS_PAGE_SETPRIORITY_NORMAL + + MENUITEM "&Podprùmìrná", ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL + + MENUITEM "Ní&zká", ID_PROCESS_PAGE_SETPRIORITY_LOW + + END + MENUITEM "Nastavit &afinitu...", ID_PROCESS_PAGE_SETAFFINITY + MENUITEM "Upravit &kanály ladìní...", ID_PROCESS_PAGE_DEBUGCHANNELS + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 259, 210 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "O správci úloh" +FONT 8, "Tahoma" +BEGIN + CONTROL "Správce úloh v1.0\nCopyright (C) 1999 - 2001\n Brian Palmer (brianp@reactos.org)", + IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,53,28, + 122,26 + DEFPUSHBUTTON "OK",IDOK,183,189,44,14,WS_GROUP + ICON IDI_TASKMANAGER,IDC_STATIC,19,30,20,20 + EDITTEXT IDC_LICENSE_EDIT,53,63,174,107,ES_MULTILINE | + ES_READONLY | WS_VSCROLL +END + +IDD_TASKMGR_DIALOG DIALOG DISCARDABLE 0, 0, 264, 246 +STYLE DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | + WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Správce úloh" +MENU IDR_TASKMANAGER +FONT 8, "Tahoma" +BEGIN + CONTROL "Tab1",IDC_TAB,"SysTabControl32",WS_TABSTOP,3,3,257,228 +END + +IDD_APPLICATION_PAGE DIALOG DISCARDABLE 0, 0, 247, 210 +STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "Tahoma" +BEGIN + CONTROL "List2",IDC_APPLIST,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,233,177 + PUSHBUTTON "&Nová úloha...",IDC_NEWTASK,187,189,53,14 + PUSHBUTTON "&Pøepnout",IDC_SWITCHTO,131,189,53,14,WS_DISABLED + PUSHBUTTON "&Ukonèit úlohu",IDC_ENDTASK,75,189,53,14,WS_DISABLED +END + +IDD_PROCESS_PAGE DIALOG DISCARDABLE 0, 0, 247, 210 +STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "Tahoma" +BEGIN + CONTROL "List2",IDC_PROCESSLIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDATA | + WS_BORDER | WS_TABSTOP,7,7,233,177 + PUSHBUTTON "&Ukonèit proces",IDC_ENDPROCESS,171,189,69,14 + CONTROL "&Zobrazit procesy všech uživatelù",IDC_SHOWALLPROCESSES, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,191,111,10 +END + +//IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 +IDD_PERFORMANCE_PAGE DIALOGEX DISCARDABLE 0, 0, 247, 210 +STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "Tahoma" +BEGIN + GROUPBOX "Využití CPU",IDC_CPU_USAGE_FRAME,5,5,60,54,WS_TABSTOP, WS_EX_TRANSPARENT + GROUPBOX "Využití RAM",IDC_MEM_USAGE_FRAME,5,63,60,54,BS_LEFTTEXT, WS_EX_TRANSPARENT + GROUPBOX "Celkem",IDC_TOTALS_FRAME,5,122,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Commit Charge (K)",IDC_COMMIT_CHARGE_FRAME,5,166,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Fyzická pamì (K)",IDC_PHYSICAL_MEMORY_FRAME,131,122,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Pamì jádra (K)",IDC_KERNEL_MEMORY_FRAME,131,166,111,39,0,WS_EX_TRANSPARENT + LTEXT "Popisovaèe",IDS_TOTALS_HANDLE_COUNT,12,131,27,8 + LTEXT "Vlákna",IDS_TOTALS_THREAD_COUNT,12,140,27,8 + LTEXT "Procesy",IDS_TOTALS_PROCESS_COUNT,12,149,34,8 + EDITTEXT IDC_TOTALS_HANDLE_COUNT,65,131,45,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_TOTALS_THREAD_COUNT,65,140,45,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_TOTALS_PROCESS_COUNT,65,149,45,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + LTEXT "Celkem",IDS_COMMIT_CHARGE_TOTAL,12,175,27,8 + LTEXT "Limit",IDS_COMMIT_CHARGE_LIMIT,12,184,15,8 + LTEXT "Vrchol",IDS_COMMIT_CHARGE_PEAK,12,193,34,8 + EDITTEXT IDC_COMMIT_CHARGE_TOTAL,65,174,45,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_COMMIT_CHARGE_LIMIT,65,184,45,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_COMMIT_CHARGE_PEAK,65,193,45,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + LTEXT "Celkem",IDS_PHYSICAL_MEMORY_TOTAL,137,131,27,8 + LTEXT "Dostupná",IDS_PHYSICAL_MEMORY_AVAILABLE,137,140,30,8 + LTEXT "Mezipamì systému",IDS_PHYSICAL_MEMORY_SYSTEM_CACHE,137,149,46,8 + EDITTEXT IDC_PHYSICAL_MEMORY_TOTAL,185,131,48,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_PHYSICAL_MEMORY_AVAILABLE,185,140,48,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_PHYSICAL_MEMORY_SYSTEM_CACHE,185,149,48,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + LTEXT "Celkem",IDS_KERNEL_MEMORY_TOTAL,137,174,27,8 + LTEXT "Stránkováno",IDS_KERNEL_MEMORY_PAGED,137,184,21,8 + LTEXT "Nestránkováno",IDS_KERNEL_MEMORY_NONPAGED,137,193,34,8 + EDITTEXT IDC_KERNEL_MEMORY_TOTAL,185,174,48,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_KERNEL_MEMORY_PAGED,185,184,48,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + EDITTEXT IDC_KERNEL_MEMORY_NONPAGED,185,193,48,8,ES_RIGHT | + ES_READONLY | ES_NUMBER | NOT WS_BORDER + GROUPBOX "Historie využití CPU",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,54,0,WS_EX_TRANSPARENT + GROUPBOX "Historie využití pamìti",IDC_MEMORY_USAGE_HISTORY_FRAME,74,63,168,54,0,WS_EX_TRANSPARENT + PUSHBUTTON "Zobrazení využití CPU",IDC_CPU_USAGE_GRAPH,12,17,47,37,0, + WS_EX_CLIENTEDGE + PUSHBUTTON "Zobrazení využití pamìti",IDC_MEM_USAGE_GRAPH,12,75,47,37,0, + WS_EX_CLIENTEDGE + PUSHBUTTON "Historie využití CPU",IDC_CPU_USAGE_HISTORY_GRAPH,81,17, + 153,37,0,WS_EX_CLIENTEDGE + PUSHBUTTON "Historie využití pamìti",IDC_MEM_USAGE_HISTORY_GRAPH,81,75, + 153,37,0,WS_EX_CLIENTEDGE +END + +IDD_DEBUG_CHANNELS_DIALOG DIALOG DISCARDABLE 0, 0, 247, 210 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Kanály ladìní" +FONT 8, "Tahoma" +BEGIN + CONTROL "List2",IDC_DEBUG_CHANNELS_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP | + LVS_SORTASCENDING,7,7,233,177 + PUSHBUTTON "Zavøít",IDOK,171,189,69,14 +END + +IDD_AFFINITY_DIALOG DIALOG DISCARDABLE 0, 0, 231, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Afinita procesoru" +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK",IDOK,120,133,50,14 + PUSHBUTTON "Storno",IDCANCEL,174,133,50,14 + LTEXT "Nastavení afinity procesoru kontroluje, který proces bude zpracucován jakým procesorem.", + IDC_STATIC,5,5,220,16 + CONTROL "CPU 0",IDC_CPU0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 11,28,37,10 + CONTROL "CPU 1",IDC_CPU1,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,11,41,37,10 + CONTROL "CPU 2",IDC_CPU2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,11,54,37,10 + CONTROL "CPU 3",IDC_CPU3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,11,67,37,10 + CONTROL "CPU 4",IDC_CPU4,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,11,80,37,10 + CONTROL "CPU 5",IDC_CPU5,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,11,93,37,10 + CONTROL "CPU 6",IDC_CPU6,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,11,106,37,10 + CONTROL "CPU 7",IDC_CPU7,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,11,119,37,10 + CONTROL "CPU 8",IDC_CPU8,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,61,28,37,10 + CONTROL "CPU 9",IDC_CPU9,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,61,41,37,10 + CONTROL "CPU 10",IDC_CPU10,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,61,54,41,10 + CONTROL "CPU 11",IDC_CPU11,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,61,67,41,10 + CONTROL "CPU 12",IDC_CPU12,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,61,80,41,10 + CONTROL "CPU 13",IDC_CPU13,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,61,93,41,10 + CONTROL "CPU 14",IDC_CPU14,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,61,106,41,10 + CONTROL "CPU 15",IDC_CPU15,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,61,119,41,10 + CONTROL "CPU 16",IDC_CPU16,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,28,41,10 + CONTROL "CPU 17",IDC_CPU17,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,41,41,10 + CONTROL "CPU 18",IDC_CPU18,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,54,41,10 + CONTROL "CPU 19",IDC_CPU19,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,67,41,10 + CONTROL "CPU 20",IDC_CPU20,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,80,41,10 + CONTROL "CPU 21",IDC_CPU21,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,93,41,10 + CONTROL "CPU 22",IDC_CPU22,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,106,41,10 + CONTROL "CPU 23",IDC_CPU23,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,116,119,41,10 + CONTROL "CPU 24",IDC_CPU24,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,28,41,10 + CONTROL "CPU 25",IDC_CPU25,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,41,41,10 + CONTROL "CPU 26",IDC_CPU26,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,54,41,10 + CONTROL "CPU 27",IDC_CPU27,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,67,41,10 + CONTROL "CPU 28",IDC_CPU28,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,80,41,10 + CONTROL "CPU 29",IDC_CPU29,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,93,41,10 + CONTROL "CPU 30",IDC_CPU30,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,106,41,10 + CONTROL "CPU 31",IDC_CPU31,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,175,119,41,10 +END + +IDD_COLUMNS_DIALOG DIALOG DISCARDABLE 0, 0, 195, 199 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Vyberte sloupce" +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK",IDOK,84,178,50,14 + PUSHBUTTON "Storno",IDCANCEL,138,178,50,14 + LTEXT "Vyberte sloupce, které se zobrazí na kartì Procesy Správce úloh.", + IDC_STATIC,7,7,181,17 + CONTROL "Název &obrazu",IDC_IMAGENAME,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,7,28,56,10 + CONTROL "&PID (Identifikátor procesu)",IDC_PID,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,39,88,10 + CONTROL "Využití &CPU",IDC_CPUUSAGE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,50,53,10 + CONTROL "&Èas CPU",IDC_CPUTIME,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,61,48,10 + CONTROL "Využití &pamìti",IDC_MEMORYUSAGE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,72,63,10 + CONTROL "&Delta využití pamìti",IDC_MEMORYUSAGEDELTA,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,83,82,10 + CONTROL "&Vrchol využití pamìti",IDC_PEAKMEMORYUSAGE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,94,82,10 + CONTROL "&Chyby stránek",IDC_PAGEFAULTS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,105,53,10 + CONTROL "&Uživatelské objekty",IDC_USEROBJECTS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,116,62,10 + CONTROL "I/O ètení",IDC_IOREADS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,127,49,10 + CONTROL "I/O pøeètené bajty",IDC_IOREADBYTES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,138,65,10 + CONTROL "&ID sezení",IDC_SESSIONID,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,149,50,10 + CONTROL "&Jméno uživatele",IDC_USERNAME,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,160,51,10 + CONTROL "&Delta chyby stránek",IDC_PAGEFAULTSDELTA,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,107,28,72,10 + CONTROL "&Velikost virtuální pamìti",IDC_VIRTUALMEMORYSIZE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,107,39,77,10 + CONTROL "&Stránkováno",IDC_PAGEDPOOL,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,107,50,53,10 + CONTROL "&Nestránkováno",IDC_NONPAGEDPOOL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,107,61,67,10 + CONTROL "Základní p&riorita",IDC_BASEPRIORITY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,107,72,55,10 + CONTROL "&popis popisovaèù",IDC_HANDLECOUNT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,107,83,59,10 + CONTROL "&Poèet vláken",IDC_THREADCOUNT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,107,94,59,10 + CONTROL "GDI Objekty",IDC_GDIOBJECTS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,107,105,55,10 + CONTROL "I/O zápisy",IDC_IOWRITES,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,107,116,49,10 + CONTROL "I/O zapsané bajty",IDC_IOWRITEBYTES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,107,127,65,10 + CONTROL "I/O ostatní",IDC_IOOTHER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,107,138,46,10 + CONTROL "I/O ostatní bajty",IDC_IOOTHERBYTES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,107,149,65,10 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 252 + TOPMARGIN, 7 + BOTTOMMARGIN, 203 + END + + IDD_TASKMGR_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 3 + RIGHTMARGIN, 260 + TOPMARGIN, 3 + BOTTOMMARGIN, 231 + END + + IDD_APPLICATION_PAGE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 240 + TOPMARGIN, 7 + BOTTOMMARGIN, 203 + END + + IDD_PROCESS_PAGE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 240 + TOPMARGIN, 7 + BOTTOMMARGIN, 203 + END + + IDD_PERFORMANCE_PAGE, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 242 + VERTGUIDE, 12 + VERTGUIDE, 65 + VERTGUIDE, 110 + TOPMARGIN, 5 + BOTTOMMARGIN, 205 + END + + IDD_AFFINITY_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 224 + VERTGUIDE, 11 + VERTGUIDE, 61 + VERTGUIDE, 116 + VERTGUIDE, 175 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + HORZGUIDE, 28 + HORZGUIDE, 38 + HORZGUIDE, 51 + HORZGUIDE, 64 + HORZGUIDE, 77 + HORZGUIDE, 90 + HORZGUIDE, 103 + HORZGUIDE, 116 + HORZGUIDE, 129 + END + + IDD_COLUMNS_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 188 + VERTGUIDE, 107 + TOPMARGIN, 7 + BOTTOMMARGIN, 192 + HORZGUIDE, 28 + END +END +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Správce úloh" + IDC_TASKMGR "Správce úloh" + IDS_IDLE_PROCESS "Neèinné procesy" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "Spustí novou aplikaci" + ID_OPTIONS_ALWAYSONTOP "Správce úloh zùstane zobrazený nad ostatními okny, dokud jej neminimalizujete" + ID_OPTIONS_MINIMIZEONUSE + "Správce úloh se zminimalizuje po pøepnutí na jinou úlohu" + ID_OPTIONS_HIDEWHENMINIMIZED "Schovat správce úloh po minimalizaci" + ID_VIEW_REFRESH "Pøinutí správce úloh k aktualizaci nezávisle na nastavení rychlosti aktualizace" + ID_VIEW_LARGE "Zobrazí úlohy velkými ikonami" + ID_VIEW_SMALL "Zobrazí úlohy malými ikonami" + ID_VIEW_DETAILS "Zobrazí informace o každé úloze" + ID_VIEW_UPDATESPEED_HIGH "Aktualizuje ukazatel dvakrát za vteøinu" + ID_VIEW_UPDATESPEED_NORMAL "Aktualizuje ukazatel jednou za dvì vteøinu" + ID_VIEW_UPDATESPEED_LOW "Aktualizuje ukazatel jednou za ètyøi vteøinu" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_UPDATESPEED_PAUSED "Automaticky neaktualizuje" + ID_WINDOWS_TILEHORIZONTALLY + "Vyrovná okna horizontálnì na ploše" + ID_WINDOWS_TILEVERTICALLY "Vyrovná okna vertikálnì na ploše" + ID_WINDOWS_MINIMIZE "Minimalizuje okna" + ID_WINDOWS_MAXIMIZE "Maximalizuje okna" + ID_WINDOWS_CASCADE "Poskládá okna do diagonální kaskády" + ID_WINDOWS_BRINGTOFRONT "Pøesune úlohu do popøedí, ale nepøepne do ní" + ID_HELP_TOPICS "Zobrazí témata nápovìdy pro správce úloh" + ID_HELP_ABOUT "Zobrazí informace o aplikaci, její verzi a copyright" + ID_FILE_EXIT "Ukonèí správce úloh" + ID_OPTIONS_SHOW16BITTASKS + "Zobrazí 16-bitové úlohy pod NTVDM" + ID_VIEW_SELECTCOLUMNS "Vyberte, které sloupce budou viditelné na kartì Procesy" + ID_VIEW_SHOWKERNELTIMES "Zobrazí èas jádra v grafu výkonu" + ID_VIEW_CPUHISTORY_ONEGRAPHALL + "Jediný graf historie zobrazí celkovou využitelnost CPU" + ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU "Každý procesor má svùj vlastní graf historie" + ID_APPLICATION_PAGE_SWITCHTO + "Pøepne úlohu do popøedí" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_ENDTASK "Pokusí se ukonèit zvolenou aplikaci" + ID_GOTOPROCESS "Pøepne na proces zvolené úlohy" + ID_RESTORE "Obnoví správce úloh z neviditelného stavu" + ID_PROCESS_PAGE_ENDPROCESS "Odstraní proces ze systému" + ID_PROCESS_PAGE_ENDPROCESSTREE + "Odstraní proces a všechny jeho dceøinné podprocesy ze systému" + ID_PROCESS_PAGE_DEBUG "Pøipojí ladicí aplikaci k tomuto procesu" + ID_PROCESS_PAGE_SETAFFINITY + "Spravuje, který procesor obslouží daný proces" + ID_PROCESS_PAGE_SETPRIORITY_REALTIME + "Pøiøadí procesu Realtime prioritu" + ID_PROCESS_PAGE_SETPRIORITY_HIGH "Pøiøadí procesu vysokou prioritu" + ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL + "Pøiøadí procesu nadprùmìrnou prioritu" + ID_PROCESS_PAGE_SETPRIORITY_NORMAL + "Pøiøadí procesu normální prioritu" + ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL + "Pøiøadí procesu podprùmìrnou prioritu" + ID_PROCESS_PAGE_SETPRIORITY_LOW "Pøiøadí procesu nízkou prioritu" + IDS_LICENSE "This program 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.\r\n\r\nThis program 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 General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA." +END + + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TAB_APPS "Aplikace" + IDS_TAB_PROCESSES "Procesy" + IDS_TAB_PERFORMANCE "Výkon" + IDS_TAB_TASK "Úloha" + IDS_TAB_STATUS "Status" + IDS_TAB_IMAGENAME "Název obrazu" + IDS_TAB_PID "PID" + IDS_TAB_USERNAME "Uživ. jméno" + IDS_TAB_SESSIONID "ID sezení" + IDS_TAB_CPU "CPU" + IDS_TAB_CPUTIME "Èas CPU" + IDS_TAB_MEMUSAGE "Využití pamìti" + IDS_TAB_PEAKMEMUSAGE "Vrchol využití pamìti" + IDS_TAB_MEMDELTA "Pamì Delta" + IDS_TAB_PAGEFAULT "Chyby stránek" + IDS_TAB_PFDELTA "PF Delta" + IDS_TAB_VMSIZE "Velikost virtuální pamìti" + IDS_TAB_PAGEDPOOL "Stránkováno" + IDS_TAB_NPPOOL "Nestránkováno" + IDS_TAB_BASEPRI "Zákl. priorita" + IDS_TAB_HANDLES "Ukazatele" + IDS_TAB_THREADS "Vlákna" + IDS_TAB_USERPBJECTS "USER Objeky" + IDS_TAB_GDIOBJECTS "GDI Objekty" + IDS_TAB_IOREADS "I/O ètení" + IDS_TAB_IOWRITES "I/O zápisy" + IDS_TAB_IOOTHER "I/O ostatní" + IDS_TAB_IOREADBYTES "I/O pøeètené bajty" + IDS_TAB_IOWRITESBYTES "I/O zapsané bajty" + IDS_TAB_IOOTHERBYTES "I/O ostatní bajty" + IDS_MENU_SELECTCOLUMNS "&Vybrat sloupce..." + IDS_MENU_16BITTASK "&Zobrazit 16-bitové úlohy" + IDS_MENU_WINDOWS "&Okna" + IDS_MENU_LARGEICONS "&Velké ikony" + IDS_MENU_SMALLICONS "&Malé ikony" + IDS_MENU_DETAILS "&Detaily" + IDS_MENU_ONEGRAPHALLCPUS "&Jeden graf, všechny CPU" + IDS_MENU_ONEGRAPHPERCPU "Jeden graf &pro každý CPU" + IDS_MENU_CPUHISTORY "Historie &CPU" + IDS_MENU_SHOWKERNELTIMES "&Zobrazit èasy jádra" + IDS_CREATENEWTASK "Vytvoøit novou úlohu" + IDS_CREATENEWTASK_DESC "Napište název aplikace, adresáø, dokument nebo zdroj na Internetu, a správce úloh jej otevøe." + IDS_MSG_ACCESSPROCESSAFF "Není možné zpøístupnit afinitu procesu" + IDS_MSG_PROCESSONEPRO "Proces musí mít nastavenou afinitu alespoò s jedním procesorem." + IDS_MSG_INVALIDOPTION "Neplatná volba" + IDS_MSG_UNABLEDEBUGPROCESS "Není možné ladit proces" + IDS_MSG_WARNINGDEBUG "Upozornìní: ladìní tohoto procesu mùže zpùsobit ztrátu dat.\nJste si jisti s pøipojením ladicího nástroje k tomuto procesu?" + IDS_MSG_TASKMGRWARNING "Upozornìní správce úloh" + IDS_MSG_WARNINGTERMINATING "Upozornìní: ukonèení procesu mùže zpùsobit nevratné škody,\nnapø.: ztrátu dat nebo nestability systému. \nProcesu nebude poskytnuta šance k uložení jeho stavu nebo\ndat pøedtím, než bude ukonèen. Jste si jisti\ns ukonèením procesu?" + IDS_MSG_UNABLETERMINATEPRO "Není možné ukonèit proces" + IDS_MSG_UNABLECHANGEPRIORITY "Není možné zmìnit prioritu" + IDS_MSG_WARNINGCHANGEPRIORITY "Upozornìní: Zmìna priority procesu mùže\nzpùsobit nestabilitu systému a jiné nepøedvídatelné problémy. Jste si jisti\nse zmìnou priority procesu?" + IDS_MSG_TRAYICONCPUUSAGE "Využití CPU: %d%%" + IDS_STATUS_MEMUSAGE "Využití pamìti: %dK / %dK" + IDS_STATUS_CPUUSAGE "Využití CPU: %3d%%" + IDS_STATUS_PROCESSES "Procesy: %d" +END + + +#endif // Czech resource file +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/reactos/subsys/system/taskmgr/En.rc b/reactos/subsys/system/taskmgr/En.rc index 9fa11c8a159..9ad69e3a495 100644 --- a/reactos/subsys/system/taskmgr/En.rc +++ b/reactos/subsys/system/taskmgr/En.rc @@ -661,7 +661,9 @@ BEGIN IDS_MSG_UNABLECHANGEPRIORITY "Unable to Change Priority" IDS_MSG_WARNINGCHANGEPRIORITY "WARNING: Changing the priority class of this process may\ncause undesired results including system instability. Are you\nsure you want to change the priority class?" IDS_MSG_TRAYICONCPUUSAGE "CPU Usage: %d%%" - + IDS_STATUS_MEMUSAGE "Mem Usage: %dK / %dK" + IDS_STATUS_CPUUSAGE "CPU Usage: %3d%%" + IDS_STATUS_PROCESSES "Processes: %d" END diff --git a/reactos/subsys/system/taskmgr/applpage.c b/reactos/subsys/system/taskmgr/applpage.c index ee547ceb86d..06bcb0d9274 100644 --- a/reactos/subsys/system/taskmgr/applpage.c +++ b/reactos/subsys/system/taskmgr/applpage.c @@ -213,7 +213,7 @@ void UpdateApplicationListControlViewSetting(void) DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter) { /* Create the event */ - hApplicationPageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Application Page Event")); + hApplicationPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL); /* If we couldn't create the event then exit the thread */ if (!hApplicationPageEvent) diff --git a/reactos/subsys/system/taskmgr/dbgchnl.c b/reactos/subsys/system/taskmgr/dbgchnl.c index aedc5f995c5..e49618e96b9 100644 --- a/reactos/subsys/system/taskmgr/dbgchnl.c +++ b/reactos/subsys/system/taskmgr/dbgchnl.c @@ -69,11 +69,11 @@ static DWORD get_selected_pid(void) return dwProcessId; } -static int list_channel_CB(HANDLE hProcess, void* addr, char* buffer, void* user) +static int list_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void* user) { int j; - char val[2]; - LVITEMA lvi; + TCHAR val[2]; + LVITEM lvi; int index; HWND hChannelLV = (HWND)user; @@ -85,10 +85,10 @@ static int list_channel_CB(HANDLE hProcess, void* addr, char* buffer, void* index = ListView_InsertItem(hChannelLV, &lvi); if (index == -1) return 0; - val[1] = '\0'; + val[1] = TEXT('\0'); for (j = 0; j < 4; j++) { - val[0] = (buffer[0] & (1 << j)) ? 'x' : ' '; + val[0] = (buffer[0] & (1 << j)) ? TEXT('x') : TEXT(' '); ListView_SetItemText(hChannelLV, index, j + 1, val); } return 1; @@ -96,7 +96,7 @@ static int list_channel_CB(HANDLE hProcess, void* addr, char* buffer, void* struct cce_user { - const char* name; /* channel to look for */ + LPCTSTR name; /* channel to look for */ unsigned value, mask; /* how to change channel */ unsigned done; /* number of successful changes */ unsigned notdone; /* number of unsuccessful changes */ @@ -107,11 +107,11 @@ struct cce_user * * Callback used for changing a given channel attributes */ -static int change_channel_CB(HANDLE hProcess, void* addr, char* buffer, void* pmt) +static int change_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void* pmt) { struct cce_user* user = (struct cce_user*)pmt; - if (!user->name || !strcmp(buffer + 1, user->name)) + if (!user->name || !_tcscmp(buffer + 1, user->name)) { buffer[0] = (buffer[0] & ~user->mask) | (user->value & user->mask); if (WriteProcessMemory(hProcess, addr, buffer, 1, NULL)) @@ -222,7 +222,7 @@ struct dll_option_layout int nb_channels; }; -typedef int (*EnumChannelCB)(HANDLE, void*, char*, void*); +typedef int (*EnumChannelCB)(HANDLE, void*, TCHAR*, void*); /****************************************************************** * enum_channel @@ -235,15 +235,15 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned struct dll_option_layout dol; int i, j, ret = 1; void* buf_addr; - char buffer[32]; + TCHAR buffer[32]; void* addr; - const char** cache = NULL; + const TCHAR** cache = NULL; unsigned num_cache, used_cache; addr = get_symbol(hProcess, "first_dll", "libwine.so"); if (!addr) return -1; if (unique) - cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(char*)); + cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(TCHAR*)); else num_cache = 0; used_cache = 0; @@ -265,12 +265,12 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned * them again */ for (j = 0; j < used_cache; j++) - if (!strcmp(cache[j], buffer + 1)) break; + if (!_tcscmp(cache[j], buffer + 1)) break; if (j != used_cache) continue; if (used_cache == num_cache) - cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(char*)); - cache[used_cache++] = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(buffer + 1) + 1), - buffer + 1); + cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(TCHAR*)); + cache[used_cache++] = _tcscpy(HeapAlloc(GetProcessHeap(), 0, (_tcslen(buffer + 1) + 1) * sizeof(TCHAR)), + buffer + 1); } ret = ce(hProcess, buf_addr, buffer, user); } @@ -278,7 +278,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned } if (unique) { - for (j = 0; j < used_cache; j++) HeapFree(GetProcessHeap(), 0, (char*)cache[j]); + for (j = 0; j < used_cache; j++) HeapFree(GetProcessHeap(), 0, (TCHAR*)cache[j]); HeapFree(GetProcessHeap(), 0, cache); } return 0; @@ -365,13 +365,13 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam) ListView_GetItemText(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0])); ListView_GetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0])); user.name = name; - user.value = (val[0] == 'x') ? 0 : bitmask; + user.value = (val[0] == TEXT('x')) ? 0 : bitmask; user.mask = bitmask; user.done = user.notdone = 0; enum_channel(hProcess, change_channel_CB, &user, FALSE); if (user.done) { - val[0] ^= ('x' ^ ' '); + val[0] ^= (TEXT('x') ^ TEXT(' ')); ListView_SetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val); } if (user.notdone) diff --git a/reactos/subsys/system/taskmgr/makefile b/reactos/subsys/system/taskmgr/makefile index cd1ba71805a..a2e3879fe77 100644 --- a/reactos/subsys/system/taskmgr/makefile +++ b/reactos/subsys/system/taskmgr/makefile @@ -16,7 +16,7 @@ TARGET_INSTALLDIR = system32 TARGET_PCH = precomp.h -TARGET_CFLAGS = -Werror -Wall -DDBG -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -D__USE_W32API +TARGET_CFLAGS = -Werror -Wall -DDBG -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -D__USE_W32API -DUNICODE -D_UNICODE TARGET_SDKLIBS = ntdll.a kernel32.a user32.a gdi32.a comctl32.a diff --git a/reactos/subsys/system/taskmgr/perfdata.c b/reactos/subsys/system/taskmgr/perfdata.c index d1efd5d769b..8583dba40b2 100644 --- a/reactos/subsys/system/taskmgr/perfdata.c +++ b/reactos/subsys/system/taskmgr/perfdata.c @@ -260,15 +260,16 @@ void PerfDataRefresh(void) pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads; pPerfData[Idx].SessionId = pSPI->SessionId; - hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId); - if (hProcess) { - if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) { - ImpersonateLoggedOnUser(hProcessToken); - memset(szTemp, 0, sizeof(TCHAR[MAX_PATH])); - dwSize = MAX_PATH; - GetUserName(szTemp, &dwSize); + if (pSPI->UniqueProcessId != NULL) { + hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId); + if (hProcess) { + if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) { + ImpersonateLoggedOnUser(hProcessToken); + memset(szTemp, 0, sizeof(TCHAR[MAX_PATH])); + dwSize = MAX_PATH; + GetUserName(szTemp, &dwSize); #ifndef UNICODE - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTemp, -1, pPerfData[Idx].UserName, MAX_PATH); + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTemp, -1, pPerfData[Idx].UserName, MAX_PATH); /* int MultiByteToWideChar( UINT CodePage, // code page @@ -280,13 +281,25 @@ int MultiByteToWideChar( ); */ #endif - RevertToSelf(); - CloseHandle(hProcessToken); + RevertToSelf(); + CloseHandle(hProcessToken); + } else { + pPerfData[Idx].UserName[0] = _T('\0'); + } + pPerfData[Idx].USERObjectCount = GetGuiResources(hProcess, GR_USEROBJECTS); + pPerfData[Idx].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS); + GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters); + CloseHandle(hProcess); + } else { + goto ClearInfo; } - pPerfData[Idx].USERObjectCount = GetGuiResources(hProcess, GR_USEROBJECTS); - pPerfData[Idx].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS); - GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters); - CloseHandle(hProcess); + } else { +ClearInfo: + /* clear information we were unable to fetch */ + pPerfData[Idx].UserName[0] = _T('\0'); + pPerfData[Idx].USERObjectCount = 0; + pPerfData[Idx].GDIObjectCount = 0; + ZeroMemory(&pPerfData[Idx].IOCounters, sizeof(IO_COUNTERS)); } pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart; pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart; diff --git a/reactos/subsys/system/taskmgr/perfpage.c b/reactos/subsys/system/taskmgr/perfpage.c index b3e9a12dc07..17d7b995583 100644 --- a/reactos/subsys/system/taskmgr/perfpage.c +++ b/reactos/subsys/system/taskmgr/perfpage.c @@ -318,14 +318,17 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) ULONG TotalProcesses; TCHAR Text[260]; + TCHAR szMemUsage[256]; /* Create the event */ - hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Performance Page Event")); + hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL); /* If we couldn't create the event then exit the thread */ if (!hPerformancePageEvent) return 0; + LoadString(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256); + while (1) { DWORD dwWaitVal; @@ -352,13 +355,13 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) CommitChargeTotal = PerfDataGetCommitChargeTotalK(); CommitChargeLimit = PerfDataGetCommitChargeLimitK(); CommitChargePeak = PerfDataGetCommitChargePeakK(); - _ultoa(CommitChargeTotal, Text, 10); + _ultot(CommitChargeTotal, Text, 10); SetWindowText(hPerformancePageCommitChargeTotalEdit, Text); - _ultoa(CommitChargeLimit, Text, 10); + _ultot(CommitChargeLimit, Text, 10); SetWindowText(hPerformancePageCommitChargeLimitEdit, Text); - _ultoa(CommitChargePeak, Text, 10); + _ultot(CommitChargePeak, Text, 10); SetWindowText(hPerformancePageCommitChargePeakEdit, Text); - wsprintf(Text, _T("Mem Usage: %dK / %dK"), CommitChargeTotal, CommitChargeLimit); + wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit); SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text); /* @@ -367,11 +370,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) KernelMemoryTotal = PerfDataGetKernelMemoryTotalK(); KernelMemoryPaged = PerfDataGetKernelMemoryPagedK(); KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK(); - _ultoa(KernelMemoryTotal, Text, 10); + _ultot(KernelMemoryTotal, Text, 10); SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text); - _ultoa(KernelMemoryPaged, Text, 10); + _ultot(KernelMemoryPaged, Text, 10); SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text); - _ultoa(KernelMemoryNonPaged, Text, 10); + _ultot(KernelMemoryNonPaged, Text, 10); SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text); /* @@ -380,11 +383,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK(); - _ultoa(PhysicalMemoryTotal, Text, 10); + _ultot(PhysicalMemoryTotal, Text, 10); SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text); - _ultoa(PhysicalMemoryAvailable, Text, 10); + _ultot(PhysicalMemoryAvailable, Text, 10); SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text); - _ultoa(PhysicalMemorySystemCache, Text, 10); + _ultot(PhysicalMemorySystemCache, Text, 10); SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text); /* @@ -393,11 +396,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) TotalHandles = PerfDataGetSystemHandleCount(); TotalThreads = PerfDataGetTotalThreadCount(); TotalProcesses = PerfDataGetProcessCount(); - _ultoa(TotalHandles, Text, 10); + _ultot(TotalHandles, Text, 10); SetWindowText(hPerformancePageTotalsHandleCountEdit, Text); - _ultoa(TotalThreads, Text, 10); + _ultot(TotalThreads, Text, 10); SetWindowText(hPerformancePageTotalsThreadCountEdit, Text); - _ultoa(TotalProcesses, Text, 10); + _ultot(TotalProcesses, Text, 10); SetWindowText(hPerformancePageTotalsProcessCountEdit, Text); /* diff --git a/reactos/subsys/system/taskmgr/procpage.c b/reactos/subsys/system/taskmgr/procpage.c index 1e1d8e9c5f7..018376d7c2f 100644 --- a/reactos/subsys/system/taskmgr/procpage.c +++ b/reactos/subsys/system/taskmgr/procpage.c @@ -490,14 +490,18 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter) { ULONG OldProcessorUsage = 0; ULONG OldProcessCount = 0; + TCHAR szCpuUsage[256], szProcesses[256]; /* Create the event */ - hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Process Page Event")); + hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL); /* If we couldn't create the event then exit the thread */ if (!hProcessPageEvent) return 0; + LoadString(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256); + LoadString(hInst, IDS_STATUS_PROCESSES, szProcesses, 256); + while (1) { DWORD dwWaitVal; @@ -523,12 +527,12 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter) if (OldProcessorUsage != PerfDataGetProcessorUsage()) { OldProcessorUsage = PerfDataGetProcessorUsage(); - wsprintf(text, _T("CPU Usage: %3d%%"), OldProcessorUsage); + wsprintf(text, szCpuUsage, OldProcessorUsage); SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text); } if (OldProcessCount != PerfDataGetProcessCount()) { OldProcessCount = PerfDataGetProcessCount(); - wsprintf(text, _T("Processes: %d"), OldProcessCount); + wsprintf(text, szProcesses, OldProcessCount); SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text); } } diff --git a/reactos/subsys/system/taskmgr/resource.h b/reactos/subsys/system/taskmgr/resource.h index e82c9d9d94d..d5fc2d713e9 100644 --- a/reactos/subsys/system/taskmgr/resource.h +++ b/reactos/subsys/system/taskmgr/resource.h @@ -237,6 +237,9 @@ #define IDS_MSG_UNABLECHANGEPRIORITY 360 #define IDS_MSG_WARNINGCHANGEPRIORITY 361 #define IDS_MSG_TRAYICONCPUUSAGE 362 +#define IDS_STATUS_MEMUSAGE 363 +#define IDS_STATUS_CPUUSAGE 364 +#define IDS_STATUS_PROCESSES 365 // Next default values for new objects diff --git a/reactos/subsys/system/taskmgr/run.c b/reactos/subsys/system/taskmgr/run.c index 08a228bf737..a3c3b7c23df 100644 --- a/reactos/subsys/system/taskmgr/run.c +++ b/reactos/subsys/system/taskmgr/run.c @@ -27,38 +27,43 @@ void TaskManager_OnFileNew(void) { HMODULE hShell32; RUNFILEDLG RunFileDlg; - OSVERSIONINFO versionInfo; - WCHAR wTitle[40]; - WCHAR wText[256]; - TCHAR szTemp[256]; - char szTitle[40]; - char szText[256]; + TCHAR szTitle[40]; + TCHAR szText[256]; - /* Load language string from resource file */ - LoadString(hInst, IDS_CREATENEWTASK, szTemp, 40); - strcpy(szTitle,szTemp); - - LoadString(hInst, IDS_CREATENEWTASK_DESC, szTemp, 256); - strcpy(szText,szTemp); + /* Load language strings from resource file */ + LoadString(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0])); + LoadString(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) / sizeof(szText[0])); hShell32 = LoadLibrary(_T("SHELL32.DLL")); - RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (char*)((long)0x3D)); + RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)0x3D); /* Show "Run..." dialog */ if (RunFileDlg) { - versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&versionInfo); - - if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) +#ifndef UNICODE + if (GetVersion() < 0x80000000) { - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, 40); - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, 256); - RunFileDlg(hMainWnd, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY); + WCHAR wTitle[40]; + WCHAR wText[256]; + + /* RunFileDlg is always unicode on NT systems, convert the ansi + strings to unicode */ + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, sizeof(szTitle) / sizeof(szTitle[0])); + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, sizeof(szText) / sizeof(szText[0])); + + RunFileDlg(hMainWnd, 0, NULL, wTitle, wText, RFF_CALCDIRECTORY); } else - RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY); + { + /* RunFileDlg is ansi on win 9x systems */ + RunFileDlg(hMainWnd, 0, NULL, (LPCWSTR)szTitle, (LPCWSTR)szText, RFF_CALCDIRECTORY); + } +#else + /* NOTE - don't check whether running on win 9x or NT, let's just + assume that a unicode build only runs on NT */ + RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY); +#endif } FreeLibrary(hShell32); diff --git a/reactos/subsys/system/taskmgr/run.h b/reactos/subsys/system/taskmgr/run.h index e98db0a5180..1cf178333e7 100644 --- a/reactos/subsys/system/taskmgr/run.h +++ b/reactos/subsys/system/taskmgr/run.h @@ -36,9 +36,9 @@ void TaskManager_OnFileNew(void); typedef void (WINAPI *RUNFILEDLG)( HWND hwndOwner, HICON hIcon, -LPCSTR lpstrDirectory, -LPCSTR lpstrTitle, -LPCSTR lpstrDescription, +LPCWSTR lpstrDirectory, +LPCWSTR lpstrTitle, +LPCWSTR lpstrDescription, UINT uFlags); /* diff --git a/reactos/subsys/system/taskmgr/taskmgr.c b/reactos/subsys/system/taskmgr/taskmgr.c index 751fe7e2f2e..72df0582ceb 100644 --- a/reactos/subsys/system/taskmgr/taskmgr.c +++ b/reactos/subsys/system/taskmgr/taskmgr.c @@ -824,6 +824,10 @@ void TaskManager_OnExitMenuLoop(HWND hWnd) RECT rc; int nParts[3]; TCHAR text[260]; + TCHAR szCpuUsage[256], szProcesses[256]; + + LoadString(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256); + LoadString(hInst, IDS_STATUS_PROCESSES, szProcesses, 256); bInMenuLoop = FALSE; /* Update the status bar pane sizes */ @@ -833,9 +837,9 @@ void TaskManager_OnExitMenuLoop(HWND hWnd) nParts[2] = rc.right; SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts); SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)_T("")); - wsprintf(text, _T("CPU Usage: %3d%%"), PerfDataGetProcessorUsage()); + wsprintf(text, szCpuUsage, PerfDataGetProcessorUsage()); SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text); - wsprintf(text, _T("Processes: %d"), PerfDataGetProcessCount()); + wsprintf(text, szProcesses, PerfDataGetProcessCount()); SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text); } diff --git a/reactos/subsys/system/taskmgr/taskmgr.rc b/reactos/subsys/system/taskmgr/taskmgr.rc index 6f2eb525668..a6144eb322a 100644 --- a/reactos/subsys/system/taskmgr/taskmgr.rc +++ b/reactos/subsys/system/taskmgr/taskmgr.rc @@ -247,6 +247,7 @@ IDB_FONT BITMAP DISCARDABLE res_dir/font.bmp '00 A0 00 00 00 00' } */ +#include "Cz.rc" #include "En.rc" #include "De.rc" #include "Dk.rc" diff --git a/reactos/subsys/system/userinit/En.rc b/reactos/subsys/system/userinit/En.rc new file mode 100644 index 00000000000..2f18fe42cfc --- /dev/null +++ b/reactos/subsys/system/userinit/En.rc @@ -0,0 +1,12 @@ +#include "resource.h" +/* Start move all hard code string to En.rc + * By Magnus Olsen 2005 + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +STRINGTABLE DISCARDABLE +{ + +STRING_USERINIT_FAIL, "Userinit failed to start the shell!\n" + +} diff --git a/reactos/subsys/system/userinit/resource.h b/reactos/subsys/system/userinit/resource.h new file mode 100644 index 00000000000..66e54ef96e5 --- /dev/null +++ b/reactos/subsys/system/userinit/resource.h @@ -0,0 +1,12 @@ +#define RC_STRING_MAX_SIZE 2048 +#define STRING_USERINIT_FAIL 100 + + + + + + + + + + diff --git a/reactos/subsys/system/userinit/userinit.c b/reactos/subsys/system/userinit/userinit.c index 2e7bfd1f9b1..af57b0c200b 100644 --- a/reactos/subsys/system/userinit/userinit.c +++ b/reactos/subsys/system/userinit/userinit.c @@ -24,6 +24,7 @@ * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net) */ #include +#include "resource.h" /* GLOBALS ******************************************************************/ @@ -77,6 +78,7 @@ void StartShell(void) PROCESS_INFORMATION pi; WCHAR Shell[MAX_PATH]; WCHAR ExpandedShell[MAX_PATH]; + TCHAR szMsg[RC_STRING_MAX_SIZE]; GetShell(Shell); @@ -102,7 +104,10 @@ void StartShell(void) CloseHandle(pi.hThread); } else - MessageBox(0, L"Userinit failed to start the shell!\n", NULL, 0); + { + LoadString( GetModuleHandle(NULL), STRING_USERINIT_FAIL, (LPTSTR) szMsg,sizeof(szMsg)); + MessageBox(0, szMsg, NULL, 0); + } } static diff --git a/reactos/subsys/system/userinit/userinit.rc b/reactos/subsys/system/userinit/userinit.rc index 3df26335ee4..29b20bbc05e 100644 --- a/reactos/subsys/system/userinit/userinit.rc +++ b/reactos/subsys/system/userinit/userinit.rc @@ -1,6 +1,9 @@ /* $Id$ */ +#include #define REACTOS_STR_FILE_DESCRIPTION "Userinit Logon Application\0" #define REACTOS_STR_INTERNAL_NAME "userinit\0" #define REACTOS_STR_ORIGINAL_FILENAME "userinit.dll\0" #include +#include "En.rc" + diff --git a/reactos/subsys/system/usetup/bootsup.c b/reactos/subsys/system/usetup/bootsup.c index 309b3ae9a57..5e501300db0 100644 --- a/reactos/subsys/system/usetup/bootsup.c +++ b/reactos/subsys/system/usetup/bootsup.c @@ -564,7 +564,7 @@ SaveCurrentBootSector(PWSTR RootPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -602,7 +602,7 @@ SaveCurrentBootSector(PWSTR RootPath, NULL); Status = NtCreateFile(&FileHandle, - FILE_WRITE_ACCESS, + GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, NULL, @@ -667,7 +667,7 @@ InstallFat16BootCodeToFile(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -716,7 +716,7 @@ InstallFat16BootCodeToFile(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -762,7 +762,7 @@ InstallFat16BootCodeToFile(PWSTR SrcPath, NULL); Status = NtCreateFile(&FileHandle, - FILE_WRITE_ACCESS, + GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, NULL, @@ -831,7 +831,7 @@ InstallFat32BootCodeToFile(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -880,7 +880,7 @@ CHECKPOINT1; NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -932,7 +932,7 @@ CHECKPOINT1; NULL); Status = NtCreateFile(&FileHandle, - FILE_WRITE_ACCESS, + GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, NULL, @@ -975,7 +975,7 @@ CHECKPOINT1; NULL); Status = NtOpenFile(&FileHandle, - FILE_WRITE_ACCESS, + GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, 0, @@ -1038,7 +1038,7 @@ InstallMbrBootCodeToDisk (PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -1087,7 +1087,7 @@ InstallMbrBootCodeToDisk (PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -1134,19 +1134,15 @@ InstallMbrBootCodeToDisk (PWSTR SrcPath, NULL, NULL); - Status = NtCreateFile(&FileHandle, - FILE_WRITE_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_OVERWRITE_IF, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, - NULL, - 0); + Status = NtOpenFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); if (!NT_SUCCESS(Status)) { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); RtlFreeHeap(ProcessHeap, 0, NewBootSector); return(Status); } @@ -1199,7 +1195,7 @@ InstallFat16BootCodeToDisk(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -1248,7 +1244,7 @@ InstallFat16BootCodeToDisk(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -1295,19 +1291,15 @@ InstallFat16BootCodeToDisk(PWSTR SrcPath, NULL, NULL); - Status = NtCreateFile(&FileHandle, - FILE_WRITE_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_OVERWRITE_IF, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, - NULL, - 0); + Status = NtOpenFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); if (!NT_SUCCESS(Status)) { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); RtlFreeHeap(ProcessHeap, 0, NewBootSector); return(Status); } @@ -1365,7 +1357,7 @@ InstallFat32BootCodeToDisk(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -1414,7 +1406,7 @@ InstallFat32BootCodeToDisk(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, @@ -1465,7 +1457,7 @@ InstallFat32BootCodeToDisk(PWSTR SrcPath, NULL); Status = NtOpenFile(&FileHandle, - FILE_WRITE_ACCESS | FILE_WRITE_ATTRIBUTES, + GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, 0, @@ -1563,7 +1555,7 @@ UnprotectBootIni(PWSTR FileName, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, + GENERIC_READ|GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, 0, @@ -1634,7 +1626,7 @@ ProtectBootIni(PWSTR FileName, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, + GENERIC_READ|GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, 0, @@ -2080,7 +2072,7 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, wcscpy(SrcPath, SourceRootPath->Buffer); wcscat(SrcPath, L"\\loader\\freeldr.sys"); - wcscat(DstPath, L"\\Device\\Floppy0\\freeldr.sys"); + wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.sys"); DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); Status = SetupCopyFile(SrcPath, DstPath); @@ -2091,7 +2083,7 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, } /* Create new 'freeldr.ini' */ - wcscat(DstPath, L"\\Device\\Floppy0\\freeldr.ini"); + wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.ini"); DPRINT("Create new 'freeldr.ini'\n"); Status = CreateFreeLoaderIniForReactos(DstPath, @@ -2106,7 +2098,7 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, wcscpy(SrcPath, SourceRootPath->Buffer); wcscat(SrcPath, L"\\loader\\fat.bin"); - wcscat(DstPath, L"\\Device\\Floppy0"); + wcscpy(DstPath, L"\\Device\\Floppy0"); DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath); Status = InstallFat16BootCodeToDisk(SrcPath, diff --git a/reactos/subsys/system/usetup/cabinet.c b/reactos/subsys/system/usetup/cabinet.c index 967f9c222d8..64dedeb3bf5 100755 --- a/reactos/subsys/system/usetup/cabinet.c +++ b/reactos/subsys/system/usetup/cabinet.c @@ -1319,7 +1319,7 @@ CabinetOpen(VOID) NULL); NtStatus = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, @@ -1673,7 +1673,7 @@ CabinetExtractFile(PWCHAR FileName) NULL); NtStatus = NtCreateFile(&DestFile, - FILE_WRITE_ACCESS, + GENERIC_WRITE|FILE_READ_ATTRIBUTES, &ObjectAttributes, &IoStatusBlock, NULL, @@ -1692,7 +1692,7 @@ CabinetExtractFile(PWCHAR FileName) { /* Create destination file, overwrite if it already exists */ NtStatus = NtCreateFile(&DestFile, - FILE_WRITE_ACCESS, + GENERIC_WRITE|FILE_READ_ATTRIBUTES, &ObjectAttributes, &IoStatusBlock, NULL, diff --git a/reactos/subsys/system/usetup/console.c b/reactos/subsys/system/usetup/console.c index d256fa2d04e..a528394223f 100644 --- a/reactos/subsys/system/usetup/console.c +++ b/reactos/subsys/system/usetup/console.c @@ -28,9 +28,11 @@ #include "precomp.h" #include +#include #include "usetup.h" #include "console.h" +#include "keytrans.h" #define NDEBUG #include @@ -194,6 +196,7 @@ ReadConsoleInput(PINPUT_RECORD Buffer) { IO_STATUS_BLOCK Iosb; NTSTATUS Status; + KEYBOARD_INPUT_DATA InputData; Buffer->EventType = KEY_EVENT; Status = NtReadFile(StdInput, @@ -201,11 +204,17 @@ ReadConsoleInput(PINPUT_RECORD Buffer) NULL, NULL, &Iosb, - &Buffer->Event.KeyEvent, + &InputData, +// &Buffer->Event.KeyEvent, sizeof(KEY_EVENT_RECORD), NULL, 0); + if (NT_SUCCESS(Status)) + { + Status = IntTranslateKey(&InputData, &Buffer->Event.KeyEvent); + } + return(Status); } diff --git a/reactos/subsys/system/usetup/filesup.c b/reactos/subsys/system/usetup/filesup.c index c51ecc2070f..20d4b06e662 100644 --- a/reactos/subsys/system/usetup/filesup.c +++ b/reactos/subsys/system/usetup/filesup.c @@ -125,7 +125,7 @@ SetupCopyFile(PWCHAR SourceFileName, NULL); Status = NtOpenFile(&FileHandleSource, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, @@ -166,7 +166,7 @@ SetupCopyFile(PWCHAR SourceFileName, NULL); Status = NtCreateFile(&FileHandleDest, - FILE_WRITE_ACCESS, + GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, NULL, @@ -383,7 +383,7 @@ DoesFileExist(PWSTR PathName, NULL); Status = NtOpenFile(&FileHandle, - FILE_READ_ACCESS, + GENERIC_READ, &ObjectAttributes, &IoStatusBlock, 0, diff --git a/reactos/subsys/system/usetup/inicache.c b/reactos/subsys/system/usetup/inicache.c index f2d63ef9259..eb4d875ef42 100644 --- a/reactos/subsys/system/usetup/inicache.c +++ b/reactos/subsys/system/usetup/inicache.c @@ -1082,7 +1082,7 @@ IniCacheSave(PINICACHE Cache, NULL); Status = NtCreateFile(&FileHandle, - FILE_WRITE_ACCESS, + GENERIC_WRITE, &ObjectAttributes, &IoStatusBlock, NULL, diff --git a/reactos/subsys/system/usetup/keytrans.c b/reactos/subsys/system/usetup/keytrans.c new file mode 100644 index 00000000000..3ea75d17aa9 --- /dev/null +++ b/reactos/subsys/system/usetup/keytrans.c @@ -0,0 +1,342 @@ +/* + * ReactOS kernel + * Copyright (C) 2002 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/keytrans.c + * PURPOSE: Console support functions: keyboard translation + * PROGRAMMER: Tinus + * + * NB: Hardcoded to US keyboard + */ +#define NDEBUG +#include + +#include "precomp.h" +#include +#include +#include + +static WORD KeyTable[] = { +/* 0x00 */ + 0x00, VK_ESCAPE, 0x31, 0x32, + 0x33, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x30, + VK_OEM_MINUS, VK_OEM_PLUS, VK_BACK, VK_TAB, +/* 0x10 */ + 0x51, 0x57, 0x45, 0x52, + 0x54, 0x59, 0x55, 0x49, + 0x4f, 0x50, VK_OEM_4, VK_OEM_6, + VK_RETURN, VK_CONTROL, 0x41, 0x53, +/* 0x20 */ + 0x44, 0x46, 0x47, 0x48, + 0x4a, 0x4b, 0x4c, VK_OEM_1, + VK_OEM_7, 0xc0, VK_LSHIFT, VK_OEM_5, + 0x5a, 0x58, 0x43, 0x56, +/* 0x30 */ + 0x42, 0x4e, 0x4d, VK_OEM_COMMA, + VK_OEM_PERIOD, VK_OEM_2, VK_RSHIFT, VK_MULTIPLY, + VK_LMENU, VK_SPACE, VK_CAPITAL, VK_F1, + VK_F2, VK_F3, VK_F4, VK_F5, +/* 0x40 */ + VK_F6, VK_F7, VK_F8, VK_F9, + VK_F10, VK_NUMLOCK, VK_SCROLL, VK_NUMPAD7, + VK_NUMPAD8, VK_NUMPAD9, VK_SUBTRACT, VK_NUMPAD4, + VK_NUMPAD5, VK_NUMPAD6, VK_ADD, VK_NUMPAD1, +/* 0x50 */ + VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD0, VK_SEPARATOR, + 0, 0, 0, VK_F11, + VK_F12, 0, 0, 0, + 0, 0, 0, 0, +/* 0x60 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, +/* 0x70 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 +}; + +static WORD KeyTableEnhanced[] = { +/* 0x00 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, +/* 0x10 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + VK_RETURN, VK_RCONTROL, 0, 0, +/* 0x20 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, +/* 0x30 */ + 0, 0, 0, 0, + 0, VK_DIVIDE, 0, VK_SNAPSHOT, + VK_RMENU, 0, 0, 0, + 0, 0, 0, 0, +/* 0x40 */ + 0, 0, 0, 0, + 0, 0, 0, VK_HOME, + VK_UP, VK_PRIOR, 0, VK_LEFT, + 0, VK_RIGHT, 0, VK_END, +/* 0x50 */ + VK_DOWN, VK_NEXT, VK_INSERT, VK_DELETE, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, +/* 0x60 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, +/* 0x70 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 +}; + +typedef struct _SCANTOASCII { + USHORT ScanCode; + USHORT Enhanced; + UCHAR Normal; + UCHAR Shift; + UCHAR NumLock; +} SCANTOASCII, *PSCANTOASCII; + +SCANTOASCII ScanToAscii[] = { +{ 0x1e, 0, 'a', 'A', 0 }, +{ 0x30, 0, 'b', 'B', 0 }, +{ 0x2e, 0, 'c', 'C', 0 }, +{ 0x20, 0, 'd', 'D', 0 }, +{ 0x12, 0, 'e', 'E', 0 }, +{ 0x21, 0, 'f', 'F', 0 }, +{ 0x22, 0, 'g', 'G', 0 }, +{ 0x23, 0, 'h', 'H', 0 }, +{ 0x17, 0, 'i', 'I', 0 }, +{ 0x24, 0, 'j', 'J', 0 }, +{ 0x25, 0, 'k', 'K', 0 }, +{ 0x26, 0, 'l', 'L', 0 }, +{ 0x32, 0, 'm', 'M', 0 }, +{ 0x31, 0, 'n', 'N', 0 }, +{ 0x18, 0, 'o', 'O', 0 }, +{ 0x19, 0, 'p', 'P', 0 }, +{ 0x10, 0, 'q', 'Q', 0 }, +{ 0x13, 0, 'r', 'R', 0 }, +{ 0x1f, 0, 's', 'S', 0 }, +{ 0x14, 0, 't', 'T', 0 }, +{ 0x16, 0, 'u', 'U', 0 }, +{ 0x2f, 0, 'v', 'V', 0 }, +{ 0x11, 0, 'w', 'W', 0 }, +{ 0x2d, 0, 'x', 'X', 0 }, +{ 0x15, 0, 'y', 'Y', 0 }, +{ 0x2c, 0, 'z', 'Z', 0 }, + +{ 0x02, 0, '1', '!', 0 }, +{ 0x03, 0, '2', '@', 0 }, +{ 0x04, 0, '3', '#', 0 }, +{ 0x05, 0, '4', '$', 0 }, +{ 0x06, 0, '5', '%', 0 }, +{ 0x07, 0, '6', '^', 0 }, +{ 0x08, 0, '7', '&', 0 }, +{ 0x09, 0, '8', '*', 0 }, +{ 0x0a, 0, '9', '(', 0 }, +{ 0x0b, 0, '0', ')', 0 }, + +{ 0x29, 0, '\'', '~', 0 }, +{ 0x0c, 0, '-', '_', 0 }, +{ 0x0d, 0, '=', '+', 0 }, +{ 0x1a, 0, '[', '{', 0 }, +{ 0x1b, 0, ']', '}', 0 }, +{ 0x2b, 0, '\\', '|', 0 }, +{ 0x27, 0, ';', ':', 0 }, +{ 0x28, 0, '\'', '"', 0 }, +{ 0x33, 0, ',', '<', 0 }, +{ 0x34, 0, '.', '>', 0 }, +{ 0x35, 0, '/', '?', 0 }, + +{ 0x4f, 0, 0, 0, '1' }, +{ 0x50, 0, 0, 0, '2' }, +{ 0x51, 0, 0, 0, '3' }, +{ 0x4b, 0, 0, 0, '4' }, +{ 0x4c, 0, 0, 0, '5' }, +{ 0x4d, 0, 0, 0, '6' }, +{ 0x47, 0, 0, 0, '7' }, +{ 0x48, 0, 0, 0, '8' }, +{ 0x49, 0, 0, 0, '9' }, +{ 0x52, 0, 0, 0, '0' }, + +{ 0x4a, 0, '-', '-', 0 }, +{ 0x4e, 0, '+', '+', 0 }, +{ 0x37, 0, '*', '*', 0 }, +{ 0x35, 1, '/', '/', 0 }, +{ 0x53, 0, 0, 0, '.' }, + +{ 0x39, 0, ' ', ' ', 0 }, + +{ 0x1c, 0, '\r', '\r', 0 }, +{ 0x1c, 1, '\r', '\r', 0 }, +{ 0x0e, 0, 0x08, 0x08, 0 }, /* backspace */ + +{ 0, 0, 0, 0, 0 } +}; + + +static void +IntUpdateControlKeyState(LPDWORD State, PKEYBOARD_INPUT_DATA InputData) +{ + DWORD Value = 0; + + if (InputData->Flags & KEY_E1) /* Only the pause key has E1 */ + return; + + if (!(InputData->Flags & KEY_E0)) { + switch (InputData->MakeCode) { + case 0x2a: + case 0x36: + Value = SHIFT_PRESSED; + break; + + case 0x1d: + Value = LEFT_CTRL_PRESSED; + break; + + case 0x38: + Value = LEFT_ALT_PRESSED; + break; + + default: + return; + } + } else { + switch (InputData->MakeCode) { + case 0x1d: + Value = RIGHT_CTRL_PRESSED; + break; + + case 0x38: + Value = RIGHT_ALT_PRESSED; + break; + + default: + return; + } + } + + if (InputData->Flags & KEY_BREAK) + *State &= ~Value; + else + *State |= Value; +} + +static DWORD +IntVKFromKbdInput(PKEYBOARD_INPUT_DATA InputData, DWORD KeyState) +{ + if (!(KeyState & ENHANCED_KEY)) { + DPRINT("Not enhanced, using %x\n", InputData->MakeCode & 0x7f); + return KeyTable[InputData->MakeCode & 0x7f]; + } + + DPRINT("Enhanced, using %x\n", InputData->MakeCode & 0x7f); + return KeyTableEnhanced[InputData->MakeCode & 0x7f]; +} + +static UCHAR +IntAsciiFromInput(PKEYBOARD_INPUT_DATA InputData, DWORD KeyState) +{ + UINT Counter = 0; + USHORT Enhanced = 0; + + if (KeyState & ENHANCED_KEY) Enhanced = 1; + + while (ScanToAscii[Counter].ScanCode != 0) { + if ((ScanToAscii[Counter].ScanCode == InputData->MakeCode) && + (ScanToAscii[Counter].Enhanced == Enhanced)) { + if (ScanToAscii[Counter].NumLock) { + if ((KeyState & NUMLOCK_ON) && + !(KeyState & SHIFT_PRESSED)) { + return ScanToAscii[Counter].NumLock; + } else { + return ScanToAscii[Counter].Normal; + } + } + if (KeyState & SHIFT_PRESSED) + return ScanToAscii[Counter].Shift; + + return ScanToAscii[Counter].Normal; + } + Counter++; + } + + return 0; +} + +/* This is going to be quick and messy. The usetup app runs in native mode + * so it cannot use the translation routines in win32k which means it'll have + * to be done here too. + * + * Only the bKeyDown, AsciiChar and wVirtualKeyCode members are used + * in the app so I'll just fill the others with somewhat sane values + */ +NTSTATUS +IntTranslateKey(PKEYBOARD_INPUT_DATA InputData, KEY_EVENT_RECORD *Event) +{ + static DWORD dwControlKeyState; + + RtlZeroMemory(Event, sizeof(KEY_EVENT_RECORD)); + + if (!(InputData->Flags & KEY_BREAK)) + Event->bKeyDown = TRUE; + else + Event->bKeyDown = FALSE; + + Event->wRepeatCount = 1; + Event->wVirtualScanCode = InputData->MakeCode; + + DPRINT("Translating: %x\n", InputData->MakeCode); + + IntUpdateControlKeyState(&dwControlKeyState, InputData); + Event->dwControlKeyState = dwControlKeyState; + + if (InputData->Flags & KEY_E0) + Event->dwControlKeyState |= ENHANCED_KEY; + + Event->wVirtualKeyCode = IntVKFromKbdInput(InputData, + Event->dwControlKeyState); + + DPRINT("Result: %x\n", Event->wVirtualKeyCode); + + if (Event->bKeyDown) { + Event->uChar.AsciiChar = + IntAsciiFromInput(InputData, + Event->dwControlKeyState); + DPRINT("Char: %x\n", Event->uChar.AsciiChar); + } else { + Event->uChar.AsciiChar = 0; + } + + return STATUS_SUCCESS; +} diff --git a/reactos/subsys/system/usetup/keytrans.h b/reactos/subsys/system/usetup/keytrans.h new file mode 100644 index 00000000000..61a757eaffb --- /dev/null +++ b/reactos/subsys/system/usetup/keytrans.h @@ -0,0 +1,35 @@ +/* + * ReactOS kernel + * Copyright (C) 2003 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: keytrans.h 12852 2005-01-06 13:58:04Z mf $ + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/keytrans.h + * PURPOSE: Keyboard translation functionality + * PROGRAMMER: Tinus + */ + +#ifndef __KEYTRANS_H__ +#define __KEYTRANS_H__ + +NTSTATUS +IntTranslateKey(PKEYBOARD_INPUT_DATA InputData, KEY_EVENT_RECORD *Event); + +#endif /* __KEYTRANS_H__ */ + +/* EOF */ diff --git a/reactos/subsys/system/usetup/makefile b/reactos/subsys/system/usetup/makefile index a51941eb83a..daa91584d4c 100644 --- a/reactos/subsys/system/usetup/makefile +++ b/reactos/subsys/system/usetup/makefile @@ -23,10 +23,10 @@ TARGET_CFLAGS = -D__NTAPP__ -I$(PATH_TO_TOP)/lib/zlib -Wall -Werror -Wno-format TARGET_OBJECTS = bootsup.o cabinet.o console.o drivesup.o filequeue.o \ filesup.o format.o fslist.o genlist.o infcache.o \ inicache.o partlist.o progress.o registry.o settings.o \ - usetup.o + usetup.o keytrans.o include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk -# EOF \ No newline at end of file +# EOF diff --git a/reactos/subsys/system/usetup/usetup.xml b/reactos/subsys/system/usetup/usetup.xml index 68b920bd0e3..98a1a31ebe4 100644 --- a/reactos/subsys/system/usetup/usetup.xml +++ b/reactos/subsys/system/usetup/usetup.xml @@ -19,6 +19,7 @@ genlist.c infcache.c inicache.c + keytrans.c partlist.c progress.c registry.c diff --git a/reactos/subsys/system/vmwinst/Cz.rc b/reactos/subsys/system/vmwinst/Cz.rc new file mode 100644 index 00000000000..ca9ebb5eec7 --- /dev/null +++ b/reactos/subsys/system/vmwinst/Cz.rc @@ -0,0 +1,130 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_WELCOMEPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "ReactOS zjistil, že bìží pod VMware(r).", -1, 100, 8, 160, 24 + LTEXT "Pokud chcete nainstalovat VMware(r) SVGA ovladaè klepnìte na 'Další', pokud ovladaè instalovat nechcete, klepnìte na 'Storno'.", -1, 100, 140, 160, 17 +END + +IDD_INSERT_VMWARE_TOOLS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Standardní instalace ReactOS neobsahuje VMware(r) SVGA ovladaè.\n\nProto musíte v oknì VMware(r) workstation vybrat nabídku 'VM' a zvolit položku 'Install VMware tools...'\n\n\nKlepnìte na 'Další' pro pokraèování nebo 'Storno' pro pøeskoèení instalace SVGA ovladaèe.",-1,25,25,225,85 +END + +IDD_INSTALLING_VMWARE_TOOLS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "{STATUS}",IDC_INSTALLINGSTATUS,25,68,225,8 + CONTROL "", IDC_INSTALLINGPROGRESS, "msctls_progress32", PBS_MARQUEE | WS_CHILD | WS_VISIBLE | WS_BORDER, 25, 80, 225, 8 +END + +IDD_CONFIG DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Ovladaè obrazovky VMware(r) SVGA byl úspìšnì nainstalován. Nyní, prosím, vyberte preferované rozlišení obrazovky:",-1,25,5,225,20 + PUSHBUTTON "640x480", 540, 25, 30, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "800x600", 1400, 25, 45, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1024x768", 1792, 25, 60, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1152x864", 2016, 25, 75, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1280x960", 2240, 110, 30, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1280x1024", 2304, 110, 45, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1400x1050", 2450, 110, 60, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1600x1200", 2800, 110, 75, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1792x1344", 3136, 195, 30, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1856x1392", 3248, 195, 45, 65, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "1920x1440", 3360, 195, 60, 50, 15, BS_AUTORADIOBUTTON + LTEXT "Nyní vyberte preferovanou hloubku barev:", -1, 25, 93, 225, 12 + COMBOBOX IDC_COLORQUALITY, 25, 105, 75, 80, CBS_DROPDOWNLIST | WS_TABSTOP +END + +IDD_INSTALLATION_FAILED DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Nelze nainstalovat VMware(r) SVGA ovladaè.\n\n\nKlepnìte na 'Dokonèit' pro pokraèování v instalaèním procesu.",-1,25,25,225,85 +END + +IDD_CHOOSEACTION DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Ovladaè VMware(r) SVGA je již nainstalován.\n\nNyní, prosím, zvolte, co chete provést:",-1,25,5,225,30 + PUSHBUTTON "Upravit nastavení obrazovky", IDC_CONFIGSETTINGS, 25, 40, 200, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "Použít jiný grafický ovladaè", IDC_USEOTHERDRIVER, 25, 55, 200, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "Odebrat ovladaè VMware(r) SVGA", IDC_UNINSTALL, 25, 70, 200, 15, BS_AUTORADIOBUTTON + LTEXT "Klepnìte na 'Další' pro pokraèování nebo na 'Storno' pro ukonèení prùvodce.", -1, 25, 93, 225, 12 +END + +IDD_SELECTDRIVER DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Vyberte, prosím, grafický ovladaè, který chcete použít:",-1,25,25,225,15 + PUSHBUTTON "ReactOS VGA ovladaè", IDC_VGA, 25, 40, 225, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "ReactOS VBE ovladaè (SVGA)", IDC_VBE, 25, 55, 225, 15, BS_AUTORADIOBUTTON + LTEXT "Klepnìte na 'Dokonèit' pro dokonèení operace nebo na 'Storno' pro ukonèení nastavení beze zmìn.", -1, 25, 93, 225, 20 +END + +IDD_DOUNINSTALL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Instalace ovladaèe obrazovky" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Nyní bude odebrán ovladaè VMware(r) SVGA!!!\n\n\nKlepnìte na 'Dokonèit' pro odebrání ovladaèe nebo na 'Storno' pro ponechání.",-1,25,25,225,85 +END + +STRINGTABLE +BEGIN + IDS_WIZARD_NAME "Detekováno prostøedí VMware(r)" + IDS_FAILEDTOLOCATEDRIVERS "ReactOS nemùže nalézt požadované soubory.\nZkontrolujte, prosím, zda je VMware(r) tools CD-ROM správnì vloženo." + IDS_FAILEDTOCOPYFILES "Nelze zkopírovat požadované soubory.\nZkontrolujte, prosím, zda je VMware(r) tools CD-ROM správnì vloženo.\n" + IDS_FAILEDTOACTIVATEDRIVER "Nepodaøilo se zaktivovat VMware(r) SVGA ovladaè!" + IDS_FAILEDTOSELVGADRIVER "Nepodaøilo se zaktivovat ReactOS VGA ovladaè!" + IDS_FAILEDTOSELVBEDRIVER "Nepodaøilo se zaktivovat ReactOS VBE ovladaè!" + IDS_UNINSTNOTICE "Podpùrné soubory VMware(r) SVGA ovladaèe nebyly odstranìny.\nSmažte je, prosím, po restarování systému." +END + +STRINGTABLE +BEGIN + 10001 "Nejnižší (8BPP)" + 10002 "Støední (16BPP)" + 10003 "Nejvyšší (32BPP)" +END + +STRINGTABLE +BEGIN + IDS_SEARCHINGFORCDROM "Hledá se VMware(r) Tools CD-ROM..." + IDS_COPYINGFILES "kopírují se soubory..." + IDS_ENABLINGDRIVER "Zavádí se ovladaè VMware(r) SVGA..." +END + +STRINGTABLE +BEGIN + IDD_INSERT_VMWARE_TOOLSTITLE "Prùvodce instalací VMware (r) SVGA ovladaèe" + IDD_INSERT_VMWARE_TOOLSSUBTITLE "Vložte, prosím, VMware(r) tools CD-ROM." + IDD_INSTALLING_VMWARE_TOOLSTITLE "Prùvodce instalací VMware (r) SVGA ovladaèe" + IDD_INSTALLING_VMWARE_TOOLSSUBTITLE "Vyhledání a kopírování VMware (r) SVGA ovladaèe." + IDD_CONFIGTITLE "Prùvodce instalací VMware (r) SVGA ovladaèe" + IDD_CONFIGSUBTITLE "Vyberte, prosím, preferované rozlišení obrazovky:" + IDD_INSTALLATION_FAILEDTITLE "Prùvodce instalací VMware (r) SVGA ovladaèe" + IDD_INSTALLATION_FAILEDSUBTITLE "Instalace ovladaèe VMware (r) SVGA selhala." + IDD_CHOOSEACTIONTITLE "Prùvodce instalací VMware (r) SVGA ovladaèe" + IDD_CHOOSEACTIONSUBTITLE "Zvolte, prosím, co chete provést." + IDD_SELECTDRIVERTITLE "Prùvodce instalací VMware (r) SVGA ovladaèe" + IDD_SELECTDRIVERSUBTITLE "Vyberte ovladaè." + IDD_DOUNINSTALLTITLE "Prùvodce instalací VMware (r) SVGA ovladaèe" + IDD_DOUNINSTALLSUBTITLE "Odstranìní ovladaèe." +END diff --git a/reactos/subsys/system/vmwinst/vmwinst.rc b/reactos/subsys/system/vmwinst/vmwinst.rc index 327d3cd090c..9408402c579 100644 --- a/reactos/subsys/system/vmwinst/vmwinst.rc +++ b/reactos/subsys/system/vmwinst/vmwinst.rc @@ -22,6 +22,7 @@ IDB_HEADER BITMAP "resources/header.bmp" * files. Note that you can and may override resources which also have * a neutral version. This is to get localized bitmaps for example. */ +#include "Cz.rc" #include "En.rc" #include "De.rc" #include "Dk.rc" diff --git a/reactos/subsys/system/welcome/Cz.rc b/reactos/subsys/system/welcome/Cz.rc new file mode 100644 index 00000000000..77df6b29a79 --- /dev/null +++ b/reactos/subsys/system/welcome/Cz.rc @@ -0,0 +1,62 @@ +/* $Id: Cz.rc 12852 2005-04-30 23:58:04Z potapnik $ */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +/* String Tables */ + +/* Default settings */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPTITLE "ReactOS - Vítejte" + IDS_DEFAULTTOPICTITLE "ReactOS" + IDS_DEFAULTTOPICDESC "Vítejte v operaèním systému ReactOS.\n\nKlepnìte na tlaèítko v levém sloupci." +// IDS_CHECKTEXT "Zobrazit dialog znovu" +// IDS_CLOSETEXT "Konec" +END + +/* Topic buttons */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOPICBUTTON0 "Instalovat ReactOS" + IDS_TOPICBUTTON1 "Prohlížet toto CD" + IDS_TOPICBUTTON2 "Konec" +// IDS_TOPICBUTTON3 "Empty Topic 3" +// IDS_TOPICBUTTON4 "Empty Topic 4" +// IDS_TOPICBUTTON5 "Empty Topic 5" +// IDS_TOPICBUTTON6 "Empty Topic 6" +// IDS_TOPICBUTTON7 "Empty Topic 7" +// IDS_TOPICBUTTON8 "Empty Topic 8" +// IDS_TOPICBUTTON9 "Empty Topic 9" +END + +/* Topic titles */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOPICTITLE0 "Instalovat ReactOS" + IDS_TOPICTITLE1 "Prohlížet toto CD" + IDS_TOPICTITLE2 "Konec" +// IDS_TOPICTITLE3 "Empty Topic Title 3" +// IDS_TOPICTITLE4 "Empty Topic Title 4" +// IDS_TOPICTITLE5 "Empty Topic Title 5" +// IDS_TOPICTITLE6 "Empty Topic Title 6" +// IDS_TOPICTITLE7 "Empty Topic Title 7" +// IDS_TOPICTITLE8 "Empty Topic Title 8" +// IDS_TOPICTITLE9 "Empty Topic Title 9" +END + +/* Topic descriptions */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOPICDESC0 "Nainstaluje ReactOS na Váš poèítaè nebo zaktualizuje existující systém." + IDS_TOPICDESC1 "Prohlížet toto CD." + IDS_TOPICDESC2 "Klepnìte pro ukonèení tohoto programu." +// IDS_TOPICDESC3 "Topic description 3.\n\nDescribe topic 3 here." +// IDS_TOPICDESC4 "Topic description 4.\n\nDescribe topic 4 here." +// IDS_TOPICDESC5 "Topic description 5.\n\nDescribe topic 5 here." +// IDS_TOPICDESC6 "Topic description 6.\n\nDescribe topic 6 here." +// IDS_TOPICDESC7 "Topic description 7.\n\nDescribe topic 7 here." +// IDS_TOPICDESC8 "Topic description 8.\n\nDescribe topic 8 here." +// IDS_TOPICDESC9 "Topic description 9.\n\nDescribe topic 9 here." +END + +/* EOF */ diff --git a/reactos/subsys/system/welcome/welcome.rc b/reactos/subsys/system/welcome/welcome.rc index 5c14ef2ace9..e6c40b5431d 100755 --- a/reactos/subsys/system/welcome/welcome.rc +++ b/reactos/subsys/system/welcome/welcome.rc @@ -47,6 +47,7 @@ END /* Language-specific resources */ +#include "Cz.rc" #include "En.rc" #include "De.rc" #include "Dk.rc" diff --git a/reactos/subsys/system/winefile/Sv.rc b/reactos/subsys/system/winefile/Sv.rc new file mode 100644 index 00000000000..6993d42f5a9 --- /dev/null +++ b/reactos/subsys/system/winefile/Sv.rc @@ -0,0 +1,213 @@ +/* + * WineFile + * Swedish Language Support + * + * Copyright 2005 David Nordenberg + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT +#pragma code_page(1252) + + +/* Menu */ + + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Arkiv" { + MENUITEM "&Öppna\tEnter", 101 + MENUITEM "&Flytta...\tF7", ID_FILE_MOVE + MENUITEM "&Kopiera...\tF8", 107 + MENUITEM "&I urklipp...\tF9", 118 + MENUITEM "&Ta bort\tDel", 108 + MENUITEM "&Byt namn...", 109 + MENUITEM "&Egenskaper...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Komprimera...", 119 + MENUITEM "Packa &upp...", 120 + MENUITEM SEPARATOR + MENUITEM "&Kör...", ID_EXECUTE + MENUITEM "&Skriv ut...", 102 + MENUITEM "Associera...", 103 + MENUITEM SEPARATOR + MENUITEM "Skapa mapp...", 111 + MENUITEM "&Sök...", 104 + MENUITEM "&Välj filer...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "&Avsluta\tAlt+X" , ID_FILE_EXIT +#else + MENUITEM "&Avsluta", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "&Kopiera disk...", 201 + MENUITEM "&Namnge disk...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatera disk...", 203 +#ifdef _WIN95 + MENUITEM "&Skapa systemdisk...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Anslut &Nätverksenhet", 252 + MENUITEM "&Koppla ifrån Nätverksenhet", 253 + MENUITEM SEPARATOR + MENUITEM "Dela ut...", 254 + MENUITEM "&Ta bort utdelning...", 255 + MENUITEM SEPARATOR + MENUITEM "&Välj enhet...", 251 + } + + POPUP "&Träd" { + MENUITEM "&Nästa nivå\t+", 301 + MENUITEM "Utöka &träd\t*", 302 + MENUITEM "Utöka &alla\tCtrl+*", 303 + MENUITEM "Kollapsa &träd\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Markera undermappar", 505 + } + + POPUP "&Visa" { + MENUITEM "&Träd och mapp", 413 + MENUITEM "Bara tr&äd", 411 + MENUITEM "Bara &mapp", 412 + MENUITEM SEPARATOR + MENUITEM "De&la", 414 + MENUITEM SEPARATOR + MENUITEM "&Namn", ID_VIEW_NAME + MENUITEM "&Alla Fildetaljer" , ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Vissa detaljer..." , ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Sortera efter namn", 404 + MENUITEM "Sortera efter t&yp", 405 + MENUITEM "Sortera efter st&orlek", 406 + MENUITEM "Sortera efter &datum", 407 + MENUITEM SEPARATOR + MENUITEM "Sortera efter &...", 409 + } + + POPUP "&Inställningar" { + MENUITEM "&Bekräftelse...", -1 + MENUITEM "&Teckensnitt...", ID_SELECT_FONT + MENUITEM "&Konfigurera verktygsfält...", -1 + MENUITEM SEPARATOR + MENUITEM "&Verktygsfält", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Enhetsfält", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "St&atusfält", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "F&ullskärm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimera vid körning" , -1 + MENUITEM "&Spara ändringar vid stängning", 511 + } + + + POPUP "&Säkerhet" { + MENUITEM "&Åtkomst..." , 605 + MENUITEM "&Loggning..." , 606 + MENUITEM "&Ägare..." , 607 + } + + POPUP "&Fönster" { + MENUITEM "Nytt &fönster", ID_WINDOW_NEW + MENUITEM "Överlappande\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Ordna &horizontellt", ID_WINDOW_TILE_HORZ + MENUITEM "Ordna &vertikalt\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Ordna automatiskt", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Ordna &symboler", ID_WINDOW_ARRANGE + MENUITEM "&Uppdatera\tF5", ID_REFRESH + } + + + POPUP "&?" { + MENUITEM "&Hjälpavsnitt\tF1", ID_HELP + MENUITEM "Hjälp &sök...\tF1", ID_HELP + MENUITEM "&Använda hjälpen\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "Information om &Winefile...", ID_ABOUT +/* POPUP "Info..." { + MENUITEM "Info about &Wine..." , ID_ABOUT_WINE + MENUITEM "&License..." ID_LICENSE + MENUITEM "&NO WARRANTY" ID_NO_WARRANTY + } */ + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Kör" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Kommando:" , -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Som &symbol" , 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK" , 1, 158, 6, 47, 14 + PUSHBUTTON "Avbryt" , 2, 158, 23, 47, 14 + PUSHBUTTON "&Hjälp" , 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Välj mål" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Sökväg:" , -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK" , 1, 158, 6, 47, 14 + PUSHBUTTON "Avbryt" , 2, 158, 23, 47, 14 + PUSHBUTTON "&Bläddra" , 254, 158, 43, 47, 14 +} + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Verkställ teckensnittsinställningar" + IDS_FONT_SEL_ERROR "Ett fel uppstog när ett nytt teckensnitt valdes." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Fel" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Skrivbord" + IDS_SHELL "Skal" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Ej implementerat ännu" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Namn" + IDS_COL_SIZE "Storlek" + IDS_COL_CDATE "CDatum" + IDS_COL_ADATE "ADatum" + IDS_COL_MDATE "MDatum" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Länkar" + IDS_COL_ATTR "Attribut" + IDS_COL_SEC "Säkerhet" +} diff --git a/reactos/subsys/system/winefile/cz.rc b/reactos/subsys/system/winefile/cz.rc new file mode 100644 index 00000000000..a7bb1e428e3 --- /dev/null +++ b/reactos/subsys/system/winefile/cz.rc @@ -0,0 +1,211 @@ +/* + * WineFile + * Czech Language Support + * + * Copyright 2005 Denzil + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT +#pragma code_page(1250) + + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Soubor" { + MENUITEM "&Otevøít\tEnter" , 101 + MENUITEM "&Pøesunout...\tF7" , ID_FILE_MOVE + MENUITEM "&Kopírovat...\tF8" , 107 + MENUITEM "&Ve schránce...\tF9" , 118 + MENUITEM "&Smazat\tDel" , 108 + MENUITEM "Pø&ejmenovat..." , 109 + MENUITEM "V&lastnosti...\tAlt+Enter" , ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Komprese..." , 119 + MENUITEM "&Dekomprese..." , 120 + MENUITEM SEPARATOR + MENUITEM "&Spustit..." , ID_EXECUTE + MENUITEM "&Tisknout..." , 102 + MENUITEM "Asociovat..." , 103 + MENUITEM SEPARATOR + MENUITEM "V&ytvoøit adresáø..." , 111 + MENUITEM "&Hledat..." , 104 + MENUITEM "&Zvolit voubory..." , 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "K&onec\tAlt+X" , ID_FILE_EXIT +#else + MENUITEM "K&onec", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "&Kopírovat disk..." , 201 + MENUITEM "&Jmenovka disk..." , 202 + MENUITEM SEPARATOR + MENUITEM "&Formátovat disk..." , 203 +#ifdef _WIN95 + MENUITEM "&Vytvoøit systemový disk...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Pøipojit &síové zaøízení" , 252 + MENUITEM "&Odpojit &síové zaøízení" , 253 + MENUITEM SEPARATOR + MENUITEM "Sdílet jako..." , 254 + MENUITEM "&Odstranit sdílení..." , 255 + MENUITEM SEPARATOR + MENUITEM "&Zvolit zaøízení..." , 251 + } + + POPUP "&Adresáøe" { + MENUITEM "&Další úroveò\t+" , 301 + MENUITEM "Rozbalit &strom\t*" , 302 + MENUITEM "Rozbalit &vše\tStrg+*" , 303 + MENUITEM "Sbalit &strom\t-" , 304 + MENUITEM SEPARATOR + MENUITEM "&Oznaèit potomky" , 505 + } + + POPUP "&Zobrazení" { + MENUITEM "&Strom a adresáøe" , 413 + MENUITEM "&Jen strom" , 411 + MENUITEM "Jen &adresáøe" , 412 + MENUITEM SEPARATOR + MENUITEM "&Rozdìlit" , 414 + MENUITEM SEPARATOR + MENUITEM "&Jméno" , ID_VIEW_NAME + MENUITEM "&Detaily všech souborù" , ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "Èá&steèné detaily..." , ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Tøídit podle jména" , 404 + MENUITEM "Tøídit &podle typu" , 405 + MENUITEM "Tøídit podle &velikosti" , 406 + MENUITEM "Tøídit podle &data" , 407 + MENUITEM SEPARATOR + MENUITEM "Tøídit podle &..." , 409 + } + + POPUP "&Nastavení" { + MENUITEM "&Potvrzování..." , -1 + MENUITEM "&Písmo..." , ID_SELECT_FONT + MENUITEM "Upravit panel &nástrojù..." , -1 + MENUITEM SEPARATOR + MENUITEM "&Panel nástrojù" , ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Panel zaøíení" , ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Stavový øádek" , ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "&Celaá obrazovka\tCtrl+Shift+S" , ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimalizovat pøi spuštìní" , -1 + MENUITEM "&Uložit nastavení pøi vypnutí" , 511 + } + + + POPUP "&Zabezpeèení" { + MENUITEM "&Pøístup..." , 605 + MENUITEM "&Logování..." , 606 + MENUITEM "&Vlastník..." , 607 + } + + POPUP "&Okno" { + MENUITEM "Nové &okno" , ID_WINDOW_NEW + MENUITEM "Kaskádování\tCtrl+F5" , ID_WINDOW_CASCADE + MENUITEM "Uspoøádat &horizontálnì" , ID_WINDOW_TILE_HORZ + MENUITEM "Uspoøádat &vertikálnì\tCtrl+F4" , ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Zarovnat automaticky" , ID_WINDOW_AUTOSORT +#endif + MENUITEM "Zarovnat &symboly" , ID_WINDOW_ARRANGE + MENUITEM "&Aktualizovat\tF5" , ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Témata nápovìdy\tF1" , ID_HELP + MENUITEM "Hledání v &nápovìdì...\tF1" , ID_HELP + MENUITEM "&Jak používat nápovìdu\tF1" , ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "Informace o &Winefile..." , ID_ABOUT +/* POPUP "Info..." { + MENUITEM "Informace o &Wine..." , ID_ABOUT_WINE +// MENUITEM "&Licence..." ID_LICENSE +// MENUITEM "&BEZ ZÁRUKY" ID_NO_WARRANTY + } */ + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Spustit" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Pøíkaz:" , -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Jako &Symbol" , 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK" , 1, 158, 6, 47, 14 + PUSHBUTTON "Zrušit" , 2, 158, 23, 47, 14 + PUSHBUTTON "&Pomoc" , 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Zvolte cíl" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Cesta:" , -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK" , 1, 158, 6, 47, 14 + PUSHBUTTON "Zrušit" , 2, 158, 23, 47, 14 + PUSHBUTTON "&Procházet" , 254, 158, 43, 47, 14 +} + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Aplikování nastavení písma" + IDS_FONT_SEL_ERROR "Chyba pøi volbì nového písma." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Chyba" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Plocha" + IDS_SHELL "Pøíkazový øádek" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Zatím neimplementováno" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Jméno" + IDS_COL_SIZE "Velikost" + IDS_COL_CDATE "CDatum" + IDS_COL_ADATE "ADatum" + IDS_COL_MDATE "MDatum" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Links" + IDS_COL_ATTR "Atributy" + IDS_COL_SEC "Zabezpeèení" +} diff --git a/reactos/subsys/system/winefile/winefile.c b/reactos/subsys/system/winefile/winefile.c index 013cdcacdba..2343274fa59 100644 --- a/reactos/subsys/system/winefile/winefile.c +++ b/reactos/subsys/system/winefile/winefile.c @@ -3411,6 +3411,59 @@ static BOOL pane_command(Pane* pane, UINT cmd) } +static IContextMenu2* s_pctxmenu2 = NULL; + +#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005) +static IContextMenu3* s_pctxmenu3 = NULL; +#endif + +static void CtxMenu_reset() +{ + s_pctxmenu2 = NULL; + +#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005) + s_pctxmenu3 = NULL; +#endif +} + +IContextMenu* CtxMenu_query_interfaces(IContextMenu* pcm1) +{ + IContextMenu* pcm = NULL; + + CtxMenu_reset(); + +#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005) + if ((*pcm1->lpVtbl->QueryInterface)(pcm1, &IID_IContextMenu3, (void**)&pcm) == NOERROR) + s_pctxmenu3 = (LPCONTEXTMENU3)pcm; + else +#endif + if ((*pcm1->lpVtbl->QueryInterface)(pcm1, &IID_IContextMenu2, (void**)&pcm) == NOERROR) + s_pctxmenu2 = (LPCONTEXTMENU2)pcm; + + if (pcm) { + (*pcm1->lpVtbl->Release)(pcm1); + return pcm; + } else + return pcm1; +} + +static BOOL CtxMenu_HandleMenuMsg(UINT nmsg, WPARAM wparam, LPARAM lparam) +{ +#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005) + if (s_pctxmenu3) { + if (SUCCEEDED((*s_pctxmenu3->lpVtbl->HandleMenuMsg)(s_pctxmenu3, nmsg, wparam, lparam))) + return TRUE; + } +#endif + + if (s_pctxmenu2) + if (SUCCEEDED((*s_pctxmenu2->lpVtbl->HandleMenuMsg)(s_pctxmenu2, nmsg, wparam, lparam))) + return TRUE; + + return FALSE; +} + + static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST* apidl, int x, int y) { IContextMenu* pcm; @@ -3421,12 +3474,16 @@ static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParen if (SUCCEEDED(hr)) { HMENU hmenu = CreatePopupMenu(); + pcm = CtxMenu_query_interfaces(pcm); + if (hmenu) { hr = (*pcm->lpVtbl->QueryContextMenu)(pcm, hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL); if (SUCCEEDED(hr)) { UINT idCmd = TrackPopupMenu(hmenu, TPM_LEFTALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON, x, y, 0, hwndParent, NULL); + CtxMenu_reset(); + if (idCmd) { CMINVOKECOMMANDINFO cmi; @@ -3442,7 +3499,8 @@ static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParen hr = (*pcm->lpVtbl->InvokeCommand)(pcm, &cmi); } - } + } else + CtxMenu_reset(); } (*pcm->lpVtbl->Release)(pcm); @@ -3466,8 +3524,10 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam if (dis->CtlID == IDW_TREE_LEFT) draw_item(&child->left, dis, entry, -1); - else + else if (dis->CtlID == IDW_TREE_RIGHT) draw_item(&child->right, dis, entry, -1); + else + goto draw_menu_item; return TRUE;} @@ -3746,6 +3806,33 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam break;} #endif + case WM_MEASUREITEM: + draw_menu_item: + if (!wparam) // Is the message menu-related? + if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam)) + return TRUE; + + break; + + case WM_INITMENUPOPUP: + if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam)) + return 0; + + break; + +#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005) + case WM_MENUCHAR: // only supported by IContextMenu3 + if (s_pctxmenu3) { + LRESULT lResult = 0; + + (*s_pctxmenu3->lpVtbl->HandleMenuMsg2)(s_pctxmenu3, nmsg, wparam, lparam, &lResult); + + return lResult; + } + + break; +#endif + case WM_SIZE: if (wparam != SIZE_MINIMIZED) resize_tree(child, LOWORD(lparam), HIWORD(lparam)); diff --git a/reactos/subsys/system/winefile/winefile.rc b/reactos/subsys/system/winefile/winefile.rc index 8724bc6a1fc..588c0edff11 100644 --- a/reactos/subsys/system/winefile/winefile.rc +++ b/reactos/subsys/system/winefile/winefile.rc @@ -27,8 +27,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* include localised resources */ -#include "de.rc" #include "en.rc" +#include "cz.rc" +#include "de.rc" #include "es.rc" #include "fr.rc" #include "hu.rc" @@ -38,4 +39,5 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "ru.rc" #include "si.rc" #include "zh.rc" +#include "sv.rc" diff --git a/reactos/subsys/system/winlogon/Cz.rc b/reactos/subsys/system/winlogon/Cz.rc new file mode 100644 index 00000000000..7e79f639b1f --- /dev/null +++ b/reactos/subsys/system/winlogon/Cz.rc @@ -0,0 +1,45 @@ +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_SHUTDOWNCOMPUTER DIALOG 45, 22, 164, 52 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Vypnutí poèítaèe" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Nyní mùžete bez obav vypnout Váš poèítaè.", IDC_SHUTDOWNCOMPUTER, 31, 13, 132, 8 + ICON IDI_WINLOGON, IDC_SHTDOWNICON, 6, 7, 18, 20 + DEFPUSHBUTTON "&Restartovat", IDC_BTNSHTDOWNCOMPUTER, 62, 32, 40, 14 +END + +IDD_GINALOADFAILED DIALOG 58, 83, 231, 119 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Chyba uživatelského rozhraní" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Dynamická knihovna %s selhala pøi nahrávaní.", IDC_GINALOADFAILED, 39, 16, 156, 24 + LTEXT "Kontaktujte správce poèítaèe pro nahrazení dynamickì knihovny nebo obnovte pùvodní dynamickou knihovnu.", IDC_GINALOADFAILEDCONTACT, 39, 53, 151, 25 + DEFPUSHBUTTON "&Restart", 1, 80, 91, 68, 14 +END + +STRINGTABLE +BEGIN + IDS_PREPARENETWORKCONNECTIONS "Pøíprava síových pøipojení..." + IDS_APPLYINGCOMPUTERSETTINGS "Nastavení poèítaèe..." + IDS_RUNNINGSTARTUPSCRIPTS "Spouštìcí skripty..." + IDS_RUNNINGSHUTDOWNSCRIPTS "Ukonèovací skripty..." + IDS_APPLYINGYOURPERSONALSETTINGS "Osobní nastavení..." + IDS_RUNNINGLOGOFFSCRIPTS "Skripty po odhlášení..." + IDS_RUNNINGLOGONSCRIPTS "Skripty po pøihlášení..." + IDS_LOADINGYOURPERSONALSETTINGS "Nahrávání osobního nastavení..." + IDS_CLOSINGNETWORKCONNECTIONS "Ukonèení síových pøipojení..." + IDS_REACTOSISSHUTTINGDOWN "ReactOS se vypíná..." + IDS_PREPARETOSTANDBY "Pøíprava k pøechodu do úsporného režimu..." + IDS_PREPARETOHIBERNATE "Pøíprava k pøechodu do režimu hibernace..." + IDS_SAVEYOURSETTINGS "Ukládání osobního nastavení..." + IDS_REACTOSISSTARTINGUP "ReactOS se spouští..." +END + +STRINGTABLE +BEGIN + IDS_FAILEDACTIVATEUSERSHELL "Aplikace Winlogon selhala pøi aktivaci shellu!" +END + diff --git a/reactos/subsys/system/winlogon/Sv.rc b/reactos/subsys/system/winlogon/Sv.rc new file mode 100644 index 00000000000..6922b43c2a4 --- /dev/null +++ b/reactos/subsys/system/winlogon/Sv.rc @@ -0,0 +1,47 @@ +//Swedish resources by David Nordenberg 2005-04-29 + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +IDD_SHUTDOWNCOMPUTER DIALOG 45, 22, 164, 52 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Stäng av datorn" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Du kan nu stänga av datorn.", IDC_SHUTDOWNCOMPUTER, 31, 13, 132, 8 + ICON IDI_WINLOGON, IDC_SHTDOWNICON, 6, 7, 18, 20 + DEFPUSHBUTTON "&Starta om", IDC_BTNSHTDOWNCOMPUTER, 62, 32, 40, 14 +END + +IDD_GINALOADFAILED DIALOG 58, 83, 231, 119 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Användargränssnittet kunde inte starta" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "DLL-filen %s kunde inte laddas.", IDC_GINALOADFAILED, 39, 16, 156, 24 + LTEXT "Kontakta din systemadministratör för att ersätta eller återställa DLL-filen.", IDC_GINALOADFAILEDCONTACT, 39, 53, 151, 25 + DEFPUSHBUTTON "&Starta om", 1, 80, 91, 68, 14 +END + +STRINGTABLE +BEGIN + IDS_PREPARENETWORKCONNECTIONS "Förbereder nätverksanslutningar..." + IDS_APPLYINGCOMPUTERSETTINGS "Verkställer datorns inställningar..." + IDS_RUNNINGSTARTUPSCRIPTS "Kör uppstartsskript..." + IDS_RUNNINGSHUTDOWNSCRIPTS "Kör avstängningsskript..." + IDS_APPLYINGYOURPERSONALSETTINGS "Verkställer dina personliga inställningar..." + IDS_RUNNINGLOGOFFSCRIPTS "Kör utloggningsskript..." + IDS_RUNNINGLOGONSCRIPTS "Kör inloggningsskript..." + IDS_LOADINGYOURPERSONALSETTINGS "Laddar dina personliga inställningar..." + IDS_CLOSINGNETWORKCONNECTIONS "Stänger nätverksanslutningar..." + IDS_REACTOSISSHUTTINGDOWN "ReactOS håller på att stängas av..." + IDS_PREPARETOSTANDBY "Förbereder för vänteläge..." + IDS_PREPARETOHIBERNATE "Förbereder för viloläge..." + IDS_SAVEYOURSETTINGS "Sparar dina inställningar..." + IDS_REACTOSISSTARTINGUP "ReactOS startas..." +END + +STRINGTABLE +BEGIN + IDS_FAILEDACTIVATEUSERSHELL "Winlogon kunde inte ladda användarskalet!" +END + diff --git a/reactos/subsys/system/winlogon/winlogon.rc b/reactos/subsys/system/winlogon/winlogon.rc index 4903dd479aa..77ca65d6283 100644 --- a/reactos/subsys/system/winlogon/winlogon.rc +++ b/reactos/subsys/system/winlogon/winlogon.rc @@ -12,6 +12,9 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US /* IDI_WINLOGON ICON "resources/winlogon.ico" */ +#include "Cz.rc" #include "En.rc" #include "De.rc" +#include "Sv.rc" + diff --git a/reactos/subsys/win32k/include/tags.h b/reactos/subsys/win32k/include/tags.h index 88634b7b1cd..9ef987f0774 100644 --- a/reactos/subsys/win32k/include/tags.h +++ b/reactos/subsys/win32k/include/tags.h @@ -5,6 +5,7 @@ /* ntuser */ #define TAG_MOUSE TAG('M', 'O', 'U', 'S') /* mouse */ +#define TAG_KEYBOARD TAG('K', 'B', 'D', ' ') /* keyboard */ #define TAG_ACCEL TAG('A', 'C', 'C', 'L') /* accelerator */ #define TAG_HOOK TAG('W', 'N', 'H', 'K') /* hook */ #define TAG_HOTKEY TAG('H', 'O', 'T', 'K') /* hotkey */ diff --git a/reactos/subsys/win32k/main/dllmain.c b/reactos/subsys/win32k/main/dllmain.c index 6270b3e6c64..494508aa4f2 100644 --- a/reactos/subsys/win32k/main/dllmain.c +++ b/reactos/subsys/win32k/main/dllmain.c @@ -195,23 +195,22 @@ Win32kThreadCallback (struct _ETHREAD *Thread, } } - Win32Thread->hDesktop = hDesk; - - Status = ObReferenceObjectByHandle(hDesk, - 0, - ExDesktopObjectType, - KernelMode, - (PVOID*)&Win32Thread->Desktop, - NULL); - - if(!NT_SUCCESS(Status)) + if (hDesk != NULL) { - DPRINT1("Unable to reference thread desktop handle 0x%x\n", hDesk); - Win32Thread->Desktop = NULL; + Status = ObReferenceObjectByHandle(hDesk, + 0, + ExDesktopObjectType, + KernelMode, + (PVOID*)&Win32Thread->Desktop, + NULL); NtClose(hDesk); + if(!NT_SUCCESS(Status)) + { + DPRINT1("Unable to reference thread desktop handle 0x%x\n", hDesk); + Win32Thread->Desktop = NULL; + } } } - Win32Thread->IsExiting = FALSE; IntDestroyCaret(Win32Thread); Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread); diff --git a/reactos/subsys/win32k/misc/driver.c b/reactos/subsys/win32k/misc/driver.c index 67618a1400e..9784caaca6b 100644 --- a/reactos/subsys/win32k/misc/driver.c +++ b/reactos/subsys/win32k/misc/driver.c @@ -187,7 +187,9 @@ BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED, DRIVER_FUNCTION(EnableSurface); DRIVER_FUNCTION(DisableSurface); DRIVER_FUNCTION(AssertMode); + DRIVER_FUNCTION(Offset); DRIVER_FUNCTION(ResetPDEV); + DRIVER_FUNCTION(DisableDriver); DRIVER_FUNCTION(CreateDeviceBitmap); DRIVER_FUNCTION(DeleteDeviceBitmap); DRIVER_FUNCTION(RealizeBrush); @@ -200,6 +202,7 @@ BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED, DRIVER_FUNCTION(TransparentBlt); DRIVER_FUNCTION(CopyBits); DRIVER_FUNCTION(StretchBlt); + DRIVER_FUNCTION(StretchBltROP); DRIVER_FUNCTION(SetPalette); DRIVER_FUNCTION(TextOut); DRIVER_FUNCTION(Escape); @@ -240,6 +243,7 @@ BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED, DRIVER_FUNCTION(QuerySpoolType); DRIVER_FUNCTION(GradientFill); DRIVER_FUNCTION(SynchronizeSurface); + DRIVER_FUNCTION(AlphaBlend); END_FUNCTION_MAP(); diff --git a/reactos/subsys/win32k/misc/ssec.c b/reactos/subsys/win32k/misc/ssec.c index 8dd28a8371e..b62e3d4b25d 100644 --- a/reactos/subsys/win32k/misc/ssec.c +++ b/reactos/subsys/win32k/misc/ssec.c @@ -310,6 +310,7 @@ IntUserMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, ASSERT(SharedSectionPool && Process && SystemMappedBase && UserMappedBase); SectionObject = NULL; + SharedSection = NULL; ExAcquireFastMutex(&SharedSectionPool->Lock); diff --git a/reactos/subsys/win32k/ntddraw/ddraw.c b/reactos/subsys/win32k/ntddraw/ddraw.c index 9e088691c13..5d3687bebb7 100644 --- a/reactos/subsys/win32k/ntddraw/ddraw.c +++ b/reactos/subsys/win32k/ntddraw/ddraw.c @@ -187,6 +187,7 @@ BOOL STDCALL NtGdiDdQueryDirectDrawObject( pDirectDraw->DdLockD3DBuffer = puD3dBufferCallbacks->LockD3DBuffer; pDirectDraw->DdUnlockD3DBuffer = puD3dBufferCallbacks->UnlockD3DBuffer; } + GDIOBJ_UnlockObj(hDirectDrawLocal); @@ -286,14 +287,14 @@ DWORD STDCALL NtGdiDdGetDriverInfo( DWORD pdwNumFourCC; DWORD *pdwFourCC = NULL; DWORD ddRVal; - - + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); - ddRVal = pDirectDraw->DrvGetDirectDrawInfo( + + ddRVal = pDirectDraw->DrvGetDirectDrawInfo( pDirectDraw->Global.dhpdev,(PDD_HALINFO) puGetDriverInfoData, &pdwNumHeaps, pvmList, &pdwNumFourCC, pdwFourCC); - + GDIOBJ_UnlockObj(hDirectDrawLocal); return ddRVal; @@ -319,5 +320,49 @@ DWORD STDCALL NtGdiDdWaitForVerticalBlank( } +DWORD STDCALL NtGdiDdCanCreateSurface( + HANDLE hDirectDrawLocal, + PDD_CANCREATESURFACEDATA puCanCreateSurfaceData +) +{ + DWORD ddRVal; + + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + + puCanCreateSurfaceData->lpDD = pDirectDraw->Local.lpGbl; + + ddRVal = pDirectDraw->DdCanCreateSurface(puCanCreateSurfaceData); + + GDIOBJ_UnlockObj(hDirectDrawLocal); + + return ddRVal; +} + + + +DWORD STDCALL NtGdiDdBlt( + HANDLE hSurfaceDest, + HANDLE hSurfaceSrc, + PDD_BLTDATA puBltData +) +{ + DWORD ddRVal; + + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceDest, GDI_OBJECT_TYPE_DIRECTDRAW); + + puBltData->lpDDDestSurface = hSurfaceDest; + puBltData->lpDDSrcSurface = hSurfaceSrc; + puBltData->lpDD = pDirectDraw->Local.lpGbl; + + ddRVal = pDirectDraw->DdBlt(puBltData); + + GDIOBJ_UnlockObj(hSurfaceDest); + + return ddRVal; +} + + + + /* EOF */ diff --git a/reactos/subsys/win32k/ntddraw/stubs.c b/reactos/subsys/win32k/ntddraw/stubs.c index 1f2eb06d3fa..5bad4c71f7a 100644 --- a/reactos/subsys/win32k/ntddraw/stubs.c +++ b/reactos/subsys/win32k/ntddraw/stubs.c @@ -21,8 +21,7 @@ DWORD STDCALL NtGdiDdGetAvailDriverMemory( PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData ) { - UNIMPLEMENTED - + UNIMPLEMENTED return 0; } @@ -91,12 +90,7 @@ DWORD STDCALL NtGdiDdAddAttachedSurface( return 0; } -DWORD STDCALL NtGdiDdAlphaBlt(VOID) -{ - UNIMPLEMENTED - return 0; -} BOOL STDCALL NtGdiDdAttachSurface( HANDLE hSurfaceFrom, @@ -118,16 +112,6 @@ DWORD STDCALL NtGdiDdBeginMoCompFrame( return 0; } -DWORD STDCALL NtGdiDdBlt( - HANDLE hSurfaceDest, - HANDLE hSurfaceSrc, - PDD_BLTDATA puBltData -) -{ - UNIMPLEMENTED - - return 0; -} DWORD STDCALL NtGdiDdCanCreateD3DBuffer( HANDLE hDirectDraw, @@ -139,15 +123,7 @@ DWORD STDCALL NtGdiDdCanCreateD3DBuffer( return 0; } -DWORD STDCALL NtGdiDdCanCreateSurface( - HANDLE hDirectDraw, - PDD_CANCREATESURFACEDATA puCanCreateSurfaceData -) -{ - UNIMPLEMENTED - return 0; -} DWORD STDCALL NtGdiDdColorControl( HANDLE hSurface, @@ -443,26 +419,6 @@ DWORD STDCALL NtGdiDdLockD3D( return 0; } -/* -BOOL STDCALL NtGdiDdQueryDirectDrawObject( - HANDLE hDirectDrawLocal, - DD_HALINFO *pHalInfo, - DWORD *pCallBackFlags, - PD3DNTHAL_CALLBACKS puD3dCallbacks, - PD3DNTHAL_GLOBALDRIVERDATA puD3dDriverData, - PDD_D3DBUFCALLBACKS puD3dBufferCallbacks, - LPDDSURFACEDESC puD3dTextureFormats, - DWORD *puNumHeaps, - VIDEOMEMORY *puvmList, - DWORD *puNumFourCC, - DWORD *puFourCC -) -{ - UNIMPLEMENTED - - return 0; -} -*/ DWORD STDCALL NtGdiDdQueryMoCompStatus( HANDLE hMoComp, @@ -595,4 +551,10 @@ DWORD STDCALL NtGdiDdUpdateOverlay( } +DWORD STDCALL NtGdiDdAlphaBlt(VOID) +{ + UNIMPLEMENTED + + return 0; +} /* EOF */ diff --git a/reactos/subsys/win32k/ntuser/input.c b/reactos/subsys/win32k/ntuser/input.c index 15374e54ced..5775b166447 100644 --- a/reactos/subsys/win32k/ntuser/input.c +++ b/reactos/subsys/win32k/ntuser/input.c @@ -31,6 +31,7 @@ #include #include +#include /* GLOBALS *******************************************************************/ @@ -219,6 +220,185 @@ MouseThreadMain(PVOID StartContext) } } +/* Returns a value that indicates if the key is a modifier key, and + * which one. + */ +STATIC UINT STDCALL +IntKeyboardGetModifiers(KEYBOARD_INPUT_DATA *InputData) +{ + if (InputData->Flags & KEY_E1) + return 0; + + if (!(InputData->Flags & KEY_E0)) + { + switch (InputData->MakeCode) + { + case 0x2a: /* left shift */ + case 0x36: /* right shift */ + return MOD_SHIFT; + + case 0x1d: /* left control */ + return MOD_CONTROL; + + case 0x38: /* left alt */ + return MOD_ALT; + + default: + return 0; + } + } + else + { + switch (InputData->MakeCode) + { + case 0x1d: /* right control */ + return MOD_CONTROL; + + case 0x38: /* right alt */ + return MOD_ALT; + + case 0x5b: /* left gui (windows) */ + case 0x5c: /* right gui (windows) */ + return MOD_WIN; + + default: + return 0; + } + } +} + +/* Asks the keyboard driver to send a small table that shows which + * lights should connect with which scancodes + */ +STATIC NTSTATUS STDCALL +IntKeyboardGetIndicatorTrans(HANDLE KeyboardDeviceHandle, + PKEYBOARD_INDICATOR_TRANSLATION *IndicatorTrans) +{ + NTSTATUS Status; + DWORD Size = 0; + IO_STATUS_BLOCK Block; + PKEYBOARD_INDICATOR_TRANSLATION Ret; + + Size = sizeof(KEYBOARD_INDICATOR_TRANSLATION); + + Ret = ExAllocatePoolWithTag(PagedPool, + Size, + TAG_KEYBOARD); + + while (Ret) + { + Status = NtDeviceIoControlFile(KeyboardDeviceHandle, + NULL, + NULL, + NULL, + &Block, + IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION, + NULL, 0, + Ret, Size); + + if (Status != STATUS_BUFFER_TOO_SMALL) + break; + + ExFreePool(Ret); + + Size += sizeof(KEYBOARD_INDICATOR_TRANSLATION); + + Ret = ExAllocatePoolWithTag(PagedPool, + Size, + TAG_KEYBOARD); + } + + if (!Ret) + return STATUS_INSUFFICIENT_RESOURCES; + + if (Status != STATUS_SUCCESS) + { + ExFreePool(Ret); + return Status; + } + + *IndicatorTrans = Ret; + return Status; +} + +/* Sends the keyboard commands to turn on/off the lights. + */ +STATIC NTSTATUS STDCALL +IntKeyboardUpdateLeds(HANDLE KeyboardDeviceHandle, + PKEYBOARD_INPUT_DATA KeyInput, + PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans) +{ + NTSTATUS Status; + UINT Count; + static KEYBOARD_INDICATOR_PARAMETERS Indicators; + IO_STATUS_BLOCK Block; + + if (!IndicatorTrans) + return STATUS_NOT_SUPPORTED; + + if (KeyInput->Flags & (KEY_E0 | KEY_E1 | KEY_BREAK)) + return STATUS_SUCCESS; + + for (Count = 0; Count < IndicatorTrans->NumberOfIndicatorKeys; Count++) + { + if (KeyInput->MakeCode == IndicatorTrans->IndicatorList[Count].MakeCode) + { + Indicators.LedFlags ^= + IndicatorTrans->IndicatorList[Count].IndicatorFlags; + + /* Update the lights on the hardware */ + + Status = NtDeviceIoControlFile(KeyboardDeviceHandle, + NULL, + NULL, + NULL, + &Block, + IOCTL_KEYBOARD_SET_INDICATORS, + &Indicators, sizeof(Indicators), + NULL, 0); + + return Status; + } + } + + return STATUS_SUCCESS; +} + +STATIC VOID STDCALL +IntKeyboardSendWinKeyMsg() +{ + PWINDOW_OBJECT Window; + MSG Mesg; + NTSTATUS Status; + + Status = ObmReferenceObjectByHandle(InputWindowStation->HandleTable, + InputWindowStation->ShellWindow, + otWindow, + (PVOID *)&Window); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Couldn't find window to send Windows key message!\n"); + return; + } + + Mesg.hwnd = InputWindowStation->ShellWindow; + Mesg.message = WM_SYSCOMMAND; + Mesg.wParam = SC_TASKLIST; + Mesg.lParam = 0; + + /* The QS_HOTKEY is just a guess */ + MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY); + + ObmDereferenceObject(Window); +} + +STATIC VOID STDCALL +IntKeyboardSendAltKeyMsg() +{ + MsqPostKeyboardMessage(WM_SYSCOMMAND,SC_KEYMENU,0); +} + STATIC VOID STDCALL KeyboardThreadMain(PVOID StartContext) { @@ -229,6 +409,12 @@ KeyboardThreadMain(PVOID StartContext) MSG msg; PUSER_MESSAGE_QUEUE FocusQueue; struct _ETHREAD *FocusThread; + + PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans = NULL; + UINT ModifierState = 0; + USHORT LastMakeCode = 0; + USHORT LastFlags = 0; + UINT RepeatCount = 0; RtlRosInitUnicodeStringFromLiteral(&KeyboardDeviceName, L"\\??\\Keyboard"); InitializeObjectAttributes(&KeyboardObjectAttributes, @@ -248,6 +434,9 @@ KeyboardThreadMain(PVOID StartContext) return; //(Status); } + IntKeyboardGetIndicatorTrans(KeyboardDeviceHandle, + &IndicatorTrans); + for (;;) { /* @@ -267,8 +456,11 @@ KeyboardThreadMain(PVOID StartContext) while (InputThreadsRunning) { KEY_EVENT_RECORD KeyEvent; + BOOLEAN NumKeys = 1; + KEYBOARD_INPUT_DATA KeyInput; + KEYBOARD_INPUT_DATA NextKeyInput; LPARAM lParam = 0; - UINT fsModifiers; + UINT fsModifiers, fsNextModifiers; struct _ETHREAD *Thread; HWND hWnd; int id; @@ -278,124 +470,223 @@ KeyboardThreadMain(PVOID StartContext) NULL, NULL, &Iosb, - &KeyEvent, - sizeof(KEY_EVENT_RECORD), + &KeyInput, + sizeof(KEYBOARD_INPUT_DATA), NULL, NULL); - DPRINT( "KeyRaw: %s %04x\n", - KeyEvent.bKeyDown ? "down" : "up", - KeyEvent.wVirtualScanCode ); + DPRINT("KeyRaw: %s %04x\n", + (KeyInput.Flags & KEY_BREAK) ? "up" : "down", + KeyInput.MakeCode ); if (Status == STATUS_ALERTED && !InputThreadsRunning) - { - break; - } + break; + if (!NT_SUCCESS(Status)) { DPRINT1("Win32K: Failed to read from keyboard.\n"); return; //(Status); } - DPRINT( "Key: %s\n", KeyEvent.bKeyDown ? "down" : "up" ); + /* Update modifier state */ + fsModifiers = IntKeyboardGetModifiers(&KeyInput); - fsModifiers = 0; - if (KeyEvent.dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) - fsModifiers |= MOD_ALT; - - if (KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) - fsModifiers |= MOD_CONTROL; - - if (KeyEvent.dwControlKeyState & SHIFT_PRESSED) - fsModifiers |= MOD_SHIFT; - - /* FIXME: Support MOD_WIN */ - - lParam = KeyEvent.wRepeatCount | - ((KeyEvent.wVirtualScanCode << 16) & 0x00FF0000) | 0x40000000; - - /* Bit 24 indicates if this is an extended key */ - if (KeyEvent.dwControlKeyState & ENHANCED_KEY) + if (fsModifiers) { - lParam |= (1 << 24); - } - - if (fsModifiers & MOD_ALT) - { - /* Context mode. 1 if ALT if pressed while the key is pressed */ - lParam |= (1 << 29); - } - - if (! KeyEvent.bKeyDown) - { - /* Transition state. 1 for KEY_UP etc, 0 for KEY_DOWN */ - lParam |= (1 << 31); - } - - if (GetHotKey(InputWindowStation, - fsModifiers, - KeyEvent.wVirtualKeyCode, - &Thread, - &hWnd, - &id)) - { - if (KeyEvent.bKeyDown) + if (KeyInput.Flags & KEY_BREAK) { - DPRINT("Hot key pressed (hWnd %lx, id %d)\n", hWnd, id); - MsqPostHotKeyMessage (Thread, - hWnd, - (WPARAM)id, - MAKELPARAM((WORD)fsModifiers, - (WORD)msg.wParam)); + ModifierState &= ~fsModifiers; + } + else + { + ModifierState |= fsModifiers; + + if (ModifierState == fsModifiers && + (fsModifiers == MOD_ALT || fsModifiers == MOD_WIN)) + { + /* First send out special notifications + * (For alt, the message that turns on accelerator + * display, not sure what for win. Both TODO though.) + */ + + /* Read the next key before sending this one */ + do + { + Status = NtReadFile (KeyboardDeviceHandle, + NULL, + NULL, + NULL, + &Iosb, + &NextKeyInput, + sizeof(KEYBOARD_INPUT_DATA), + NULL, + NULL); + DPRINT("KeyRaw: %s %04x\n", + (NextKeyInput.Flags & KEY_BREAK) ? "up":"down", + NextKeyInput.MakeCode ); + + if (Status == STATUS_ALERTED && !InputThreadsRunning) + goto KeyboardEscape; + + } while ((!(NextKeyInput.Flags & KEY_BREAK)) && + NextKeyInput.MakeCode == KeyInput.MakeCode); + /* ^ Ignore repeats, they'll be KEY_MAKE and the same + * code. I'm not caring about the counting, not sure + * if that matters. I think not. + */ + + /* If the ModifierState is now empty again, send a + * special notification and eat both keypresses + */ + + fsNextModifiers = IntKeyboardGetModifiers(&NextKeyInput); + + if (fsNextModifiers) + ModifierState ^= fsNextModifiers; + + if (ModifierState == 0) + { + if (fsModifiers == MOD_WIN) + IntKeyboardSendWinKeyMsg(); + else if (fsModifiers == MOD_ALT) + IntKeyboardSendAltKeyMsg(); + continue; + } + + NumKeys = 2; + } } - continue; } - /* Find the target thread whose locale is in effect */ - if (!IntGetScreenDC()) + for (;NumKeys;memcpy(&KeyInput, &NextKeyInput, sizeof(KeyInput)), + NumKeys--) { - FocusQueue = W32kGetPrimitiveMessageQueue(); - } - else - { - FocusQueue = IntGetFocusMessageQueue(); - } + lParam = 0; - if (!FocusQueue) continue; + IntKeyboardUpdateLeds(KeyboardDeviceHandle, + &KeyInput, + IndicatorTrans); - if(KeyEvent.bKeyDown && (fsModifiers & MOD_ALT)) - msg.message = WM_SYSKEYDOWN; - else if(KeyEvent.bKeyDown) - msg.message = WM_KEYDOWN; - else if(fsModifiers & MOD_ALT) - msg.message = WM_SYSKEYUP; - else - msg.message = WM_KEYUP; + /* While we are working, we set up lParam. The format is: + * 0-15: The number of times this key has autorepeated + * 16-23: The keyboard scancode + * 24: Set if it's and extended key (I assume KEY_E0 | KEY_E1) + * Note that E1 is only used for PAUSE (E1-1D-45) and + * E0-45 happens not to be anything. + * 29: Alt is pressed ('Context code') + * 30: Previous state, if the key was down before this message + * This is a cheap way to ignore autorepeat keys + * 31: 1 if the key is being pressed + */ - msg.wParam = KeyEvent.wVirtualKeyCode; - msg.lParam = lParam; - msg.hwnd = FocusQueue->FocusWindow; + /* If it's a KEY_MAKE (which is 0, so test using !KEY_BREAK) + * and it's the same key as the last one, increase the repeat + * count. + */ - FocusThread = FocusQueue->Thread; + if (!(KeyInput.Flags & KEY_BREAK)) + { + if (((KeyInput.Flags & (KEY_E0 | KEY_E1)) == LastFlags) && + (KeyInput.MakeCode == LastMakeCode)) + { + RepeatCount++; + lParam |= (1 << 30); + } + else + { + RepeatCount = 0; + LastFlags = KeyInput.Flags & (KEY_E0 | KEY_E1); + LastMakeCode = KeyInput.MakeCode; + } + } + else + { + LastFlags = 0; + LastMakeCode = 0; /* Should never match */ + lParam |= (1 << 30) | (1 << 31); + } - if (FocusThread && FocusThread->Tcb.Win32Thread && - FocusThread->Tcb.Win32Thread->KeyboardLayout) - { + lParam |= RepeatCount; + + lParam |= (KeyInput.MakeCode & 0xff) << 16; + + if (KeyInput.Flags & (KEY_E0 | KEY_E1)) + lParam |= (1 << 24); + + if (ModifierState & MOD_ALT) + { + lParam |= (1 << 29); + + if (!(KeyInput.Flags & KEY_BREAK)) + msg.message = WM_SYSKEYDOWN; + else + msg.message = WM_SYSKEYUP; + } + else + { + if (!(KeyInput.Flags & KEY_BREAK)) + msg.message = WM_KEYDOWN; + else + msg.message = WM_KEYUP; + } + + /* Find the target thread whose locale is in effect */ + if (!IntGetScreenDC()) + FocusQueue = W32kGetPrimitiveMessageQueue(); + else + FocusQueue = IntGetFocusMessageQueue(); + + /* This might cause us to lose hot keys, which are important + * (ctrl-alt-del secure attention sequence). Not sure if it + * can happen though. + */ + if (!FocusQueue) continue; + + msg.lParam = lParam; + msg.hwnd = FocusQueue->FocusWindow; + + FocusThread = FocusQueue->Thread; + + if (!(FocusThread && FocusThread->Tcb.Win32Thread && + FocusThread->Tcb.Win32Thread->KeyboardLayout)) + continue; + + /* This function uses lParam to fill wParam according to the + * keyboard layout in use. + */ W32kKeyProcessMessage(&msg, FocusThread->Tcb.Win32Thread->KeyboardLayout); - } - else - continue; + + if (GetHotKey(InputWindowStation, + ModifierState, + msg.wParam, + &Thread, + &hWnd, + &id)) + { + if (KeyEvent.bKeyDown) + { + DPRINT("Hot key pressed (hWnd %lx, id %d)\n", hWnd, id); + MsqPostHotKeyMessage (Thread, + hWnd, + (WPARAM)id, + MAKELPARAM((WORD)ModifierState, + (WORD)msg.wParam)); + } + continue; /* Eat key up motion too */ + } - /* - * Post a keyboard message. - */ - MsqPostKeyboardMessage(msg.message,msg.wParam,msg.lParam); + /* + * Post a keyboard message. + */ + MsqPostKeyboardMessage(msg.message,msg.wParam,msg.lParam); + } } + +KeyboardEscape: DPRINT( "KeyboardInput Thread Stopped...\n" ); } } - NTSTATUS STDCALL NtUserAcquireOrReleaseInputOwnership(BOOLEAN Release) { diff --git a/reactos/subsys/win32k/ntuser/keyboard.c b/reactos/subsys/win32k/ntuser/keyboard.c index d5c77f5b416..6da05f01bad 100644 --- a/reactos/subsys/win32k/ntuser/keyboard.c +++ b/reactos/subsys/win32k/ntuser/keyboard.c @@ -533,9 +533,8 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) RtlInitUnicodeString(&FullLayoutPath,SYSTEMROOT_DIR); if( !NT_SUCCESS(Status) ) { - DPRINT1("Got default locale but not layout file. (%08x)\n", + DPRINT1("Got default locale but not layout file. (%08lx)\n", Status); - RtlFreeUnicodeString(&LayoutFile); } else { DPRINT("Read registry and got %wZ\n", &LayoutFile); @@ -566,9 +565,9 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) if( !kbModule ) DPRINT1( "Load Keyboard Layout: No %wZ\n", &FullLayoutPath ); + + RtlFreeUnicodeString(&FullLayoutPath); } - - RtlFreeUnicodeString(&FullLayoutPath); } if( !kbModule ) @@ -632,6 +631,10 @@ IntTranslateKbdMessage(LPMSG lpMsg, IntLockQueueState; + /* All messages have to contain the cursor point. */ + IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation, + &NewMsg.pt); + UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff, QueueKeyStateTable, wp, 2, 0, keyLayout ); @@ -659,6 +662,7 @@ IntTranslateKbdMessage(LPMSG lpMsg, DPRINT("FINAL CHAR: %c\n", wp[0]); } + if (dead_char) { NewMsg.hwnd = lpMsg->hwnd; diff --git a/reactos/subsys/win32k/ntuser/msgqueue.c b/reactos/subsys/win32k/ntuser/msgqueue.c index b1c00482c93..7a5aa4d29fd 100644 --- a/reactos/subsys/win32k/ntuser/msgqueue.c +++ b/reactos/subsys/win32k/ntuser/msgqueue.c @@ -617,6 +617,7 @@ MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { PUSER_MESSAGE_QUEUE FocusMessageQueue; MSG Msg; + LARGE_INTEGER LargeTickCount; DPRINT("MsqPostKeyboardMessage(uMsg 0x%x, wParam 0x%x, lParam 0x%x)\n", uMsg, wParam, lParam); @@ -625,10 +626,15 @@ MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) Msg.message = uMsg; Msg.wParam = wParam; Msg.lParam = lParam; - /* FIXME: Initialize time and point. */ + + KeQueryTickCount(&LargeTickCount); + Msg.time = LargeTickCount.u.LowPart; + /* We can't get the Msg.pt point here since we don't know thread + (and thus the window station) the message will end up in yet. */ FocusMessageQueue = IntGetFocusMessageQueue(); if( !IntGetScreenDC() ) { + /* FIXME: What to do about Msg.pt here? */ if( W32kGetPrimitiveMessageQueue() ) { MsqPostMessage(W32kGetPrimitiveMessageQueue(), &Msg, FALSE, QS_KEY); } @@ -643,6 +649,8 @@ MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { Msg.hwnd = FocusMessageQueue->FocusWindow; DPRINT("Msg.hwnd = %x\n", Msg.hwnd); + IntGetCursorLocation(FocusMessageQueue->Desktop->WindowStation, + &Msg.pt); MsqPostMessage(FocusMessageQueue, &Msg, FALSE, QS_KEY); } else @@ -659,6 +667,7 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam) PW32THREAD Win32Thread; PWINSTATION_OBJECT WinSta; MSG Mesg; + LARGE_INTEGER LargeTickCount; NTSTATUS Status; Status = ObReferenceObjectByPointer (Thread, @@ -688,10 +697,9 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam) Mesg.message = WM_HOTKEY; Mesg.wParam = wParam; Mesg.lParam = lParam; -// Mesg.pt.x = PsGetWin32Process()->WindowStation->SystemCursor.x; -// Mesg.pt.y = PsGetWin32Process()->WindowStation->SystemCursor.y; -// KeQueryTickCount(&LargeTickCount); -// Mesg.time = LargeTickCount.u.LowPart; + KeQueryTickCount(&LargeTickCount); + Mesg.time = LargeTickCount.u.LowPart; + IntGetCursorLocation(WinSta, &Mesg.pt); MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY); ObmDereferenceObject(Window); ObDereferenceObject (Thread); diff --git a/reactos/subsys/win32k/ntuser/painting.c b/reactos/subsys/win32k/ntuser/painting.c index 2c603127650..9e8d7968a96 100644 --- a/reactos/subsys/win32k/ntuser/painting.c +++ b/reactos/subsys/win32k/ntuser/painting.c @@ -1212,15 +1212,19 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect, int i; RECT r, dummy; POINT ClientOrigin; + PWINDOW_OBJECT WindowObject; + IntGetClientOrigin(hWnd, &ClientOrigin); for (i = 0; List[i]; i++) { - NtUserGetWindowRect(List[i], &r); - IntGetClientOrigin(hWnd, &ClientOrigin); + WindowObject = IntGetWindowObject(List[i]); + if (!WindowObject) continue; + r = WindowObject->WindowRect; r.left -= ClientOrigin.x; r.top -= ClientOrigin.y; r.right -= ClientOrigin.x; r.bottom -= ClientOrigin.y; + IntReleaseWindowObject(WindowObject); if (! UnsafeRect || IntGdiIntersectRect(&dummy, &r, &rc)) WinPosSetWindowPos(List[i], 0, r.left + dx, r.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | diff --git a/reactos/subsys/win32k/ntuser/scrollbar.c b/reactos/subsys/win32k/ntuser/scrollbar.c index 8f424d21302..58eef428708 100644 --- a/reactos/subsys/win32k/ntuser/scrollbar.c +++ b/reactos/subsys/win32k/ntuser/scrollbar.c @@ -360,7 +360,7 @@ IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedr /* Check if the scrollbar should be hidden or disabled */ if (0 != (lpsi->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))) { - if (Info->nMin >= Info->nMax - max(Info->nPage - 1, 0)) + if (Info->nMin >= (int)(Info->nMax - max(Info->nPage - 1, 0))) { /* Hide or disable scroll-bar */ if (0 != (lpsi->fMask & SIF_DISABLENOSCROLL)) diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 3dab0ce0d4c..e04c0cf5c76 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: Windows @@ -26,7 +25,9 @@ * REVISION HISTORY: * 06-06-2001 CSH Created */ + /* INCLUDES ******************************************************************/ + #include static WndProcHandle *WndProcHandlesArray = 0; @@ -3204,12 +3205,12 @@ NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi) } /* - * Only allow CSRSS to mess with the desktop window + * WndProc is only available to the owner process */ - if (hWnd == IntGetDesktopWindow() + if (GWL_WNDPROC == Index && WindowObject->OwnerThread->ThreadsProcess != PsGetCurrentProcess()) { - SetLastWin32Error(STATUS_ACCESS_DENIED); + SetLastWin32Error(ERROR_ACCESS_DENIED); return 0; } diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index f432429fc40..e43fc6e712c 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -1283,6 +1283,10 @@ WinPosShowWindow(HWND Wnd, INT Cmd) * FIXME: Need to check the window wasn't destroyed during the * window procedure. */ + if (!(Window->Parent)) + { + IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Wnd); + } } /* We can't activate a child window */ @@ -1314,6 +1318,11 @@ WinPosShowWindow(HWND Wnd, INT Cmd) { NtUserSetFocus(Window->Parent); } + + if (!(Window->Parent)) + { + IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Wnd); + } } /* FIXME: Check for window destruction. */ diff --git a/reactos/subsys/win32k/objects/brush.c b/reactos/subsys/win32k/objects/brush.c index 9dee1e9e884..91e50117edb 100644 --- a/reactos/subsys/win32k/objects/brush.c +++ b/reactos/subsys/win32k/objects/brush.c @@ -241,7 +241,7 @@ IntGdiCreateDIBBrush( ULONG_PTR DataPtr; UINT PaletteEntryCount; PBITMAPOBJ BitmapObject; - UINT PaletteType; + INT PaletteType; if (BitmapInfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER)) { diff --git a/reactos/tools/cabman/cabinet.cxx b/reactos/tools/cabman/cabinet.cxx index aa17a001af3..2fb470c4290 100755 --- a/reactos/tools/cabman/cabinet.cxx +++ b/reactos/tools/cabman/cabinet.cxx @@ -2489,7 +2489,7 @@ unsigned long CCabinet::ComputeChecksum(void* Buffer, /* FIXME: Doesn't seem to be correct. EXTRACT.EXE won't accept checksums computed by this routine */ - DPRINT(MIN_TRACE, ("Checksumming buffer (0x%X) Size (%d)\n", (unsigned int)Buffer, Size)); + DPRINT(MIN_TRACE, ("Checksumming buffer (0x%p) Size (%d)\n", Buffer, Size)); UlongCount = Size / 4; // Number of ULONGs Checksum = Seed; // Init checksum diff --git a/reactos/tools/create_nls/create_nls.c b/reactos/tools/create_nls/create_nls.c index c3c31baffee..47b675e0acc 100644 --- a/reactos/tools/create_nls/create_nls.c +++ b/reactos/tools/create_nls/create_nls.c @@ -611,8 +611,10 @@ int write_nls_files() static WORD *to_upper_org = NULL, *to_lower_org = NULL; +#if 0 static WORD diffs[256]; static int number_of_diffs; +#endif static WORD number_of_subtables_with_diffs; /* pointers to subtables with 16 elements in each to the main table */ @@ -624,7 +626,7 @@ static WORD subtables_with_offsets[4096 * 16]; static void test_packed_table(WCHAR *table) { - WCHAR test_str[] = L"This is an English text. Ïî-ðóññêè ÿ ïèñàòü óìåþ íåìíîæêî. 1234567890"; + WCHAR test_str[] = L"This is an English text. \x0CF\x0EE-\x0F0\x0F3\x0F1\x0F1\x0EA\x0E8 \x0FF \x0EF\x0E8\x0F1\x0E0\x0F2\x0FC \x0F3\x0EC\x0E5\x0FE \x0ED\x0E5\x0EC\x0ED\x0EE\x0E6\x0EA\x0EE. 1234567890"; //WORD diff, off; //WORD *sub_table; DWORD i, len; @@ -805,6 +807,7 @@ static BOOL CreateCaseDiff(char *table_name) return TRUE; } +#if 0 static int find_diff(WORD diff) { int i; @@ -816,6 +819,7 @@ static int find_diff(WORD diff) return -1; } +#endif static WORD find_subtable_with_diffs(WORD *table, WORD *subtable) { diff --git a/reactos/tools/mkhive/Makefile b/reactos/tools/mkhive/Makefile index 248acaf7508..ed1c38815d0 100644 --- a/reactos/tools/mkhive/Makefile +++ b/reactos/tools/mkhive/Makefile @@ -36,6 +36,11 @@ clean: rm -f *.o rm -f mkhive$(EXE_POSTFIX) endif +ifeq ($(HOST),mingw32-linux64) +clean: + rm -f *.o + rm -f mkhive$(EXE_POSTFIX) +endif ifeq ($(HOST),mingw32-windows) clean: -del *.o diff --git a/reactos/tools/mkhive/binhive.c b/reactos/tools/mkhive/binhive.c index d9788cc0420..ddf3a47c87a 100644 --- a/reactos/tools/mkhive/binhive.c +++ b/reactos/tools/mkhive/binhive.c @@ -196,7 +196,7 @@ typedef struct _KEY_CELL USHORT ClassSize; /* Name of key (not zero terminated) */ - UCHAR Name[0]; + CHAR Name[0]; } GCC_PACKED KEY_CELL, *PKEY_CELL; /* KEY_CELL.Type constants */ @@ -237,7 +237,7 @@ typedef struct _VALUE_CELL ULONG DataType; USHORT Flags; USHORT Unused1; - UCHAR Name[0]; /* warning : not zero terminated */ + CHAR Name[0]; /* warning : not zero terminated */ } GCC_PACKED VALUE_CELL, *PVALUE_CELL; /* VALUE_CELL.Flags constants */ @@ -250,7 +250,7 @@ typedef struct _VALUE_CELL typedef struct _DATA_CELL { LONG CellSize; - UCHAR Data[0]; + CHAR Data[0]; } GCC_PACKED DATA_CELL, *PDATA_CELL; #ifdef _MSC_VER @@ -1028,7 +1028,7 @@ CmiExportValue (PREGISTRY_HIVE Hive, ULONG SrcDataSize; ULONG DstDataSize; ULONG DataType; - PUCHAR Data; + PCHAR Data; BOOL Expand = FALSE; DPRINT ("CmiExportValue('%s') called\n", (Value == NULL) ? "" : (PCHAR)Value->Name); diff --git a/reactos/tools/mkhive/infcache.c b/reactos/tools/mkhive/infcache.c index a10d2b665bc..f274a0842f7 100644 --- a/reactos/tools/mkhive/infcache.c +++ b/reactos/tools/mkhive/infcache.c @@ -1192,7 +1192,7 @@ InfGetFieldCount(PINFCONTEXT Context) BOOL InfGetBinaryField (PINFCONTEXT Context, ULONG FieldIndex, - PUCHAR ReturnBuffer, + PCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize) { @@ -1200,7 +1200,7 @@ InfGetBinaryField (PINFCONTEXT Context, PINFCACHEFIELD CacheField; ULONG Index; ULONG Size; - PUCHAR Ptr; + PCHAR Ptr; if (Context == NULL || Context->Line == NULL || FieldIndex == 0) { @@ -1234,7 +1234,7 @@ InfGetBinaryField (PINFCONTEXT Context, Ptr = ReturnBuffer; while (CacheField != NULL) { - *Ptr = (UCHAR)strtoul (CacheField->Data, NULL, 16); + *Ptr = (CHAR)strtoul (CacheField->Data, NULL, 16); Ptr++; CacheField = CacheField->Next; diff --git a/reactos/tools/mkhive/infcache.h b/reactos/tools/mkhive/infcache.h index 40403b30b9e..848e3753f65 100644 --- a/reactos/tools/mkhive/infcache.h +++ b/reactos/tools/mkhive/infcache.h @@ -92,7 +92,7 @@ InfGetFieldCount (PINFCONTEXT Context); BOOL InfGetBinaryField (PINFCONTEXT Context, ULONG FieldIndex, - PUCHAR ReturnBuffer, + PCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize); diff --git a/reactos/tools/mkhive/reginf.c b/reactos/tools/mkhive/reginf.c index 73cfd41c3a7..120069f2ec3 100644 --- a/reactos/tools/mkhive/reginf.c +++ b/reactos/tools/mkhive/reginf.c @@ -124,7 +124,7 @@ AppendMultiSzValue (HKEY KeyHandle, Error = RegQueryValue (KeyHandle, ValueName, NULL, - (PUCHAR)Buffer, + (PCHAR)Buffer, &Size); if (Error != ERROR_SUCCESS) goto done; @@ -154,7 +154,7 @@ AppendMultiSzValue (HKEY KeyHandle, RegSetValue (KeyHandle, ValueName, REG_MULTI_SZ, - (PUCHAR)Buffer, + (PCHAR)Buffer, Total); } @@ -331,7 +331,7 @@ do_reg_operation(HKEY KeyHandle, } else /* get the binary data */ { - PUCHAR Data = NULL; + PCHAR Data = NULL; if (!InfGetBinaryField (Context, 5, NULL, 0, &Size)) Size = 0; diff --git a/reactos/tools/mkhive/registry.c b/reactos/tools/mkhive/registry.c index 9ea4751789d..105f897fb22 100644 --- a/reactos/tools/mkhive/registry.c +++ b/reactos/tools/mkhive/registry.c @@ -58,7 +58,7 @@ RegInitializeRegistry(VOID) RootKey->ValueCount = 0; RootKey->NameSize = 2; - RootKey->Name = (PUCHAR)malloc(2); + RootKey->Name = (PCHAR)malloc(2); strcpy(RootKey->Name, "\\"); RootKey->DataType = 0; @@ -82,7 +82,7 @@ RegInitializeRegistry(VOID) RegSetValue(LinkKey, NULL, REG_LINK, - (PUCHAR)&ControlSetKey, + (PCHAR)&ControlSetKey, sizeof(PVOID)); /* Create HARDWARE key */ @@ -392,7 +392,7 @@ LONG RegSetValue(HKEY Key, PCHAR ValueName, ULONG Type, - PUCHAR Data, + PCHAR Data, ULONG DataSize) { PLIST_ENTRY Ptr; @@ -404,12 +404,12 @@ RegSetValue(HKEY Key, if ((ValueName == NULL) || (*ValueName == 0)) { /* set default value */ - if ((Key->Data != NULL) && (Key->DataSize > sizeof(PUCHAR))) + if ((Key->Data != NULL) && (Key->DataSize > sizeof(PCHAR))) { free(Key->Data); } - if (DataSize <= sizeof(PUCHAR)) + if (DataSize <= sizeof(PCHAR)) { Key->DataSize = DataSize; Key->DataType = Type; @@ -417,7 +417,7 @@ RegSetValue(HKEY Key, } else { - Key->Data = (PUCHAR)malloc(DataSize); + Key->Data = (PCHAR)malloc(DataSize); Key->DataSize = DataSize; Key->DataType = Type; memcpy(Key->Data, Data, DataSize); @@ -462,12 +462,12 @@ RegSetValue(HKEY Key, } /* set new value */ - if ((Value->Data != NULL) && (Value->DataSize > sizeof(PUCHAR))) + if ((Value->Data != NULL) && (Value->DataSize > sizeof(PCHAR))) { free(Value->Data); } - if (DataSize <= sizeof(PUCHAR)) + if (DataSize <= sizeof(PCHAR)) { Value->DataSize = DataSize; Value->DataType = Type; @@ -475,7 +475,7 @@ RegSetValue(HKEY Key, } else { - Value->Data = (PUCHAR)malloc(DataSize); + Value->Data = (PCHAR)malloc(DataSize); if (Value->Data == NULL) return(ERROR_OUTOFMEMORY); Value->DataType = Type; @@ -491,7 +491,7 @@ LONG RegQueryValue(HKEY Key, PCHAR ValueName, PULONG Type, - PUCHAR Data, + PCHAR Data, PULONG DataSize) { ULONG Size; @@ -508,7 +508,7 @@ RegQueryValue(HKEY Key, *Type = Key->DataType; if ((Data != NULL) && (DataSize != NULL)) { - if (Key->DataSize <= sizeof(PUCHAR)) + if (Key->DataSize <= sizeof(PCHAR)) { Size = min(Key->DataSize, *DataSize); memcpy(Data, &Key->Data, Size); @@ -551,7 +551,7 @@ RegQueryValue(HKEY Key, *Type = Value->DataType; if ((Data != NULL) && (DataSize != NULL)) { - if (Value->DataSize <= sizeof(PUCHAR)) + if (Value->DataSize <= sizeof(PCHAR)) { Size = min(Value->DataSize, *DataSize); memcpy(Data, &Value->Data, Size); @@ -615,7 +615,7 @@ RegDeleteValue(HKEY Key, Value->Name = NULL; Value->NameSize = 0; - if (Value->DataSize > sizeof(PUCHAR)) + if (Value->DataSize > sizeof(PCHAR)) { if (Value->Data != NULL) free(Value->Data); @@ -637,7 +637,7 @@ RegEnumValue(HKEY Key, PCHAR ValueName, PULONG NameSize, PULONG Type, - PUCHAR Data, + PCHAR Data, PULONG DataSize) { PLIST_ENTRY Ptr; diff --git a/reactos/tools/mkhive/registry.h b/reactos/tools/mkhive/registry.h index 4ff26f36fd0..3105eb4223f 100644 --- a/reactos/tools/mkhive/registry.h +++ b/reactos/tools/mkhive/registry.h @@ -47,12 +47,12 @@ typedef struct _REG_KEY ULONG ValueCount; USHORT NameSize; - PUCHAR Name; + PCHAR Name; /* default data */ ULONG DataType; ULONG DataSize; - PUCHAR Data; + PCHAR Data; } KEY, *HKEY, **PHKEY; @@ -62,12 +62,12 @@ typedef struct _REG_VALUE /* value name */ ULONG NameSize; - PUCHAR Name; + PCHAR Name; /* value data */ ULONG DataType; ULONG DataSize; - PUCHAR Data; + PCHAR Data; } VALUE, *PVALUE; @@ -260,14 +260,14 @@ LONG RegSetValue(HKEY Key, PCHAR ValueName, ULONG Type, - PUCHAR Data, + PCHAR Data, ULONG DataSize); LONG RegQueryValue(HKEY Key, PCHAR ValueName, PULONG Type, - PUCHAR Data, + PCHAR Data, PULONG DataSize); LONG @@ -280,7 +280,7 @@ RegEnumValue(HKEY Key, PCHAR ValueName, PULONG NameSize, PULONG Type, - PUCHAR Data, + PCHAR Data, PULONG DataSize); USHORT diff --git a/reactos/tools/nci/sysfuncs.lst b/reactos/tools/nci/sysfuncs.lst index 7b76c796e9e..ab956599dee 100644 --- a/reactos/tools/nci/sysfuncs.lst +++ b/reactos/tools/nci/sysfuncs.lst @@ -166,6 +166,7 @@ NtRequestPort 2 NtRequestWaitReplyPort 3 NtResetEvent 2 NtRestoreKey 3 +NtResumeProcess 1 NtResumeThread 2 NtSaveKey 2 NtSaveKeyEx 3 @@ -206,6 +207,7 @@ NtShutdownSystem 1 NtSignalAndWaitForSingleObject 4 NtStartProfile 1 NtStopProfile 1 +NtSuspendProcess 1 NtSuspendThread 2 NtSystemDebugControl 6 NtTerminateJobObject 2 diff --git a/reactos/tools/raddr2line.c b/reactos/tools/raddr2line.c index fa0bdec2851..955a7ade9df 100644 --- a/reactos/tools/raddr2line.c +++ b/reactos/tools/raddr2line.c @@ -57,7 +57,7 @@ find_rossym_section ( PIMAGE_FILE_HEADER PEFileHeader, size_t i; for ( i = 0; i < PEFileHeader->NumberOfSections; i++ ) { - if ( 0 == strcmp ( PESectionHeaders[i].Name, ".rossym" ) ) + if ( 0 == strcmp ( (char*)PESectionHeaders[i].Name, ".rossym" ) ) return &PESectionHeaders[i]; } return NULL; diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index d18cf9eeee3..a8c0c49da62 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -949,15 +949,21 @@ MingwModuleHandler::GenerateWinebuildCommands ( stub_file.c_str () ); } +string +MingwModuleHandler::GetWidlFlags ( const File& file ) +{ + return file.switches; +} + void MingwModuleHandler::GenerateWidlCommandsServer ( - const string& sourceFilename, + const File& file, const string& widlflagsMacro ) { - string dependencies = sourceFilename; + string dependencies = file.name; dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); - string basename = GetBasename ( sourceFilename ); + string basename = GetBasename ( file.name ); /*string generatedHeaderFilename = PassThruCacheDirectory ( basename + ".h", @@ -980,23 +986,24 @@ MingwModuleHandler::GenerateWidlCommandsServer ( GetDirectory ( generatedServerFilename ).c_str () ); fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" ); fprintf ( fMakefile, - "\t%s %s -h -H %s -s -S %s %s\n", + "\t%s %s %s -h -H %s -s -S %s %s\n", "$(Q)$(WIDL_TARGET)", + GetWidlFlags ( file ).c_str (), widlflagsMacro.c_str (), generatedHeaderFilename.c_str (), generatedServerFilename.c_str (), - sourceFilename.c_str () ); + file.name.c_str () ); } void MingwModuleHandler::GenerateWidlCommandsClient ( - const string& sourceFilename, + const File& file, const string& widlflagsMacro ) { - string dependencies = sourceFilename; + string dependencies = file.name; dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); - string basename = GetBasename ( sourceFilename ); + string basename = GetBasename ( file.name ); /*string generatedHeaderFilename = PassThruCacheDirectory ( basename + ".h", @@ -1019,30 +1026,31 @@ MingwModuleHandler::GenerateWidlCommandsClient ( GetDirectory ( generatedClientFilename ).c_str () ); fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" ); fprintf ( fMakefile, - "\t%s %s -h -H %s -c -C %s %s\n", + "\t%s %s %s -h -H %s -c -C %s %s\n", "$(Q)$(WIDL_TARGET)", + GetWidlFlags ( file ).c_str (), widlflagsMacro.c_str (), generatedHeaderFilename.c_str (), generatedClientFilename.c_str (), - sourceFilename.c_str () ); + file.name.c_str () ); } void MingwModuleHandler::GenerateWidlCommands ( - const string& sourceFilename, + const File& file, const string& widlflagsMacro ) { if ( module.type == RpcServer ) - GenerateWidlCommandsServer ( sourceFilename, + GenerateWidlCommandsServer ( file, widlflagsMacro ); else - GenerateWidlCommandsClient ( sourceFilename, + GenerateWidlCommandsClient ( file, widlflagsMacro ); } void MingwModuleHandler::GenerateCommands ( - const string& sourceFilename, + const File& file, const string& cc, const string& cppc, const string& cflagsMacro, @@ -1050,10 +1058,10 @@ MingwModuleHandler::GenerateCommands ( const string& windresflagsMacro, const string& widlflagsMacro ) { - string extension = GetExtension ( sourceFilename ); + string extension = GetExtension ( file.name ); if ( extension == ".c" || extension == ".C" ) { - GenerateGccCommand ( sourceFilename, + GenerateGccCommand ( file.name, cc, cflagsMacro ); return; @@ -1062,43 +1070,43 @@ MingwModuleHandler::GenerateCommands ( extension == ".cpp" || extension == ".CPP" || extension == ".cxx" || extension == ".CXX" ) { - GenerateGccCommand ( sourceFilename, + GenerateGccCommand ( file.name, cppc, cflagsMacro ); return; } else if ( extension == ".s" || extension == ".S" ) { - GenerateGccAssemblerCommand ( sourceFilename, + GenerateGccAssemblerCommand ( file.name, cc, cflagsMacro ); return; } else if ( extension == ".asm" || extension == ".ASM" ) { - GenerateNasmCommand ( sourceFilename, + GenerateNasmCommand ( file.name, nasmflagsMacro ); return; } else if ( extension == ".rc" || extension == ".RC" ) { - GenerateWindresCommand ( sourceFilename, + GenerateWindresCommand ( file.name, windresflagsMacro ); return; } else if ( extension == ".spec" || extension == ".SPEC" ) { - GenerateWinebuildCommands ( sourceFilename ); - GenerateGccCommand ( GetActualSourceFilename ( sourceFilename ), + GenerateWinebuildCommands ( file.name ); + GenerateGccCommand ( GetActualSourceFilename ( file.name ), cc, cflagsMacro ); return; } else if ( extension == ".idl" || extension == ".IDL" ) { - GenerateWidlCommands ( sourceFilename, + GenerateWidlCommands ( file, widlflagsMacro ); - GenerateGccCommand ( GetActualSourceFilename ( sourceFilename ), + GenerateGccCommand ( GetActualSourceFilename ( file.name ), cc, cflagsMacro ); return; @@ -1108,7 +1116,7 @@ MingwModuleHandler::GenerateCommands ( __LINE__, "Unsupported filename extension '%s' in file '%s'", extension.c_str (), - sourceFilename.c_str () ); + file.name.c_str () ); } void @@ -1349,8 +1357,7 @@ MingwModuleHandler::GenerateObjectFileTargets ( const vector& files = data.files; for ( i = 0; i < files.size (); i++ ) { - string sourceFilename = files[i]->name; - GenerateCommands ( sourceFilename, + GenerateCommands ( *files[i], cc, cppc, cflagsMacro, diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index 8b63e489fd4..567d4ac3f86 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -129,15 +129,16 @@ private: void GenerateWindresCommand ( const std::string& sourceFilename, const std::string& windresflagsMacro ); void GenerateWinebuildCommands ( const std::string& sourceFilename ); + std::string GetWidlFlags ( const File& file ); void GenerateWidlCommandsServer ( - const std::string& sourceFilename, + const File& file, const std::string& widlflagsMacro ); void GenerateWidlCommandsClient ( - const std::string& sourceFilename, + const File& file, const std::string& widlflagsMacro ); - void GenerateWidlCommands ( const std::string& sourceFilename, + void GenerateWidlCommands ( const File& file, const std::string& widlflagsMacro ); - void GenerateCommands ( const std::string& sourceFilename, + void GenerateCommands ( const File& file, const std::string& cc, const std::string& cppc, const std::string& cflagsMacro, diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 2260fa2116d..26422d2af86 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -281,7 +281,7 @@ Module::ProcessXMLSubElement ( const XMLElement& e, { bool first = false; const XMLAttribute* att = e.GetAttribute ( "first", false ); - if ( att ) + if ( att != NULL ) { if ( !stricmp ( att->value.c_str(), "true" ) ) first = true; @@ -290,6 +290,10 @@ Module::ProcessXMLSubElement ( const XMLElement& e, e.location, "attribute 'first' of element can only be 'true' or 'false'" ); } + string switches = ""; + att = e.GetAttribute ( "switches", false ); + if ( att != NULL ) + switches = att->value; if ( !cplusplus ) { // check for c++ file @@ -301,7 +305,9 @@ Module::ProcessXMLSubElement ( const XMLElement& e, else if ( !stricmp ( ext.c_str(), ".cxx" ) ) cplusplus = true; } - File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), first ); + File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), + first, + switches ); if ( pIf ) pIf->data.files.push_back ( pFile ); else @@ -677,8 +683,11 @@ Module::InvokeModule () const } -File::File ( const string& _name, bool _first ) - : name(_name), first(_first) +File::File ( const string& _name, bool _first, + std::string _switches ) + : name(_name), + first(_first), + switches(_switches) { } diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index f14cc2ddcfe..88d8838a3ef 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -254,8 +254,11 @@ class File public: std::string name; bool first; + std::string switches; - File ( const std::string& _name, bool _first ); + File ( const std::string& _name, + bool _first, + std::string _switches ); void ProcessXML(); }; diff --git a/reactos/tools/rgenstat/Makefile b/reactos/tools/rgenstat/Makefile index 9cad0150176..7723119e9f6 100755 --- a/reactos/tools/rgenstat/Makefile +++ b/reactos/tools/rgenstat/Makefile @@ -19,12 +19,11 @@ llmosrt.o: llmosrt.c rgenstat$(EXE_POSTFIX): $(OBJECTS) $(HOST_CC) $(OBJECTS) -o rgenstat$(EXE_POSTFIX) -ifeq ($(HOST),mingw32-linux) +ifeq ($(HOST_TYPE),unix) clean: rm -f *.o rm -f rgenstat$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) +else clean: -del *.o -del rgenstat$(EXE_POSTFIX) diff --git a/reactos/tools/tools-check.mak b/reactos/tools/tools-check.mak index 89e3b3a1c86..dc0626a6be9 100644 --- a/reactos/tools/tools-check.mak +++ b/reactos/tools/tools-check.mak @@ -12,10 +12,9 @@ include $(PATH_TO_TOP)/rules.mak BINUTILS_VERSION_DATE=$(word 5,$(shell $(PREFIX)ld -v)) all: -ifeq ($(HOST),mingw32-linux) +ifeq ($(HOST_TYPE),unix) @echo "#define BINUTILS_VERSION_DATE $(BINUTILS_VERSION_DATE)" > tools-check.h -endif -ifeq ($(HOST),mingw32-windows) +else @echo #define BINUTILS_VERSION_DATE $(BINUTILS_VERSION_DATE) > tools-check.h endif $(HOST_CC) -c tools-check.c -o tools-check.temp diff --git a/reactos/tools/widl/ChangeLog b/reactos/tools/widl/ChangeLog index 3b14c38e2e3..6b2f895cebf 100644 --- a/reactos/tools/widl/ChangeLog +++ b/reactos/tools/widl/ChangeLog @@ -1,5 +1,25 @@ ChangeLog +2005-04-18 navaraf + + tools/widl/parser.y + +Don't use pointer to freed memory. + +2005-04-17 ekohl + + tools/widl/server.c + +Support out-pointers to structs. + +2005-04-15 ekohl + + tools/widl/client.c + tools/widl/parser.y + tools/widl/server.c + +Support in-pointers to structs. + 2005-04-03 ekohl tools/widl/client.c diff --git a/reactos/tools/widl/Makefile b/reactos/tools/widl/Makefile index b70896aaa0e..835138347c3 100644 --- a/reactos/tools/widl/Makefile +++ b/reactos/tools/widl/Makefile @@ -34,7 +34,7 @@ LIBS = $(LIB_WPP_DIR)/libwpp.a CLEAN_FILES = *.o $(TARGET) -HOST_CFLAGS = -DYYDEBUG=1 -DINT16=SHORT -D__USE_W32API \ +HOST_CFLAGS = $(HOSTARCH) -DYYDEBUG=1 -DINT16=SHORT -D__USE_W32API \ -I$(LIB_WPP_DIR) -I$(PATH_TO_TOP)/include/wine \ -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/w32api/include \ -Werror -Wall @@ -43,13 +43,12 @@ HOST_CFLAGS = -DYYDEBUG=1 -DINT16=SHORT -D__USE_W32API \ $(HOST_CC) $(HOST_CFLAGS) -c $< -o $@ $(TARGET): $(OBJECTS) $(LIBS) - $(HOST_CC) -o $(TARGET) $(OBJECTS) $(LIBS) + $(HOST_CC) $(HOSTARCH) -o $(TARGET) $(OBJECTS) $(LIBS) -ifeq ($(HOST),mingw32-linux) +ifeq ($(HOST_TYPE),unix) clean: -rm -f $(OBJECTS) $(TARGET) -endif -ifneq ($(HOST),mingw32-linux) +else clean: -del $(TARGET) -del *.o diff --git a/reactos/tools/widl/client.c b/reactos/tools/widl/client.c index 134652997c0..e696e288e7d 100644 --- a/reactos/tools/widl/client.c +++ b/reactos/tools/widl/client.c @@ -75,6 +75,65 @@ get_base_type(unsigned char type) } +static int get_type_size(type_t *type, int alignment) +{ + int size; + var_t *field; + + switch(type->type) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_SMALL: + size = 1; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_FLOAT: + size = 4; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_IGNORE: + size = 0; + break; + + case RPC_FC_STRUCT: + field = type->fields; + size = 0; + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + size += get_type_size(field->type, alignment); + field = PREV_LINK(field); + } + break; + + default: + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, type->type); + return 0; + } + + return size; +} + + static void write_procformatstring(type_t *iface) { func_t *func = iface->funcs; @@ -113,8 +172,39 @@ static void write_procformatstring(type_t *iface) print_client("0x4e, /* FC_IN_PARAM_BASETYPE */\n"); print_client("0x%02x, /* FC_ */\n", get_base_type(var->type->type)); } + else if (var->type->type == RPC_FC_RP) + { + var_t *field = var->type->ref->ref->fields; + int size; + + if (in_attr & !out_attr) + print_client("0x4d, /* FC_IN_PARAM */\n"); + else if (!in_attr & out_attr) + print_client("0x51, /* FC_OUT_PARAM */\n"); + else if (in_attr & out_attr) + print_client("0x50, /* FC_IN_OUT_PARAM */\n"); + fprintf(client, "#ifndef _ALPHA_\n"); + print_client("0x01,\n"); + fprintf(client, "#else\n"); + print_client("0x02,\n"); + fprintf(client, "#endif\n"); + print_client("NdrFcShort(0x%x),\n", type_offset); + + size = 9; + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + size++; + field = PREV_LINK(field); + } + if (size % 2) + size++; + type_offset += size; + } else { + print_client("0x4d, /* FC_IN_PARAM */\n"); + error("%s:%d Unknown/unsupported type 0x%x\n", __FUNCTION__,__LINE__, var->type->type); return; @@ -122,8 +212,8 @@ static void write_procformatstring(type_t *iface) } else if (var->ptr_level == 1) { - if (is_base_type(var->type)) - { +// if (is_base_type(var->type)) +// { if (in_attr & !out_attr) print_client("0x4d, /* FC_IN_PARAM */\n"); else if (!in_attr & out_attr) @@ -137,13 +227,19 @@ static void write_procformatstring(type_t *iface) fprintf(client, "#endif\n"); print_client("NdrFcShort(0x%x),\n", type_offset); type_offset += 4; - } - else - { - error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); - return; - } +// } +// else +// { +// error("%s:%d Unknown/unsupported type 0x%x\n", +// __FUNCTION__,__LINE__, var->type->type); +// return; +// } + } + else + { + error("%s:%d Pointer level %d is not supported!\n", + __FUNCTION__,__LINE__, var->ptr_level); + return; } var = PREV_LINK(var); @@ -185,7 +281,7 @@ static void write_typeformatstring(type_t *iface) { func_t *func = iface->funcs; var_t *var; - int out_attr; + int in_attr, out_attr; int string_attr; int ptr_attr, ref_attr, unique_attr; @@ -195,7 +291,7 @@ static void write_typeformatstring(type_t *iface) print_client("0,\n"); print_client("{\n"); indent++; - print_client("NdrFcShort(0x0),\n"); + print_client("NdrFcShort(0x00),\n"); while (NEXT_LINK(func)) func = NEXT_LINK(func); while (func) @@ -206,6 +302,7 @@ static void write_typeformatstring(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { + in_attr = is_attr(var->attrs, ATTR_IN); out_attr = is_attr(var->attrs, ATTR_OUT); string_attr = is_attr(var->attrs, ATTR_STRING); @@ -216,7 +313,50 @@ static void write_typeformatstring(type_t *iface) return; } - if (var->ptr_level == 1) + if (var->ptr_level == 0) + { + if (!is_base_type(var->type)) + { + if (var->type->type == RPC_FC_RP) + { + var_t *field; + int tsize = 9; + unsigned char flags = 0; + + if (!in_attr && out_attr) + flags |= RPC_FC_P_ONSTACK; + + print_client("0x11, 0x%02X, /* FC_RP, [flags] */\n", flags); + print_client("NdrFcShort(0x%02X),\n", 0x02); + print_client("0x%02X,\n", var->type->ref->ref->type); + print_client("0x%02X,\n", 3); /* alignment -1 */ + print_client("NdrFcShort(0x%02X),\n", get_type_size(var->type->ref->ref, 4)); + + field = var->type->ref->ref->fields; + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + print_client("0x%02X,\n", get_base_type(field->type->type)); + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + { + print_client("0x5c, /* FC_PAD */\n"); + tsize++; + } + print_client("0x5b, /* FC_END */\n"); + } + else + { + + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } + } + } + else if (var->ptr_level == 1) { ptr_attr = is_attr(var->attrs, ATTR_PTR); ref_attr = is_attr(var->attrs, ATTR_REF); @@ -389,6 +529,17 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) size = 0; break; + case 0: + printf("%s\n", __FUNCTION__); + printf("ptr_level %d\n", var->ptr_level); + printf("Type %p\n", var->type); + printf("Type %x\n", var->type->type); + printf("Type name: %s\n", var->type->name); + printf("Tref %p\n", var->type->ref); + printf("Tref->name %s\n", var->type->ref->name); + printf("Tref->ref %p\n", var->type->ref->ref); + return; + default: error("%s:%d Unknown/unsupported type 0x%x\n", __FUNCTION__,__LINE__, var->type->type); @@ -441,6 +592,12 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) size = 0; break; + case RPC_FC_RP: + case RPC_FC_UP: + case RPC_FC_FP: + size = 0; + break; + default: error("%s:%d Unknown/unsupported type 0x%x\n", __FUNCTION__,__LINE__, var->type->type); @@ -489,9 +646,24 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) if (in_attr) { - if (var->ptr_level == 1 && - string_attr && - (var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR)) + if (var->ptr_level == 0 && + var->type->type == RPC_FC_RP) + { + if (var->type->ref->ref->type == RPC_FC_STRUCT) + { + print_client("NdrSimpleStructBufferSize(\n"); + indent++; + print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); + print_client("(unsigned char __RPC_FAR *)%s,\n", var->name); + print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n", + local_type_offset + 4); + nothing_printed = 1; + indent--; + } + } + else if (var->ptr_level == 1 && + string_attr && + (var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR)) { if (ptr_attr) { @@ -523,7 +695,27 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) } /* calculate the next type offset */ - if (var->ptr_level == 1) + if (var->ptr_level == 0) + { + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + local_type_offset += tsize; + } + } + else if (var->ptr_level == 1) { local_type_offset += 4; } @@ -545,6 +737,7 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset) int string_attr; int ptr_attr, ref_attr, unique_attr; var_t *var; + unsigned int local_type_offset = *type_offset; if (!func->args) return; @@ -670,81 +863,118 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset) } else { - alignment = 0; - switch (var->type->type) + if (is_base_type(var->type)) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - size = 1; alignment = 0; - break; + switch (var->type->type) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_SMALL: + size = 1; + alignment = 0; + break; - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - size = 2; - if (last_size > 0 && last_size < 2) - alignment = (2 - last_size); - break; + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + if (last_size > 0 && last_size < 2) + alignment = (2 - last_size); + break; - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_FLOAT: - size = 4; - if (last_size > 0 && last_size < 4) - alignment = (4 - last_size); - break; + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_FLOAT: + size = 4; + if (last_size > 0 && last_size < 4) + alignment = (4 - last_size); + break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: - size = 8; - if (last_size > 0 && last_size < 4) - alignment = (4 - last_size); - break; + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + if (last_size > 0 && last_size < 4) + alignment = (4 - last_size); + break; - case RPC_FC_IGNORE: - size = 0; - break; + case RPC_FC_IGNORE: + size = 0; + break; - default: - error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); - return; + default: + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } + + if (size != 0) + { + if (alignment != 0) + print_client("_StubMsg.Buffer += %u;\n", alignment); + + print_client("*(("); + write_type(client, var->type, NULL, var->tname); + fprintf(client, " __RPC_FAR*)_StubMsg.Buffer) = "); + if (var->ptr_level == 1) + fprintf(client, "*"); + write_name(client, var); + fprintf(client, ";\n"); + print_client("_StubMsg.Buffer += sizeof("); + write_type(client, var->type, NULL, var->tname); + fprintf(client, ");\n"); + fprintf(client, "\n"); + + last_size = size; + } } - - if (size != 0) + else if (var->type->type == RPC_FC_RP) { - if (alignment != 0) - print_client("_StubMsg.Buffer += %u;\n", alignment); - - print_client("*(("); - write_type(client, var->type, NULL, var->tname); - fprintf(client, " __RPC_FAR*)_StubMsg.Buffer) = "); - if (var->ptr_level == 1) - fprintf(client, "*"); - write_name(client, var); - fprintf(client, ";\n"); - print_client("_StubMsg.Buffer += sizeof("); - write_type(client, var->type, NULL, var->tname); - fprintf(client, ");\n"); - fprintf(client, "\n"); - - last_size = size; + if (var->type->ref->ref->type == RPC_FC_STRUCT) + { + print_client("NdrSimpleStructMarshall(\n"); + indent++; + print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); + print_client("(unsigned char __RPC_FAR *)%s,\n", var->name); + print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n", + *type_offset + 4); + indent--; + fprintf(client, "\n"); + } } } } /* calculate the next type offset */ - if (var->ptr_level == 1) + if (var->ptr_level == 0) { - *type_offset += 4; + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + local_type_offset += tsize; + } + } + else if (var->ptr_level == 1) + { + local_type_offset += 4; } } } -static void unmarshall_out_arguments(func_t *func) +static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset) { unsigned int alignment; unsigned int size; @@ -752,6 +982,7 @@ static void unmarshall_out_arguments(func_t *func) int out_attr; var_t *var; var_t *def; + unsigned int local_type_offset = *type_offset; def = func->def; @@ -763,79 +994,130 @@ static void unmarshall_out_arguments(func_t *func) for (; var; var = PREV_LINK(var)) { out_attr = is_attr(var->attrs, ATTR_OUT); - if (!out_attr) - continue; - - if (var->ptr_level > 1) + if (out_attr) { - error("Function '%s' argument '%s': Pointer level %d not supported!\n", - func->def->name, var->name, var->ptr_level); - return; - } - - alignment = 0; - switch (var->type->type) - { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - size = 1; - alignment = 0; - break; - - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - size = 2; - if (last_size > 0 && last_size < 2) - alignment = (2 - last_size); - break; - - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_FLOAT: - size = 4; - if (last_size > 0 && last_size < 4) - alignment = (4 - last_size); - break; - - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: - size = 8; - if (last_size > 0 && last_size < 4) - alignment = (4 - last_size); - break; - - case RPC_FC_IGNORE: - size = 0; - break; - - default: - error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); - return; - } - - if (size != 0) - { - if (var->ptr_level == 1) + if (var->ptr_level > 1) { - fprintf(client, "\n"); - if (alignment != 0) - print_client("_StubMsg.Buffer += %u;\n", alignment); - - print_client("*"); - write_name(client, var); - fprintf(client, " = *(("); - write_type(client, var->type, NULL, var->tname); - fprintf(client, " __RPC_FAR *)_StubMsg.Buffer);\n"); - - print_client("_StubMsg.Buffer += sizeof("); - write_type(client, var->type, NULL, var->tname); - fprintf(client, ");\n"); + error("Function '%s' argument '%s': Pointer level %d not supported!\n", + func->def->name, var->name, var->ptr_level); + return; } - last_size = size; + if (is_base_type(var->type)) + { + alignment = 0; + switch (var->type->type) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_SMALL: + size = 1; + alignment = 0; + break; + + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + if (last_size > 0 && last_size < 2) + alignment = (2 - last_size); + break; + + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_FLOAT: + size = 4; + if (last_size > 0 && last_size < 4) + alignment = (4 - last_size); + break; + + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + if (last_size > 0 && last_size < 4) + alignment = (4 - last_size); + break; + + case RPC_FC_IGNORE: + size = 0; + break; + + default: + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } + + if (size != 0) + { + if (var->ptr_level == 1) + { + fprintf(client, "\n"); + if (alignment != 0) + print_client("_StubMsg.Buffer += %u;\n", alignment); + + print_client("*"); + write_name(client, var); + fprintf(client, " = *(("); + write_type(client, var->type, NULL, var->tname); + fprintf(client, " __RPC_FAR *)_StubMsg.Buffer);\n"); + + print_client("_StubMsg.Buffer += sizeof("); + write_type(client, var->type, NULL, var->tname); + fprintf(client, ");\n"); + } + + last_size = size; + } + } + else if (var->type->type == RPC_FC_RP) + { + if (var->type->ref->ref->type == RPC_FC_STRUCT) + { + fprintf(client, "\n"); + print_client("NdrSimpleStructUnmarshall(\n"); + indent++; + print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); + print_client("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name); + print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", + *type_offset + 4); + print_client("(unsigned char)0);\n"); + indent--; + fprintf(client, "\n"); + } + } + else + { + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } + } + + /* calculate the next type offset */ + if (var->ptr_level == 0) + { + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + local_type_offset += tsize; + } + } + else if (var->ptr_level == 1) + { + local_type_offset += 4; } } } @@ -1102,7 +1384,42 @@ static void write_function_stubs(type_t *iface) indent -= 2; /* unmarshal out arguments */ - unmarshall_out_arguments(func); + unmarshall_out_arguments(func, &type_offset); + } + + /* update type_offset */ + if (func->args) + { + var = func->args; + while (NEXT_LINK(var)) var = NEXT_LINK(var); + while (var) + { + if (var->ptr_level == 0) + { + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + type_offset += tsize; + } + } + else if (var->ptr_level == 1) + { + type_offset += 4; + } + var = PREV_LINK(var); + } } /* update proc_offset */ @@ -1267,7 +1584,7 @@ static int get_type_format_string_size(type_t *iface) func_t *func; var_t *var; - /* determine the proc format string size */ + /* determine the type format string size */ func = iface->funcs; while (NEXT_LINK(func)) func = NEXT_LINK(func); while (func) @@ -1279,7 +1596,25 @@ static int get_type_format_string_size(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { - if (var->ptr_level == 1) + if (var->ptr_level == 0) + { + if (var->type->type == RPC_FC_RP) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize ++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + size += tsize; + } + } + else if (var->ptr_level == 1) { if (is_base_type(var->type)) size += 4; @@ -1319,6 +1654,8 @@ static int get_proc_format_string_size(type_t *iface) case 0: if (is_base_type(var->type)) size += 2; + else if (var->type->type == RPC_FC_RP) + size += 4; break; case 1: @@ -1377,12 +1714,12 @@ static void init_client(void) error("Could not open %s for output\n", client_name); print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name); - print_client("#include\n"); + print_client("#include \n"); print_client("#ifdef _ALPHA_\n"); - print_client("#include\n"); + print_client("#include \n"); print_client("#endif\n"); fprintf(client, "\n"); - print_client("#include\"%s\"\n", header_name); + print_client("#include \"%s\"\n", header_name); fprintf(client, "\n"); } diff --git a/reactos/tools/widl/lex.yy.c b/reactos/tools/widl/lex.yy.c index 6083b88b7c2..bedaca53a7c 100644 --- a/reactos/tools/widl/lex.yy.c +++ b/reactos/tools/widl/lex.yy.c @@ -1,4 +1,3 @@ -#line 2 "lex.yy.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: @@ -10,6 +9,7 @@ #define YY_FLEX_MINOR_VERSION 5 #include +#include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ @@ -23,7 +23,6 @@ #ifdef __cplusplus #include -#include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS @@ -3088,7 +3087,7 @@ static yyconst short int yy_rule_linenum[18] = #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "parser.l" +#line 1 "./parser.l" #define INITIAL 0 /* * IDL Compiler @@ -3115,7 +3114,7 @@ char *yytext; #define pp_line 2 -#line 36 "parser.l" +#line 36 "./parser.l" #include "config.h" @@ -3186,7 +3185,7 @@ static UUID* parse_uuid(const char*u) * The flexer starts here ************************************************************************** */ -#line 3190 "lex.yy.c" +#line 3189 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -3337,12 +3336,12 @@ YY_MALLOC_DECL YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; + register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 108 "parser.l" +#line 108 "./parser.l" -#line 3346 "lex.yy.c" +#line 3345 "lex.yy.c" if ( yy_init ) { @@ -3431,12 +3430,12 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 109 "parser.l" +#line 109 "./parser.l" yy_push_state(pp_line); YY_BREAK case 2: YY_RULE_SETUP -#line 110 "parser.l" +#line 110 "./parser.l" { int lineno; char *cptr, *fname; @@ -3459,12 +3458,12 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 129 "parser.l" +#line 129 "./parser.l" yy_push_state(QUOTE); cbufidx = 0; YY_BREAK case 4: YY_RULE_SETUP -#line 130 "parser.l" +#line 130 "./parser.l" { yy_pop_state(); yylval.str = get_buffered_cstring(); @@ -3472,25 +3471,25 @@ YY_RULE_SETUP } YY_BREAK case 5: -#line 136 "parser.l" +#line 136 "./parser.l" case 6: YY_RULE_SETUP -#line 136 "parser.l" +#line 136 "./parser.l" addcchar(yytext[1]); YY_BREAK case 7: YY_RULE_SETUP -#line 137 "parser.l" +#line 137 "./parser.l" addcchar('\\'); addcchar(yytext[1]); YY_BREAK case 8: YY_RULE_SETUP -#line 138 "parser.l" +#line 138 "./parser.l" addcchar(yytext[0]); YY_BREAK case 9: YY_RULE_SETUP -#line 139 "parser.l" +#line 139 "./parser.l" { yylval.uuid = parse_uuid(yytext); return aUUID; @@ -3498,7 +3497,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 143 "parser.l" +#line 143 "./parser.l" { yylval.num = strtoul(yytext, NULL, 0); return aHEXNUM; @@ -3506,7 +3505,7 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 147 "parser.l" +#line 147 "./parser.l" { yylval.num = strtoul(yytext, NULL, 0); return aNUM; @@ -3514,38 +3513,38 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 151 "parser.l" +#line 151 "./parser.l" return kw_token(yytext); YY_BREAK case 13: YY_RULE_SETUP -#line 152 "parser.l" +#line 152 "./parser.l" line_number++; YY_BREAK case 14: YY_RULE_SETUP -#line 153 "parser.l" +#line 153 "./parser.l" YY_BREAK case 15: YY_RULE_SETUP -#line 154 "parser.l" +#line 154 "./parser.l" return SHL; YY_BREAK case 16: YY_RULE_SETUP -#line 155 "parser.l" +#line 155 "./parser.l" return SHR; YY_BREAK case 17: YY_RULE_SETUP -#line 156 "parser.l" +#line 156 "./parser.l" return yytext[0]; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(QUOTE): case YY_STATE_EOF(pp_line): -#line 157 "parser.l" +#line 157 "./parser.l" { if (import_stack_ptr) { pop_import(); @@ -3556,10 +3555,10 @@ case YY_STATE_EOF(pp_line): YY_BREAK case 18: YY_RULE_SETUP -#line 164 "parser.l" +#line 164 "./parser.l" ECHO; YY_BREAK -#line 3563 "lex.yy.c" +#line 3562 "lex.yy.c" case YY_END_OF_BUFFER: { @@ -3935,6 +3934,7 @@ register char *yy_bp; #endif /* ifndef YY_NO_UNPUT */ +#ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else @@ -4007,7 +4007,7 @@ static int input() return c; } - +#endif /* YY_NO_INPUT */ #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -4118,11 +4118,6 @@ YY_BUFFER_STATE b; } -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) @@ -4440,7 +4435,7 @@ int main() return 0; } #endif -#line 164 "parser.l" +#line 164 "./parser.l" #ifndef yywrap @@ -4566,6 +4561,7 @@ static struct keyword { /* ... */ {"short", tSHORT}, {"signed", tSIGNED}, + {"single", tSINGLE}, {"size_is", tSIZEIS}, {"sizeof", tSIZEOF}, /* ... */ diff --git a/reactos/tools/widl/parser.l b/reactos/tools/widl/parser.l index 72716b70e0d..fba310c3d85 100644 --- a/reactos/tools/widl/parser.l +++ b/reactos/tools/widl/parser.l @@ -286,6 +286,7 @@ static struct keyword { /* ... */ {"short", tSHORT}, {"signed", tSIGNED}, + {"single", tSINGLE}, {"size_is", tSIZEIS}, {"sizeof", tSIZEOF}, /* ... */ diff --git a/reactos/tools/widl/parser.y b/reactos/tools/widl/parser.y index a4b7edf05c6..9631774de41 100644 --- a/reactos/tools/widl/parser.y +++ b/reactos/tools/widl/parser.y @@ -169,6 +169,7 @@ static type_t std_uhyper = { "MIDL_uhyper" }; %token tRETVAL %token tSHORT %token tSIGNED +%token tSINGLE %token tSIZEIS tSIZEOF %token tSMALL %token tSOURCE @@ -565,9 +566,9 @@ base_type: tBYTE { $$ = make_type(RPC_FC_BYTE, NULL); } default: break; } } - | tUNSIGNED { $$ = make_type(RPC_FC_ULONG, &std_int); - $$->sign = -1; } + | tUNSIGNED { $$ = make_type(RPC_FC_ULONG, &std_int); $$->sign = -1; } | tFLOAT { $$ = make_type(RPC_FC_FLOAT, NULL); } + | tSINGLE { $$ = make_type(RPC_FC_FLOAT, NULL); } | tDOUBLE { $$ = make_type(RPC_FC_DOUBLE, NULL); } | tBOOLEAN { $$ = make_type(RPC_FC_SMALL, &std_bool); } | tERRORSTATUST { $$ = make_type(RPC_FC_ERROR_STATUS_T, NULL); } @@ -593,7 +594,8 @@ coclass: tCOCLASS aIDENTIFIER { $$ = make_class($2); } coclasshdr: attributes coclass { $$ = $2; $$->attrs = $1; - if (!parse_only && do_header) write_coclass($$); + if (!parse_only && do_header) + write_coclass($$); } ; @@ -744,14 +746,15 @@ type: tVOID { $$ = make_tref(NULL, make_type(0, NULL)); } | tUNION aIDENTIFIER { $$ = make_tref(NULL, find_type2($2, tsUNION)); } ; -typedef: tTYPEDEF m_attributes type pident_list { typeref_t *tref = uniq_tref($3); +typedef: tTYPEDEF m_attributes type pident_list { typeref_t *tref = uniq_tref($3); $4->tname = tref->name; tref->name = NULL; $$ = type_ref(tref); $$->attrs = $2; - if (!parse_only && do_header) write_typedef($$, $4); - if (in_typelib && $$->attrs) - add_typedef($$, $4); + if (!parse_only && do_header) + write_typedef($$, $4); + if (in_typelib && $$->attrs) + add_typedef($$, $4); reg_types($$, $4, 0); } ; @@ -1114,6 +1117,7 @@ static type_t *reg_type(type_t *type, char *name, int t) nt->t = t; nt->next = type_hash[hash]; type_hash[hash] = nt; + type->name = name; return type; } @@ -1136,7 +1140,14 @@ static unsigned char get_pointer_type( type_t *type ) } t = get_attrv( type->attrs, ATTR_POINTERTYPE ); if (t) return t; - return RPC_FC_FP; + + if(is_attr( type->attrs, ATTR_PTR )) + return RPC_FC_FP; + + if(is_attr( type->attrs, ATTR_UNIQUE )) + return RPC_FC_UP; + + return RPC_FC_RP; } static type_t *reg_types(type_t *type, var_t *names, int t) diff --git a/reactos/tools/widl/server.c b/reactos/tools/widl/server.c index 833c117951b..fd0108c8094 100644 --- a/reactos/tools/widl/server.c +++ b/reactos/tools/widl/server.c @@ -80,6 +80,65 @@ get_base_type(unsigned char type) } +static int get_type_size(type_t *type, int alignment) +{ + int size; + var_t *field; + + switch(type->type) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_SMALL: + size = 1; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_FLOAT: + size = 4; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + size = ((size + alignment - 1) & ~(alignment -1)); + break; + + case RPC_FC_IGNORE: + size = 0; + break; + + case RPC_FC_STRUCT: + field = type->fields; + size = 0; + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + size += get_type_size(field->type, alignment); + field = PREV_LINK(field); + } + break; + + default: + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, type->type); + return 0; + } + + return size; +} + + static void write_procformatstring(type_t *iface) { func_t *func = iface->funcs; @@ -118,6 +177,35 @@ static void write_procformatstring(type_t *iface) print_server("0x4e, /* FC_IN_PARAM_BASETYPE */\n"); print_server("0x%02x, /* FC_ */\n", get_base_type(var->type->type)); } + else if (var->type->type == RPC_FC_RP) + { + var_t *field = var->type->ref->ref->fields; + int size; + + if (in_attr & !out_attr) + print_server("0x4d, /* FC_IN_PARAM */\n"); + else if (!in_attr & out_attr) + print_server("0x51, /* FC_OUT_PARAM */\n"); + else if (in_attr & out_attr) + print_server("0x50, /* FC_IN_OUT_PARAM */\n"); + fprintf(server, "#ifndef _ALPHA_\n"); + print_server("0x01,\n"); + fprintf(server, "#else\n"); + print_server("0x02,\n"); + fprintf(server, "#endif\n"); + print_server("NdrFcShort(0x%x),\n", type_offset); + + size = 9; + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + size++; + field = PREV_LINK(field); + } + if (size % 2) + size++; + type_offset += size; + } else { error("%s:%d Unknown/unsupported type 0x%x\n", @@ -127,8 +215,8 @@ static void write_procformatstring(type_t *iface) } else if (var->ptr_level == 1) { - if (is_base_type(var->type)) - { +// if (is_base_type(var->type)) +// { if (in_attr & !out_attr) print_server("0x4d, /* FC_IN_PARAM */\n"); else if (!in_attr & out_attr) @@ -142,13 +230,13 @@ static void write_procformatstring(type_t *iface) fprintf(server, "#endif\n"); print_server("NdrFcShort(0x%x),\n", type_offset); type_offset += 4; - } - else - { - error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); - return; - } +// } +// else +// { +// error("%s:%d Unknown/unsupported type 0x%x\n", +// __FUNCTION__,__LINE__, var->type->type); +// return; +// } } var = PREV_LINK(var); @@ -190,7 +278,7 @@ static void write_typeformatstring(type_t *iface) { func_t *func = iface->funcs; var_t *var; - int out_attr; + int in_attr, out_attr; int string_attr; int ptr_attr, ref_attr, unique_attr; @@ -211,6 +299,7 @@ static void write_typeformatstring(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { + in_attr = is_attr(var->attrs, ATTR_IN); out_attr = is_attr(var->attrs, ATTR_OUT); string_attr = is_attr(var->attrs, ATTR_STRING); @@ -221,7 +310,50 @@ static void write_typeformatstring(type_t *iface) return; } - if (var->ptr_level == 1) + if (var->ptr_level == 0) + { + if (!is_base_type(var->type)) + { + if (var->type->type == RPC_FC_RP) + { + var_t *field; + int tsize = 9; + unsigned char flags = 0; + + if (!in_attr & out_attr) + flags |= RPC_FC_P_ONSTACK; + + print_server("0x11, 0x%02X, /* FC_RP, [flags] */\n", flags); + print_server("NdrFcShort(0x%02X),\n", 0x02); + print_server("0x%02X,\n", var->type->ref->ref->type); + print_server("0x%02X,\n", 3); /* alignment -1 */ + print_server("NdrFcShort(0x%02X),\n", get_type_size(var->type->ref->ref, 4)); + + field = var->type->ref->ref->fields; + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + print_server("0x%02X,\n", get_base_type(field->type->type)); + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + { + print_server("0x5c, /* FC_PAD */\n"); + tsize++; + } + print_server("0x5b, /* FC_END */\n"); + } + else + { + + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } + } + } + else if (var->ptr_level == 1) { ptr_attr = is_attr(var->attrs, ATTR_PTR); ref_attr = is_attr(var->attrs, ATTR_REF); @@ -280,7 +412,7 @@ static void write_typeformatstring(type_t *iface) } -static void print_message_buffer_size(func_t *func) +static void print_message_buffer_size(func_t *func, unsigned int *type_offset) { unsigned int alignment = 0; int size = 0; @@ -291,6 +423,11 @@ static void print_message_buffer_size(func_t *func) int empty_line; var_t *var; + int start_new_line = 0; + int add_plus = 0; + + unsigned int local_type_offset = *type_offset; + fprintf(server, "\n"); print_server("_StubMsg.BufferLength ="); if (func->args) @@ -300,59 +437,125 @@ static void print_message_buffer_size(func_t *func) for (; var; var = PREV_LINK(var)) { out_attr = is_attr(var->attrs, ATTR_OUT); - if (!out_attr) - continue; - - alignment = 0; - switch (var->type->type) + if (out_attr) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - size = 1; - alignment = 0; - break; + if (is_base_type(var->type)) + { + if (start_new_line) + { + print_server("_StubMsg.BufferLength +="); + } - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - size = 2; - if (last_size > 0 && last_size < 2) - alignment += (2 - last_size); - break; + alignment = 0; + switch (var->type->type) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_SMALL: + size = 1; + alignment = 0; + break; - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_FLOAT: - size = 4; - if (last_size > 0 && last_size < 4) - alignment += (4 - last_size); - break; + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + if (last_size > 0 && last_size < 2) + alignment += (2 - last_size); + break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: - size = 8; - if (last_size > 0 && last_size < 4) - alignment += (4 - last_size); - break; + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_FLOAT: + size = 4; + if (last_size > 0 && last_size < 4) + alignment += (4 - last_size); + break; - default: - error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); - return; + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + if (last_size > 0 && last_size < 4) + alignment += (4 - last_size); + break; + + default: + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } + + if (add_plus) + fprintf(server, " +"); + fprintf(server, " %dU", (size == 0) ? 0 : size + alignment); + + last_size = size; + start_new_line = 0; + add_plus = 1; + } + else if (var->type->type == RPC_FC_RP) + { + if (size == 0) + { + fprintf(server, " 12U;\n"); + } + else if (last_size != 0) + { + fprintf(server, " + 12U;\n"); + last_size = 0; + } + + fprintf(server,"\n"); + print_server("NdrSimpleStructBufferSize(\n"); + indent++; + print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); + print_server("(unsigned char __RPC_FAR *)%s,\n", var->name); + print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n", + local_type_offset + 4); /* FIXME */ + indent--; + fprintf(server,"\n"); + + start_new_line = 1; + } + + /* calculate the next type offset */ + if (var->ptr_level == 0) + { + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + local_type_offset += tsize; + } + } + else if (var->ptr_level == 1) + { + local_type_offset += 4; + } } - - if (last_size != -1) - fprintf(server, " +"); - fprintf(server, " %dU", (size == 0) ? 0 : size + alignment); - - last_size = size; } } /* return value size */ if (!is_void(func->def->type, NULL)) { + if (start_new_line) + { + print_server("_StubMsg.BufferLength +="); + add_plus = 0; + } + switch(func->def->type->type) { case RPC_FC_BYTE: @@ -382,7 +585,7 @@ static void print_message_buffer_size(func_t *func) return; } - if (last_size != -1) + if (add_plus) fprintf(server, " +"); fprintf(server, " %dU", (size == 0) ? 0 : size + alignment); @@ -431,7 +634,16 @@ static void init_pointers (func_t *func) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { - if (var->ptr_level == 1) + if (var->ptr_level == 0) + { + if (var->type->type == RPC_FC_RP) + { + print_server("("); + write_type(server, var->type, NULL, var->tname); + fprintf(server, ")%s = 0;\n", var->name); + } + } + else if (var->ptr_level == 1) { print_server("("); write_type(server, var->type, NULL, var->tname); @@ -458,6 +670,7 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset) int in_attr, out_attr; int string_attr; int ptr_attr, ref_attr, unique_attr; + unsigned int local_type_offset = *type_offset; if (!func->args) return; @@ -493,7 +706,8 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset) indent++; print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); print_server("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name); - print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", *type_offset + 2); + print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", + local_type_offset + 2); print_server("(unsigned char)0);\n"); indent--; fprintf(server, "\n"); @@ -568,7 +782,8 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset) indent++; print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); print_server("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name); - print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", *type_offset); + print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", + local_type_offset); print_server("(unsigned char)0);\n"); indent--; fprintf(server, "\n"); @@ -577,79 +792,117 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset) } else { - alignment = 0; - switch (var->type->type) + if (is_base_type(var->type)) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - size = 1; alignment = 0; - break; + switch (var->type->type) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_SMALL: + size = 1; + alignment = 0; + break; - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - size = 2; - if (last_size != 0 && last_size < 2) - alignment = (2 - last_size); - break; + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + if (last_size != 0 && last_size < 2) + alignment = (2 - last_size); + break; - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_FLOAT: - size = 4; - if (last_size != 0 && last_size < 4) - alignment = (4 - last_size); - break; + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_FLOAT: + size = 4; + if (last_size != 0 && last_size < 4) + alignment = (4 - last_size); + break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: - size = 8; - if (last_size != 0 && last_size < 4) - alignment = (4 - last_size); - break; + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + if (last_size != 0 && last_size < 4) + alignment = (4 - last_size); + break; - case RPC_FC_IGNORE: - size = 0; - break; + case RPC_FC_IGNORE: + size = 0; + break; - default: - error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); - return; + default: + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } + + if (size != 0) + { + if (alignment != 0) + print_server("_StubMsg.Buffer += %u;\n", alignment); + + print_server(""); + write_name(server, var); + fprintf(server, " = *(("); + write_type(server, var->type, NULL, var->tname); + fprintf(server, " __RPC_FAR*)_StubMsg.Buffer);\n"); + print_server("_StubMsg.Buffer += sizeof("); + write_type(server, var->type, NULL, var->tname); + fprintf(server, ");\n"); + fprintf(server, "\n"); + + last_size = size; + } } - - if (size != 0) + else if (var->type->type == RPC_FC_RP) { - if (alignment != 0) - print_server("_StubMsg.Buffer += %u;\n", alignment); - - print_server(""); - write_name(server, var); - fprintf(server, " = *(("); - write_type(server, var->type, NULL, var->tname); - fprintf(server, " __RPC_FAR*)_StubMsg.Buffer);\n"); - print_server("_StubMsg.Buffer += sizeof("); - write_type(server, var->type, NULL, var->tname); - fprintf(server, ");\n"); - fprintf(server, "\n"); - - last_size = size; + if (var->type->ref->ref->type == RPC_FC_STRUCT) + { + print_server("NdrSimpleStructUnmarshall(\n"); + indent++; + print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); + print_server("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name); + print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", + local_type_offset + 4); + print_server("(unsigned char)0);\n"); + indent--; + fprintf(server, "\n"); + } } } } /* calculate the next type offset */ - if (var->ptr_level == 1) + if (var->ptr_level == 0) { - *type_offset += 4; + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + local_type_offset += tsize; + } + } + else if (var->ptr_level == 1) + { + local_type_offset += 4; } } } -static void marshall_out_arguments(func_t *func) +static void marshall_out_arguments(func_t *func, unsigned int *type_offset) { unsigned int alignment = 0; unsigned int size = 0; @@ -657,6 +910,7 @@ static void marshall_out_arguments(func_t *func) var_t *var; var_t *def; int out_attr; + unsigned int local_type_offset = *type_offset; def = func->def; @@ -668,77 +922,117 @@ static void marshall_out_arguments(func_t *func) for (; var; var = PREV_LINK(var)) { out_attr = is_attr(var->attrs, ATTR_OUT); - if (!out_attr) - continue; - - alignment = 0; - switch (var->type->type) + if (out_attr) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - size = 1; - alignment = 0; - break; + if (is_base_type(var->type)) + { + alignment = 0; + switch (var->type->type) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_SMALL: + size = 1; + alignment = 0; + break; - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - size = 2; - if (last_size != 0 && last_size < 2) - alignment = (2 - last_size); - break; + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + if (last_size != 0 && last_size < 2) + alignment = (2 - last_size); + break; - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_FLOAT: - size = 4; - if (last_size != 0 && last_size < 4) - alignment = (4 - last_size); - break; + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_FLOAT: + size = 4; + if (last_size != 0 && last_size < 4) + alignment = (4 - last_size); + break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: - size = 8; - if (last_size != 0 && last_size < 4) - alignment = (4 - last_size); - break; + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + if (last_size != 0 && last_size < 4) + alignment = (4 - last_size); + break; - case RPC_FC_IGNORE: - size = 0; - break; + case RPC_FC_IGNORE: + size = 0; + break; - default: - error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); - return; - } + default: + error("%s:%d Unknown/unsupported type 0x%x\n", + __FUNCTION__,__LINE__, var->type->type); + return; + } - if (size != 0) - { - if (alignment != 0) - print_server("_StubMsg.Buffer += %u;\n", alignment); + if (size != 0) + { + if (alignment != 0) + print_server("_StubMsg.Buffer += %u;\n", alignment); - if (var->ptr_level == 1) + if (var->ptr_level == 1) + { + fprintf(server, "\n"); + print_server("*(("); + write_type(server, var->type, NULL, var->tname); + fprintf(server, " __RPC_FAR *)_StubMsg.Buffer) = *"); + write_name(server, var); + fprintf(server, ";\n"); + + print_server("_StubMsg.Buffer += sizeof("); + write_type(server, var->type, NULL, var->tname); + fprintf(server, ");"); + } + else + { + error("Pointer level %d is not supported!\n", var->ptr_level); + return; + } + + last_size = size; + } + } + else if (var->type->type == RPC_FC_RP) { fprintf(server, "\n"); - print_server("*(("); - write_type(server, var->type, NULL, var->tname); - fprintf(server, " __RPC_FAR *)_StubMsg.Buffer) = *"); - write_name(server, var); - fprintf(server, ";\n"); - - print_server("_StubMsg.Buffer += sizeof("); - write_type(server, var->type, NULL, var->tname); - fprintf(server, ");"); + print_server("NdrSimpleStructMarshall(\n"); + indent++; + print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); + print_server("(unsigned char __RPC_FAR *)%s,\n", var->name); + print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n", + local_type_offset + 4); + indent--; } - else + } + + /* calculate the next type offset */ + if (var->ptr_level == 0) + { + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) { - error("Pointer level %d is not supported!\n", var->ptr_level); - return; - } + var_t *field = var->type->ref->ref->fields; + int tsize = 9; - last_size = size; + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + local_type_offset += tsize; + } + } + else if (var->ptr_level == 1) + { + local_type_offset += 4; } } } @@ -821,7 +1115,7 @@ static void write_function_stubs(type_t *iface) var_t* explicit_handle_var; unsigned int proc_offset = 0; unsigned int type_offset = 2; - unsigned int i; + unsigned int i, sep; int in_attr; int out_attr; @@ -883,10 +1177,19 @@ static void write_function_stubs(type_t *iface) in_attr = 1; if (!in_attr) { - print_server(""); - write_type(server, var->type, NULL, var->tname); - fprintf(server, " _W%u;\n", i); - i++; + if (var->type->type == RPC_FC_RP) + { + print_server("struct "); + write_type(server, NULL, NULL, var->type->ref->ref->name); + fprintf(server, " _%sW;\n", var->name); + } + else + { + print_server(""); + write_type(server, var->type, NULL, var->tname); + fprintf(server, " _W%u;\n", i); + i++; + } } print_server(""); @@ -962,6 +1265,7 @@ static void write_function_stubs(type_t *iface) /* assign out arguments */ if (func->args) { + sep = 0; i = 0; var = func->args; while (NEXT_LINK(var)) var = NEXT_LINK(var); @@ -973,16 +1277,27 @@ static void write_function_stubs(type_t *iface) in_attr = 1; if (!in_attr) { - print_server(""); - write_name(server, var); - fprintf(server, " = &_W%u;\n", i); - i++; + if (var->type->type == RPC_FC_RP) + { + print_server(""); + write_name(server, var); + fprintf(server, " = &_%sW;\n", var->name); + sep = 1; + } + else + { + print_server(""); + write_name(server, var); + fprintf(server, " = &_W%u;\n", i); + i++; + sep = 1; + } } var = PREV_LINK(var); } - if (i) + if (sep) fprintf(server, "\n"); } @@ -1022,7 +1337,7 @@ static void write_function_stubs(type_t *iface) /* allocate and fill the return message buffer */ if (use_return_buffer(func)) { - print_message_buffer_size(func); + print_message_buffer_size(func, &type_offset); print_server("_pRpcMessage->BufferLength = _StubMsg.BufferLength;\n"); fprintf(server, "\n"); print_server("_Status = I_RpcGetBuffer(_pRpcMessage);\n"); @@ -1034,7 +1349,7 @@ static void write_function_stubs(type_t *iface) print_server("_StubMsg.Buffer = (unsigned char __RPC_FAR *)_pRpcMessage->Buffer;\n"); /* marshall the out arguments */ - marshall_out_arguments(func); + marshall_out_arguments(func, &type_offset); } indent--; @@ -1054,6 +1369,41 @@ static void write_function_stubs(type_t *iface) fprintf(server, "}\n"); fprintf(server, "\n"); + /* update type_offset */ + if (func->args) + { + var = func->args; + while (NEXT_LINK(var)) var = NEXT_LINK(var); + while (var) + { + if (var->ptr_level == 0) + { + if ((var->type->type == RPC_FC_RP) && + (var->type->ref->ref->type == RPC_FC_STRUCT)) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + + type_offset += tsize; + } + } + else if (var->ptr_level == 1) + { + type_offset += 4; + } + var = PREV_LINK(var); + } + } + /* update proc_offset */ if (func->args) { @@ -1208,7 +1558,25 @@ static int get_type_format_string_size(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { - if (var->ptr_level == 1) + if (var->ptr_level == 0) + { + if (var->type->type == RPC_FC_RP) + { + var_t *field = var->type->ref->ref->fields; + int tsize = 9; + + while (NEXT_LINK(field)) field = NEXT_LINK(field); + while (field) + { + tsize ++; + field = PREV_LINK(field); + } + if (tsize % 2) + tsize++; + size += tsize; + } + } + else if (var->ptr_level == 1) { if (is_base_type(var->type)) size += 4; @@ -1248,6 +1616,8 @@ static int get_proc_format_string_size(type_t *iface) case 0: if (is_base_type(var->type)) size += 2; + else if (var->type->type == RPC_FC_RP) + size += 4; break; case 1: @@ -1295,9 +1665,9 @@ static void init_server(void) error("Could not open %s for output\n", server_name); print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name); - print_server("#include\n"); + print_server("#include \n"); fprintf(server, "\n"); - print_server("#include\"%s\"\n", header_name); + print_server("#include \"%s\"\n", header_name); fprintf(server, "\n"); } diff --git a/reactos/tools/widl/typelib_struct.h b/reactos/tools/widl/typelib_struct.h index 43c140628e9..9617f2d5b12 100644 --- a/reactos/tools/widl/typelib_struct.h +++ b/reactos/tools/widl/typelib_struct.h @@ -165,7 +165,7 @@ typedef struct tagMSFT_ImpInfo { /* function description data */ typedef struct { /* INT recsize; record size including some xtra stuff */ - INT DataType; /* data type of the memeber, eg return of function */ + INT DataType; /* data type of the member, eg return of function */ INT Flags; /* something to do with attribute flags (LOWORD) */ #ifdef WORDS_BIGENDIAN INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */ diff --git a/reactos/tools/widl/widl.c b/reactos/tools/widl/widl.c index a5f17570a94..bb96b6e87b2 100644 --- a/reactos/tools/widl/widl.c +++ b/reactos/tools/widl/widl.c @@ -236,7 +236,7 @@ int main(int argc,char *argv[]) (debuglevel & DEBUGLEVEL_PPTRACE) != 0, (debuglevel & DEBUGLEVEL_PPMSG) != 0 ); - if (!header_name && do_header) { + if (!header_name) { header_name = dup_basename(input_name, ".idl"); strcat(header_name, ".h"); } diff --git a/reactos/tools/widl/widl.man b/reactos/tools/widl/widl.man index 9e449309e03..46cd98c6973 100644 --- a/reactos/tools/widl/widl.man +++ b/reactos/tools/widl/widl.man @@ -31,6 +31,20 @@ Generate a type library. Define the name of the type library to be generated. The default filename is infile.tlb. .PP +.B Proxy/stub generation options: +.IP \fB-c\fR +Generate client stub. +.IP \fB-C \fIfile\fR +Name of client stub file (default is infile_c.c) +.IP \fB-c\fR +Generate proxy. +.IP \fB-P \fIfile\fR +Name of proxy file (default is infile_p.c) +.IP \fB-s\fR +Generate server stub. +.IP \fB-S \fIfile\fR +Name of server stub file (default is infile_s.c) +.PP .B Preprocessor options: .IP "\fB-I \fIpath\fR" Add a header search dir to path. Multiple search diff --git a/reactos/tools/widl/widltypes.h b/reactos/tools/widl/widltypes.h index 5802099589d..5db3c09c0d2 100644 --- a/reactos/tools/widl/widltypes.h +++ b/reactos/tools/widl/widltypes.h @@ -66,11 +66,12 @@ enum attr_type ATTR_DEFAULT, ATTR_DEFAULTVALUE_EXPR, ATTR_DEFAULTVALUE_STRING, + ATTR_DISPINTERFACE, ATTR_DLLNAME, ATTR_DUAL, ATTR_ENDPOINT, - ATTR_ENTRY_STRING, ATTR_ENTRY_ORDINAL, + ATTR_ENTRY_STRING, ATTR_EXPLICIT_HANDLE, ATTR_HANDLE, ATTR_HELPCONTEXT, @@ -115,8 +116,7 @@ enum attr_type ATTR_V1ENUM, ATTR_VARARG, ATTR_VERSION, - ATTR_WIREMARSHAL, - ATTR_DISPINTERFACE + ATTR_WIREMARSHAL }; enum expr_type diff --git a/reactos/tools/widl/write_msft.c b/reactos/tools/widl/write_msft.c index c9ae86ab24e..e59e4548220 100644 --- a/reactos/tools/widl/write_msft.c +++ b/reactos/tools/widl/write_msft.c @@ -297,7 +297,7 @@ static int ctl2_encode_name( converted_name[1] = 0x00; - value = lhash_val_of_name_sys(typelib->typelib_header.varflags & 0x0f, typelib->typelib_header.lcid, converted_name + 4); + value = lhash_val_of_name_sys(typelib->typelib_header.varflags & 0x0f, typelib->typelib_header.lcid, (LPCSTR)converted_name + 4); converted_name[2] = value; converted_name[3] = value >> 8; diff --git a/reactos/tools/widl/y.tab.c b/reactos/tools/widl/y.tab.c index ca14f77f36f..f229801015f 100644 --- a/reactos/tools/widl/y.tab.c +++ b/reactos/tools/widl/y.tab.c @@ -1,133 +1,133 @@ - -/* A Bison parser, made from parser.y - by GNU Bison version 1.28 */ +/* A Bison parser, made from ./parser.y + by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ -#define aIDENTIFIER 257 -#define aKNOWNTYPE 258 -#define aNUM 259 -#define aHEXNUM 260 -#define aSTRING 261 -#define aUUID 262 -#define aEOF 263 -#define SHL 264 -#define SHR 265 -#define tAGGREGATABLE 266 -#define tALLOCATE 267 -#define tAPPOBJECT 268 -#define tARRAYS 269 -#define tASYNC 270 -#define tASYNCUUID 271 -#define tAUTOHANDLE 272 -#define tBINDABLE 273 -#define tBOOLEAN 274 -#define tBROADCAST 275 -#define tBYTE 276 -#define tBYTECOUNT 277 -#define tCALLAS 278 -#define tCALLBACK 279 -#define tCASE 280 -#define tCDECL 281 -#define tCHAR 282 -#define tCOCLASS 283 -#define tCODE 284 -#define tCOMMSTATUS 285 -#define tCONST 286 -#define tCONTEXTHANDLE 287 -#define tCONTEXTHANDLENOSERIALIZE 288 -#define tCONTEXTHANDLESERIALIZE 289 -#define tCONTROL 290 -#define tCPPQUOTE 291 -#define tDEFAULT 292 -#define tDEFAULTVALUE 293 -#define tDISPINTERFACE 294 -#define tDLLNAME 295 -#define tDOUBLE 296 -#define tDUAL 297 -#define tENDPOINT 298 -#define tENTRY 299 -#define tENUM 300 -#define tERRORSTATUST 301 -#define tEXPLICITHANDLE 302 -#define tEXTERN 303 -#define tFLOAT 304 -#define tHANDLE 305 -#define tHANDLET 306 -#define tHELPCONTEXT 307 -#define tHELPFILE 308 -#define tHELPSTRING 309 -#define tHELPSTRINGCONTEXT 310 -#define tHELPSTRINGDLL 311 -#define tHIDDEN 312 -#define tHYPER 313 -#define tID 314 -#define tIDEMPOTENT 315 -#define tIIDIS 316 -#define tIMPLICITHANDLE 317 -#define tIMPORT 318 -#define tIMPORTLIB 319 -#define tIN 320 -#define tINCLUDE 321 -#define tINLINE 322 -#define tINPUTSYNC 323 -#define tINT 324 -#define tINT64 325 -#define tINTERFACE 326 -#define tLENGTHIS 327 -#define tLIBRARY 328 -#define tLOCAL 329 -#define tLONG 330 -#define tMETHODS 331 -#define tMODULE 332 -#define tNONCREATABLE 333 -#define tOBJECT 334 -#define tODL 335 -#define tOLEAUTOMATION 336 -#define tOPTIONAL 337 -#define tOUT 338 -#define tPOINTERDEFAULT 339 -#define tPROPERTIES 340 -#define tPROPGET 341 -#define tPROPPUT 342 -#define tPROPPUTREF 343 -#define tPTR 344 -#define tPUBLIC 345 -#define tREADONLY 346 -#define tREF 347 -#define tRESTRICTED 348 -#define tRETVAL 349 -#define tSHORT 350 -#define tSIGNED 351 -#define tSIZEIS 352 -#define tSIZEOF 353 -#define tSMALL 354 -#define tSOURCE 355 -#define tSTDCALL 356 -#define tSTRING 357 -#define tSTRUCT 358 -#define tSWITCH 359 -#define tSWITCHIS 360 -#define tSWITCHTYPE 361 -#define tTRANSMITAS 362 -#define tTYPEDEF 363 -#define tUNION 364 -#define tUNIQUE 365 -#define tUNSIGNED 366 -#define tUUID 367 -#define tV1ENUM 368 -#define tVARARG 369 -#define tVERSION 370 -#define tVOID 371 -#define tWCHAR 372 -#define tWIREMARSHAL 373 -#define tPOINTERTYPE 374 -#define COND 375 -#define CAST 376 -#define PPTR 377 -#define NEG 378 +# define aIDENTIFIER 257 +# define aKNOWNTYPE 258 +# define aNUM 259 +# define aHEXNUM 260 +# define aSTRING 261 +# define aUUID 262 +# define aEOF 263 +# define SHL 264 +# define SHR 265 +# define tAGGREGATABLE 266 +# define tALLOCATE 267 +# define tAPPOBJECT 268 +# define tARRAYS 269 +# define tASYNC 270 +# define tASYNCUUID 271 +# define tAUTOHANDLE 272 +# define tBINDABLE 273 +# define tBOOLEAN 274 +# define tBROADCAST 275 +# define tBYTE 276 +# define tBYTECOUNT 277 +# define tCALLAS 278 +# define tCALLBACK 279 +# define tCASE 280 +# define tCDECL 281 +# define tCHAR 282 +# define tCOCLASS 283 +# define tCODE 284 +# define tCOMMSTATUS 285 +# define tCONST 286 +# define tCONTEXTHANDLE 287 +# define tCONTEXTHANDLENOSERIALIZE 288 +# define tCONTEXTHANDLESERIALIZE 289 +# define tCONTROL 290 +# define tCPPQUOTE 291 +# define tDEFAULT 292 +# define tDEFAULTVALUE 293 +# define tDISPINTERFACE 294 +# define tDLLNAME 295 +# define tDOUBLE 296 +# define tDUAL 297 +# define tENDPOINT 298 +# define tENTRY 299 +# define tENUM 300 +# define tERRORSTATUST 301 +# define tEXPLICITHANDLE 302 +# define tEXTERN 303 +# define tFLOAT 304 +# define tHANDLE 305 +# define tHANDLET 306 +# define tHELPCONTEXT 307 +# define tHELPFILE 308 +# define tHELPSTRING 309 +# define tHELPSTRINGCONTEXT 310 +# define tHELPSTRINGDLL 311 +# define tHIDDEN 312 +# define tHYPER 313 +# define tID 314 +# define tIDEMPOTENT 315 +# define tIIDIS 316 +# define tIMPLICITHANDLE 317 +# define tIMPORT 318 +# define tIMPORTLIB 319 +# define tIN 320 +# define tINCLUDE 321 +# define tINLINE 322 +# define tINPUTSYNC 323 +# define tINT 324 +# define tINT64 325 +# define tINTERFACE 326 +# define tLENGTHIS 327 +# define tLIBRARY 328 +# define tLOCAL 329 +# define tLONG 330 +# define tMETHODS 331 +# define tMODULE 332 +# define tNONCREATABLE 333 +# define tOBJECT 334 +# define tODL 335 +# define tOLEAUTOMATION 336 +# define tOPTIONAL 337 +# define tOUT 338 +# define tPOINTERDEFAULT 339 +# define tPROPERTIES 340 +# define tPROPGET 341 +# define tPROPPUT 342 +# define tPROPPUTREF 343 +# define tPTR 344 +# define tPUBLIC 345 +# define tREADONLY 346 +# define tREF 347 +# define tRESTRICTED 348 +# define tRETVAL 349 +# define tSHORT 350 +# define tSIGNED 351 +# define tSINGLE 352 +# define tSIZEIS 353 +# define tSIZEOF 354 +# define tSMALL 355 +# define tSOURCE 356 +# define tSTDCALL 357 +# define tSTRING 358 +# define tSTRUCT 359 +# define tSWITCH 360 +# define tSWITCHIS 361 +# define tSWITCHTYPE 362 +# define tTRANSMITAS 363 +# define tTYPEDEF 364 +# define tUNION 365 +# define tUNIQUE 366 +# define tUNSIGNED 367 +# define tUUID 368 +# define tV1ENUM 369 +# define tVARARG 370 +# define tVERSION 371 +# define tVOID 372 +# define tWCHAR 373 +# define tWIREMARSHAL 374 +# define tPOINTERTYPE 375 +# define COND 376 +# define CAST 377 +# define PPTR 378 +# define NEG 379 -#line 1 "parser.y" +#line 1 "./parser.y" /* * IDL Compiler @@ -233,7 +233,8 @@ static type_t std_int64 = { "__int64" }; static type_t std_uhyper = { "MIDL_uhyper" }; -#line 106 "parser.y" +#line 106 "./parser.y" +#ifndef YYSTYPE typedef union { attr_t *attr; expr_t *expr; @@ -246,608 +247,646 @@ typedef union { char *str; UUID *uuid; unsigned int num; -} YYSTYPE; -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 #endif +#ifndef YYDEBUG +# define YYDEBUG 1 #endif -#define YYFINAL 462 +#define YYFINAL 463 #define YYFLAG -32768 -#define YYNTBASE 144 +#define YYNTBASE 145 -#define YYTRANSLATE(x) ((unsigned)(x) <= 378 ? yytranslate[x] : 216) +/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ +#define YYTRANSLATE(x) ((unsigned)(x) <= 379 ? yytranslate[x] : 217) -static const short yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 124, 2, 134, - 135, 127, 126, 121, 125, 143, 128, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 140, 133, 2, - 141, 2, 142, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 138, 2, 139, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 136, 123, 137, 129, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 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, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 122, 130, 131, 132 +/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ +static const short yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 125, 2, + 135, 136, 128, 127, 122, 126, 144, 129, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 141, 134, + 2, 142, 2, 143, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 139, 2, 140, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 137, 124, 138, 130, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 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, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 123, 131, 132, 133 }; -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 3, 6, 9, 12, 15, 18, 21, 22, - 25, 28, 31, 34, 37, 38, 42, 45, 47, 50, - 52, 55, 58, 60, 63, 66, 69, 74, 78, 82, - 85, 89, 93, 94, 96, 98, 100, 104, 106, 111, - 115, 122, 128, 129, 133, 137, 139, 143, 148, 149, - 151, 155, 157, 161, 166, 168, 170, 175, 180, 182, - 184, 186, 188, 190, 195, 200, 205, 207, 212, 217, - 222, 224, 226, 231, 236, 241, 246, 251, 253, 258, - 260, 265, 271, 273, 275, 280, 282, 284, 286, 288, - 290, 292, 294, 299, 301, 303, 305, 307, 309, 311, - 313, 315, 317, 322, 324, 326, 331, 336, 341, 343, - 348, 350, 352, 357, 362, 364, 365, 367, 368, 371, - 376, 380, 386, 387, 390, 392, 394, 398, 402, 404, - 410, 412, 416, 417, 419, 421, 423, 425, 431, 435, - 439, 443, 447, 451, 455, 459, 463, 466, 469, 472, - 477, 482, 486, 488, 492, 494, 499, 500, 503, 506, - 510, 513, 515, 520, 528, 529, 531, 532, 534, 536, - 538, 540, 542, 544, 546, 548, 550, 552, 555, 558, - 560, 562, 564, 566, 568, 570, 571, 573, 575, 578, - 581, 584, 587, 589, 591, 594, 597, 600, 605, 606, - 609, 612, 615, 618, 621, 624, 628, 631, 635, 641, - 642, 645, 648, 651, 654, 660, 668, 670, 673, 676, - 679, 682, 685, 690, 693, 696, 698, 700, 704, 706, - 710, 712, 714, 720, 722, 724, 726, 729, 731, 734, - 736, 739, 741, 744, 749, 755, 766, 768 +#if YYDEBUG +static const short yyprhs[] = +{ + 0, 0, 2, 3, 6, 9, 12, 15, 18, 21, + 22, 25, 28, 31, 34, 37, 38, 42, 45, 47, + 50, 52, 55, 58, 60, 63, 66, 69, 74, 78, + 82, 85, 89, 93, 94, 96, 98, 100, 104, 106, + 111, 115, 122, 128, 129, 133, 137, 139, 143, 148, + 149, 151, 155, 157, 161, 166, 168, 170, 175, 180, + 182, 184, 186, 188, 190, 195, 200, 205, 207, 212, + 217, 222, 224, 226, 231, 236, 241, 246, 251, 253, + 258, 260, 265, 271, 273, 275, 280, 282, 284, 286, + 288, 290, 292, 294, 299, 301, 303, 305, 307, 309, + 311, 313, 315, 317, 322, 324, 326, 331, 336, 341, + 343, 348, 350, 352, 357, 362, 364, 365, 367, 368, + 371, 376, 380, 386, 387, 390, 392, 394, 398, 402, + 404, 410, 412, 416, 417, 419, 421, 423, 425, 431, + 435, 439, 443, 447, 451, 455, 459, 463, 466, 469, + 472, 477, 482, 486, 488, 492, 494, 499, 500, 503, + 506, 510, 513, 515, 520, 528, 529, 531, 532, 534, + 536, 538, 540, 542, 544, 546, 548, 550, 552, 555, + 558, 560, 562, 564, 566, 568, 570, 572, 573, 575, + 577, 580, 583, 586, 589, 591, 593, 596, 599, 602, + 607, 608, 611, 614, 617, 620, 623, 626, 630, 633, + 637, 643, 644, 647, 650, 653, 656, 662, 670, 672, + 675, 678, 681, 684, 687, 692, 695, 698, 700, 702, + 706, 708, 712, 714, 716, 722, 724, 726, 728, 731, + 733, 736, 738, 741, 743, 746, 751, 757, 768, 770 }; - -static const short yyrhs[] = { 145, - 0, 0, 145, 203, 0, 145, 202, 0, 145, 191, - 0, 145, 206, 0, 145, 154, 0, 145, 148, 0, - 0, 146, 203, 0, 146, 202, 0, 146, 191, 0, - 146, 206, 0, 146, 148, 0, 0, 147, 182, 133, - 0, 147, 148, 0, 133, 0, 168, 133, 0, 149, - 0, 172, 133, 0, 178, 133, 0, 151, 0, 211, - 133, 0, 213, 133, 0, 214, 133, 0, 37, 134, - 7, 135, 0, 64, 7, 133, 0, 150, 146, 9, - 0, 74, 3, 0, 162, 152, 136, 0, 153, 146, - 137, 0, 0, 157, 0, 117, 0, 158, 0, 157, - 121, 158, 0, 156, 0, 162, 212, 208, 159, 0, - 212, 208, 159, 0, 162, 212, 208, 134, 155, 135, - 0, 212, 208, 134, 155, 135, 0, 0, 138, 160, - 139, 0, 138, 127, 139, 0, 174, 0, 160, 121, - 175, 0, 160, 139, 138, 175, 0, 0, 162, 0, - 138, 163, 139, 0, 164, 0, 163, 121, 164, 0, - 163, 139, 138, 164, 0, 16, 0, 18, 0, 24, - 134, 185, 135, 0, 26, 134, 176, 135, 0, 33, - 0, 34, 0, 35, 0, 36, 0, 38, 0, 39, - 134, 177, 135, 0, 39, 134, 7, 135, 0, 41, - 134, 7, 135, 0, 43, 0, 44, 134, 7, 135, - 0, 45, 134, 7, 135, 0, 45, 134, 177, 135, - 0, 48, 0, 51, 0, 53, 134, 177, 135, 0, - 54, 134, 7, 135, 0, 55, 134, 7, 135, 0, - 56, 134, 177, 135, 0, 57, 134, 7, 135, 0, - 58, 0, 60, 134, 177, 135, 0, 61, 0, 62, - 134, 185, 135, 0, 63, 134, 52, 3, 135, 0, - 66, 0, 69, 0, 73, 134, 173, 135, 0, 75, - 0, 79, 0, 80, 0, 81, 0, 82, 0, 83, - 0, 84, 0, 85, 134, 210, 135, 0, 87, 0, - 88, 0, 89, 0, 90, 0, 91, 0, 92, 0, - 93, 0, 94, 0, 95, 0, 98, 134, 173, 135, - 0, 101, 0, 103, 0, 106, 134, 175, 135, 0, - 107, 134, 212, 135, 0, 108, 134, 212, 135, 0, - 111, 0, 113, 134, 8, 135, 0, 114, 0, 115, - 0, 116, 134, 215, 135, 0, 119, 134, 212, 135, - 0, 210, 0, 0, 102, 0, 0, 166, 167, 0, - 26, 175, 140, 180, 0, 38, 140, 180, 0, 32, - 212, 185, 141, 177, 0, 0, 170, 121, 0, 170, - 0, 171, 0, 170, 121, 171, 0, 185, 141, 177, - 0, 185, 0, 46, 184, 136, 169, 137, 0, 174, - 0, 173, 121, 174, 0, 0, 175, 0, 5, 0, - 6, 0, 3, 0, 175, 142, 175, 140, 175, 0, - 175, 123, 175, 0, 175, 124, 175, 0, 175, 126, - 175, 0, 175, 125, 175, 0, 175, 127, 175, 0, - 175, 128, 175, 0, 175, 10, 175, 0, 175, 11, - 175, 0, 129, 175, 0, 125, 175, 0, 127, 175, - 0, 134, 212, 135, 175, 0, 99, 134, 212, 135, - 0, 134, 175, 135, 0, 177, 0, 176, 121, 177, - 0, 175, 0, 49, 32, 212, 185, 0, 0, 179, - 180, 0, 181, 133, 0, 161, 214, 133, 0, 162, - 133, 0, 133, 0, 161, 212, 208, 159, 0, 161, - 212, 165, 208, 134, 155, 135, 0, 0, 185, 0, - 0, 3, 0, 4, 0, 3, 0, 4, 0, 60, - 0, 95, 0, 116, 0, 22, 0, 118, 0, 188, - 0, 97, 188, 0, 112, 188, 0, 112, 0, 50, - 0, 42, 0, 20, 0, 47, 0, 52, 0, 0, - 70, 0, 70, 0, 100, 187, 0, 96, 187, 0, - 76, 187, 0, 59, 187, 0, 71, 0, 28, 0, - 29, 3, 0, 29, 4, 0, 162, 189, 0, 190, - 136, 192, 137, 0, 0, 192, 193, 0, 161, 203, - 0, 40, 3, 0, 40, 4, 0, 162, 194, 0, - 86, 140, 0, 196, 181, 133, 0, 77, 140, 0, - 197, 182, 133, 0, 195, 136, 196, 197, 137, 0, - 0, 140, 4, 0, 72, 3, 0, 72, 4, 0, - 162, 200, 0, 201, 199, 136, 147, 137, 0, 201, - 140, 3, 136, 151, 147, 137, 0, 198, 0, 200, - 133, 0, 194, 133, 0, 78, 3, 0, 78, 4, - 0, 162, 204, 0, 205, 136, 147, 137, 0, 127, - 208, 0, 32, 207, 0, 185, 0, 207, 0, 134, - 208, 135, 0, 208, 0, 209, 121, 208, 0, 93, - 0, 111, 0, 104, 184, 136, 179, 137, 0, 117, - 0, 4, 0, 186, 0, 32, 212, 0, 172, 0, - 46, 3, 0, 211, 0, 104, 3, 0, 214, 0, - 110, 3, 0, 109, 161, 212, 209, 0, 110, 184, - 136, 179, 137, 0, 110, 184, 105, 134, 181, 135, - 183, 136, 166, 137, 0, 5, 0, 5, 143, 5, - 0 +static const short yyrhs[] = +{ + 146, 0, 0, 146, 204, 0, 146, 203, 0, 146, + 192, 0, 146, 207, 0, 146, 155, 0, 146, 149, + 0, 0, 147, 204, 0, 147, 203, 0, 147, 192, + 0, 147, 207, 0, 147, 149, 0, 0, 148, 183, + 134, 0, 148, 149, 0, 134, 0, 169, 134, 0, + 150, 0, 173, 134, 0, 179, 134, 0, 152, 0, + 212, 134, 0, 214, 134, 0, 215, 134, 0, 37, + 135, 7, 136, 0, 64, 7, 134, 0, 151, 147, + 9, 0, 74, 3, 0, 163, 153, 137, 0, 154, + 147, 138, 0, 0, 158, 0, 118, 0, 159, 0, + 158, 122, 159, 0, 157, 0, 163, 213, 209, 160, + 0, 213, 209, 160, 0, 163, 213, 209, 135, 156, + 136, 0, 213, 209, 135, 156, 136, 0, 0, 139, + 161, 140, 0, 139, 128, 140, 0, 175, 0, 161, + 122, 176, 0, 161, 140, 139, 176, 0, 0, 163, + 0, 139, 164, 140, 0, 165, 0, 164, 122, 165, + 0, 164, 140, 139, 165, 0, 16, 0, 18, 0, + 24, 135, 186, 136, 0, 26, 135, 177, 136, 0, + 33, 0, 34, 0, 35, 0, 36, 0, 38, 0, + 39, 135, 178, 136, 0, 39, 135, 7, 136, 0, + 41, 135, 7, 136, 0, 43, 0, 44, 135, 7, + 136, 0, 45, 135, 7, 136, 0, 45, 135, 178, + 136, 0, 48, 0, 51, 0, 53, 135, 178, 136, + 0, 54, 135, 7, 136, 0, 55, 135, 7, 136, + 0, 56, 135, 178, 136, 0, 57, 135, 7, 136, + 0, 58, 0, 60, 135, 178, 136, 0, 61, 0, + 62, 135, 186, 136, 0, 63, 135, 52, 3, 136, + 0, 66, 0, 69, 0, 73, 135, 174, 136, 0, + 75, 0, 79, 0, 80, 0, 81, 0, 82, 0, + 83, 0, 84, 0, 85, 135, 211, 136, 0, 87, + 0, 88, 0, 89, 0, 90, 0, 91, 0, 92, + 0, 93, 0, 94, 0, 95, 0, 99, 135, 174, + 136, 0, 102, 0, 104, 0, 107, 135, 176, 136, + 0, 108, 135, 213, 136, 0, 109, 135, 213, 136, + 0, 112, 0, 114, 135, 8, 136, 0, 115, 0, + 116, 0, 117, 135, 216, 136, 0, 120, 135, 213, + 136, 0, 211, 0, 0, 103, 0, 0, 167, 168, + 0, 26, 176, 141, 181, 0, 38, 141, 181, 0, + 32, 213, 186, 142, 178, 0, 0, 171, 122, 0, + 171, 0, 172, 0, 171, 122, 172, 0, 186, 142, + 178, 0, 186, 0, 46, 185, 137, 170, 138, 0, + 175, 0, 174, 122, 175, 0, 0, 176, 0, 5, + 0, 6, 0, 3, 0, 176, 143, 176, 141, 176, + 0, 176, 124, 176, 0, 176, 125, 176, 0, 176, + 127, 176, 0, 176, 126, 176, 0, 176, 128, 176, + 0, 176, 129, 176, 0, 176, 10, 176, 0, 176, + 11, 176, 0, 130, 176, 0, 126, 176, 0, 128, + 176, 0, 135, 213, 136, 176, 0, 100, 135, 213, + 136, 0, 135, 176, 136, 0, 178, 0, 177, 122, + 178, 0, 176, 0, 49, 32, 213, 186, 0, 0, + 180, 181, 0, 182, 134, 0, 162, 215, 134, 0, + 163, 134, 0, 134, 0, 162, 213, 209, 160, 0, + 162, 213, 166, 209, 135, 156, 136, 0, 0, 186, + 0, 0, 3, 0, 4, 0, 3, 0, 4, 0, + 60, 0, 95, 0, 117, 0, 22, 0, 119, 0, + 189, 0, 97, 189, 0, 113, 189, 0, 113, 0, + 50, 0, 98, 0, 42, 0, 20, 0, 47, 0, + 52, 0, 0, 70, 0, 70, 0, 101, 188, 0, + 96, 188, 0, 76, 188, 0, 59, 188, 0, 71, + 0, 28, 0, 29, 3, 0, 29, 4, 0, 163, + 190, 0, 191, 137, 193, 138, 0, 0, 193, 194, + 0, 162, 204, 0, 40, 3, 0, 40, 4, 0, + 163, 195, 0, 86, 141, 0, 197, 182, 134, 0, + 77, 141, 0, 198, 183, 134, 0, 196, 137, 197, + 198, 138, 0, 0, 141, 4, 0, 72, 3, 0, + 72, 4, 0, 163, 201, 0, 202, 200, 137, 148, + 138, 0, 202, 141, 3, 137, 152, 148, 138, 0, + 199, 0, 201, 134, 0, 195, 134, 0, 78, 3, + 0, 78, 4, 0, 163, 205, 0, 206, 137, 148, + 138, 0, 128, 209, 0, 32, 208, 0, 186, 0, + 208, 0, 135, 209, 136, 0, 209, 0, 210, 122, + 209, 0, 93, 0, 112, 0, 105, 185, 137, 180, + 138, 0, 118, 0, 4, 0, 187, 0, 32, 213, + 0, 173, 0, 46, 3, 0, 212, 0, 105, 3, + 0, 215, 0, 111, 3, 0, 110, 162, 213, 210, + 0, 111, 185, 137, 180, 138, 0, 111, 185, 106, + 135, 182, 136, 184, 137, 167, 138, 0, 5, 0, + 5, 144, 5, 0 }; #endif -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 227, 230, 231, 232, 233, 234, 235, 236, 239, 240, - 241, 242, 243, 244, 247, 248, 249, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 263, 265, 268, 271, - 273, 275, 278, 279, 282, 285, 286, 287, 291, 295, - 298, 304, 311, 312, 313, 316, 317, 318, 321, 322, - 325, 329, 330, 331, 334, 336, 337, 338, 339, 340, - 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 398, 399, 402, 403, 408, - 412, 418, 425, 426, 427, 430, 431, 437, 442, 448, - 456, 457, 470, 471, 474, 475, 476, 477, 478, 479, - 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, - 490, 491, 494, 495, 498, 504, 509, 510, 515, 516, - 517, 518, 521, 524, 535, 536, 539, 540, 541, 544, - 546, 547, 548, 549, 552, 553, 554, 555, 556, 568, - 570, 571, 572, 573, 574, 577, 578, 581, 582, 583, - 584, 585, 586, 587, 590, 591, 594, 600, 605, 606, - 609, 613, 614, 617, 629, 630, 633, 634, 637, 652, - 653, 656, 657, 660, 668, 676, 683, 686, 688, 691, - 692, 695, 700, 706, 707, 710, 711, 712, 715, 717, - 720, 722, 725, 735, 736, 737, 738, 739, 740, 741, - 742, 743, 744, 747, 759, 763, 776, 778 +#if YYDEBUG +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const short yyrline[] = +{ + 0, 228, 231, 232, 233, 234, 235, 236, 237, 240, + 241, 242, 243, 244, 245, 248, 249, 250, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 264, 266, 269, + 272, 274, 276, 279, 280, 283, 286, 287, 288, 292, + 296, 299, 305, 312, 313, 314, 317, 318, 319, 322, + 323, 326, 330, 331, 332, 335, 337, 338, 339, 340, + 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 399, 400, 403, 404, + 409, 413, 419, 426, 427, 428, 431, 432, 438, 443, + 449, 457, 458, 471, 472, 475, 476, 477, 478, 479, + 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, + 490, 491, 492, 495, 496, 499, 505, 510, 511, 516, + 517, 518, 519, 522, 525, 536, 537, 540, 541, 542, + 545, 547, 548, 549, 550, 553, 554, 555, 556, 557, + 569, 570, 571, 572, 573, 574, 575, 578, 579, 582, + 583, 584, 585, 586, 587, 588, 591, 592, 595, 602, + 607, 608, 611, 615, 616, 619, 631, 632, 635, 636, + 639, 654, 655, 658, 659, 662, 670, 678, 685, 688, + 690, 693, 694, 697, 702, 708, 709, 712, 713, 714, + 717, 719, 722, 724, 727, 737, 738, 739, 740, 741, + 742, 743, 744, 745, 746, 749, 762, 766, 779, 781 }; #endif -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +#if (YYDEBUG) || defined YYERROR_VERBOSE -static const char * const yytname[] = { "$","error","$undefined.","aIDENTIFIER", -"aKNOWNTYPE","aNUM","aHEXNUM","aSTRING","aUUID","aEOF","SHL","SHR","tAGGREGATABLE", -"tALLOCATE","tAPPOBJECT","tARRAYS","tASYNC","tASYNCUUID","tAUTOHANDLE","tBINDABLE", -"tBOOLEAN","tBROADCAST","tBYTE","tBYTECOUNT","tCALLAS","tCALLBACK","tCASE","tCDECL", -"tCHAR","tCOCLASS","tCODE","tCOMMSTATUS","tCONST","tCONTEXTHANDLE","tCONTEXTHANDLENOSERIALIZE", -"tCONTEXTHANDLESERIALIZE","tCONTROL","tCPPQUOTE","tDEFAULT","tDEFAULTVALUE", -"tDISPINTERFACE","tDLLNAME","tDOUBLE","tDUAL","tENDPOINT","tENTRY","tENUM","tERRORSTATUST", -"tEXPLICITHANDLE","tEXTERN","tFLOAT","tHANDLE","tHANDLET","tHELPCONTEXT","tHELPFILE", -"tHELPSTRING","tHELPSTRINGCONTEXT","tHELPSTRINGDLL","tHIDDEN","tHYPER","tID", -"tIDEMPOTENT","tIIDIS","tIMPLICITHANDLE","tIMPORT","tIMPORTLIB","tIN","tINCLUDE", -"tINLINE","tINPUTSYNC","tINT","tINT64","tINTERFACE","tLENGTHIS","tLIBRARY","tLOCAL", -"tLONG","tMETHODS","tMODULE","tNONCREATABLE","tOBJECT","tODL","tOLEAUTOMATION", -"tOPTIONAL","tOUT","tPOINTERDEFAULT","tPROPERTIES","tPROPGET","tPROPPUT","tPROPPUTREF", -"tPTR","tPUBLIC","tREADONLY","tREF","tRESTRICTED","tRETVAL","tSHORT","tSIGNED", -"tSIZEIS","tSIZEOF","tSMALL","tSOURCE","tSTDCALL","tSTRING","tSTRUCT","tSWITCH", -"tSWITCHIS","tSWITCHTYPE","tTRANSMITAS","tTYPEDEF","tUNION","tUNIQUE","tUNSIGNED", -"tUUID","tV1ENUM","tVARARG","tVERSION","tVOID","tWCHAR","tWIREMARSHAL","tPOINTERTYPE", -"','","COND","'|'","'&'","'-'","'+'","'*'","'/'","'~'","CAST","PPTR","NEG","';'", -"'('","')'","'{'","'}'","'['","']'","':'","'='","'?'","'.'","input","gbl_statements", -"imp_statements","int_statements","statement","cppquote","import_start","import", -"libraryhdr","library_start","librarydef","m_args","no_args","args","arg","array", -"array_list","m_attributes","attributes","attrib_list","attribute","callconv", -"cases","case","constdef","enums","enum_list","enum","enumdef","m_exprs","m_expr", -"expr","expr_list_const","expr_const","externdef","fields","field","s_field", -"funcdef","m_ident","t_ident","ident","base_type","m_int","int_std","coclass", -"coclasshdr","coclassdef","coclass_ints","coclass_int","dispinterface","dispinterfacehdr", -"dispint_props","dispint_meths","dispinterfacedef","inherit","interface","interfacehdr", -"interfacedef","interfacedec","module","modulehdr","moduledef","p_ident","pident", -"pident_list","pointer_type","structdef","type","typedef","uniondef","version", NULL +/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +static const char *const yytname[] = +{ + "$", "error", "$undefined.", "aIDENTIFIER", "aKNOWNTYPE", "aNUM", + "aHEXNUM", "aSTRING", "aUUID", "aEOF", "SHL", "SHR", "tAGGREGATABLE", + "tALLOCATE", "tAPPOBJECT", "tARRAYS", "tASYNC", "tASYNCUUID", + "tAUTOHANDLE", "tBINDABLE", "tBOOLEAN", "tBROADCAST", "tBYTE", + "tBYTECOUNT", "tCALLAS", "tCALLBACK", "tCASE", "tCDECL", "tCHAR", + "tCOCLASS", "tCODE", "tCOMMSTATUS", "tCONST", "tCONTEXTHANDLE", + "tCONTEXTHANDLENOSERIALIZE", "tCONTEXTHANDLESERIALIZE", "tCONTROL", + "tCPPQUOTE", "tDEFAULT", "tDEFAULTVALUE", "tDISPINTERFACE", "tDLLNAME", + "tDOUBLE", "tDUAL", "tENDPOINT", "tENTRY", "tENUM", "tERRORSTATUST", + "tEXPLICITHANDLE", "tEXTERN", "tFLOAT", "tHANDLE", "tHANDLET", + "tHELPCONTEXT", "tHELPFILE", "tHELPSTRING", "tHELPSTRINGCONTEXT", + "tHELPSTRINGDLL", "tHIDDEN", "tHYPER", "tID", "tIDEMPOTENT", "tIIDIS", + "tIMPLICITHANDLE", "tIMPORT", "tIMPORTLIB", "tIN", "tINCLUDE", + "tINLINE", "tINPUTSYNC", "tINT", "tINT64", "tINTERFACE", "tLENGTHIS", + "tLIBRARY", "tLOCAL", "tLONG", "tMETHODS", "tMODULE", "tNONCREATABLE", + "tOBJECT", "tODL", "tOLEAUTOMATION", "tOPTIONAL", "tOUT", + "tPOINTERDEFAULT", "tPROPERTIES", "tPROPGET", "tPROPPUT", "tPROPPUTREF", + "tPTR", "tPUBLIC", "tREADONLY", "tREF", "tRESTRICTED", "tRETVAL", + "tSHORT", "tSIGNED", "tSINGLE", "tSIZEIS", "tSIZEOF", "tSMALL", + "tSOURCE", "tSTDCALL", "tSTRING", "tSTRUCT", "tSWITCH", "tSWITCHIS", + "tSWITCHTYPE", "tTRANSMITAS", "tTYPEDEF", "tUNION", "tUNIQUE", + "tUNSIGNED", "tUUID", "tV1ENUM", "tVARARG", "tVERSION", "tVOID", + "tWCHAR", "tWIREMARSHAL", "tPOINTERTYPE", "','", "COND", "'|'", "'&'", + "'-'", "'+'", "'*'", "'/'", "'~'", "CAST", "PPTR", "NEG", "';'", "'('", + "')'", "'{'", "'}'", "'['", "']'", "':'", "'='", "'?'", "'.'", "input", + "gbl_statements", "imp_statements", "int_statements", "statement", + "cppquote", "import_start", "import", "libraryhdr", "library_start", + "librarydef", "m_args", "no_args", "args", "arg", "array", "array_list", + "m_attributes", "attributes", "attrib_list", "attribute", "callconv", + "cases", "case", "constdef", "enums", "enum_list", "enum", "enumdef", + "m_exprs", "m_expr", "expr", "expr_list_const", "expr_const", + "externdef", "fields", "field", "s_field", "funcdef", "m_ident", + "t_ident", "ident", "base_type", "m_int", "int_std", "coclass", + "coclasshdr", "coclassdef", "coclass_ints", "coclass_int", + "dispinterface", "dispinterfacehdr", "dispint_props", "dispint_meths", + "dispinterfacedef", "inherit", "interface", "interfacehdr", + "interfacedef", "interfacedec", "module", "modulehdr", "moduledef", + "p_ident", "pident", "pident_list", "pointer_type", "structdef", "type", + "typedef", "uniondef", "version", 0 }; #endif -static const short yyr1[] = { 0, - 144, 145, 145, 145, 145, 145, 145, 145, 146, 146, - 146, 146, 146, 146, 147, 147, 147, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 149, 150, 151, 152, - 153, 154, 155, 155, 156, 157, 157, 157, 158, 158, - 158, 158, 159, 159, 159, 160, 160, 160, 161, 161, - 162, 163, 163, 163, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 165, 165, 166, 166, 167, - 167, 168, 169, 169, 169, 170, 170, 171, 171, 172, - 173, 173, 174, 174, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 176, 176, 177, 178, 179, 179, 180, 180, - 180, 180, 181, 182, 183, 183, 184, 184, 184, 185, - 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 187, 187, 188, 188, 188, - 188, 188, 188, 188, 189, 189, 190, 191, 192, 192, - 193, 194, 194, 195, 196, 196, 197, 197, 198, 199, - 199, 200, 200, 201, 202, 202, 202, 203, 203, 204, - 204, 205, 206, 207, 207, 208, 208, 208, 209, 209, - 210, 210, 211, 212, 212, 212, 212, 212, 212, 212, - 212, 212, 212, 213, 214, 214, 215, 215 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const short yyr1[] = +{ + 0, 145, 146, 146, 146, 146, 146, 146, 146, 147, + 147, 147, 147, 147, 147, 148, 148, 148, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 150, 151, 152, + 153, 154, 155, 156, 156, 157, 158, 158, 158, 159, + 159, 159, 159, 160, 160, 160, 161, 161, 161, 162, + 162, 163, 164, 164, 164, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 166, 166, 167, 167, + 168, 168, 169, 170, 170, 170, 171, 171, 172, 172, + 173, 174, 174, 175, 175, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 177, 177, 178, 179, 180, 180, 181, + 181, 181, 181, 182, 183, 184, 184, 185, 185, 185, + 186, 186, 186, 186, 186, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 188, 188, 189, + 189, 189, 189, 189, 189, 189, 190, 190, 191, 192, + 193, 193, 194, 195, 195, 196, 197, 197, 198, 198, + 199, 200, 200, 201, 201, 202, 203, 203, 203, 204, + 204, 205, 205, 206, 207, 208, 208, 209, 209, 209, + 210, 210, 211, 211, 212, 213, 213, 213, 213, 213, + 213, 213, 213, 213, 213, 214, 215, 215, 216, 216 }; -static const short yyr2[] = { 0, - 1, 0, 2, 2, 2, 2, 2, 2, 0, 2, - 2, 2, 2, 2, 0, 3, 2, 1, 2, 1, - 2, 2, 1, 2, 2, 2, 4, 3, 3, 2, - 3, 3, 0, 1, 1, 1, 3, 1, 4, 3, - 6, 5, 0, 3, 3, 1, 3, 4, 0, 1, - 3, 1, 3, 4, 1, 1, 4, 4, 1, 1, - 1, 1, 1, 4, 4, 4, 1, 4, 4, 4, - 1, 1, 4, 4, 4, 4, 4, 1, 4, 1, - 4, 5, 1, 1, 4, 1, 1, 1, 1, 1, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 1, 1, 4, 4, 4, 1, 4, - 1, 1, 4, 4, 1, 0, 1, 0, 2, 4, - 3, 5, 0, 2, 1, 1, 3, 3, 1, 5, - 1, 3, 0, 1, 1, 1, 1, 5, 3, 3, - 3, 3, 3, 3, 3, 3, 2, 2, 2, 4, - 4, 3, 1, 3, 1, 4, 0, 2, 2, 3, - 2, 1, 4, 7, 0, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, - 1, 1, 1, 1, 1, 0, 1, 1, 2, 2, - 2, 2, 1, 1, 2, 2, 2, 4, 0, 2, - 2, 2, 2, 2, 2, 3, 2, 3, 5, 0, - 2, 2, 2, 2, 5, 7, 1, 2, 2, 2, - 2, 2, 4, 2, 2, 1, 1, 3, 1, 3, - 1, 1, 5, 1, 1, 1, 2, 1, 2, 1, - 2, 1, 2, 4, 5, 10, 1, 3 +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const short yyr2[] = +{ + 0, 1, 0, 2, 2, 2, 2, 2, 2, 0, + 2, 2, 2, 2, 2, 0, 3, 2, 1, 2, + 1, 2, 2, 1, 2, 2, 2, 4, 3, 3, + 2, 3, 3, 0, 1, 1, 1, 3, 1, 4, + 3, 6, 5, 0, 3, 3, 1, 3, 4, 0, + 1, 3, 1, 3, 4, 1, 1, 4, 4, 1, + 1, 1, 1, 1, 4, 4, 4, 1, 4, 4, + 4, 1, 1, 4, 4, 4, 4, 4, 1, 4, + 1, 4, 5, 1, 1, 4, 1, 1, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 1, 1, 4, 4, 4, 1, + 4, 1, 1, 4, 4, 1, 0, 1, 0, 2, + 4, 3, 5, 0, 2, 1, 1, 3, 3, 1, + 5, 1, 3, 0, 1, 1, 1, 1, 5, 3, + 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, + 4, 4, 3, 1, 3, 1, 4, 0, 2, 2, + 3, 2, 1, 4, 7, 0, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, + 2, 2, 2, 2, 1, 1, 2, 2, 2, 4, + 0, 2, 2, 2, 2, 2, 2, 3, 2, 3, + 5, 0, 2, 2, 2, 2, 5, 7, 1, 2, + 2, 2, 2, 2, 4, 2, 2, 1, 1, 3, + 1, 3, 1, 1, 5, 1, 1, 1, 2, 1, + 2, 1, 2, 1, 2, 4, 5, 10, 1, 3 }; -static const short yydefact[] = { 2, - 1, 0, 0, 0, 167, 0, 0, 0, 167, 49, - 167, 18, 0, 8, 20, 9, 23, 9, 7, 0, - 0, 0, 0, 0, 5, 0, 0, 217, 0, 210, - 4, 3, 0, 6, 0, 0, 0, 235, 183, 175, - 194, 0, 182, 167, 184, 181, 185, 186, 188, 193, - 186, 186, 0, 186, 167, 167, 180, 234, 176, 238, - 236, 177, 240, 0, 242, 0, 202, 203, 168, 169, - 0, 0, 0, 212, 213, 0, 0, 50, 0, 55, - 56, 0, 0, 59, 60, 61, 62, 63, 0, 0, - 67, 0, 0, 71, 72, 0, 0, 0, 0, 0, - 78, 0, 80, 0, 0, 83, 84, 0, 86, 87, - 88, 89, 90, 91, 92, 0, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 0, 104, 105, 0, 0, - 0, 109, 0, 111, 112, 0, 0, 0, 52, 115, - 0, 0, 0, 0, 0, 0, 197, 204, 214, 222, - 19, 21, 22, 199, 219, 0, 218, 0, 0, 15, - 24, 25, 26, 237, 239, 187, 192, 191, 190, 178, - 189, 241, 243, 179, 170, 171, 172, 173, 174, 0, - 0, 123, 0, 28, 157, 0, 0, 157, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 133, 0, 133, 0, 0, 0, 0, 0, - 0, 0, 51, 29, 14, 0, 12, 11, 10, 13, - 32, 195, 196, 30, 220, 221, 31, 49, 0, 49, - 0, 211, 15, 49, 0, 27, 0, 125, 126, 129, - 156, 49, 0, 0, 0, 226, 227, 229, 244, 49, - 49, 0, 137, 135, 136, 0, 0, 0, 0, 0, - 155, 0, 153, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 131, 134, - 231, 232, 0, 0, 0, 0, 0, 0, 247, 0, - 0, 53, 0, 198, 0, 200, 205, 0, 0, 0, - 49, 0, 49, 223, 17, 0, 0, 122, 130, 124, - 0, 162, 233, 0, 50, 158, 0, 225, 224, 0, - 0, 0, 245, 57, 0, 148, 149, 147, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 58, 65, 64, 66, 68, 69, 70, 73, 74, 75, - 76, 77, 79, 81, 0, 133, 85, 93, 103, 106, - 107, 108, 110, 0, 113, 114, 54, 201, 207, 0, - 206, 209, 0, 15, 215, 116, 16, 127, 128, 242, - 161, 159, 228, 230, 165, 0, 152, 0, 145, 146, - 139, 140, 142, 141, 143, 144, 0, 154, 82, 132, - 248, 43, 208, 49, 117, 0, 160, 0, 166, 151, - 150, 0, 133, 163, 216, 0, 118, 138, 0, 0, - 46, 33, 0, 45, 0, 44, 234, 0, 38, 34, - 36, 0, 0, 0, 0, 246, 119, 47, 0, 164, - 0, 0, 43, 0, 49, 48, 37, 43, 33, 40, - 49, 121, 33, 39, 0, 120, 0, 42, 41, 0, - 0, 0 +/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ +static const short yydefact[] = +{ + 2, 1, 0, 0, 0, 167, 0, 0, 0, 167, + 49, 167, 18, 0, 8, 20, 9, 23, 9, 7, + 0, 0, 0, 0, 0, 5, 0, 0, 218, 0, + 211, 4, 3, 0, 6, 0, 0, 0, 236, 184, + 175, 195, 0, 183, 167, 185, 181, 186, 187, 189, + 194, 187, 187, 0, 182, 187, 167, 167, 180, 235, + 176, 239, 237, 177, 241, 0, 243, 0, 203, 204, + 168, 169, 0, 0, 0, 213, 214, 0, 0, 50, + 0, 55, 56, 0, 0, 59, 60, 61, 62, 63, + 0, 0, 67, 0, 0, 71, 72, 0, 0, 0, + 0, 0, 78, 0, 80, 0, 0, 83, 84, 0, + 86, 87, 88, 89, 90, 91, 92, 0, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 0, 104, 105, + 0, 0, 0, 109, 0, 111, 112, 0, 0, 0, + 52, 115, 0, 0, 0, 0, 0, 0, 198, 205, + 215, 223, 19, 21, 22, 200, 220, 0, 219, 0, + 0, 15, 24, 25, 26, 238, 240, 188, 193, 192, + 191, 178, 190, 242, 244, 179, 170, 171, 172, 173, + 174, 0, 0, 123, 0, 28, 157, 0, 0, 157, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 133, 0, 133, 0, 0, 0, + 0, 0, 0, 0, 51, 29, 14, 0, 12, 11, + 10, 13, 32, 196, 197, 30, 221, 222, 31, 49, + 0, 49, 0, 212, 15, 49, 0, 27, 0, 125, + 126, 129, 156, 49, 0, 0, 0, 227, 228, 230, + 245, 49, 49, 0, 137, 135, 136, 0, 0, 0, + 0, 0, 155, 0, 153, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 131, 134, 232, 233, 0, 0, 0, 0, 0, 0, + 248, 0, 0, 53, 0, 199, 0, 201, 206, 0, + 0, 0, 49, 0, 49, 224, 17, 0, 0, 122, + 130, 124, 0, 162, 234, 0, 50, 158, 0, 226, + 225, 0, 0, 0, 246, 57, 0, 148, 149, 147, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 58, 65, 64, 66, 68, 69, 70, 73, + 74, 75, 76, 77, 79, 81, 0, 133, 85, 93, + 103, 106, 107, 108, 110, 0, 113, 114, 54, 202, + 208, 0, 207, 210, 0, 15, 216, 116, 16, 127, + 128, 243, 161, 159, 229, 231, 165, 0, 152, 0, + 145, 146, 139, 140, 142, 141, 143, 144, 0, 154, + 82, 132, 249, 43, 209, 49, 117, 0, 160, 0, + 166, 151, 150, 0, 133, 163, 217, 0, 118, 138, + 0, 0, 46, 33, 0, 45, 0, 44, 235, 0, + 38, 34, 36, 0, 0, 0, 0, 247, 119, 47, + 0, 164, 0, 0, 43, 0, 49, 48, 37, 43, + 33, 40, 49, 121, 33, 39, 0, 120, 0, 42, + 41, 0, 0, 0 }; -static const short yydefgoto[] = { 460, - 1, 141, 234, 305, 15, 16, 17, 146, 18, 19, - 428, 429, 430, 431, 414, 420, 306, 78, 138, 139, - 406, 423, 437, 21, 237, 238, 239, 60, 278, 279, - 261, 262, 263, 23, 242, 316, 317, 307, 408, 71, - 246, 61, 167, 62, 147, 24, 217, 228, 296, 26, - 27, 230, 301, 28, 159, 29, 30, 218, 219, 150, - 33, 220, 247, 248, 249, 140, 63, 433, 36, 65, - 290 +static const short yydefgoto[] = +{ + 461, 1, 142, 235, 306, 15, 16, 17, 147, 18, + 19, 429, 430, 431, 432, 415, 421, 307, 79, 139, + 140, 407, 424, 438, 21, 238, 239, 240, 61, 279, + 280, 262, 263, 264, 23, 243, 317, 318, 308, 409, + 72, 247, 62, 168, 63, 148, 24, 218, 229, 297, + 26, 27, 231, 302, 28, 160, 29, 30, 219, 220, + 151, 33, 221, 248, 249, 250, 141, 64, 434, 36, + 66, 291 }; -static const short yypact[] = {-32768, - 514, 533, -109, 177, 188, 15, 30, 207, 188, -79, - 188,-32768, 742,-32768,-32768,-32768,-32768,-32768,-32768, 24, - -83, -54, -36, -20,-32768, -27, -5,-32768, -11, 2, --32768,-32768, 17,-32768, 6, 42, 60,-32768,-32768,-32768, --32768, 533,-32768, 215,-32768,-32768,-32768, 54,-32768,-32768, - 54, 54, 29, 54, 265, 270, 29,-32768,-32768,-32768, --32768,-32768,-32768, 299,-32768, 175,-32768,-32768,-32768,-32768, - 66, 533, 83,-32768,-32768, 91, 533,-32768, -74,-32768, --32768, 96, 98,-32768,-32768,-32768,-32768,-32768, 102, 117, --32768, 119, 126,-32768,-32768, 129, 131, 141, 145, 151, --32768, 160,-32768, 161, 162,-32768,-32768, 163,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 164,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 167,-32768,-32768, 178, 180, - 182,-32768, 184,-32768,-32768, 186, 187, -88,-32768,-32768, - 498, 595, 274, 306, 279, 189,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 225,-32768, 284, 191,-32768, --32768,-32768,-32768,-32768, 192,-32768,-32768,-32768,-32768,-32768, --32768, 192, -71,-32768,-32768,-32768,-32768,-32768,-32768, 183, - 194, 299, 299,-32768,-32768, 394, 198,-32768, 299, 220, - 106, 316, 326, 130, 220, 328, 329, 220, 330, 220, - 299, 287, 220, -45, 220, 220, 533, 533, 332, 336, - 533, 742, 204,-32768,-32768, 32,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768, 152, 203, -57, - 212,-32768,-32768, 616, 220,-32768, 213, 237,-32768, 214, --32768, -30, -9, 394, 394,-32768,-32768,-32768, 239, -79, - -10, 235,-32768,-32768,-32768, 240, 220, 220, 220, 472, - 357, -61,-32768, 241, 243, 244, 247, 254, 255, 257, - 258, 268, 269, 271, 276, 281, 372, -50,-32768, 357, --32768,-32768, 282, -46, 72, 283, 288, 289, 262, 292, - 293,-32768, 742,-32768, -14,-32768,-32768, 290, 533, 296, - 154, 358, 626,-32768,-32768, 533, 298,-32768,-32768, 299, - 220,-32768,-32768, 533, 301,-32768, 302,-32768,-32768, 297, - 394, 303,-32768,-32768, 533, 294, 294, 294, 238, 304, - 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768, 307, 220,-32768,-32768,-32768,-32768, --32768,-32768,-32768, 436,-32768,-32768,-32768,-32768,-32768, 394, --32768,-32768, 314,-32768,-32768, 353,-32768,-32768,-32768, 318, --32768,-32768,-32768,-32768, 299, 321,-32768, 220, 294, 294, - 31, 59, 35, 35, 18, 18, 260,-32768,-32768,-32768, --32768, 319,-32768, 636,-32768, 394,-32768, 322,-32768,-32768, - 294, 220, 407,-32768,-32768, 331,-32768, 357, 49, -72, --32768, 234, -16,-32768, 220, 324, -34, 325,-32768, 342, --32768, 533, 394, 220, 339,-32768,-32768, 357, 220,-32768, - 349, 394, -4, 346, -98, 357,-32768, 56, 234,-32768, - -98,-32768, 234,-32768, 333,-32768, 355,-32768,-32768, 464, - 491,-32768 +static const short yypact[] = +{ + -32768, 613, 602, -100, 104, 112, 13, 48, 140, 112, + -67, 112,-32768, 772,-32768,-32768,-32768,-32768,-32768,-32768, + 11, -37, -34, 25, -47,-32768, 32, -10,-32768, 47, + -9,-32768,-32768, 2,-32768, 49, 51, 59,-32768,-32768, + -32768,-32768, 602,-32768, 153,-32768,-32768,-32768, 60,-32768, + -32768, 60, 60, 296,-32768, 60, 187, 222, 296,-32768, + -32768,-32768,-32768,-32768,-32768, 17,-32768, 181,-32768,-32768, + -32768,-32768, 69, 602, 68,-32768,-32768, 74, 602,-32768, + -75,-32768,-32768, 87, 98,-32768,-32768,-32768,-32768,-32768, + 106, 122,-32768, 134, 143,-32768,-32768, 144, 146, 150, + 151, 152,-32768, 154,-32768, 155, 163,-32768,-32768, 164, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 168,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 169,-32768,-32768, + 170, 171, 176,-32768, 177,-32768,-32768, 182, 184, -84, + -32768,-32768, 450, 532, 233, 205, 268, 102,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 202,-32768, 270, + 165,-32768,-32768,-32768,-32768,-32768, 183,-32768,-32768,-32768, + -32768,-32768,-32768, 183, -74,-32768,-32768,-32768,-32768,-32768, + -32768, 186, 190, 17, 17,-32768,-32768, 353, 188,-32768, + 17, 328, 247, 322, 323, 253, 328, 325, 329, 328, + 330, 328, 17, 286, 328, -60, 328, 328, 602, 602, + 333, 337, 602, 772, 207,-32768,-32768, 8,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 138, + 203, -51, 211,-32768,-32768, 644, 328,-32768, 212, 227, + -32768, 209,-32768, -35, -7, 353, 353,-32768,-32768,-32768, + 232, -67, -29, 223,-32768,-32768,-32768, 225, 328, 328, + 328, 497, 167, -78,-32768, 229, 234, 235, 238, 240, + 242, 244, 248, 250, 251, 257, 259, 260, 355, -72, + -32768, 167,-32768,-32768, 263, -49, 71, 264, 265, 266, + 224, 267, 269,-32768, 772,-32768, -11,-32768,-32768, 273, + 602, 275, 145, 343, 655,-32768,-32768, 602, 282,-32768, + -32768, 17, 328,-32768,-32768, 602, 283,-32768, 284,-32768, + -32768, 285, 353, 287,-32768,-32768, 602, 277, 277, 277, + 91, 288, 328, 328, 328, 328, 328, 328, 328, 328, + 328, 328,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768, 289, 328,-32768,-32768, + -32768,-32768,-32768,-32768,-32768, 421,-32768,-32768,-32768,-32768, + -32768, 353,-32768,-32768, 295,-32768,-32768, 324,-32768,-32768, + -32768, 297,-32768,-32768,-32768,-32768, 17, 294,-32768, 328, + 277, 277, 103, 36, 58, 58, 12, 12, 139,-32768, + -32768,-32768,-32768, 300,-32768, 665,-32768, 353,-32768, 299, + -32768,-32768, 277, 328, 503,-32768,-32768, 298,-32768, 167, + 54, -73,-32768, 293, -2,-32768, 328, 301, -44, 306, + -32768, 338,-32768, 602, 353, 328, 305,-32768,-32768, 167, + 328,-32768, 415, 353, -69, 351, -28, 167,-32768, -4, + 293,-32768, -28,-32768, 293,-32768, 314,-32768, 316,-32768, + -32768, 455, 464,-32768 }; -static const short yypgoto[] = {-32768, --32768, 475, -220, 8,-32768,-32768, 193,-32768,-32768,-32768, - -236,-32768,-32768, 55, -380,-32768, -8, -1,-32768, -198, --32768,-32768,-32768,-32768,-32768,-32768, 195, 5, 308, -329, - -167,-32768, -179,-32768, 309, -365, -206, 197,-32768, 21, - -63,-32768, 63, 171,-32768,-32768, 500,-32768,-32768, -13, --32768,-32768,-32768,-32768,-32768, -12,-32768, 501, 4,-32768, --32768, 502, 266, -227,-32768, 311, 10, 1,-32768, 3, --32768 +static const short yypgoto[] = +{ + -32768,-32768, 448, -224, 18,-32768,-32768, 166,-32768,-32768, + -32768, -317,-32768,-32768, 26, -327,-32768, -8, -1,-32768, + -196,-32768,-32768,-32768,-32768,-32768,-32768, 160, 5, 278, + -330, -165,-32768, -183,-32768, 304, -381, -197, 193,-32768, + 19, -64,-32768, 73, 65,-32768,-32768, 471,-32768,-32768, + -13,-32768,-32768,-32768,-32768,-32768, -12,-32768, 472, 4, + -32768,-32768, 482, 245, -231,-32768, 292, 10, 1,-32768, + 3,-32768 }; -#define YYLAST 861 +#define YYLAST 892 -static const short yytable[] = { 20, - 180, 77, 64, 37, 32, 22, 148, 149, 14, 434, - 35, 265, 303, 292, 269, 270, 319, 320, 273, 298, - 275, 435, 243, 300, 66, 4, 400, 331, 332, 76, - 187, 79, 212, -168, 312, 280, 73, 280, 285, 13, - 331, 332, 164, 322, 331, 332, 72, 281, 425, 151, - 213, 253, 143, 254, 255, 308, 41, 8, 13, 340, - 143, 188, 450, 4, -168, 282, 426, 454, 331, 332, - 356, 4, 183, 341, 356, 76, 79, 186, 152, 452, - 13, 331, 332, 421, 357, 456, -35, 48, 359, 326, - 327, 328, 329, 384, 367, 8, 153, 144, 49, 50, - -35, 145, 312, 8, 51, 155, 313, 13, 253, 145, - 254, 255, 264, 168, 169, 154, 171, 244, 240, 241, - 436, 157, 312, 166, 52, 252, 323, 13, 54, 449, - 156, 379, 253, 413, 254, 255, 268, 276, 161, 216, - 216, 158, 402, 37, 37, 22, 22, 256, 215, 215, - 35, 35, 160, 404, 334, 335, 336, 337, 338, 339, - 398, 337, 338, 389, 390, 391, 392, 393, 394, 395, - 396, 397, 339, 257, 162, 258, 339, 259, 416, 67, - 68, 181, 260, 335, 336, 337, 338, 424, 280, 453, - 69, 70, 163, 413, 333, 334, 335, 336, 337, 338, - 339, 182, 148, 149, 256, 443, 360, 286, 287, 74, - 75, 291, 455, 339, 448, 184, 457, 165, 70, 295, - 411, 299, 253, 170, 254, 255, 185, 174, 256, 189, - 257, 190, 258, 314, 259, 191, 37, 38, 22, 260, - 315, 299, 314, 35, 418, 280, 240, 331, 332, 315, - 192, 327, 193, 39, 257, 40, 258, 438, 259, 194, - 330, 41, 195, 260, 196, 42, 444, 172, 70, 331, - 332, 446, 173, 70, 197, 43, 222, 223, 198, 44, - 45, 225, 226, 46, 199, 47, 231, 232, 294, 13, - 372, 13, 48, 200, 201, 202, 203, 204, 368, 370, - 205, 175, 176, 49, 50, 37, 376, 22, 224, 51, - 229, 206, 35, 207, 370, 208, 380, 209, 256, 210, - 211, 409, 266, 235, 227, 386, 233, -168, 236, 52, - 53, 250, 267, 54, 271, 272, 274, 55, 277, 288, - 289, 293, 297, 56, 257, 57, 258, 302, 259, 309, - 427, 59, 38, 260, 311, 331, 332, 310, 177, 321, - 333, 334, 335, 336, 337, 338, 331, 332, 39, 324, - 40, 13, 387, 325, 355, 342, 41, 343, 344, 339, - 42, 345, 333, 334, 335, 336, 337, 338, 346, 347, - 43, 348, 349, 178, 44, 45, 175, 176, 46, 412, - 47, 339, 350, 351, 364, 352, 37, 48, 22, 253, - 353, 254, 255, 35, 179, 354, 358, 361, 49, 50, - 432, 7, 362, 363, 51, 243, 365, 366, 371, 369, - 377, 383, 442, 381, 382, 339, 314, 385, 388, 432, - 401, 399, 314, 315, 52, 53, 403, 432, 54, 315, - 407, 432, 55, 177, 405, 410, 413, 417, 56, 440, - 57, 439, 441, 461, 422, 58, 59, 458, 333, 334, - 335, 336, 337, 338, 253, 38, 254, 255, 445, 333, - 334, 335, 336, 337, 338, 451, 13, 339, 178, 459, - 462, 39, 142, 40, 374, 447, 251, 373, 339, 41, - 25, 31, 34, 42, 378, 256, 214, 0, 318, 179, - 0, 0, 284, 43, 283, 0, 0, 44, 45, 0, - 244, 46, 0, 47, 0, 0, 0, 245, 0, 2, - 48, 257, 0, 419, 3, 259, 38, 4, 0, 0, - 260, 49, 50, 5, 0, 2, 6, 51, 0, 0, - 3, 0, 39, 4, 40, 0, 0, 0, 0, 5, - 41, 7, 6, 0, 42, 0, 0, 52, 53, 8, - 256, 54, 0, 0, 43, 55, 0, 7, 44, 45, - 0, 56, 46, 57, 47, 8, 0, 0, 58, 59, - 0, 48, 0, 0, 0, 0, 257, 0, 258, 0, - 259, 9, 49, 50, 0, 260, 10, 11, 51, 0, - 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, - 0, 0, 10, 11, 0, 0, 2, 0, 52, 53, - 12, 3, 54, 0, 4, 13, 55, 0, 0, 0, - 5, 0, 56, 6, 57, 0, 12, 2, 0, 58, - 59, 13, 3, 0, 0, 0, 0, 2, 7, 0, - 0, 5, 3, 0, 6, 0, 8, 2, 0, 0, - 0, 5, 3, 0, 6, 0, 0, 0, 0, 7, - 0, 5, 0, 0, 6, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 9, 7, - 0, 0, 0, 10, 11, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 0, 0, 0, 0, 10, 11, 0, 12, 0, 9, - 0, 221, 13, 0, 10, 11, 0, 0, 0, 9, - 0, 0, 0, 0, 10, 11, 0, 0, 12, 0, - 0, 0, 304, 13, 0, 0, 0, 80, 12, 81, - 0, 0, 375, 13, 0, 82, 0, 83, 12, 0, - 0, 0, 415, 13, 84, 85, 86, 87, 0, 88, - 89, 0, 90, 0, 91, 92, 93, 0, 0, 94, - 0, 0, 95, 0, 96, 97, 98, 99, 100, 101, - 0, 102, 103, 104, 105, 0, 0, 106, 0, 0, - 107, 0, 0, 0, 108, 0, 109, 0, 0, 0, - 110, 111, 112, 113, 114, 115, 116, 0, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 0, 0, 126, - 0, 0, 127, 0, 128, 0, 0, 129, 130, 131, - 0, 0, 132, 0, 133, 134, 135, 136, 0, 0, - 137 +static const short yytable[] = +{ + 20, 181, 78, 65, 37, 32, 22, 149, 150, 266, + 304, 35, 270, 271, 320, 321, 274, 293, 276, 14, + 176, 177, 332, 333, 435, 244, 299, 401, 77, 4, + 80, 188, -168, 282, 301, 67, 436, 144, 213, 281, + 144, 281, 286, 165, 341, 73, 332, 333, 4, 426, + 357, 4, 283, 309, 323, 74, 214, 254, 342, 255, + 256, 8, 189, -168, 358, 453, 450, 427, 332, 333, + 414, 457, 13, 357, 184, 77, 80, 178, -35, 187, + 8, 332, 333, 8, 422, 145, 146, 360, 13, 146, + 155, 385, -35, 327, 328, 329, 330, 152, 368, 313, + 153, 332, 333, 314, 13, 313, 313, 68, 69, 324, + 13, 13, 179, 332, 333, 70, 71, 451, 171, 241, + 242, 245, 455, 175, 169, 170, 253, 157, 172, 380, + 167, 454, 159, 456, 180, 414, 437, 458, 277, 161, + 403, 217, 217, 75, 76, 37, 37, 22, 22, 332, + 333, 405, 35, 35, 257, 340, 166, 71, 399, 154, + 216, 216, 336, 337, 338, 339, 156, 390, 391, 392, + 393, 394, 395, 396, 397, 398, 417, 332, 333, 340, + 258, 158, 259, 162, 260, 163, 338, 339, 182, 261, + 173, 71, 281, 164, 425, 334, 335, 336, 337, 338, + 339, 340, 185, 444, 149, 150, 183, 361, 225, 287, + 288, 186, 449, 292, 340, 334, 335, 336, 337, 338, + 339, 296, 190, 300, 412, 174, 71, 388, 335, 336, + 337, 338, 339, 191, 340, 315, 223, 224, 37, 228, + 22, 192, 316, 300, 315, 35, 340, 241, 419, 281, + 254, 316, 255, 256, 265, 328, 254, 193, 255, 256, + 269, 439, 331, 334, 335, 336, 337, 338, 339, 194, + 445, 226, 227, 232, 233, 447, 295, 13, 195, 196, + 413, 197, 340, 373, 13, 198, 199, 200, 230, 201, + 202, 334, 335, 336, 337, 338, 339, 38, 203, 204, + 369, 371, 234, 205, 206, 207, 208, 37, 377, 22, + 340, 209, 210, 39, 35, 40, 371, 211, 381, 212, + -168, 41, 410, 251, 41, 42, 237, 387, 236, 267, + 268, 254, 272, 255, 256, 43, 273, 275, 278, 44, + 45, 289, 290, 46, 298, 47, 294, 257, 303, 311, + 310, 312, 48, 257, 322, 48, 176, 177, 356, 325, + 326, 332, 333, 49, 50, 343, 49, 50, 365, 51, + 344, 345, 51, 258, 346, 259, 347, 260, 348, 258, + 349, 259, 261, 260, 350, 244, 351, 352, 261, 52, + 53, 54, 52, 353, 55, 354, 355, 55, 56, 359, + 362, 363, 364, 366, 57, 367, 58, 7, 37, 372, + 22, 428, 60, 178, 370, 35, 378, 382, 383, 38, + 340, 384, 433, 386, 389, 400, 402, 406, 257, 404, + 411, 408, 13, 423, 443, 39, 418, 40, 315, 414, + 440, 433, 441, 41, 315, 316, 446, 42, 179, 433, + 459, 316, 460, 433, 258, 462, 259, 43, 260, 215, + 442, 44, 45, 261, 463, 46, 143, 47, 448, 375, + 180, 379, 25, 31, 48, 334, 335, 336, 337, 338, + 339, 245, 2, 34, 285, 49, 50, 3, 246, 319, + 4, 51, 452, 252, 340, 374, 5, 284, 0, 6, + 254, 38, 255, 256, 0, 0, 254, 0, 255, 256, + 0, 52, 53, 54, 7, 0, 55, 39, 0, 40, + 56, 0, 8, 0, 0, 41, 57, 0, 58, 42, + 0, 0, 0, 59, 60, 0, 0, 0, 0, 43, + 0, 0, 0, 44, 45, 0, 0, 46, 0, 47, + 0, 0, 0, 0, 13, 9, 48, 0, 0, 0, + 10, 11, 0, 0, 2, 0, 0, 49, 50, 3, + 0, 0, 4, 51, 0, 0, 0, 0, 5, 0, + 0, 6, 0, 0, 12, 0, 0, 0, 0, 13, + 0, 0, 0, 52, 53, 54, 7, 257, 55, 0, + 0, 0, 56, 257, 8, 0, 38, 0, 57, 0, + 58, 0, 0, 0, 0, 59, 60, 0, 0, 0, + 0, 0, 39, 258, 40, 259, 0, 260, 0, 258, + 41, 420, 261, 260, 42, 0, 0, 9, 261, 0, + 0, 0, 10, 11, 43, 2, 0, 0, 44, 45, + 3, 0, 46, 4, 47, 0, 0, 0, 0, 5, + 0, 48, 6, 0, 0, 0, 12, 0, 0, 0, + 222, 13, 49, 50, 0, 0, 2, 7, 51, 0, + 0, 3, 0, 0, 0, 8, 0, 2, 0, 0, + 5, 0, 3, 6, 0, 0, 0, 2, 52, 53, + 54, 5, 3, 55, 6, 0, 0, 56, 7, 0, + 0, 5, 0, 57, 6, 58, 0, 0, 9, 7, + 59, 60, 0, 10, 11, 0, 0, 0, 0, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 12, 0, 9, + 0, 0, 13, 0, 10, 11, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 10, 11, 0, 0, 0, + 9, 0, 0, 0, 0, 10, 11, 0, 12, 0, + 0, 0, 305, 13, 0, 0, 0, 0, 81, 12, + 82, 0, 0, 376, 13, 0, 83, 0, 84, 12, + 0, 0, 0, 416, 13, 85, 86, 87, 88, 0, + 89, 90, 0, 91, 0, 92, 93, 94, 0, 0, + 95, 0, 0, 96, 0, 97, 98, 99, 100, 101, + 102, 0, 103, 104, 105, 106, 0, 0, 107, 0, + 0, 108, 0, 0, 0, 109, 0, 110, 0, 0, + 0, 111, 112, 113, 114, 115, 116, 117, 0, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 0, 0, + 0, 127, 0, 0, 128, 0, 129, 0, 0, 130, + 131, 132, 0, 0, 133, 0, 134, 135, 136, 137, + 0, 0, 138 }; -static const short yycheck[] = { 1, - 64, 10, 2, 1, 1, 1, 20, 20, 1, 26, - 1, 191, 233, 212, 194, 195, 244, 245, 198, 77, - 200, 38, 32, 230, 134, 40, 356, 10, 11, 9, - 105, 11, 121, 105, 133, 203, 7, 205, 206, 138, - 10, 11, 42, 250, 10, 11, 32, 93, 121, 133, - 139, 3, 29, 5, 6, 235, 28, 72, 138, 121, - 29, 136, 443, 40, 136, 111, 139, 448, 10, 11, - 121, 40, 72, 135, 121, 55, 56, 77, 133, 445, - 138, 10, 11, 413, 135, 451, 121, 59, 135, 257, - 258, 259, 260, 321, 293, 72, 133, 74, 70, 71, - 135, 78, 133, 72, 76, 133, 137, 138, 3, 78, - 5, 6, 7, 51, 52, 136, 54, 127, 182, 183, - 137, 133, 133, 70, 96, 189, 137, 138, 100, 134, - 136, 311, 3, 138, 5, 6, 7, 201, 133, 141, - 142, 140, 370, 141, 142, 141, 142, 99, 141, 142, - 141, 142, 136, 374, 124, 125, 126, 127, 128, 142, - 340, 127, 128, 331, 332, 333, 334, 335, 336, 337, - 338, 339, 142, 125, 133, 127, 142, 129, 406, 3, - 4, 7, 134, 125, 126, 127, 128, 139, 356, 134, - 3, 4, 133, 138, 123, 124, 125, 126, 127, 128, - 142, 136, 216, 216, 99, 433, 135, 207, 208, 3, - 4, 211, 449, 142, 442, 133, 453, 3, 4, 228, - 388, 230, 3, 53, 5, 6, 136, 57, 99, 134, - 125, 134, 127, 242, 129, 134, 234, 4, 234, 134, - 242, 250, 251, 234, 412, 413, 310, 10, 11, 251, - 134, 419, 134, 20, 125, 22, 127, 425, 129, 134, - 260, 28, 134, 134, 134, 32, 434, 3, 4, 10, - 11, 439, 3, 4, 134, 42, 3, 4, 134, 46, - 47, 3, 4, 50, 134, 52, 3, 4, 137, 138, - 137, 138, 59, 134, 134, 134, 134, 134, 295, 299, - 134, 3, 4, 70, 71, 303, 306, 303, 3, 76, - 86, 134, 303, 134, 314, 134, 314, 134, 99, 134, - 134, 385, 7, 141, 136, 325, 136, 136, 135, 96, - 97, 134, 7, 100, 7, 7, 7, 104, 52, 8, - 5, 138, 140, 110, 125, 112, 127, 136, 129, 137, - 117, 118, 4, 134, 141, 10, 11, 121, 60, 121, - 123, 124, 125, 126, 127, 128, 10, 11, 20, 135, - 22, 138, 135, 134, 3, 135, 28, 135, 135, 142, - 32, 135, 123, 124, 125, 126, 127, 128, 135, 135, - 42, 135, 135, 95, 46, 47, 3, 4, 50, 140, - 52, 142, 135, 135, 143, 135, 404, 59, 404, 3, - 135, 5, 6, 404, 116, 135, 135, 135, 70, 71, - 422, 64, 135, 135, 76, 32, 135, 135, 133, 140, - 133, 135, 432, 133, 133, 142, 445, 135, 135, 441, - 5, 135, 451, 445, 96, 97, 133, 449, 100, 451, - 133, 453, 104, 60, 102, 135, 138, 136, 110, 135, - 112, 138, 121, 0, 134, 117, 118, 135, 123, 124, - 125, 126, 127, 128, 3, 4, 5, 6, 140, 123, - 124, 125, 126, 127, 128, 140, 138, 142, 95, 135, - 0, 20, 18, 22, 302, 441, 188, 301, 142, 28, - 1, 1, 1, 32, 310, 99, 9, -1, 243, 116, - -1, -1, 205, 42, 204, -1, -1, 46, 47, -1, - 127, 50, -1, 52, -1, -1, -1, 134, -1, 32, - 59, 125, -1, 127, 37, 129, 4, 40, -1, -1, - 134, 70, 71, 46, -1, 32, 49, 76, -1, -1, - 37, -1, 20, 40, 22, -1, -1, -1, -1, 46, - 28, 64, 49, -1, 32, -1, -1, 96, 97, 72, - 99, 100, -1, -1, 42, 104, -1, 64, 46, 47, - -1, 110, 50, 112, 52, 72, -1, -1, 117, 118, - -1, 59, -1, -1, -1, -1, 125, -1, 127, -1, - 129, 104, 70, 71, -1, 134, 109, 110, 76, -1, - -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, - -1, -1, 109, 110, -1, -1, 32, -1, 96, 97, - 133, 37, 100, -1, 40, 138, 104, -1, -1, -1, - 46, -1, 110, 49, 112, -1, 133, 32, -1, 117, - 118, 138, 37, -1, -1, -1, -1, 32, 64, -1, - -1, 46, 37, -1, 49, -1, 72, 32, -1, -1, - -1, 46, 37, -1, 49, -1, -1, -1, -1, 64, - -1, 46, -1, -1, 49, -1, -1, -1, -1, 64, - -1, -1, -1, -1, -1, -1, -1, -1, 104, 64, - -1, -1, -1, 109, 110, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, - -1, -1, -1, -1, 109, 110, -1, 133, -1, 104, - -1, 137, 138, -1, 109, 110, -1, -1, -1, 104, - -1, -1, -1, -1, 109, 110, -1, -1, 133, -1, - -1, -1, 137, 138, -1, -1, -1, 16, 133, 18, - -1, -1, 137, 138, -1, 24, -1, 26, 133, -1, - -1, -1, 137, 138, 33, 34, 35, 36, -1, 38, - 39, -1, 41, -1, 43, 44, 45, -1, -1, 48, - -1, -1, 51, -1, 53, 54, 55, 56, 57, 58, - -1, 60, 61, 62, 63, -1, -1, 66, -1, -1, - 69, -1, -1, -1, 73, -1, 75, -1, -1, -1, - 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, - 89, 90, 91, 92, 93, 94, 95, -1, -1, 98, - -1, -1, 101, -1, 103, -1, -1, 106, 107, 108, - -1, -1, 111, -1, 113, 114, 115, 116, -1, -1, - 119 +static const short yycheck[] = +{ + 1, 65, 10, 2, 1, 1, 1, 20, 20, 192, + 234, 1, 195, 196, 245, 246, 199, 213, 201, 1, + 3, 4, 10, 11, 26, 32, 77, 357, 9, 40, + 11, 106, 106, 93, 231, 135, 38, 29, 122, 204, + 29, 206, 207, 42, 122, 32, 10, 11, 40, 122, + 122, 40, 112, 236, 251, 7, 140, 3, 136, 5, + 6, 72, 137, 137, 136, 446, 135, 140, 10, 11, + 139, 452, 139, 122, 73, 56, 57, 60, 122, 78, + 72, 10, 11, 72, 414, 74, 78, 136, 139, 78, + 137, 322, 136, 258, 259, 260, 261, 134, 294, 134, + 134, 10, 11, 138, 139, 134, 134, 3, 4, 138, + 139, 139, 95, 10, 11, 3, 4, 444, 53, 183, + 184, 128, 449, 58, 51, 52, 190, 137, 55, 312, + 70, 135, 141, 450, 117, 139, 138, 454, 202, 137, + 371, 142, 143, 3, 4, 142, 143, 142, 143, 10, + 11, 375, 142, 143, 100, 143, 3, 4, 341, 134, + 142, 143, 126, 127, 128, 129, 134, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 407, 10, 11, 143, + 126, 134, 128, 134, 130, 134, 128, 129, 7, 135, + 3, 4, 357, 134, 140, 124, 125, 126, 127, 128, + 129, 143, 134, 434, 217, 217, 137, 136, 3, 208, + 209, 137, 443, 212, 143, 124, 125, 126, 127, 128, + 129, 229, 135, 231, 389, 3, 4, 136, 125, 126, + 127, 128, 129, 135, 143, 243, 3, 4, 235, 137, + 235, 135, 243, 251, 252, 235, 143, 311, 413, 414, + 3, 252, 5, 6, 7, 420, 3, 135, 5, 6, + 7, 426, 261, 124, 125, 126, 127, 128, 129, 135, + 435, 3, 4, 3, 4, 440, 138, 139, 135, 135, + 141, 135, 143, 138, 139, 135, 135, 135, 86, 135, + 135, 124, 125, 126, 127, 128, 129, 4, 135, 135, + 296, 300, 137, 135, 135, 135, 135, 304, 307, 304, + 143, 135, 135, 20, 304, 22, 315, 135, 315, 135, + 137, 28, 386, 135, 28, 32, 136, 326, 142, 7, + 7, 3, 7, 5, 6, 42, 7, 7, 52, 46, + 47, 8, 5, 50, 141, 52, 139, 100, 137, 122, + 138, 142, 59, 100, 122, 59, 3, 4, 3, 136, + 135, 10, 11, 70, 71, 136, 70, 71, 144, 76, + 136, 136, 76, 126, 136, 128, 136, 130, 136, 126, + 136, 128, 135, 130, 136, 32, 136, 136, 135, 96, + 97, 98, 96, 136, 101, 136, 136, 101, 105, 136, + 136, 136, 136, 136, 111, 136, 113, 64, 405, 134, + 405, 118, 119, 60, 141, 405, 134, 134, 134, 4, + 143, 136, 423, 136, 136, 136, 5, 103, 100, 134, + 136, 134, 139, 135, 433, 20, 137, 22, 446, 139, + 139, 442, 136, 28, 452, 446, 141, 32, 95, 450, + 136, 452, 136, 454, 126, 0, 128, 42, 130, 9, + 122, 46, 47, 135, 0, 50, 18, 52, 442, 303, + 117, 311, 1, 1, 59, 124, 125, 126, 127, 128, + 129, 128, 32, 1, 206, 70, 71, 37, 135, 244, + 40, 76, 141, 189, 143, 302, 46, 205, -1, 49, + 3, 4, 5, 6, -1, -1, 3, -1, 5, 6, + -1, 96, 97, 98, 64, -1, 101, 20, -1, 22, + 105, -1, 72, -1, -1, 28, 111, -1, 113, 32, + -1, -1, -1, 118, 119, -1, -1, -1, -1, 42, + -1, -1, -1, 46, 47, -1, -1, 50, -1, 52, + -1, -1, -1, -1, 139, 105, 59, -1, -1, -1, + 110, 111, -1, -1, 32, -1, -1, 70, 71, 37, + -1, -1, 40, 76, -1, -1, -1, -1, 46, -1, + -1, 49, -1, -1, 134, -1, -1, -1, -1, 139, + -1, -1, -1, 96, 97, 98, 64, 100, 101, -1, + -1, -1, 105, 100, 72, -1, 4, -1, 111, -1, + 113, -1, -1, -1, -1, 118, 119, -1, -1, -1, + -1, -1, 20, 126, 22, 128, -1, 130, -1, 126, + 28, 128, 135, 130, 32, -1, -1, 105, 135, -1, + -1, -1, 110, 111, 42, 32, -1, -1, 46, 47, + 37, -1, 50, 40, 52, -1, -1, -1, -1, 46, + -1, 59, 49, -1, -1, -1, 134, -1, -1, -1, + 138, 139, 70, 71, -1, -1, 32, 64, 76, -1, + -1, 37, -1, -1, -1, 72, -1, 32, -1, -1, + 46, -1, 37, 49, -1, -1, -1, 32, 96, 97, + 98, 46, 37, 101, 49, -1, -1, 105, 64, -1, + -1, 46, -1, 111, 49, 113, -1, -1, 105, 64, + 118, 119, -1, 110, 111, -1, -1, -1, -1, 64, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 134, -1, 105, + -1, -1, 139, -1, 110, 111, -1, -1, -1, -1, + 105, -1, -1, -1, -1, 110, 111, -1, -1, -1, + 105, -1, -1, -1, -1, 110, 111, -1, 134, -1, + -1, -1, 138, 139, -1, -1, -1, -1, 16, 134, + 18, -1, -1, 138, 139, -1, 24, -1, 26, 134, + -1, -1, -1, 138, 139, 33, 34, 35, 36, -1, + 38, 39, -1, 41, -1, 43, 44, 45, -1, -1, + 48, -1, -1, 51, -1, 53, 54, 55, 56, 57, + 58, -1, 60, 61, 62, 63, -1, -1, 66, -1, + -1, 69, -1, -1, -1, 73, -1, 75, -1, -1, + -1, 79, 80, 81, 82, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, 93, 94, 95, -1, -1, + -1, 99, -1, -1, 102, -1, 104, -1, -1, 107, + 108, 109, -1, -1, 112, -1, 114, 115, 116, 117, + -1, -1, 120 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" -/* This file comes from bison-1.28. */ +#line 3 "/usr/share/bison/bison.simple" /* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -869,62 +908,131 @@ static const short yycheck[] = { 1, This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ +/* This is the parser code that is written into each bison parser when + the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; +# if YYLSP_NEEDED + YYLTYPE yyls; +# endif +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# if YYLSP_NEEDED +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAX) +# else +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAX) +# endif + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc #endif -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) @@ -933,131 +1041,161 @@ static const short yycheck[] = { 1, #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ + { \ + yychar = (Token); \ + yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ + { \ + yyerror ("syntax error: cannot back up"); \ + YYERROR; \ + } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX yylex() + +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). + + When YYLLOC_DEFAULT is run, CURRENT is set the location of the + first token. By default, to implement support for ranges, extend + its range to the last symbol. */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #endif -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif -/* If nonreentrant, generate the variables here */ +/* YYLEX -- calling `yylex' with the right arguments. */ -#ifndef YYPURE +#if YYPURE +# if YYLSP_NEEDED +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval, &yylloc) +# endif +# else /* !YYLSP_NEEDED */ +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval) +# endif +# endif /* !YYLSP_NEEDED */ +#else /* !YYPURE */ +# define YYLEX yylex () +#endif /* !YYPURE */ -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif +/* Enable debugging if requested. */ +#if YYDEBUG -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +#endif /* !YYDEBUG */ +/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 -#undef YYMAXDEPTH +# undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ +#ifdef YYERROR_VERBOSE -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif { - register char *f = from; - register char *t = to; - register int i = count; + register const char *yys = yystr; - while (i-- > 0) - *t++ = *f++; + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; } +# endif +# endif -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif { - register char *t = to; - register char *f = from; - register int i = count; + register char *yyd = yydest; + register const char *yys = yysrc; - while (i-- > 0) - *t++ = *f++; + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; } - -#endif +# endif +# endif #endif -#line 217 "/usr/share/bison.simple" +#line 315 "/usr/share/bison/bison.simple" + /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -1066,76 +1204,121 @@ __yy_memcpy (char *to, char *from, unsigned int count) to the proper pointer type. */ #ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ +# if defined (__STDC__) || defined (__cplusplus) +# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +# define YYPARSE_PARAM_DECL +# else +# define YYPARSE_PARAM_ARG YYPARSE_PARAM +# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +# endif +#else /* !YYPARSE_PARAM */ +# define YYPARSE_PARAM_ARG +# define YYPARSE_PARAM_DECL +#endif /* !YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ -#ifdef YYPARSE_PARAM +# ifdef YYPARSE_PARAM int yyparse (void *); -#else +# else int yyparse (void); +# endif #endif + +/* YY_DECL_VARIABLES -- depending whether we use a pure parser, + variables are global, or local to YYPARSE. */ + +#define YY_DECL_NON_LSP_VARIABLES \ +/* The lookahead symbol. */ \ +int yychar; \ + \ +/* The semantic value of the lookahead symbol. */ \ +YYSTYPE yylval; \ + \ +/* Number of parse errors so far. */ \ +int yynerrs; + +#if YYLSP_NEEDED +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES \ + \ +/* Location data for the lookahead symbol. */ \ +YYLTYPE yylloc; +#else +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES #endif + +/* If nonreentrant, generate the variables here. */ + +#if !YYPURE +YY_DECL_VARIABLES +#endif /* !YYPURE */ + int -yyparse(YYPARSE_PARAM_ARG) +yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { + /* If reentrant, generate the variables here. */ +#if YYPURE + YY_DECL_VARIABLES +#endif /* !YYPURE */ + register int yystate; register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yychar1 = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ +#if YYLSP_NEEDED + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; +#endif -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#if YYLSP_NEEDED +# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else -#define YYPOPSTACK (yyvsp--, yyssp--) +# define YYPOPSTACK (yyvsp--, yyssp--) #endif - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; + YYSIZE_T yystacksize = YYINITDEPTH; -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; +#if YYLSP_NEEDED + YYLTYPE yyloc; #endif - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ int yylen; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -1147,110 +1330,110 @@ yyparse(YYPARSE_PARAM_ARG) so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED yylsp = yyls; #endif + goto yysetstate; -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; - *++yyssp = yystate; + yysetstate: + *yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. */ +# if YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + yyls = yyls1; +# else + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); +# endif + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); +# if YYLSP_NEEDED + YYSTACK_RELOCATE (yyls); +# endif +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; +#if YYLSP_NEEDED + yylsp = yyls + yysize - 1; #endif -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: + + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ @@ -1269,10 +1452,7 @@ yynewstate: if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } @@ -1283,25 +1463,25 @@ yynewstate: yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE(yychar); + yychar1 = YYTRANSLATE (yychar); -#if YYDEBUG != 0 +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables + which are defined only if `YYDEBUG' is set. */ if (yydebug) { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT + YYFPRINTF (stderr, "Next token is %d (%s", + yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise + meaning of a token, for further debugging info. */ +# ifdef YYPRINT YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); +# endif + YYFPRINTF (stderr, ")\n"); } #endif } @@ -1333,767 +1513,789 @@ yynewstate: YYACCEPT; /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif + YYDPRINTF ((stderr, "Shifting token %d (%s), ", + yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED *++yylsp = yylloc; #endif - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; yystate = yyn; goto yynewstate; -/* Do the default action for the current state. */ -yydefault: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; -/* Do a reduction. yyn is the number of a rule to reduce with. */ + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ -#if YYDEBUG != 0 - if (yydebug) - { - int i; + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + Otherwise, the following line sets YYVAL to the semantic value of + the lookahead token. This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } +#if YYLSP_NEEDED + /* Similarly for the default location. Let the user run additional + commands if for instance locations are ranges. */ + yyloc = yylsp[1-yylen]; + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); #endif +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables which + are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + int yyi; + + YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif switch (yyn) { case 1: -#line 227 "parser.y" -{ write_proxies(yyvsp[0].ifref); write_client(yyvsp[0].ifref); write_server(yyvsp[0].ifref); ; - break;} +#line 228 "./parser.y" +{ write_proxies(yyvsp[0].ifref); write_client(yyvsp[0].ifref); write_server(yyvsp[0].ifref); } + break; case 2: -#line 230 "parser.y" -{ yyval.ifref = NULL; ; - break;} +#line 231 "./parser.y" +{ yyval.ifref = NULL; } + break; case 3: -#line 231 "parser.y" -{ yyval.ifref = yyvsp[-1].ifref; ; - break;} +#line 232 "./parser.y" +{ yyval.ifref = yyvsp[-1].ifref; } + break; case 4: -#line 232 "parser.y" -{ yyval.ifref = make_ifref(yyvsp[0].type); LINK(yyval.ifref, yyvsp[-1].ifref); ; - break;} +#line 233 "./parser.y" +{ yyval.ifref = make_ifref(yyvsp[0].type); LINK(yyval.ifref, yyvsp[-1].ifref); } + break; case 5: -#line 233 "parser.y" -{ yyval.ifref = yyvsp[-1].ifref; add_coclass(yyvsp[0].clas); ; - break;} +#line 234 "./parser.y" +{ yyval.ifref = yyvsp[-1].ifref; add_coclass(yyvsp[0].clas); } + break; case 6: -#line 234 "parser.y" -{ yyval.ifref = yyvsp[-1].ifref; add_module(yyvsp[0].type); ; - break;} +#line 235 "./parser.y" +{ yyval.ifref = yyvsp[-1].ifref; add_module(yyvsp[0].type); } + break; case 7: -#line 235 "parser.y" -{ yyval.ifref = yyvsp[-1].ifref; ; - break;} +#line 236 "./parser.y" +{ yyval.ifref = yyvsp[-1].ifref; } + break; case 8: -#line 236 "parser.y" -{ yyval.ifref = yyvsp[-1].ifref; ; - break;} +#line 237 "./parser.y" +{ yyval.ifref = yyvsp[-1].ifref; } + break; case 9: -#line 239 "parser.y" -{; - break;} +#line 240 "./parser.y" +{} + break; case 10: -#line 240 "parser.y" -{ if (!parse_only) add_interface(yyvsp[0].type); ; - break;} +#line 241 "./parser.y" +{ if (!parse_only) add_interface(yyvsp[0].type); } + break; case 11: -#line 241 "parser.y" -{ if (!parse_only) add_interface(yyvsp[0].type); ; - break;} +#line 242 "./parser.y" +{ if (!parse_only) add_interface(yyvsp[0].type); } + break; case 12: -#line 242 "parser.y" -{ if (!parse_only) add_coclass(yyvsp[0].clas); ; - break;} +#line 243 "./parser.y" +{ if (!parse_only) add_coclass(yyvsp[0].clas); } + break; case 13: -#line 243 "parser.y" -{ if (!parse_only) add_module(yyvsp[0].type); ; - break;} +#line 244 "./parser.y" +{ if (!parse_only) add_module(yyvsp[0].type); } + break; case 14: -#line 244 "parser.y" -{; - break;} +#line 245 "./parser.y" +{} + break; case 15: -#line 247 "parser.y" -{ yyval.func = NULL; ; - break;} +#line 248 "./parser.y" +{ yyval.func = NULL; } + break; case 16: -#line 248 "parser.y" -{ yyval.func = yyvsp[-1].func; LINK(yyval.func, yyvsp[-2].func); ; - break;} +#line 249 "./parser.y" +{ yyval.func = yyvsp[-1].func; LINK(yyval.func, yyvsp[-2].func); } + break; case 17: -#line 249 "parser.y" -{ yyval.func = yyvsp[-1].func; ; - break;} +#line 250 "./parser.y" +{ yyval.func = yyvsp[-1].func; } + break; case 18: -#line 252 "parser.y" -{; - break;} +#line 253 "./parser.y" +{} + break; case 19: -#line 253 "parser.y" -{ if (!parse_only && do_header) { write_constdef(yyvsp[-1].var); } ; - break;} +#line 254 "./parser.y" +{ if (!parse_only && do_header) { write_constdef(yyvsp[-1].var); } } + break; case 20: -#line 254 "parser.y" -{; - break;} +#line 255 "./parser.y" +{} + break; case 21: -#line 255 "parser.y" -{ if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } ; - break;} +#line 256 "./parser.y" +{ if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } } + break; case 22: -#line 256 "parser.y" -{ if (!parse_only && do_header) { write_externdef(yyvsp[-1].var); } ; - break;} +#line 257 "./parser.y" +{ if (!parse_only && do_header) { write_externdef(yyvsp[-1].var); } } + break; case 23: -#line 257 "parser.y" -{; - break;} +#line 258 "./parser.y" +{} + break; case 24: -#line 258 "parser.y" -{ if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } ; - break;} +#line 259 "./parser.y" +{ if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } } + break; case 25: -#line 259 "parser.y" -{; - break;} +#line 260 "./parser.y" +{} + break; case 26: -#line 260 "parser.y" -{ if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } ; - break;} +#line 261 "./parser.y" +{ if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } } + break; case 27: -#line 263 "parser.y" -{ if (!parse_only && do_header) fprintf(header, "%s\n", yyvsp[-1].str); ; - break;} +#line 264 "./parser.y" +{ if (!parse_only && do_header) fprintf(header, "%s\n", yyvsp[-1].str); } + break; case 28: -#line 265 "parser.y" +#line 266 "./parser.y" { assert(yychar == YYEMPTY); - if (!do_import(yyvsp[-1].str)) yychar = aEOF; ; - break;} + if (!do_import(yyvsp[-1].str)) yychar = aEOF; } + break; case 29: -#line 268 "parser.y" -{; - break;} +#line 269 "./parser.y" +{} + break; case 30: -#line 271 "parser.y" -{ yyval.str = yyvsp[0].str; ; - break;} +#line 272 "./parser.y" +{ yyval.str = yyvsp[0].str; } + break; case 31: -#line 273 "parser.y" -{ start_typelib(yyvsp[-1].str, yyvsp[-2].attr); ; - break;} +#line 274 "./parser.y" +{ start_typelib(yyvsp[-1].str, yyvsp[-2].attr); } + break; case 32: -#line 275 "parser.y" -{ end_typelib(); ; - break;} +#line 276 "./parser.y" +{ end_typelib(); } + break; case 33: -#line 278 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 279 "./parser.y" +{ yyval.var = NULL; } + break; case 35: -#line 282 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 283 "./parser.y" +{ yyval.var = NULL; } + break; case 37: -#line 286 "parser.y" -{ LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; ; - break;} +#line 287 "./parser.y" +{ LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; } + break; case 39: -#line 291 "parser.y" +#line 292 "./parser.y" { yyval.var = yyvsp[-1].var; set_type(yyval.var, yyvsp[-2].tref, yyvsp[0].expr); yyval.var->attrs = yyvsp[-3].attr; - ; - break;} + } + break; case 40: -#line 295 "parser.y" +#line 296 "./parser.y" { yyval.var = yyvsp[-1].var; set_type(yyval.var, yyvsp[-2].tref, yyvsp[0].expr); - ; - break;} + } + break; case 41: -#line 298 "parser.y" +#line 299 "./parser.y" { yyval.var = yyvsp[-3].var; yyval.var->ptr_level--; set_type(yyval.var, yyvsp[-4].tref, NULL); yyval.var->attrs = yyvsp[-5].attr; yyval.var->args = yyvsp[-1].var; - ; - break;} + } + break; case 42: -#line 304 "parser.y" +#line 305 "./parser.y" { yyval.var = yyvsp[-3].var; yyval.var->ptr_level--; set_type(yyval.var, yyvsp[-4].tref, NULL); yyval.var->args = yyvsp[-1].var; - ; - break;} + } + break; case 43: -#line 311 "parser.y" -{ yyval.expr = NULL; ; - break;} +#line 312 "./parser.y" +{ yyval.expr = NULL; } + break; case 44: -#line 312 "parser.y" -{ yyval.expr = yyvsp[-1].expr; ; - break;} +#line 313 "./parser.y" +{ yyval.expr = yyvsp[-1].expr; } + break; case 45: -#line 313 "parser.y" -{ yyval.expr = make_expr(EXPR_VOID); ; - break;} +#line 314 "./parser.y" +{ yyval.expr = make_expr(EXPR_VOID); } + break; case 47: -#line 317 "parser.y" -{ LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; ; - break;} +#line 318 "./parser.y" +{ LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; } + break; case 48: -#line 318 "parser.y" -{ LINK(yyvsp[0].expr, yyvsp[-3].expr); yyval.expr = yyvsp[0].expr; ; - break;} +#line 319 "./parser.y" +{ LINK(yyvsp[0].expr, yyvsp[-3].expr); yyval.expr = yyvsp[0].expr; } + break; case 49: -#line 321 "parser.y" -{ yyval.attr = NULL; ; - break;} +#line 322 "./parser.y" +{ yyval.attr = NULL; } + break; case 51: -#line 326 "parser.y" -{ yyval.attr = yyvsp[-1].attr; ; - break;} +#line 327 "./parser.y" +{ yyval.attr = yyvsp[-1].attr; } + break; case 53: -#line 330 "parser.y" -{ LINK(yyvsp[0].attr, yyvsp[-2].attr); yyval.attr = yyvsp[0].attr; ; - break;} +#line 331 "./parser.y" +{ LINK(yyvsp[0].attr, yyvsp[-2].attr); yyval.attr = yyvsp[0].attr; } + break; case 54: -#line 331 "parser.y" -{ LINK(yyvsp[0].attr, yyvsp[-3].attr); yyval.attr = yyvsp[0].attr; ; - break;} +#line 332 "./parser.y" +{ LINK(yyvsp[0].attr, yyvsp[-3].attr); yyval.attr = yyvsp[0].attr; } + break; case 55: -#line 335 "parser.y" -{ yyval.attr = make_attr(ATTR_ASYNC); ; - break;} +#line 336 "./parser.y" +{ yyval.attr = make_attr(ATTR_ASYNC); } + break; case 56: -#line 336 "parser.y" -{ yyval.attr = make_attr(ATTR_AUTO_HANDLE); ; - break;} +#line 337 "./parser.y" +{ yyval.attr = make_attr(ATTR_AUTO_HANDLE); } + break; case 57: -#line 337 "parser.y" -{ yyval.attr = make_attrp(ATTR_CALLAS, yyvsp[-1].var); ; - break;} +#line 338 "./parser.y" +{ yyval.attr = make_attrp(ATTR_CALLAS, yyvsp[-1].var); } + break; case 58: -#line 338 "parser.y" -{ yyval.attr = make_attrp(ATTR_CASE, yyvsp[-1].expr); ; - break;} +#line 339 "./parser.y" +{ yyval.attr = make_attrp(ATTR_CASE, yyvsp[-1].expr); } + break; case 59: -#line 339 "parser.y" -{ yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); ; - break;} +#line 340 "./parser.y" +{ yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); } + break; case 60: -#line 340 "parser.y" -{ yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ; - break;} +#line 341 "./parser.y" +{ yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ } + break; case 61: -#line 341 "parser.y" -{ yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ; - break;} +#line 342 "./parser.y" +{ yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ } + break; case 62: -#line 342 "parser.y" -{ yyval.attr = make_attr(ATTR_CONTROL); ; - break;} +#line 343 "./parser.y" +{ yyval.attr = make_attr(ATTR_CONTROL); } + break; case 63: -#line 343 "parser.y" -{ yyval.attr = make_attr(ATTR_DEFAULT); ; - break;} +#line 344 "./parser.y" +{ yyval.attr = make_attr(ATTR_DEFAULT); } + break; case 64: -#line 344 "parser.y" -{ yyval.attr = make_attrp(ATTR_DEFAULTVALUE_EXPR, yyvsp[-1].expr); ; - break;} +#line 345 "./parser.y" +{ yyval.attr = make_attrp(ATTR_DEFAULTVALUE_EXPR, yyvsp[-1].expr); } + break; case 65: -#line 345 "parser.y" -{ yyval.attr = make_attrp(ATTR_DEFAULTVALUE_STRING, yyvsp[-1].str); ; - break;} +#line 346 "./parser.y" +{ yyval.attr = make_attrp(ATTR_DEFAULTVALUE_STRING, yyvsp[-1].str); } + break; case 66: -#line 346 "parser.y" -{ yyval.attr = make_attrp(ATTR_DLLNAME, yyvsp[-1].str); ; - break;} +#line 347 "./parser.y" +{ yyval.attr = make_attrp(ATTR_DLLNAME, yyvsp[-1].str); } + break; case 67: -#line 347 "parser.y" -{ yyval.attr = make_attr(ATTR_DUAL); ; - break;} +#line 348 "./parser.y" +{ yyval.attr = make_attr(ATTR_DUAL); } + break; case 68: -#line 348 "parser.y" -{ yyval.attr = make_attrp(ATTR_ENDPOINT, yyvsp[-1].str); ; - break;} +#line 349 "./parser.y" +{ yyval.attr = make_attrp(ATTR_ENDPOINT, yyvsp[-1].str); } + break; case 69: -#line 349 "parser.y" -{ yyval.attr = make_attrp(ATTR_ENTRY_STRING, yyvsp[-1].str); ; - break;} +#line 350 "./parser.y" +{ yyval.attr = make_attrp(ATTR_ENTRY_STRING, yyvsp[-1].str); } + break; case 70: -#line 350 "parser.y" -{ yyval.attr = make_attrp(ATTR_ENTRY_ORDINAL, yyvsp[-1].expr); ; - break;} +#line 351 "./parser.y" +{ yyval.attr = make_attrp(ATTR_ENTRY_ORDINAL, yyvsp[-1].expr); } + break; case 71: -#line 351 "parser.y" -{ yyval.attr = make_attr(ATTR_EXPLICIT_HANDLE); ; - break;} +#line 352 "./parser.y" +{ yyval.attr = make_attr(ATTR_EXPLICIT_HANDLE); } + break; case 72: -#line 352 "parser.y" -{ yyval.attr = make_attr(ATTR_HANDLE); ; - break;} +#line 353 "./parser.y" +{ yyval.attr = make_attr(ATTR_HANDLE); } + break; case 73: -#line 353 "parser.y" -{ yyval.attr = make_attrp(ATTR_HELPCONTEXT, yyvsp[-1].expr); ; - break;} +#line 354 "./parser.y" +{ yyval.attr = make_attrp(ATTR_HELPCONTEXT, yyvsp[-1].expr); } + break; case 74: -#line 354 "parser.y" -{ yyval.attr = make_attrp(ATTR_HELPFILE, yyvsp[-1].str); ; - break;} +#line 355 "./parser.y" +{ yyval.attr = make_attrp(ATTR_HELPFILE, yyvsp[-1].str); } + break; case 75: -#line 355 "parser.y" -{ yyval.attr = make_attrp(ATTR_HELPSTRING, yyvsp[-1].str); ; - break;} +#line 356 "./parser.y" +{ yyval.attr = make_attrp(ATTR_HELPSTRING, yyvsp[-1].str); } + break; case 76: -#line 356 "parser.y" -{ yyval.attr = make_attrp(ATTR_HELPSTRINGCONTEXT, yyvsp[-1].expr); ; - break;} +#line 357 "./parser.y" +{ yyval.attr = make_attrp(ATTR_HELPSTRINGCONTEXT, yyvsp[-1].expr); } + break; case 77: -#line 357 "parser.y" -{ yyval.attr = make_attrp(ATTR_HELPSTRINGDLL, yyvsp[-1].str); ; - break;} +#line 358 "./parser.y" +{ yyval.attr = make_attrp(ATTR_HELPSTRINGDLL, yyvsp[-1].str); } + break; case 78: -#line 358 "parser.y" -{ yyval.attr = make_attr(ATTR_HIDDEN); ; - break;} +#line 359 "./parser.y" +{ yyval.attr = make_attr(ATTR_HIDDEN); } + break; case 79: -#line 359 "parser.y" -{ yyval.attr = make_attrp(ATTR_ID, yyvsp[-1].expr); ; - break;} +#line 360 "./parser.y" +{ yyval.attr = make_attrp(ATTR_ID, yyvsp[-1].expr); } + break; case 80: -#line 360 "parser.y" -{ yyval.attr = make_attr(ATTR_IDEMPOTENT); ; - break;} +#line 361 "./parser.y" +{ yyval.attr = make_attr(ATTR_IDEMPOTENT); } + break; case 81: -#line 361 "parser.y" -{ yyval.attr = make_attrp(ATTR_IIDIS, yyvsp[-1].var); ; - break;} +#line 362 "./parser.y" +{ yyval.attr = make_attrp(ATTR_IIDIS, yyvsp[-1].var); } + break; case 82: -#line 362 "parser.y" -{ yyval.attr = make_attrp(ATTR_IMPLICIT_HANDLE, yyvsp[-1].str); ; - break;} +#line 363 "./parser.y" +{ yyval.attr = make_attrp(ATTR_IMPLICIT_HANDLE, yyvsp[-1].str); } + break; case 83: -#line 363 "parser.y" -{ yyval.attr = make_attr(ATTR_IN); ; - break;} +#line 364 "./parser.y" +{ yyval.attr = make_attr(ATTR_IN); } + break; case 84: -#line 364 "parser.y" -{ yyval.attr = make_attr(ATTR_INPUTSYNC); ; - break;} +#line 365 "./parser.y" +{ yyval.attr = make_attr(ATTR_INPUTSYNC); } + break; case 85: -#line 365 "parser.y" -{ yyval.attr = make_attrp(ATTR_LENGTHIS, yyvsp[-1].expr); ; - break;} +#line 366 "./parser.y" +{ yyval.attr = make_attrp(ATTR_LENGTHIS, yyvsp[-1].expr); } + break; case 86: -#line 366 "parser.y" -{ yyval.attr = make_attr(ATTR_LOCAL); ; - break;} +#line 367 "./parser.y" +{ yyval.attr = make_attr(ATTR_LOCAL); } + break; case 87: -#line 367 "parser.y" -{ yyval.attr = make_attr(ATTR_NONCREATABLE); ; - break;} +#line 368 "./parser.y" +{ yyval.attr = make_attr(ATTR_NONCREATABLE); } + break; case 88: -#line 368 "parser.y" -{ yyval.attr = make_attr(ATTR_OBJECT); ; - break;} +#line 369 "./parser.y" +{ yyval.attr = make_attr(ATTR_OBJECT); } + break; case 89: -#line 369 "parser.y" -{ yyval.attr = make_attr(ATTR_ODL); ; - break;} +#line 370 "./parser.y" +{ yyval.attr = make_attr(ATTR_ODL); } + break; case 90: -#line 370 "parser.y" -{ yyval.attr = make_attr(ATTR_OLEAUTOMATION); ; - break;} +#line 371 "./parser.y" +{ yyval.attr = make_attr(ATTR_OLEAUTOMATION); } + break; case 91: -#line 371 "parser.y" -{ yyval.attr = make_attr(ATTR_OPTIONAL); ; - break;} +#line 372 "./parser.y" +{ yyval.attr = make_attr(ATTR_OPTIONAL); } + break; case 92: -#line 372 "parser.y" -{ yyval.attr = make_attr(ATTR_OUT); ; - break;} +#line 373 "./parser.y" +{ yyval.attr = make_attr(ATTR_OUT); } + break; case 93: -#line 373 "parser.y" -{ yyval.attr = make_attrv(ATTR_POINTERDEFAULT, yyvsp[-1].num); ; - break;} +#line 374 "./parser.y" +{ yyval.attr = make_attrv(ATTR_POINTERDEFAULT, yyvsp[-1].num); } + break; case 94: -#line 374 "parser.y" -{ yyval.attr = make_attr(ATTR_PROPGET); ; - break;} +#line 375 "./parser.y" +{ yyval.attr = make_attr(ATTR_PROPGET); } + break; case 95: -#line 375 "parser.y" -{ yyval.attr = make_attr(ATTR_PROPPUT); ; - break;} +#line 376 "./parser.y" +{ yyval.attr = make_attr(ATTR_PROPPUT); } + break; case 96: -#line 376 "parser.y" -{ yyval.attr = make_attr(ATTR_PROPPUTREF); ; - break;} +#line 377 "./parser.y" +{ yyval.attr = make_attr(ATTR_PROPPUTREF); } + break; case 97: -#line 377 "parser.y" -{ yyval.attr = make_attr(ATTR_PTR); ; - break;} +#line 378 "./parser.y" +{ yyval.attr = make_attr(ATTR_PTR); } + break; case 98: -#line 378 "parser.y" -{ yyval.attr = make_attr(ATTR_PUBLIC); ; - break;} +#line 379 "./parser.y" +{ yyval.attr = make_attr(ATTR_PUBLIC); } + break; case 99: -#line 379 "parser.y" -{ yyval.attr = make_attr(ATTR_READONLY); ; - break;} +#line 380 "./parser.y" +{ yyval.attr = make_attr(ATTR_READONLY); } + break; case 100: -#line 380 "parser.y" -{ yyval.attr = make_attr(ATTR_REF); ; - break;} +#line 381 "./parser.y" +{ yyval.attr = make_attr(ATTR_REF); } + break; case 101: -#line 381 "parser.y" -{ yyval.attr = make_attr(ATTR_RESTRICTED); ; - break;} +#line 382 "./parser.y" +{ yyval.attr = make_attr(ATTR_RESTRICTED); } + break; case 102: -#line 382 "parser.y" -{ yyval.attr = make_attr(ATTR_RETVAL); ; - break;} +#line 383 "./parser.y" +{ yyval.attr = make_attr(ATTR_RETVAL); } + break; case 103: -#line 383 "parser.y" -{ yyval.attr = make_attrp(ATTR_SIZEIS, yyvsp[-1].expr); ; - break;} +#line 384 "./parser.y" +{ yyval.attr = make_attrp(ATTR_SIZEIS, yyvsp[-1].expr); } + break; case 104: -#line 384 "parser.y" -{ yyval.attr = make_attr(ATTR_SOURCE); ; - break;} +#line 385 "./parser.y" +{ yyval.attr = make_attr(ATTR_SOURCE); } + break; case 105: -#line 385 "parser.y" -{ yyval.attr = make_attr(ATTR_STRING); ; - break;} +#line 386 "./parser.y" +{ yyval.attr = make_attr(ATTR_STRING); } + break; case 106: -#line 386 "parser.y" -{ yyval.attr = make_attrp(ATTR_SWITCHIS, yyvsp[-1].expr); ; - break;} +#line 387 "./parser.y" +{ yyval.attr = make_attrp(ATTR_SWITCHIS, yyvsp[-1].expr); } + break; case 107: -#line 387 "parser.y" -{ yyval.attr = make_attrp(ATTR_SWITCHTYPE, type_ref(yyvsp[-1].tref)); ; - break;} +#line 388 "./parser.y" +{ yyval.attr = make_attrp(ATTR_SWITCHTYPE, type_ref(yyvsp[-1].tref)); } + break; case 108: -#line 388 "parser.y" -{ yyval.attr = make_attrp(ATTR_TRANSMITAS, type_ref(yyvsp[-1].tref)); ; - break;} +#line 389 "./parser.y" +{ yyval.attr = make_attrp(ATTR_TRANSMITAS, type_ref(yyvsp[-1].tref)); } + break; case 109: -#line 389 "parser.y" -{ yyval.attr = make_attr(ATTR_UNIQUE); ; - break;} +#line 390 "./parser.y" +{ yyval.attr = make_attr(ATTR_UNIQUE); } + break; case 110: -#line 390 "parser.y" -{ yyval.attr = make_attrp(ATTR_UUID, yyvsp[-1].uuid); ; - break;} +#line 391 "./parser.y" +{ yyval.attr = make_attrp(ATTR_UUID, yyvsp[-1].uuid); } + break; case 111: -#line 391 "parser.y" -{ yyval.attr = make_attr(ATTR_V1ENUM); ; - break;} +#line 392 "./parser.y" +{ yyval.attr = make_attr(ATTR_V1ENUM); } + break; case 112: -#line 392 "parser.y" -{ yyval.attr = make_attr(ATTR_VARARG); ; - break;} +#line 393 "./parser.y" +{ yyval.attr = make_attr(ATTR_VARARG); } + break; case 113: -#line 393 "parser.y" -{ yyval.attr = make_attrv(ATTR_VERSION, yyvsp[-1].num); ; - break;} +#line 394 "./parser.y" +{ yyval.attr = make_attrv(ATTR_VERSION, yyvsp[-1].num); } + break; case 114: -#line 394 "parser.y" -{ yyval.attr = make_attrp(ATTR_WIREMARSHAL, type_ref(yyvsp[-1].tref)); ; - break;} +#line 395 "./parser.y" +{ yyval.attr = make_attrp(ATTR_WIREMARSHAL, type_ref(yyvsp[-1].tref)); } + break; case 115: -#line 395 "parser.y" -{ yyval.attr = make_attrv(ATTR_POINTERTYPE, yyvsp[0].num); ; - break;} +#line 396 "./parser.y" +{ yyval.attr = make_attrv(ATTR_POINTERTYPE, yyvsp[0].num); } + break; case 118: -#line 402 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 403 "./parser.y" +{ yyval.var = NULL; } + break; case 119: -#line 403 "parser.y" +#line 404 "./parser.y" { if (yyvsp[0].var) { LINK(yyvsp[0].var, yyvsp[-1].var); yyval.var = yyvsp[0].var; } else { yyval.var = yyvsp[-1].var; } - ; - break;} + } + break; case 120: -#line 408 "parser.y" +#line 409 "./parser.y" { attr_t *a = make_attrp(ATTR_CASE, yyvsp[-2].expr); yyval.var = yyvsp[0].var; if (!yyval.var) yyval.var = make_var(NULL); LINK(a, yyval.var->attrs); yyval.var->attrs = a; - ; - break;} + } + break; case 121: -#line 412 "parser.y" +#line 413 "./parser.y" { attr_t *a = make_attr(ATTR_DEFAULT); yyval.var = yyvsp[0].var; if (!yyval.var) yyval.var = make_var(NULL); LINK(a, yyval.var->attrs); yyval.var->attrs = a; - ; - break;} + } + break; case 122: -#line 418 "parser.y" +#line 419 "./parser.y" { yyval.var = reg_const(yyvsp[-2].var); set_type(yyval.var, yyvsp[-3].tref, NULL); yyval.var->eval = yyvsp[0].expr; yyval.var->lval = yyvsp[0].expr->cval; - ; - break;} + } + break; case 123: -#line 425 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 426 "./parser.y" +{ yyval.var = NULL; } + break; case 124: -#line 426 "parser.y" -{ yyval.var = yyvsp[-1].var; ; - break;} +#line 427 "./parser.y" +{ yyval.var = yyvsp[-1].var; } + break; case 127: -#line 431 "parser.y" +#line 432 "./parser.y" { LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; if (yyvsp[-2].var && !yyvsp[0].var->eval) yyvsp[0].var->lval = yyvsp[-2].var->lval + 1; - ; - break;} + } + break; case 128: -#line 437 "parser.y" +#line 438 "./parser.y" { yyval.var = reg_const(yyvsp[-2].var); yyval.var->eval = yyvsp[0].expr; yyval.var->lval = yyvsp[0].expr->cval; yyval.var->type = make_type(RPC_FC_LONG, &std_int); - ; - break;} + } + break; case 129: -#line 442 "parser.y" +#line 443 "./parser.y" { yyval.var = reg_const(yyvsp[0].var); yyval.var->lval = 0; /* default for first enum entry */ yyval.var->type = make_type(RPC_FC_LONG, &std_int); - ; - break;} + } + break; case 130: -#line 448 "parser.y" +#line 449 "./parser.y" { yyval.type = get_typev(RPC_FC_ENUM16, yyvsp[-3].var, tsENUM); yyval.type->fields = yyvsp[-1].var; yyval.type->defined = TRUE; if(in_typelib) add_enum(yyval.type); - ; - break;} + } + break; case 132: -#line 457 "parser.y" -{ LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; ; - break;} +#line 458 "./parser.y" +{ LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; } + break; case 133: -#line 470 "parser.y" -{ yyval.expr = make_expr(EXPR_VOID); ; - break;} +#line 471 "./parser.y" +{ yyval.expr = make_expr(EXPR_VOID); } + break; case 135: -#line 474 "parser.y" -{ yyval.expr = make_exprl(EXPR_NUM, yyvsp[0].num); ; - break;} +#line 475 "./parser.y" +{ yyval.expr = make_exprl(EXPR_NUM, yyvsp[0].num); } + break; case 136: -#line 475 "parser.y" -{ yyval.expr = make_exprl(EXPR_HEXNUM, yyvsp[0].num); ; - break;} +#line 476 "./parser.y" +{ yyval.expr = make_exprl(EXPR_HEXNUM, yyvsp[0].num); } + break; case 137: -#line 476 "parser.y" -{ yyval.expr = make_exprs(EXPR_IDENTIFIER, yyvsp[0].str); ; - break;} +#line 477 "./parser.y" +{ yyval.expr = make_exprs(EXPR_IDENTIFIER, yyvsp[0].str); } + break; case 138: -#line 477 "parser.y" -{ yyval.expr = make_expr3(EXPR_COND, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 478 "./parser.y" +{ yyval.expr = make_expr3(EXPR_COND, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 139: -#line 478 "parser.y" -{ yyval.expr = make_expr2(EXPR_OR , yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 479 "./parser.y" +{ yyval.expr = make_expr2(EXPR_OR , yyvsp[-2].expr, yyvsp[0].expr); } + break; case 140: -#line 479 "parser.y" -{ yyval.expr = make_expr2(EXPR_AND, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 480 "./parser.y" +{ yyval.expr = make_expr2(EXPR_AND, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 141: -#line 480 "parser.y" -{ yyval.expr = make_expr2(EXPR_ADD, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 481 "./parser.y" +{ yyval.expr = make_expr2(EXPR_ADD, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 142: -#line 481 "parser.y" -{ yyval.expr = make_expr2(EXPR_SUB, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 482 "./parser.y" +{ yyval.expr = make_expr2(EXPR_SUB, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 143: -#line 482 "parser.y" -{ yyval.expr = make_expr2(EXPR_MUL, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 483 "./parser.y" +{ yyval.expr = make_expr2(EXPR_MUL, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 144: -#line 483 "parser.y" -{ yyval.expr = make_expr2(EXPR_DIV, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 484 "./parser.y" +{ yyval.expr = make_expr2(EXPR_DIV, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 145: -#line 484 "parser.y" -{ yyval.expr = make_expr2(EXPR_SHL, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 485 "./parser.y" +{ yyval.expr = make_expr2(EXPR_SHL, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 146: -#line 485 "parser.y" -{ yyval.expr = make_expr2(EXPR_SHR, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} +#line 486 "./parser.y" +{ yyval.expr = make_expr2(EXPR_SHR, yyvsp[-2].expr, yyvsp[0].expr); } + break; case 147: -#line 486 "parser.y" -{ yyval.expr = make_expr1(EXPR_NOT, yyvsp[0].expr); ; - break;} +#line 487 "./parser.y" +{ yyval.expr = make_expr1(EXPR_NOT, yyvsp[0].expr); } + break; case 148: -#line 487 "parser.y" -{ yyval.expr = make_expr1(EXPR_NEG, yyvsp[0].expr); ; - break;} +#line 488 "./parser.y" +{ yyval.expr = make_expr1(EXPR_NEG, yyvsp[0].expr); } + break; case 149: -#line 488 "parser.y" -{ yyval.expr = make_expr1(EXPR_PPTR, yyvsp[0].expr); ; - break;} +#line 489 "./parser.y" +{ yyval.expr = make_expr1(EXPR_PPTR, yyvsp[0].expr); } + break; case 150: -#line 489 "parser.y" -{ yyval.expr = make_exprt(EXPR_CAST, yyvsp[-2].tref, yyvsp[0].expr); ; - break;} +#line 490 "./parser.y" +{ yyval.expr = make_exprt(EXPR_CAST, yyvsp[-2].tref, yyvsp[0].expr); } + break; case 151: -#line 490 "parser.y" -{ yyval.expr = make_exprt(EXPR_SIZEOF, yyvsp[-1].tref, NULL); ; - break;} +#line 491 "./parser.y" +{ yyval.expr = make_exprt(EXPR_SIZEOF, yyvsp[-1].tref, NULL); } + break; case 152: -#line 491 "parser.y" -{ yyval.expr = yyvsp[-1].expr; ; - break;} +#line 492 "./parser.y" +{ yyval.expr = yyvsp[-1].expr; } + break; case 154: -#line 495 "parser.y" -{ LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; ; - break;} +#line 496 "./parser.y" +{ LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; } + break; case 155: -#line 498 "parser.y" +#line 499 "./parser.y" { yyval.expr = yyvsp[0].expr; if (!yyval.expr->is_const) yyerror("expression is not constant\n"); - ; - break;} + } + break; case 156: -#line 504 "parser.y" +#line 505 "./parser.y" { yyval.var = yyvsp[0].var; set_type(yyval.var, yyvsp[-1].tref, NULL); - ; - break;} + } + break; case 157: -#line 509 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 510 "./parser.y" +{ yyval.var = NULL; } + break; case 158: -#line 510 "parser.y" +#line 511 "./parser.y" { if (yyvsp[0].var) { LINK(yyvsp[0].var, yyvsp[-1].var); yyval.var = yyvsp[0].var; } else { yyval.var = yyvsp[-1].var; } - ; - break;} + } + break; case 159: -#line 515 "parser.y" -{ yyval.var = yyvsp[-1].var; ; - break;} +#line 516 "./parser.y" +{ yyval.var = yyvsp[-1].var; } + break; case 160: -#line 516 "parser.y" -{ yyval.var = make_var(NULL); yyval.var->type = yyvsp[-1].type; yyval.var->attrs = yyvsp[-2].attr; ; - break;} +#line 517 "./parser.y" +{ yyval.var = make_var(NULL); yyval.var->type = yyvsp[-1].type; yyval.var->attrs = yyvsp[-2].attr; } + break; case 161: -#line 517 "parser.y" -{ yyval.var = make_var(NULL); yyval.var->attrs = yyvsp[-1].attr; ; - break;} +#line 518 "./parser.y" +{ yyval.var = make_var(NULL); yyval.var->attrs = yyvsp[-1].attr; } + break; case 162: -#line 518 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 519 "./parser.y" +{ yyval.var = NULL; } + break; case 163: -#line 521 "parser.y" -{ yyval.var = yyvsp[-1].var; set_type(yyval.var, yyvsp[-2].tref, yyvsp[0].expr); yyval.var->attrs = yyvsp[-3].attr; ; - break;} +#line 522 "./parser.y" +{ yyval.var = yyvsp[-1].var; set_type(yyval.var, yyvsp[-2].tref, yyvsp[0].expr); yyval.var->attrs = yyvsp[-3].attr; } + break; case 164: -#line 526 "parser.y" +#line 527 "./parser.y" { set_type(yyvsp[-3].var, yyvsp[-5].tref, NULL); yyvsp[-3].var->attrs = yyvsp[-6].attr; yyval.func = make_func(yyvsp[-3].var, yyvsp[-1].var); if (is_attr(yyvsp[-3].var->attrs, ATTR_IN)) { yyerror("Inapplicable attribute"); } - ; - break;} + } + break; case 165: -#line 535 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 536 "./parser.y" +{ yyval.var = NULL; } + break; case 167: -#line 539 "parser.y" -{ yyval.var = NULL; ; - break;} +#line 540 "./parser.y" +{ yyval.var = NULL; } + break; case 168: -#line 540 "parser.y" -{ yyval.var = make_var(yyvsp[0].str); ; - break;} +#line 541 "./parser.y" +{ yyval.var = make_var(yyvsp[0].str); } + break; case 169: -#line 541 "parser.y" -{ yyval.var = make_var(yyvsp[0].str); ; - break;} +#line 542 "./parser.y" +{ yyval.var = make_var(yyvsp[0].str); } + break; case 170: -#line 544 "parser.y" -{ yyval.var = make_var(yyvsp[0].str); ; - break;} +#line 545 "./parser.y" +{ yyval.var = make_var(yyvsp[0].str); } + break; case 171: -#line 546 "parser.y" -{ yyval.var = make_var(yyvsp[0].str); ; - break;} +#line 547 "./parser.y" +{ yyval.var = make_var(yyvsp[0].str); } + break; case 172: -#line 547 "parser.y" -{ yyval.var = make_var(yyvsp[0].str); ; - break;} +#line 548 "./parser.y" +{ yyval.var = make_var(yyvsp[0].str); } + break; case 173: -#line 548 "parser.y" -{ yyval.var = make_var(yyvsp[0].str); ; - break;} +#line 549 "./parser.y" +{ yyval.var = make_var(yyvsp[0].str); } + break; case 174: -#line 549 "parser.y" -{ yyval.var = make_var(yyvsp[0].str); ; - break;} +#line 550 "./parser.y" +{ yyval.var = make_var(yyvsp[0].str); } + break; case 175: -#line 552 "parser.y" -{ yyval.type = make_type(RPC_FC_BYTE, NULL); ; - break;} +#line 553 "./parser.y" +{ yyval.type = make_type(RPC_FC_BYTE, NULL); } + break; case 176: -#line 553 "parser.y" -{ yyval.type = make_type(RPC_FC_WCHAR, NULL); ; - break;} +#line 554 "./parser.y" +{ yyval.type = make_type(RPC_FC_WCHAR, NULL); } + break; case 178: -#line 555 "parser.y" -{ yyval.type = yyvsp[0].type; yyval.type->sign = 1; ; - break;} +#line 556 "./parser.y" +{ yyval.type = yyvsp[0].type; yyval.type->sign = 1; } + break; case 179: -#line 556 "parser.y" +#line 557 "./parser.y" { yyval.type = yyvsp[0].type; yyval.type->sign = -1; switch (yyval.type->type) { case RPC_FC_CHAR: break; @@ -2105,104 +2307,108 @@ case 179: break; default: break; } - ; - break;} + } + break; case 180: -#line 568 "parser.y" -{ yyval.type = make_type(RPC_FC_ULONG, &std_int); - yyval.type->sign = -1; ; - break;} +#line 569 "./parser.y" +{ yyval.type = make_type(RPC_FC_ULONG, &std_int); yyval.type->sign = -1; } + break; case 181: -#line 570 "parser.y" -{ yyval.type = make_type(RPC_FC_FLOAT, NULL); ; - break;} +#line 570 "./parser.y" +{ yyval.type = make_type(RPC_FC_FLOAT, NULL); } + break; case 182: -#line 571 "parser.y" -{ yyval.type = make_type(RPC_FC_DOUBLE, NULL); ; - break;} +#line 571 "./parser.y" +{ yyval.type = make_type(RPC_FC_FLOAT, NULL); } + break; case 183: -#line 572 "parser.y" -{ yyval.type = make_type(RPC_FC_SMALL, &std_bool); ; - break;} +#line 572 "./parser.y" +{ yyval.type = make_type(RPC_FC_DOUBLE, NULL); } + break; case 184: -#line 573 "parser.y" -{ yyval.type = make_type(RPC_FC_ERROR_STATUS_T, NULL); ; - break;} +#line 573 "./parser.y" +{ yyval.type = make_type(RPC_FC_SMALL, &std_bool); } + break; case 185: -#line 574 "parser.y" -{ yyval.type = make_type(RPC_FC_IGNORE, NULL); ; - break;} -case 188: -#line 581 "parser.y" -{ yyval.type = make_type(RPC_FC_LONG, &std_int); ; - break;} +#line 574 "./parser.y" +{ yyval.type = make_type(RPC_FC_ERROR_STATUS_T, NULL); } + break; +case 186: +#line 575 "./parser.y" +{ yyval.type = make_type(RPC_FC_IGNORE, NULL); } + break; case 189: -#line 582 "parser.y" -{ yyval.type = make_type(RPC_FC_SMALL, NULL); ; - break;} +#line 582 "./parser.y" +{ yyval.type = make_type(RPC_FC_LONG, &std_int); } + break; case 190: -#line 583 "parser.y" -{ yyval.type = make_type(RPC_FC_SHORT, NULL); ; - break;} +#line 583 "./parser.y" +{ yyval.type = make_type(RPC_FC_SMALL, NULL); } + break; case 191: -#line 584 "parser.y" -{ yyval.type = make_type(RPC_FC_LONG, NULL); ; - break;} +#line 584 "./parser.y" +{ yyval.type = make_type(RPC_FC_SHORT, NULL); } + break; case 192: -#line 585 "parser.y" -{ yyval.type = make_type(RPC_FC_HYPER, NULL); ; - break;} +#line 585 "./parser.y" +{ yyval.type = make_type(RPC_FC_LONG, NULL); } + break; case 193: -#line 586 "parser.y" -{ yyval.type = make_type(RPC_FC_HYPER, &std_int64); ; - break;} +#line 586 "./parser.y" +{ yyval.type = make_type(RPC_FC_HYPER, NULL); } + break; case 194: -#line 587 "parser.y" -{ yyval.type = make_type(RPC_FC_CHAR, NULL); ; - break;} +#line 587 "./parser.y" +{ yyval.type = make_type(RPC_FC_HYPER, &std_int64); } + break; case 195: -#line 590 "parser.y" -{ yyval.clas = make_class(yyvsp[0].str); ; - break;} +#line 588 "./parser.y" +{ yyval.type = make_type(RPC_FC_CHAR, NULL); } + break; case 196: -#line 591 "parser.y" -{ yyval.clas = make_class(yyvsp[0].str); ; - break;} +#line 591 "./parser.y" +{ yyval.clas = make_class(yyvsp[0].str); } + break; case 197: -#line 594 "parser.y" +#line 592 "./parser.y" +{ yyval.clas = make_class(yyvsp[0].str); } + break; +case 198: +#line 595 "./parser.y" { yyval.clas = yyvsp[0].clas; yyval.clas->attrs = yyvsp[-1].attr; - if (!parse_only && do_header) write_coclass(yyval.clas); - ; - break;} -case 198: -#line 600 "parser.y" + if (!parse_only && do_header) + write_coclass(yyval.clas); + } + break; +case 199: +#line 602 "./parser.y" { yyval.clas = yyvsp[-3].clas; yyval.clas->ifaces = yyvsp[-1].ifref; - ; - break;} -case 199: -#line 605 "parser.y" -{ yyval.ifref = NULL; ; - break;} + } + break; case 200: -#line 606 "parser.y" -{ LINK(yyvsp[0].ifref, yyvsp[-1].ifref); yyval.ifref = yyvsp[0].ifref; ; - break;} +#line 607 "./parser.y" +{ yyval.ifref = NULL; } + break; case 201: -#line 610 "parser.y" -{ yyval.ifref = make_ifref(yyvsp[0].type); yyval.ifref->attrs = yyvsp[-1].attr; ; - break;} +#line 608 "./parser.y" +{ LINK(yyvsp[0].ifref, yyvsp[-1].ifref); yyval.ifref = yyvsp[0].ifref; } + break; case 202: -#line 613 "parser.y" -{ yyval.type = get_type(0, yyvsp[0].str, 0); ; - break;} +#line 612 "./parser.y" +{ yyval.ifref = make_ifref(yyvsp[0].type); yyval.ifref->attrs = yyvsp[-1].attr; } + break; case 203: -#line 614 "parser.y" -{ yyval.type = get_type(0, yyvsp[0].str, 0); ; - break;} +#line 615 "./parser.y" +{ yyval.type = get_type(0, yyvsp[0].str, 0); } + break; case 204: -#line 617 "parser.y" +#line 616 "./parser.y" +{ yyval.type = get_type(0, yyvsp[0].str, 0); } + break; +case 205: +#line 619 "./parser.y" { yyval.type = yyvsp[0].type; if (yyval.type->defined) yyerror("multiple definition error\n"); yyval.type->attrs = yyvsp[-1].attr; @@ -2212,133 +2418,133 @@ case 204: if (!yyval.type->ref) yyerror("IDispatch is undefined\n"); yyval.type->defined = TRUE; if (!parse_only && do_header) write_forward(yyval.type); - ; - break;} -case 205: -#line 629 "parser.y" -{ yyval.var = NULL; ; - break;} + } + break; case 206: -#line 630 "parser.y" -{ LINK(yyvsp[-1].var, yyvsp[-2].var); yyval.var = yyvsp[-1].var; ; - break;} +#line 631 "./parser.y" +{ yyval.var = NULL; } + break; case 207: -#line 633 "parser.y" -{ yyval.func = NULL; ; - break;} +#line 632 "./parser.y" +{ LINK(yyvsp[-1].var, yyvsp[-2].var); yyval.var = yyvsp[-1].var; } + break; case 208: -#line 634 "parser.y" -{ LINK(yyvsp[-1].func, yyvsp[-2].func); yyval.func = yyvsp[-1].func; ; - break;} +#line 635 "./parser.y" +{ yyval.func = NULL; } + break; case 209: -#line 640 "parser.y" +#line 636 "./parser.y" +{ LINK(yyvsp[-1].func, yyvsp[-2].func); yyval.func = yyvsp[-1].func; } + break; +case 210: +#line 642 "./parser.y" { yyval.type = yyvsp[-4].type; yyval.type->fields = yyvsp[-2].var; yyval.type->funcs = yyvsp[-1].func; if (!parse_only && do_header) write_dispinterface(yyval.type); - ; - break;} -case 210: -#line 652 "parser.y" -{ yyval.type = NULL; ; - break;} + } + break; case 211: -#line 653 "parser.y" -{ yyval.type = find_type2(yyvsp[0].str, 0); ; - break;} +#line 654 "./parser.y" +{ yyval.type = NULL; } + break; case 212: -#line 656 "parser.y" -{ yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); ; - break;} +#line 655 "./parser.y" +{ yyval.type = find_type2(yyvsp[0].str, 0); } + break; case 213: -#line 657 "parser.y" -{ yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); ; - break;} +#line 658 "./parser.y" +{ yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); } + break; case 214: -#line 660 "parser.y" +#line 659 "./parser.y" +{ yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); } + break; +case 215: +#line 662 "./parser.y" { yyval.type = yyvsp[0].type; if (yyval.type->defined) yyerror("multiple definition error\n"); yyval.type->attrs = yyvsp[-1].attr; yyval.type->defined = TRUE; if (!parse_only && do_header) write_forward(yyval.type); - ; - break;} -case 215: -#line 669 "parser.y" + } + break; +case 216: +#line 671 "./parser.y" { yyval.type = yyvsp[-4].type; yyval.type->ref = yyvsp[-3].type; yyval.type->funcs = yyvsp[-1].func; if (!parse_only && do_header) write_interface(yyval.type); - ; - break;} -case 216: -#line 677 "parser.y" + } + break; +case 217: +#line 679 "./parser.y" { yyval.type = yyvsp[-6].type; yyval.type->ref = find_type2(yyvsp[-4].str, 0); if (!yyval.type->ref) yyerror("base class %s not found in import\n", yyvsp[-4].str); yyval.type->funcs = yyvsp[-1].func; if (!parse_only && do_header) write_interface(yyval.type); - ; - break;} -case 217: -#line 683 "parser.y" -{ yyval.type = yyvsp[0].type; ; - break;} + } + break; case 218: -#line 687 "parser.y" -{ yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); ; - break;} +#line 685 "./parser.y" +{ yyval.type = yyvsp[0].type; } + break; case 219: -#line 688 "parser.y" -{ yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); ; - break;} +#line 689 "./parser.y" +{ yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); } + break; case 220: -#line 691 "parser.y" -{ yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; ; - break;} +#line 690 "./parser.y" +{ yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); } + break; case 221: -#line 692 "parser.y" -{ yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; ; - break;} +#line 693 "./parser.y" +{ yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; } + break; case 222: -#line 695 "parser.y" +#line 694 "./parser.y" +{ yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; } + break; +case 223: +#line 697 "./parser.y" { yyval.type = yyvsp[0].type; yyval.type->attrs = yyvsp[-1].attr; - ; - break;} -case 223: -#line 700 "parser.y" + } + break; +case 224: +#line 702 "./parser.y" { yyval.type = yyvsp[-3].type; yyval.type->funcs = yyvsp[-1].func; /* FIXME: if (!parse_only && do_header) write_module($$); */ - ; - break;} -case 224: -#line 706 "parser.y" -{ yyval.var = yyvsp[0].var; yyval.var->ptr_level++; ; - break;} + } + break; case 225: -#line 707 "parser.y" -{ yyval.var = yyvsp[0].var; /* FIXME */ ; - break;} -case 228: -#line 712 "parser.y" -{ yyval.var = yyvsp[-1].var; ; - break;} -case 230: -#line 717 "parser.y" -{ LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; ; - break;} +#line 708 "./parser.y" +{ yyval.var = yyvsp[0].var; yyval.var->ptr_level++; } + break; +case 226: +#line 709 "./parser.y" +{ yyval.var = yyvsp[0].var; /* FIXME */ } + break; +case 229: +#line 714 "./parser.y" +{ yyval.var = yyvsp[-1].var; } + break; case 231: -#line 721 "parser.y" -{ yyval.num = RPC_FC_RP; ; - break;} +#line 719 "./parser.y" +{ LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; } + break; case 232: -#line 722 "parser.y" -{ yyval.num = RPC_FC_UP; ; - break;} +#line 723 "./parser.y" +{ yyval.num = RPC_FC_RP; } + break; case 233: -#line 725 "parser.y" +#line 724 "./parser.y" +{ yyval.num = RPC_FC_UP; } + break; +case 234: +#line 727 "./parser.y" { yyval.type = get_typev(RPC_FC_STRUCT, yyvsp[-3].var, tsSTRUCT); /* overwrite RPC_FC_STRUCT with a more exact type */ yyval.type->type = get_struct_type( yyvsp[-1].var ); @@ -2346,70 +2552,71 @@ case 233: yyval.type->defined = TRUE; if(in_typelib) add_struct(yyval.type); - ; - break;} -case 234: -#line 735 "parser.y" -{ yyval.tref = make_tref(NULL, make_type(0, NULL)); ; - break;} + } + break; case 235: -#line 736 "parser.y" -{ yyval.tref = make_tref(yyvsp[0].str, find_type(yyvsp[0].str, 0)); ; - break;} +#line 737 "./parser.y" +{ yyval.tref = make_tref(NULL, make_type(0, NULL)); } + break; case 236: -#line 737 "parser.y" -{ yyval.tref = make_tref(NULL, yyvsp[0].type); ; - break;} +#line 738 "./parser.y" +{ yyval.tref = make_tref(yyvsp[0].str, find_type(yyvsp[0].str, 0)); } + break; case 237: -#line 738 "parser.y" -{ yyval.tref = uniq_tref(yyvsp[0].tref); yyval.tref->ref->is_const = TRUE; ; - break;} +#line 739 "./parser.y" +{ yyval.tref = make_tref(NULL, yyvsp[0].type); } + break; case 238: -#line 739 "parser.y" -{ yyval.tref = make_tref(NULL, yyvsp[0].type); ; - break;} +#line 740 "./parser.y" +{ yyval.tref = uniq_tref(yyvsp[0].tref); yyval.tref->ref->is_const = TRUE; } + break; case 239: -#line 740 "parser.y" -{ yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsENUM)); ; - break;} +#line 741 "./parser.y" +{ yyval.tref = make_tref(NULL, yyvsp[0].type); } + break; case 240: -#line 741 "parser.y" -{ yyval.tref = make_tref(NULL, yyvsp[0].type); ; - break;} +#line 742 "./parser.y" +{ yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsENUM)); } + break; case 241: -#line 742 "parser.y" -{ yyval.tref = make_tref(NULL, get_type(RPC_FC_STRUCT, yyvsp[0].str, tsSTRUCT)); ; - break;} +#line 743 "./parser.y" +{ yyval.tref = make_tref(NULL, yyvsp[0].type); } + break; case 242: -#line 743 "parser.y" -{ yyval.tref = make_tref(NULL, yyvsp[0].type); ; - break;} +#line 744 "./parser.y" +{ yyval.tref = make_tref(NULL, get_type(RPC_FC_STRUCT, yyvsp[0].str, tsSTRUCT)); } + break; case 243: -#line 744 "parser.y" -{ yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsUNION)); ; - break;} +#line 745 "./parser.y" +{ yyval.tref = make_tref(NULL, yyvsp[0].type); } + break; case 244: -#line 747 "parser.y" -{ typeref_t *tref = uniq_tref(yyvsp[-1].tref); +#line 746 "./parser.y" +{ yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsUNION)); } + break; +case 245: +#line 749 "./parser.y" +{ typeref_t *tref = uniq_tref(yyvsp[-1].tref); yyvsp[0].var->tname = tref->name; tref->name = NULL; yyval.type = type_ref(tref); yyval.type->attrs = yyvsp[-2].attr; - if (!parse_only && do_header) write_typedef(yyval.type, yyvsp[0].var); - if (in_typelib && yyval.type->attrs) - add_typedef(yyval.type, yyvsp[0].var); + if (!parse_only && do_header) + write_typedef(yyval.type, yyvsp[0].var); + if (in_typelib && yyval.type->attrs) + add_typedef(yyval.type, yyvsp[0].var); reg_types(yyval.type, yyvsp[0].var, 0); - ; - break;} -case 245: -#line 759 "parser.y" + } + break; +case 246: +#line 762 "./parser.y" { yyval.type = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, yyvsp[-3].var, tsUNION); yyval.type->fields = yyvsp[-1].var; yyval.type->defined = TRUE; - ; - break;} -case 246: -#line 765 "parser.y" + } + break; +case 247: +#line 768 "./parser.y" { var_t *u = yyvsp[-3].var; yyval.type = get_typev(RPC_FC_ENCAPSULATED_UNION, yyvsp[-8].var, tsUNION); if (!u) u = make_var("tagged_union"); @@ -2418,60 +2625,46 @@ case 246: u->type->defined = TRUE; LINK(u, yyvsp[-5].var); yyval.type->fields = u; yyval.type->defined = TRUE; - ; - break;} -case 247: -#line 777 "parser.y" -{ yyval.num = MAKELONG(yyvsp[0].num, 0); ; - break;} + } + break; case 248: -#line 778 "parser.y" -{ yyval.num = MAKELONG(yyvsp[-2].num, yyvsp[0].num); ; - break;} +#line 780 "./parser.y" +{ yyval.num = MAKELONG(yyvsp[0].num, 0); } + break; +case 249: +#line 781 "./parser.y" +{ yyval.num = MAKELONG(yyvsp[-2].num, yyvsp[0].num); } + break; } - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/share/bison.simple" + +#line 705 "/usr/share/bison/bison.simple" + yyvsp -= yylen; yyssp -= yylen; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED yylsp -= yylen; #endif -#if YYDEBUG != 0 +#if YYDEBUG if (yydebug) { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); } #endif *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } +#if YYLSP_NEEDED + *++yylsp = yyloc; #endif - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ yyn = yyr1[yyn]; @@ -2483,10 +2676,13 @@ case 248: goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { ++yynerrs; @@ -2495,102 +2691,121 @@ yyerrlab: /* here on detecting error */ if (yyn > YYFLAG && yyn < YYLAST) { - int size = 0; - char *msg; - int x, count; + YYSIZE_T yysize = 0; + char *yymsg; + int yyx, yycount; - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("parse error, unexpected ") + 1; + yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) { - strcpy(msg, "parse error"); + char *yyp = yystpcpy (yymsg, "parse error, unexpected "); + yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); - if (count < 5) + if (yycount < 5) { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx) { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; } } - yyerror(msg); - free(msg); + yyerror (yymsg); + YYSTACK_FREE (yymsg); } else - yyerror ("parse error; also virtual memory exceeded"); + yyerror ("parse error; also virtual memory exhausted"); } else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); +#endif /* defined (YYERROR_VERBOSE) */ + yyerror ("parse error"); } - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ + +/*--------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action | +`--------------------------------------------------*/ +yyerrlab1: if (yyerrstatus == 3) { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - + YYDPRINTF ((stderr, "Discarding token %d (%s).\n", + yychar, yytname[yychar1])); yychar = YYEMPTY; } - /* Else will try to reuse lookahead token - after shifting the error token. */ + /* Else will try to reuse lookahead token after shifting the error + token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; -yyerrdefault: /* current state does not do anything special for the error token. */ +/*-------------------------------------------------------------------. +| yyerrdefault -- current state does not do anything special for the | +| error token. | +`-------------------------------------------------------------------*/ +yyerrdefault: #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; + + /* If its default is to accept any token, ok. Otherwise pop it. */ + yyn = yydefact[yystate]; + if (yyn) + goto yydefault; #endif -yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; +/*---------------------------------------------------------------. +| yyerrpop -- pop the current state because it cannot handle the | +| error token | +`---------------------------------------------------------------*/ +yyerrpop: + if (yyssp == yyss) + YYABORT; yyvsp--; yystate = *--yyssp; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED yylsp--; #endif -#if YYDEBUG != 0 +#if YYDEBUG if (yydebug) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "Error: state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); } #endif +/*--------------. +| yyerrhandle. | +`--------------*/ yyerrhandle: - yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; @@ -2613,44 +2828,47 @@ yyerrhandle: if (yyn == YYFINAL) YYACCEPT; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif + YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +/*---------------------------------------------. +| yyoverflowab -- parser overflow comes here. | +`---------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); #endif - } - return 1; + return yyresult; } -#line 781 "parser.y" +#line 784 "./parser.y" static attr_t *make_attr(enum attr_type type) @@ -2987,6 +3205,7 @@ static type_t *reg_type(type_t *type, char *name, int t) nt->t = t; nt->next = type_hash[hash]; type_hash[hash] = nt; + type->name = name; return type; } @@ -3009,7 +3228,14 @@ static unsigned char get_pointer_type( type_t *type ) } t = get_attrv( type->attrs, ATTR_POINTERTYPE ); if (t) return t; - return RPC_FC_FP; + + if(is_attr( type->attrs, ATTR_PTR )) + return RPC_FC_FP; + + if(is_attr( type->attrs, ATTR_UNIQUE )) + return RPC_FC_UP; + + return RPC_FC_RP; } static type_t *reg_types(type_t *type, var_t *names, int t) diff --git a/reactos/tools/widl/y.tab.h b/reactos/tools/widl/y.tab.h index 1e3f2af1dd4..c8e735ba06e 100644 --- a/reactos/tools/widl/y.tab.h +++ b/reactos/tools/widl/y.tab.h @@ -1,3 +1,7 @@ +#ifndef BISON_Y_TAB_H +# define BISON_Y_TAB_H + +#ifndef YYSTYPE typedef union { attr_t *attr; expr_t *expr; @@ -10,129 +14,135 @@ typedef union { char *str; UUID *uuid; unsigned int num; -} YYSTYPE; -#define aIDENTIFIER 257 -#define aKNOWNTYPE 258 -#define aNUM 259 -#define aHEXNUM 260 -#define aSTRING 261 -#define aUUID 262 -#define aEOF 263 -#define SHL 264 -#define SHR 265 -#define tAGGREGATABLE 266 -#define tALLOCATE 267 -#define tAPPOBJECT 268 -#define tARRAYS 269 -#define tASYNC 270 -#define tASYNCUUID 271 -#define tAUTOHANDLE 272 -#define tBINDABLE 273 -#define tBOOLEAN 274 -#define tBROADCAST 275 -#define tBYTE 276 -#define tBYTECOUNT 277 -#define tCALLAS 278 -#define tCALLBACK 279 -#define tCASE 280 -#define tCDECL 281 -#define tCHAR 282 -#define tCOCLASS 283 -#define tCODE 284 -#define tCOMMSTATUS 285 -#define tCONST 286 -#define tCONTEXTHANDLE 287 -#define tCONTEXTHANDLENOSERIALIZE 288 -#define tCONTEXTHANDLESERIALIZE 289 -#define tCONTROL 290 -#define tCPPQUOTE 291 -#define tDEFAULT 292 -#define tDEFAULTVALUE 293 -#define tDISPINTERFACE 294 -#define tDLLNAME 295 -#define tDOUBLE 296 -#define tDUAL 297 -#define tENDPOINT 298 -#define tENTRY 299 -#define tENUM 300 -#define tERRORSTATUST 301 -#define tEXPLICITHANDLE 302 -#define tEXTERN 303 -#define tFLOAT 304 -#define tHANDLE 305 -#define tHANDLET 306 -#define tHELPCONTEXT 307 -#define tHELPFILE 308 -#define tHELPSTRING 309 -#define tHELPSTRINGCONTEXT 310 -#define tHELPSTRINGDLL 311 -#define tHIDDEN 312 -#define tHYPER 313 -#define tID 314 -#define tIDEMPOTENT 315 -#define tIIDIS 316 -#define tIMPLICITHANDLE 317 -#define tIMPORT 318 -#define tIMPORTLIB 319 -#define tIN 320 -#define tINCLUDE 321 -#define tINLINE 322 -#define tINPUTSYNC 323 -#define tINT 324 -#define tINT64 325 -#define tINTERFACE 326 -#define tLENGTHIS 327 -#define tLIBRARY 328 -#define tLOCAL 329 -#define tLONG 330 -#define tMETHODS 331 -#define tMODULE 332 -#define tNONCREATABLE 333 -#define tOBJECT 334 -#define tODL 335 -#define tOLEAUTOMATION 336 -#define tOPTIONAL 337 -#define tOUT 338 -#define tPOINTERDEFAULT 339 -#define tPROPERTIES 340 -#define tPROPGET 341 -#define tPROPPUT 342 -#define tPROPPUTREF 343 -#define tPTR 344 -#define tPUBLIC 345 -#define tREADONLY 346 -#define tREF 347 -#define tRESTRICTED 348 -#define tRETVAL 349 -#define tSHORT 350 -#define tSIGNED 351 -#define tSIZEIS 352 -#define tSIZEOF 353 -#define tSMALL 354 -#define tSOURCE 355 -#define tSTDCALL 356 -#define tSTRING 357 -#define tSTRUCT 358 -#define tSWITCH 359 -#define tSWITCHIS 360 -#define tSWITCHTYPE 361 -#define tTRANSMITAS 362 -#define tTYPEDEF 363 -#define tUNION 364 -#define tUNIQUE 365 -#define tUNSIGNED 366 -#define tUUID 367 -#define tV1ENUM 368 -#define tVARARG 369 -#define tVERSION 370 -#define tVOID 371 -#define tWCHAR 372 -#define tWIREMARSHAL 373 -#define tPOINTERTYPE 374 -#define COND 375 -#define CAST 376 -#define PPTR 377 -#define NEG 378 +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +# define aIDENTIFIER 257 +# define aKNOWNTYPE 258 +# define aNUM 259 +# define aHEXNUM 260 +# define aSTRING 261 +# define aUUID 262 +# define aEOF 263 +# define SHL 264 +# define SHR 265 +# define tAGGREGATABLE 266 +# define tALLOCATE 267 +# define tAPPOBJECT 268 +# define tARRAYS 269 +# define tASYNC 270 +# define tASYNCUUID 271 +# define tAUTOHANDLE 272 +# define tBINDABLE 273 +# define tBOOLEAN 274 +# define tBROADCAST 275 +# define tBYTE 276 +# define tBYTECOUNT 277 +# define tCALLAS 278 +# define tCALLBACK 279 +# define tCASE 280 +# define tCDECL 281 +# define tCHAR 282 +# define tCOCLASS 283 +# define tCODE 284 +# define tCOMMSTATUS 285 +# define tCONST 286 +# define tCONTEXTHANDLE 287 +# define tCONTEXTHANDLENOSERIALIZE 288 +# define tCONTEXTHANDLESERIALIZE 289 +# define tCONTROL 290 +# define tCPPQUOTE 291 +# define tDEFAULT 292 +# define tDEFAULTVALUE 293 +# define tDISPINTERFACE 294 +# define tDLLNAME 295 +# define tDOUBLE 296 +# define tDUAL 297 +# define tENDPOINT 298 +# define tENTRY 299 +# define tENUM 300 +# define tERRORSTATUST 301 +# define tEXPLICITHANDLE 302 +# define tEXTERN 303 +# define tFLOAT 304 +# define tHANDLE 305 +# define tHANDLET 306 +# define tHELPCONTEXT 307 +# define tHELPFILE 308 +# define tHELPSTRING 309 +# define tHELPSTRINGCONTEXT 310 +# define tHELPSTRINGDLL 311 +# define tHIDDEN 312 +# define tHYPER 313 +# define tID 314 +# define tIDEMPOTENT 315 +# define tIIDIS 316 +# define tIMPLICITHANDLE 317 +# define tIMPORT 318 +# define tIMPORTLIB 319 +# define tIN 320 +# define tINCLUDE 321 +# define tINLINE 322 +# define tINPUTSYNC 323 +# define tINT 324 +# define tINT64 325 +# define tINTERFACE 326 +# define tLENGTHIS 327 +# define tLIBRARY 328 +# define tLOCAL 329 +# define tLONG 330 +# define tMETHODS 331 +# define tMODULE 332 +# define tNONCREATABLE 333 +# define tOBJECT 334 +# define tODL 335 +# define tOLEAUTOMATION 336 +# define tOPTIONAL 337 +# define tOUT 338 +# define tPOINTERDEFAULT 339 +# define tPROPERTIES 340 +# define tPROPGET 341 +# define tPROPPUT 342 +# define tPROPPUTREF 343 +# define tPTR 344 +# define tPUBLIC 345 +# define tREADONLY 346 +# define tREF 347 +# define tRESTRICTED 348 +# define tRETVAL 349 +# define tSHORT 350 +# define tSIGNED 351 +# define tSINGLE 352 +# define tSIZEIS 353 +# define tSIZEOF 354 +# define tSMALL 355 +# define tSOURCE 356 +# define tSTDCALL 357 +# define tSTRING 358 +# define tSTRUCT 359 +# define tSWITCH 360 +# define tSWITCHIS 361 +# define tSWITCHTYPE 362 +# define tTRANSMITAS 363 +# define tTYPEDEF 364 +# define tUNION 365 +# define tUNIQUE 366 +# define tUNSIGNED 367 +# define tUUID 368 +# define tV1ENUM 369 +# define tVARARG 370 +# define tVERSION 371 +# define tVOID 372 +# define tWCHAR 373 +# define tWIREMARSHAL 374 +# define tPOINTERTYPE 375 +# define COND 376 +# define CAST 377 +# define PPTR 378 +# define NEG 379 extern YYSTYPE yylval; + +#endif /* not BISON_Y_TAB_H */ diff --git a/reactos/tools/wine2ros/Makefile b/reactos/tools/wine2ros/Makefile index 63196cbe826..07e2fefdd02 100644 --- a/reactos/tools/wine2ros/Makefile +++ b/reactos/tools/wine2ros/Makefile @@ -16,11 +16,10 @@ wine2ros.o: wine2ros.c wine2ros$(EXE_POSTFIX): $(OBJECTS) $(HOST_CC) -g $(OBJECTS) -o $(TARGET) -ifeq ($(HOST),mingw32-linux) +ifeq ($(HOST_TYPE),unix) clean: rm -f *.o $(TARGET) -endif -ifneq ($(HOST),mingw32-linux) +else clean: del *.o $(TARGET) endif diff --git a/reactos/tools/winebuild/Makefile b/reactos/tools/winebuild/Makefile index 925892a46bc..6d7cec5f718 100644 --- a/reactos/tools/winebuild/Makefile +++ b/reactos/tools/winebuild/Makefile @@ -22,19 +22,23 @@ OBJECTS = \ CLEAN_FILES = *.o $(TARGET) -HOST_CFLAGS = -D__USE_W32API -I$(PATH_TO_TOP)/include/wine +HOST_CFLAGS = $(HOSTARCH) -D__USE_W32API -I$(PATH_TO_TOP)/include/wine %.o: %.c $(HOST_CC) $(HOST_CFLAGS) -c $< -o $@ $(TARGET): $(OBJECTS) - $(HOST_CC) $(OBJECTS) -o $(TARGET) + $(HOST_CC) $(HOSTARCH) $(OBJECTS) -o $(TARGET) ifeq ($(HOST),mingw32-linux) clean: rm -f $(CLEAN_FILES) endif -ifneq ($(HOST),mingw32-linux) +ifeq ($(HOST),mingw32-linux64) +clean: + rm -f $(CLEAN_FILES) +endif +ifeq ($(HOST),mingw32-windows) clean: del $(CLEAN_FILES) endif diff --git a/reactos/tools/winebuild/build.h b/reactos/tools/winebuild/build.h index c17c7208202..d6af3a0fbd2 100644 --- a/reactos/tools/winebuild/build.h +++ b/reactos/tools/winebuild/build.h @@ -98,7 +98,7 @@ typedef struct int nb_entry_points; /* number of used entry points */ int alloc_entry_points; /* number of allocated entry points */ int nb_names; /* number of entry points with names */ - int nb_resources; /* number of resources */ + unsigned int nb_resources; /* number of resources */ int characteristics; /* characteristics for the PE header */ int subsystem; /* subsystem id */ int subsystem_major; /* subsystem version major number */ @@ -203,6 +203,7 @@ extern int display_warnings; extern int kill_at; extern char *input_file_name; +extern char *spec_file_name; extern const char *output_file_name; extern char **debug_channels; extern char **lib_path; diff --git a/reactos/tools/winebuild/import.c b/reactos/tools/winebuild/import.c index aa655375e95..0a6aff1b3d1 100644 --- a/reactos/tools/winebuild/import.c +++ b/reactos/tools/winebuild/import.c @@ -703,6 +703,7 @@ static int output_immediate_imports( FILE *outfile ) fprintf( outfile, " \"\\t.globl " __ASM_NAME("%s") "\\n\"\n", name ); fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\\t", name); +#ifndef __REACTOS__ #if defined(__i386__) if (strstr( name, "__wine_call_from_16" )) fprintf( outfile, ".byte 0x2e\\n\\tjmp *(imports+%d)\\n\\tnop\\n", pos ); @@ -754,6 +755,7 @@ static int output_immediate_imports( FILE *outfile ) #else #error You need to define import thunks for your architecture! #endif +#endif /*__REACTOS__*/ fprintf( outfile, "\"\n" ); output_function_size( outfile, name ); } diff --git a/reactos/tools/winebuild/main.c b/reactos/tools/winebuild/main.c index 2071777f741..8d4466d85c3 100644 --- a/reactos/tools/winebuild/main.c +++ b/reactos/tools/winebuild/main.c @@ -56,6 +56,7 @@ char **debug_channels = NULL; char **lib_path = NULL; char *input_file_name = NULL; +char *spec_file_name = NULL; const char *output_file_name = NULL; char *ld_command = "ld"; @@ -65,7 +66,6 @@ static FILE *output_file; static const char *current_src_dir; static int nb_res_files; static char **res_files; -static char *spec_file_name; /* execution mode */ enum exec_mode_values diff --git a/reactos/tools/winebuild/relay.c b/reactos/tools/winebuild/relay.c index b43f5a09633..6548714b43d 100644 --- a/reactos/tools/winebuild/relay.c +++ b/reactos/tools/winebuild/relay.c @@ -171,7 +171,7 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho else fprintf( outfile, "\tmovw " __ASM_NAME("CallTo16_TebSelector") ", %%fs\n" ); - fprintf( outfile, "\t.byte 0x64\n\tmovl (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); + fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); /* Get address of wine_ldt_copy array into %ecx */ if ( UsePIC ) @@ -481,7 +481,7 @@ static void BuildCallTo16Core( FILE *outfile, int reg_func ) fprintf( outfile, "\tpushl %%ebx\n" ); fprintf( outfile, "\tpushl %%esi\n" ); fprintf( outfile, "\tpushl %%edi\n" ); - fprintf( outfile, "\t.byte 0x64\n\tmovl %%gs,(%d)\n", STRUCTOFFSET(TEB,gs_sel) ); + fprintf( outfile, "\t.byte 0x64\n\tmov %%gs,(%d)\n", STRUCTOFFSET(TEB,gs_sel) ); /* Setup exception frame */ fprintf( outfile, "\t.byte 0x64\n\tpushl (%d)\n", STACKOFFSET ); @@ -635,9 +635,9 @@ static void BuildRet16Func( FILE *outfile ) #endif fprintf( outfile, "\tmovw %%di,%%es\n" ); - fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_TebSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%fs\n" ); + fprintf( outfile, "\t.byte 0x2e\n\tmov " __ASM_NAME("CallTo16_TebSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%fs\n" ); - fprintf( outfile, "\t.byte 0x64\n\tmovl (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); + fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); /* Restore the 32-bit stack */ diff --git a/reactos/tools/winebuild/res16.c b/reactos/tools/winebuild/res16.c index 285e890859f..a5fd5849132 100644 --- a/reactos/tools/winebuild/res16.c +++ b/reactos/tools/winebuild/res16.c @@ -142,7 +142,7 @@ static void get_string( struct string_id *str ) } else { - char *p = xmalloc( (strlen(file_pos) + 1) ); + char *p = xmalloc( (strlen((char*)file_pos) + 1) ); str->str = p; str->id = 0; while ((*p++ = get_byte())); @@ -215,7 +215,7 @@ static int cmp_res( const void *ptr1, const void *ptr2 ) /* build the 2-level (type,name) resource tree */ static struct res_tree *build_resource_tree( DLLSPEC *spec ) { - int i; + unsigned int i; struct res_tree *tree; struct res_type *type = NULL; @@ -270,7 +270,8 @@ int output_res16_data( FILE *outfile, DLLSPEC *spec ) { const struct resource *res; unsigned char *buffer, *p; - int i, total; + unsigned int i; + int total; if (!spec->nb_resources) return 0; @@ -292,8 +293,8 @@ int output_res16_data( FILE *outfile, DLLSPEC *spec ) /* output the resource definitions */ int output_res16_directory( unsigned char *buffer, DLLSPEC *spec ) { - int i, offset, res_offset = 0; - unsigned int j; + int offset, res_offset = 0; + unsigned int i, j; struct res_tree *tree; const struct res_type *type; const struct resource *res; diff --git a/reactos/tools/winebuild/res32.c b/reactos/tools/winebuild/res32.c index 1e4d28bde84..6fb12adcc10 100644 --- a/reactos/tools/winebuild/res32.c +++ b/reactos/tools/winebuild/res32.c @@ -205,7 +205,7 @@ static void load_next_resource( DLLSPEC *spec ) get_dword(); /* skip version */ get_dword(); /* skip characteristics */ - file_pos = (const char *)res->data + res->data_size; + file_pos = (const unsigned char *)res->data + res->data_size; if (file_pos > file_end) fatal_error( "%s is a truncated file\n", file_name ); } @@ -267,7 +267,7 @@ static int cmp_res( const void *ptr1, const void *ptr2 ) /* build the 3-level (type,name,language) resource tree */ static struct res_tree *build_resource_tree( DLLSPEC *spec ) { - int i; + unsigned int i; struct res_tree *tree; struct res_type *type = NULL; struct res_name *name = NULL; @@ -297,7 +297,7 @@ static struct res_tree *build_resource_tree( DLLSPEC *spec ) /* free the resource tree */ static void free_resource_tree( struct res_tree *tree ) { - int i; + unsigned int i; for (i = 0; i < tree->nb_types; i++) free( tree->types[i].names ); free( tree->types ); @@ -318,8 +318,8 @@ static void output_string( FILE *outfile, const WCHAR *name ) /* output the resource definitions */ void output_resources( FILE *outfile, DLLSPEC *spec ) { - int i, j, k, nb_id_types; - unsigned int n, offset, data_offset; + int j, k, nb_id_types; + unsigned int i, n, offset, data_offset; struct res_tree *tree; struct res_type *type; struct res_name *name; diff --git a/reactos/tools/winebuild/spec32.c b/reactos/tools/winebuild/spec32.c index 222cdabe500..6fb1f4ae0ef 100644 --- a/reactos/tools/winebuild/spec32.c +++ b/reactos/tools/winebuild/spec32.c @@ -846,8 +846,11 @@ void BuildDef32File( FILE *outfile, DLLSPEC *spec ) const char *name; int i; - fprintf(outfile, "; File generated automatically from %s; do not edit!\n\n", - input_file_name ); + if (spec_file_name) + fprintf( outfile, "; File generated automatically from %s; do not edit!\n\n", + spec_file_name ); + else + fprintf( outfile, "; File generated automatically; do not edit!\n\n" ); fprintf(outfile, "LIBRARY %s\n\n", spec->file_name); diff --git a/reactos/tools/winebuild/utils.c b/reactos/tools/winebuild/utils.c index bf71941ee0d..79b3899d97e 100644 --- a/reactos/tools/winebuild/utils.c +++ b/reactos/tools/winebuild/utils.c @@ -48,7 +48,7 @@ void *xmalloc (size_t size) void *xrealloc (void *ptr, size_t size) { void *res = realloc (ptr, size); - if (res == NULL) + if (size && res == NULL) { fprintf (stderr, "Virtual memory exhausted.\n"); exit (1); @@ -145,9 +145,9 @@ void warning( const char *msg, ... ) /* output a standard header for generated files */ void output_standard_file_header( FILE *outfile ) { - if (input_file_name) + if (spec_file_name) fprintf( outfile, "/* File generated automatically from %s; do not edit! */\n", - input_file_name ); + spec_file_name ); else fprintf( outfile, "/* File generated automatically; do not edit! */\n" ); fprintf( outfile, diff --git a/reactos/tools/wrc/dumpres.c b/reactos/tools/wrc/dumpres.c index 53cc64eba3b..914b10d3acf 100644 --- a/reactos/tools/wrc/dumpres.c +++ b/reactos/tools/wrc/dumpres.c @@ -78,13 +78,13 @@ const char *get_typename(const resource_t* r) * Remarks : No codepage translation is done. ***************************************************************************** */ -static char *strncpyWtoA(char *cs, const short *ws, int maxlen) +static char *strncpyWtoA(char *cs, WCHAR *ws, int maxlen) { char *cptr = cs; - const short *wsMax = ws + maxlen - 1; + WCHAR *wsMax = ws + maxlen - 1; while(*ws && ws < wsMax) { - if(*ws < -128 || *ws > 127) + if((short)*ws < -128 || (short)*ws > 127) fprintf(stderr, "***Warning: Unicode string contains non-printable chars***\n"); *cptr++ = (char)*ws++; } diff --git a/reactos/tools/wrc/genres.c b/reactos/tools/wrc/genres.c index 7a33e923aae..88a9ce149f9 100644 --- a/reactos/tools/wrc/genres.c +++ b/reactos/tools/wrc/genres.c @@ -1755,7 +1755,7 @@ char *prep_nid_for_label(const name_id_t *nid) if(nid->type == name_str && nid->name.s_name->type == str_unicode) { - short *sptr; + WCHAR *sptr; int i; sptr = nid->name.s_name->str.wstr; buf[0] = '\0'; diff --git a/reactos/tools/wrc/lex.yy.c b/reactos/tools/wrc/lex.yy.c index 9b2a62725ca..caa5f3efe5c 100644 --- a/reactos/tools/wrc/lex.yy.c +++ b/reactos/tools/wrc/lex.yy.c @@ -9,7 +9,8 @@ #define YY_FLEX_MINOR_VERSION 5 #include -#include +#include + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus @@ -22,9 +23,6 @@ #ifdef __cplusplus #include -#ifndef _WIN32 -#include -#endif /* Use prototypes in function declarations. */ #define YY_USE_PROTOS @@ -64,7 +62,6 @@ #define YY_PROTO(proto) () #endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -6887,7 +6884,7 @@ static yyconst short int yy_rule_linenum[92] = #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "parser.l" +#line 1 "./parser.l" #define INITIAL 0 /* -*-C-*- * @@ -6989,7 +6986,7 @@ char *yytext; #define YY_STACK_USED 1 #define YY_NEVER_INTERACTIVE 1 /* Some shortcut definitions */ -#line 97 "parser.l" +#line 97 "./parser.l" /*#define LEX_DEBUG*/ @@ -7197,7 +7194,7 @@ static struct keyword *iskeyword(char *kw) * The flexer starts here ************************************************************************** */ -#line 7201 "lex.yy.c" +#line 7198 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -7297,20 +7294,9 @@ YY_MALLOC_DECL YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - } + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -7359,10 +7345,10 @@ YY_MALLOC_DECL YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; + register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 306 "parser.l" +#line 306 "./parser.l" /* * Catch the GCC-style line statements here and parse them. @@ -7382,7 +7368,7 @@ YY_DECL * because we only want to know the linenumber and * filename. */ -#line 7386 "lex.yy.c" +#line 7372 "lex.yy.c" if ( yy_init ) { @@ -7471,17 +7457,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 325 "parser.l" +#line 325 "./parser.l" yy_push_state(pp_pragma); YY_BREAK case 2: YY_RULE_SETUP -#line 326 "parser.l" +#line 326 "./parser.l" yy_push_state(pp_line); YY_BREAK case 3: YY_RULE_SETUP -#line 327 "parser.l" +#line 327 "./parser.l" { int lineno; char *cptr; @@ -7504,22 +7490,22 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 347 "parser.l" +#line 347 "./parser.l" yyless(9); yy_pop_state(); yy_push_state(pp_code_page); YY_BREAK case 5: YY_RULE_SETUP -#line 348 "parser.l" +#line 348 "./parser.l" yy_pop_state(); if (pedantic) yywarning("Unrecognized #pragma directive '%s'",yytext); YY_BREAK case 6: YY_RULE_SETUP -#line 350 "parser.l" +#line 350 "./parser.l" current_codepage = -1; yy_pop_state(); YY_BREAK case 7: YY_RULE_SETUP -#line 351 "parser.l" +#line 351 "./parser.l" { char *p = yytext; yy_pop_state(); @@ -7534,7 +7520,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 362 "parser.l" +#line 362 "./parser.l" yy_pop_state(); yyerror("Malformed #pragma code_page directive"); YY_BREAK /* @@ -7544,42 +7530,42 @@ yy_pop_state(); yyerror("Malformed #pragma code_page directive"); */ case 9: YY_RULE_SETUP -#line 369 "parser.l" +#line 369 "./parser.l" stripslevel++; YY_BREAK case 10: YY_RULE_SETUP -#line 370 "parser.l" +#line 370 "./parser.l" stripslevel--; YY_BREAK case 11: YY_RULE_SETUP -#line 371 "parser.l" +#line 371 "./parser.l" if(!stripslevel) yy_pop_state(); YY_BREAK case 12: YY_RULE_SETUP -#line 372 "parser.l" +#line 372 "./parser.l" ; /* To catch comments */ YY_BREAK case 13: YY_RULE_SETUP -#line 373 "parser.l" +#line 373 "./parser.l" ; /* Ignore rest */ YY_BREAK case 14: YY_RULE_SETUP -#line 374 "parser.l" +#line 374 "./parser.l" line_number++; char_number = 1; YY_BREAK case 15: YY_RULE_SETUP -#line 376 "parser.l" +#line 376 "./parser.l" stripplevel++; YY_BREAK case 16: YY_RULE_SETUP -#line 377 "parser.l" +#line 377 "./parser.l" { stripplevel--; if(!stripplevel) @@ -7591,62 +7577,62 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 385 "parser.l" +#line 385 "./parser.l" ; /* To catch comments */ YY_BREAK case 18: YY_RULE_SETUP -#line 386 "parser.l" +#line 386 "./parser.l" ; /* Ignore rest */ YY_BREAK case 19: YY_RULE_SETUP -#line 387 "parser.l" +#line 387 "./parser.l" line_number++; char_number = 1; YY_BREAK case 20: YY_RULE_SETUP -#line 389 "parser.l" +#line 389 "./parser.l" ; /* Ignore */ YY_BREAK case 21: YY_RULE_SETUP -#line 390 "parser.l" +#line 390 "./parser.l" yy_pop_state(); /* Kill the semicolon */ YY_BREAK case 22: YY_RULE_SETUP -#line 391 "parser.l" +#line 391 "./parser.l" line_number++; char_number = 1; yy_pop_state(); YY_BREAK case 23: YY_RULE_SETUP -#line 392 "parser.l" +#line 392 "./parser.l" yyless(0); yy_pop_state(); YY_BREAK case 24: YY_RULE_SETUP -#line 394 "parser.l" +#line 394 "./parser.l" return tBEGIN; YY_BREAK case 25: YY_RULE_SETUP -#line 395 "parser.l" +#line 395 "./parser.l" return tEND; YY_BREAK case 26: YY_RULE_SETUP -#line 397 "parser.l" +#line 397 "./parser.l" { yylval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } YY_BREAK case 27: YY_RULE_SETUP -#line 398 "parser.l" +#line 398 "./parser.l" { yylval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } YY_BREAK case 28: YY_RULE_SETUP -#line 399 "parser.l" +#line 399 "./parser.l" { yylval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } YY_BREAK /* @@ -7658,7 +7644,7 @@ YY_RULE_SETUP */ case 29: YY_RULE_SETUP -#line 408 "parser.l" +#line 408 "./parser.l" { struct keyword *tok = iskeyword(yytext); @@ -7681,7 +7667,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 427 "parser.l" +#line 427 "./parser.l" yylval.str = make_string(yytext); return tFILENAME; YY_BREAK /* @@ -7689,7 +7675,7 @@ yylval.str = make_string(yytext); return tFILENAME; */ case 31: YY_RULE_SETUP -#line 432 "parser.l" +#line 432 "./parser.l" { yy_push_state(yylstr); wbufidx = 0; @@ -7698,10 +7684,10 @@ YY_RULE_SETUP } YY_BREAK case 32: -#line 439 "parser.l" +#line 439 "./parser.l" case 33: YY_RULE_SETUP -#line 439 "parser.l" +#line 439 "./parser.l" { yy_pop_state(); yylval.str = get_buffered_wstring(); @@ -7710,7 +7696,7 @@ YY_RULE_SETUP YY_BREAK case 34: YY_RULE_SETUP -#line 444 "parser.l" +#line 444 "./parser.l" { /* octal escape sequence */ unsigned int result; result = strtoul(yytext+1, 0, 8); @@ -7721,7 +7707,7 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 451 "parser.l" +#line 451 "./parser.l" { /* hex escape sequence */ unsigned int result; result = strtoul(yytext+2, 0, 16); @@ -7730,82 +7716,82 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 456 "parser.l" +#line 456 "./parser.l" { yyerror("Invalid hex escape sequence '%s'", yytext); } YY_BREAK case 37: YY_RULE_SETUP -#line 458 "parser.l" +#line 458 "./parser.l" yyerror("Bad escape sequence"); YY_BREAK case 38: YY_RULE_SETUP -#line 459 "parser.l" +#line 459 "./parser.l" line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ YY_BREAK case 39: YY_RULE_SETUP -#line 460 "parser.l" +#line 460 "./parser.l" addwchar('\a'); YY_BREAK case 40: YY_RULE_SETUP -#line 461 "parser.l" +#line 461 "./parser.l" addwchar('\b'); YY_BREAK case 41: YY_RULE_SETUP -#line 462 "parser.l" +#line 462 "./parser.l" addwchar('\f'); YY_BREAK case 42: YY_RULE_SETUP -#line 463 "parser.l" +#line 463 "./parser.l" addwchar('\n'); YY_BREAK case 43: YY_RULE_SETUP -#line 464 "parser.l" +#line 464 "./parser.l" addwchar('\r'); YY_BREAK case 44: YY_RULE_SETUP -#line 465 "parser.l" +#line 465 "./parser.l" addwchar('\t'); YY_BREAK case 45: YY_RULE_SETUP -#line 466 "parser.l" +#line 466 "./parser.l" addwchar('\v'); YY_BREAK case 46: YY_RULE_SETUP -#line 467 "parser.l" +#line 467 "./parser.l" addwchar(yytext[1]); YY_BREAK case 47: YY_RULE_SETUP -#line 468 "parser.l" +#line 468 "./parser.l" addwchar(yytext[2]); line_number++; char_number = 1; YY_BREAK case 48: YY_RULE_SETUP -#line 469 "parser.l" +#line 469 "./parser.l" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */ YY_BREAK case 49: YY_RULE_SETUP -#line 470 "parser.l" +#line 470 "./parser.l" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */ YY_BREAK case 50: YY_RULE_SETUP -#line 471 "parser.l" +#line 471 "./parser.l" ; /* "bla" "bla" -> "blabla" */ YY_BREAK case 51: YY_RULE_SETUP -#line 472 "parser.l" +#line 472 "./parser.l" { char *yptr = yytext; while(*yptr) /* FIXME: codepage translation */ @@ -7814,7 +7800,7 @@ YY_RULE_SETUP YY_BREAK case 52: YY_RULE_SETUP -#line 477 "parser.l" +#line 477 "./parser.l" yyerror("Unterminated string"); YY_BREAK /* @@ -7822,14 +7808,14 @@ yyerror("Unterminated string"); */ case 53: YY_RULE_SETUP -#line 482 "parser.l" +#line 482 "./parser.l" yy_push_state(yystr); cbufidx = 0; YY_BREAK case 54: -#line 484 "parser.l" +#line 484 "./parser.l" case 55: YY_RULE_SETUP -#line 484 "parser.l" +#line 484 "./parser.l" { yy_pop_state(); yylval.str = get_buffered_cstring(); @@ -7838,7 +7824,7 @@ YY_RULE_SETUP YY_BREAK case 56: YY_RULE_SETUP -#line 489 "parser.l" +#line 489 "./parser.l" { /* octal escape sequence */ int result; result = strtol(yytext+1, 0, 8); @@ -7849,7 +7835,7 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 496 "parser.l" +#line 496 "./parser.l" { /* hex escape sequence */ int result; result = strtol(yytext+2, 0, 16); @@ -7858,67 +7844,67 @@ YY_RULE_SETUP YY_BREAK case 58: YY_RULE_SETUP -#line 501 "parser.l" +#line 501 "./parser.l" { yyerror("Invalid hex escape sequence '%s'", yytext); } YY_BREAK case 59: YY_RULE_SETUP -#line 503 "parser.l" +#line 503 "./parser.l" yyerror("Bad escape sequence"); YY_BREAK case 60: YY_RULE_SETUP -#line 504 "parser.l" +#line 504 "./parser.l" line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ YY_BREAK case 61: YY_RULE_SETUP -#line 505 "parser.l" +#line 505 "./parser.l" addcchar('\a'); YY_BREAK case 62: YY_RULE_SETUP -#line 506 "parser.l" +#line 506 "./parser.l" addcchar('\b'); YY_BREAK case 63: YY_RULE_SETUP -#line 507 "parser.l" +#line 507 "./parser.l" addcchar('\f'); YY_BREAK case 64: YY_RULE_SETUP -#line 508 "parser.l" +#line 508 "./parser.l" addcchar('\n'); YY_BREAK case 65: YY_RULE_SETUP -#line 509 "parser.l" +#line 509 "./parser.l" addcchar('\r'); YY_BREAK case 66: YY_RULE_SETUP -#line 510 "parser.l" +#line 510 "./parser.l" addcchar('\t'); YY_BREAK case 67: YY_RULE_SETUP -#line 511 "parser.l" +#line 511 "./parser.l" addcchar('\v'); YY_BREAK case 68: YY_RULE_SETUP -#line 512 "parser.l" +#line 512 "./parser.l" addcchar(yytext[1]); YY_BREAK case 69: YY_RULE_SETUP -#line 513 "parser.l" +#line 513 "./parser.l" addcchar(yytext[2]); line_number++; char_number = 1; YY_BREAK case 70: YY_RULE_SETUP -#line 514 "parser.l" +#line 514 "./parser.l" { char *yptr = yytext; while(*yptr) @@ -7927,22 +7913,22 @@ YY_RULE_SETUP YY_BREAK case 71: YY_RULE_SETUP -#line 519 "parser.l" +#line 519 "./parser.l" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */ YY_BREAK case 72: YY_RULE_SETUP -#line 520 "parser.l" +#line 520 "./parser.l" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */ YY_BREAK case 73: YY_RULE_SETUP -#line 521 "parser.l" +#line 521 "./parser.l" ; /* "bla" "bla" -> "blabla" */ YY_BREAK case 74: YY_RULE_SETUP -#line 522 "parser.l" +#line 522 "./parser.l" yyerror("Unterminated string"); YY_BREAK /* @@ -7950,12 +7936,12 @@ yyerror("Unterminated string"); */ case 75: YY_RULE_SETUP -#line 527 "parser.l" +#line 527 "./parser.l" yy_push_state(yyrcd); cbufidx = 0; YY_BREAK case 76: YY_RULE_SETUP -#line 528 "parser.l" +#line 528 "./parser.l" { yy_pop_state(); yylval.raw = new_raw_data(); @@ -7967,7 +7953,7 @@ YY_RULE_SETUP YY_BREAK case 77: YY_RULE_SETUP -#line 536 "parser.l" +#line 536 "./parser.l" { int result; result = strtol(yytext, 0, 16); @@ -7976,17 +7962,17 @@ YY_RULE_SETUP YY_BREAK case 78: YY_RULE_SETUP -#line 541 "parser.l" +#line 541 "./parser.l" ; /* Ignore space */ YY_BREAK case 79: YY_RULE_SETUP -#line 542 "parser.l" +#line 542 "./parser.l" line_number++; char_number = 1; YY_BREAK case 80: YY_RULE_SETUP -#line 543 "parser.l" +#line 543 "./parser.l" yyerror("Malformed data-line"); YY_BREAK /* @@ -7995,7 +7981,7 @@ yyerror("Malformed data-line"); */ case 81: YY_RULE_SETUP -#line 549 "parser.l" +#line 549 "./parser.l" { yy_push_state(comment); save_wanted_id = wanted_id; @@ -8005,37 +7991,37 @@ YY_RULE_SETUP YY_BREAK case 82: YY_RULE_SETUP -#line 555 "parser.l" +#line 555 "./parser.l" ; YY_BREAK case 83: YY_RULE_SETUP -#line 556 "parser.l" +#line 556 "./parser.l" ; YY_BREAK case 84: YY_RULE_SETUP -#line 557 "parser.l" +#line 557 "./parser.l" line_number++; char_number = 1; YY_BREAK case 85: YY_RULE_SETUP -#line 558 "parser.l" +#line 558 "./parser.l" yy_pop_state(); want_id = save_wanted_id; YY_BREAK case 86: YY_RULE_SETUP -#line 560 "parser.l" +#line 560 "./parser.l" want_id = wanted_id; /* not really comment, but left-over c-junk */ YY_BREAK case 87: YY_RULE_SETUP -#line 561 "parser.l" +#line 561 "./parser.l" want_id = wanted_id; if(!no_preprocess) yywarning("Found comments after preprocessing, please report"); YY_BREAK case 88: YY_RULE_SETUP -#line 563 "parser.l" +#line 563 "./parser.l" { want_id = wanted_id; line_number++; @@ -8049,12 +8035,12 @@ YY_RULE_SETUP YY_BREAK case 89: YY_RULE_SETUP -#line 573 "parser.l" +#line 573 "./parser.l" want_id = wanted_id; /* Eat whitespace */ YY_BREAK case 90: YY_RULE_SETUP -#line 575 "parser.l" +#line 575 "./parser.l" return yytext[0]; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -8069,7 +8055,7 @@ case YY_STATE_EOF(pp_stripp_final): case YY_STATE_EOF(pp_line): case YY_STATE_EOF(pp_pragma): case YY_STATE_EOF(pp_code_page): -#line 577 "parser.l" +#line 577 "./parser.l" { if(YY_START == pp_strips || YY_START == pp_stripe || YY_START == pp_stripp || YY_START == pp_stripp_final) yyerror("Unexpected end of file during c-junk scanning (started at %d)", cjunk_tagline); @@ -8079,7 +8065,7 @@ case YY_STATE_EOF(pp_code_page): YY_BREAK case 91: YY_RULE_SETUP -#line 584 "parser.l" +#line 584 "./parser.l" { /* Catch all rule to find any unmatched text */ if(*yytext == '\n') @@ -8093,10 +8079,10 @@ YY_RULE_SETUP YY_BREAK case 92: YY_RULE_SETUP -#line 595 "parser.l" +#line 595 "./parser.l" ECHO; YY_BREAK -#line 8100 "lex.yy.c" +#line 8086 "lex.yy.c" case YY_END_OF_BUFFER: { @@ -8472,6 +8458,7 @@ register char *yy_bp; #endif /* ifndef YY_NO_UNPUT */ +#ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else @@ -8544,7 +8531,7 @@ static int input() return c; } - +#endif /* YY_NO_INPUT */ #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -8655,15 +8642,6 @@ YY_BUFFER_STATE b; } -#ifndef _WIN32 -#include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif -#endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) @@ -8981,7 +8959,7 @@ int main() return 0; } #endif -#line 595 "parser.l" +#line 595 "./parser.l" #ifndef yywrap diff --git a/reactos/tools/wrc/newstruc.c b/reactos/tools/wrc/newstruc.c index c9c056082f1..46d0a6ce3e4 100644 --- a/reactos/tools/wrc/newstruc.c +++ b/reactos/tools/wrc/newstruc.c @@ -858,8 +858,8 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt) /* We only go through the RIFF file if we need to swap * bytes in words/dwords. Else we couldn't care less * what the file contains. This is consistent with - * MS' rc.exe, which doesn't complain at all, eventhough - * the fileformat might not be entirely correct. + * MS' rc.exe, which doesn't complain at all, even though + * the file format might not be entirely correct. */ rtp++; /* Skip the "RIFF" tag */ diff --git a/reactos/tools/wrc/parser.y b/reactos/tools/wrc/parser.y index 2e2c40c2a2b..7eb3d01fc21 100644 --- a/reactos/tools/wrc/parser.y +++ b/reactos/tools/wrc/parser.y @@ -1283,12 +1283,12 @@ item_definitions */ item_options : /* Empty */ { $$ = 0; } - | ',' tCHECKED item_options { $$ = $3 | MF_CHECKED; } - | ',' tGRAYED item_options { $$ = $3 | MF_GRAYED; } - | ',' tHELP item_options { $$ = $3 | MF_HELP; } - | ',' tINACTIVE item_options { $$ = $3 | MF_DISABLED; } - | ',' tMENUBARBREAK item_options { $$ = $3 | MF_MENUBARBREAK; } - | ',' tMENUBREAK item_options { $$ = $3 | MF_MENUBREAK; } + | opt_comma tCHECKED item_options { $$ = $3 | MF_CHECKED; } + | opt_comma tGRAYED item_options { $$ = $3 | MF_GRAYED; } + | opt_comma tHELP item_options { $$ = $3 | MF_HELP; } + | opt_comma tINACTIVE item_options { $$ = $3 | MF_DISABLED; } + | opt_comma tMENUBARBREAK item_options { $$ = $3 | MF_MENUBARBREAK; } + | opt_comma tMENUBREAK item_options { $$ = $3 | MF_MENUBREAK; } ; /* ------------------------------ MenuEx ------------------------------ */ diff --git a/reactos/tools/wrc/readres.c b/reactos/tools/wrc/readres.c index ae80cf20203..993e1d3eee2 100644 --- a/reactos/tools/wrc/readres.c +++ b/reactos/tools/wrc/readres.c @@ -232,7 +232,7 @@ static resource_t *read_res32(FILE *fp) str = new_string(); str->type = str_unicode; str->size = (idx - tag) / 2; - str->str.wstr = (short *)xmalloc(idx-tag+2); + str->str.wstr = (WCHAR *)xmalloc(idx-tag+2); memcpy(str->str.wstr, &res->data[tag], idx-tag); str->str.wstr[str->size] = 0; type = new_name_id(); @@ -266,7 +266,7 @@ static resource_t *read_res32(FILE *fp) str = new_string(); str->type = str_unicode; str->size = (idx - tag) / 2; - str->str.wstr = (short *)xmalloc(idx-tag+2); + str->str.wstr = (WCHAR *)xmalloc(idx-tag+2); memcpy(str->str.wstr, &res->data[tag], idx-tag); str->str.wstr[str->size] = 0; name = new_name_id(); diff --git a/reactos/tools/wrc/y.tab.c b/reactos/tools/wrc/y.tab.c index 0ad3f05174d..1905fbe9f84 100644 --- a/reactos/tools/wrc/y.tab.c +++ b/reactos/tools/wrc/y.tab.c @@ -634,7 +634,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 696 +#define YYLAST 669 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 96 @@ -791,9 +791,9 @@ static const short yyrhs[] = 93, 175, -1, 15, 164, 167, 143, -1, 80, 144, 81, -1, -1, 144, 74, 6, 154, 175, 145, -1, 144, 74, 76, -1, 144, 75, 6, 145, 143, -1, - -1, 93, 48, 145, -1, 93, 47, 145, -1, 93, - 77, 145, -1, 93, 49, 145, -1, 93, 72, 145, - -1, 93, 73, 145, -1, 16, 164, 167, 147, -1, + -1, 154, 48, 145, -1, 154, 47, 145, -1, 154, + 77, 145, -1, 154, 49, 145, -1, 154, 72, 145, + -1, 154, 73, 145, -1, 16, 164, 167, 147, -1, 80, 148, 81, -1, -1, 148, 74, 6, 149, -1, 148, 74, 76, -1, 148, 75, 6, 150, 147, -1, -1, 93, 175, -1, 93, 174, 93, 174, 145, -1, @@ -1007,20 +1007,20 @@ static const unsigned short yydefact[] = 190, 191, 188, 192, 0, 217, 221, 0, 46, 0, 227, 229, 224, 0, 0, 0, 0, 0, 151, 0, 0, 164, 0, 0, 0, 184, 194, 0, 0, 0, - 232, 234, 236, 231, 0, 0, 0, 182, 154, 156, + 232, 234, 236, 231, 0, 0, 0, 182, 154, 182, 169, 167, 173, 0, 0, 0, 204, 50, 50, 233, 235, 0, 0, 0, 0, 0, 239, 166, 239, 0, - 0, 0, 196, 0, 0, 48, 49, 61, 145, 156, - 156, 156, 156, 156, 156, 156, 155, 0, 170, 0, + 0, 0, 196, 0, 0, 48, 49, 61, 145, 182, + 155, 182, 182, 182, 182, 182, 182, 0, 170, 0, 174, 168, 0, 0, 0, 206, 0, 203, 56, 55, 57, 58, 59, 54, 51, 52, 0, 0, 109, 153, 158, 157, 160, 161, 162, 159, 239, 239, 0, 0, 0, 195, 198, 197, 205, 0, 0, 0, 0, 0, - 0, 0, 71, 65, 68, 69, 70, 146, 0, 156, + 0, 0, 71, 65, 68, 69, 70, 146, 0, 182, 240, 0, 175, 186, 187, 0, 53, 13, 67, 12, 0, 15, 14, 66, 64, 0, 0, 63, 104, 62, 0, 0, 0, 0, 0, 0, 0, 120, 113, 114, - 117, 118, 119, 0, 171, 239, 0, 0, 105, 253, + 117, 118, 119, 183, 171, 239, 0, 0, 105, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 116, 0, 115, 112, 111, 110, 0, 172, @@ -1052,8 +1052,8 @@ static const short yydefgoto[] = 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 166, 245, 274, 275, 67, 276, 330, 390, 399, 508, 404, 303, 528, 327, 481, 68, 308, 378, 452, - 438, 447, 551, 278, 339, 502, 69, 152, 175, 235, - 70, 154, 176, 237, 239, 16, 17, 85, 146, 71, + 438, 447, 551, 278, 339, 502, 69, 152, 175, 234, + 70, 154, 176, 237, 239, 16, 17, 85, 235, 71, 134, 184, 206, 264, 293, 383, 72, 243, 22, 80, 81, 124, 113, 114, 115, 125, 172, 126, 257, 319, 19, 20 @@ -1061,79 +1061,79 @@ static const short yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -523 +#define YYPACT_NINF -399 static const short yypact[] = { - -523, 5, 13, -523, -523, -523, -523, -523, -523, -523, - 284, 284, 284, 93, 284, -523, -523, -69, -523, 600, - -523, 392, 639, 284, -523, -523, -523, -523, 554, -523, - 392, 284, 284, 284, 284, 284, 284, 284, -523, -523, - -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, - -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, - -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, - -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, - -523, -523, 122, -66, -523, 108, -523, 391, 357, 138, - 27, 27, -523, -523, 639, 524, 524, 33, 33, 639, - 639, 524, 524, 639, 524, 524, 524, 33, 524, 524, - 284, 284, 284, -523, -523, -523, 284, -523, -58, 210, - -523, -523, -523, -523, 242, -523, -523, -523, 35, 42, - 254, 273, -523, -523, 448, -523, -523, -523, 50, -523, - -523, -523, -523, 59, -523, -523, 159, -523, 19, 284, - 284, -523, -523, -523, -523, 284, 284, 284, 284, 284, - 284, 284, -523, 284, 284, -523, 171, -523, -523, -523, - -523, 267, -67, 75, 78, -10, 172, 88, 104, -523, - -523, -523, -523, -523, 1, -523, -523, 116, -523, 121, - -523, -523, -523, 63, 284, 284, 0, 184, -523, 2, - 211, -523, 284, 284, 231, -523, -523, 287, 284, 284, - -523, -523, -523, -523, 311, 157, 162, -58, -523, 166, - 167, -523, 170, 176, 185, 203, -523, 198, 198, -523, - -523, 284, 284, 284, 131, 214, 284, -523, 284, 221, - 284, 284, -523, 201, 405, -523, -523, -523, 226, 166, - 166, 166, 166, 166, 166, 166, -523, 230, 233, 234, - 233, -523, 245, 246, 51, -523, 284, -523, -523, -523, - -523, -523, -523, -523, 247, -523, 376, 284, -523, -523, - -523, -523, -523, -523, -523, -523, 284, 284, 284, 284, - 325, -523, -523, -523, -523, 405, 206, 284, 39, 329, - 294, 294, -523, -523, -523, -523, -523, -523, 432, 249, - -523, 256, 233, -523, -523, 259, -523, -523, -523, -523, - 261, -523, -523, -523, -523, 284, 294, 265, 600, 265, - 563, 206, 284, 39, 351, 294, 294, -523, -523, -523, - -523, -523, -523, 97, -523, 284, 217, 352, 391, -523, - -4, 554, 294, 39, 353, 353, 353, 353, 353, 353, - 353, 353, 353, 284, 284, 284, 39, 284, 353, 353, - 353, -523, -523, 271, -523, -523, 265, 265, 581, -523, - 275, 233, -523, 276, -523, -523, -523, -523, -58, -58, - -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, - 286, -523, -523, -58, -523, -523, -523, -523, -523, 354, - 39, 360, 360, 360, 360, 360, 360, 360, 360, 360, - 284, 284, 284, 39, 284, 360, 360, 360, -523, 284, - 284, 284, 284, 284, 284, 289, -58, -58, -523, -523, - -523, -523, -523, -523, -523, -523, -523, -523, 290, -523, - -523, -58, -523, -523, -523, -523, -523, -523, -523, 293, - 296, 297, 299, 284, 284, 284, 284, 284, 284, 284, - 284, 238, 301, 302, 305, 307, 308, 319, 323, 324, - -523, 328, -523, 284, 284, 284, 284, 238, 284, 284, - 284, 294, 330, 331, 332, 333, 340, 359, 361, 364, - -64, 284, -523, 284, 284, 284, 294, 284, -523, 284, - 284, 284, -523, 359, 365, 366, -23, 367, 378, 379, - 380, -523, 284, 284, 284, 284, 284, 294, -523, 284, - 396, 379, 404, 407, 379, -20, 411, 284, 226, 284, - 294, -523, 294, 284, 379, 313, 413, 28, 265, 417, - 226, -523, -523, 284, 294, 284, 313, 436, 265, 440, - -523, 284, 294, 152, 265, 294, -523, 80, 313, -523 + -399, 11, 13, -399, -399, -399, -399, -399, -399, -399, + 207, 207, 207, 37, 207, -399, -399, -66, -399, 351, + -399, 363, 612, 207, -399, -399, -399, -399, 564, -399, + 363, 207, 207, 207, 207, 207, 207, 207, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -399, 361, -46, -399, 108, -399, 445, 469, 311, + 49, 49, -399, -399, 612, 282, 282, 33, 33, 612, + 612, 282, 282, 612, 282, 282, 282, 33, 282, 282, + 207, 207, 207, -399, -399, -399, 207, -399, -15, 38, + -399, -399, -399, -399, 182, -399, -399, -399, 1, 28, + 236, 243, -399, -399, 448, -399, -399, -399, 42, -399, + -399, -399, -399, 51, -399, -399, 75, -399, 58, 207, + 207, -399, -399, -399, -399, 207, 207, 207, 207, 207, + 207, 207, -399, 207, 207, -399, 87, -399, -399, -399, + -399, 138, -21, 70, 74, -62, 41, 98, 103, -399, + -399, -399, -399, -399, 30, -399, -399, 115, -399, 117, + -399, -399, -399, 64, 207, 207, -1, 209, -399, 0, + 213, -399, 207, 207, 222, -399, -399, 268, 207, 207, + -399, -399, -399, -399, 167, 123, 142, -15, -399, -57, + 144, -399, 151, 159, 168, 100, -399, 170, 170, -399, + -399, 207, 207, 207, 194, 178, 207, -399, 207, 200, + 207, 207, -399, 60, 500, -399, -399, -399, 190, 276, + -399, 398, 398, 398, 398, 398, 398, 198, 217, 224, + 217, -399, 231, 234, -33, -399, 207, -399, -399, -399, + -399, -399, -399, -399, 249, -399, 332, 207, -399, -399, + -399, -399, -399, -399, -399, -399, 207, 207, 207, 207, + 296, -399, -399, -399, -399, 500, 127, 207, 39, 305, + 228, 228, -399, -399, -399, -399, -399, -399, 343, 419, + -399, 256, 217, -399, -399, 259, -399, -399, -399, -399, + 261, -399, -399, -399, -399, 207, 228, 246, 351, 246, + 563, 127, 207, 39, 354, 228, 228, -399, -399, -399, + -399, -399, -399, 207, -399, 207, 179, 360, 445, -399, + 93, 564, 228, 39, 362, 362, 362, 362, 362, 362, + 362, 362, 362, 207, 207, 207, 39, 207, 362, 362, + 362, -399, -399, 266, -399, -399, 246, 246, 581, -399, + 278, 217, -399, 290, -399, -399, -399, -399, -15, -15, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + 294, -399, -399, -15, -399, -399, -399, -399, -399, 382, + 39, 383, 383, 383, 383, 383, 383, 383, 383, 383, + 207, 207, 207, 39, 207, 383, 383, 383, -399, 207, + 207, 207, 207, 207, 207, 317, -15, -15, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, 321, -399, + -399, -15, -399, -399, -399, -399, -399, -399, -399, 322, + 333, 349, 350, 207, 207, 207, 207, 207, 207, 207, + 207, 218, 377, 387, 396, 397, 399, 402, 403, 404, + -399, 405, -399, 207, 207, 207, 207, 218, 207, 207, + 207, 228, 411, 413, 417, 432, 446, 447, 449, 455, + 165, 207, -399, 207, 207, 207, 228, 207, -399, 207, + 207, 207, -399, 447, 456, 459, 166, 468, 478, 479, + 480, -399, 207, 207, 207, 207, 207, 228, -399, 207, + 482, 479, 486, 487, 479, 174, 488, 207, 190, 207, + 228, -399, 228, 207, 479, 353, 490, 188, 246, 491, + 190, -399, -399, 207, 228, 207, 353, 538, 246, 539, + -399, 207, 228, 86, 246, 228, -399, 189, 353, -399 }; /* YYPGOTO[NTERM-NUM]. */ static const short yypgoto[] = { - -523, -523, -523, -523, -523, 369, -283, -292, 468, -523, - -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, - -523, -523, 306, -523, 241, -523, -523, -523, 295, -116, - 12, -523, 232, -522, -286, 52, -523, -523, -523, -523, - 255, -112, -328, -416, -523, -523, -523, 303, -523, -113, - -523, 304, -523, -523, -523, -523, -523, -523, -170, -523, - -523, -523, 278, -523, -523, -523, -523, -523, 582, -523, - -523, -19, -272, -269, -214, -396, -523, 462, -228, -2, + -399, -399, -399, -399, -399, 426, -292, -163, 508, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -399, 248, -399, 335, -399, -399, -399, 208, 44, + 121, -399, 346, -291, -286, 153, -399, -399, -399, -399, + 210, 53, -381, -398, -399, -399, -399, 421, -399, -227, + -399, 418, -399, -399, -399, -399, -399, -399, -111, -399, + -399, -399, 392, -399, -399, -399, -399, -399, 406, -399, + -399, -20, -273, -211, -148, -359, -399, 537, -228, -2, 20, -12 }; @@ -1144,150 +1144,144 @@ static const short yypgoto[] = #define YYTABLE_NINF -241 static const short yytable[] = { - 18, 27, 193, 82, 304, 3, 217, 305, 220, 538, - 259, 29, 541, 318, 192, 329, 4, 5, 6, 352, - 7, 83, 550, 167, 168, 169, 145, 116, 170, 511, - 24, 25, 26, 8, 28, 145, 340, 5, 6, 341, - 350, 374, 204, 5, 6, 321, 317, 233, 372, 376, + 18, 27, 82, 304, 318, 217, 220, 146, 204, 290, + 259, 3, 196, 197, 29, 329, 4, 5, 6, 198, + 7, 83, 279, -156, 280, 281, 282, 283, 284, 285, + 24, 25, 26, 8, 28, 340, 145, 5, 6, 372, + 350, 5, 6, 5, 6, 321, 317, 116, 291, 376, 377, 87, 88, 89, 90, 91, 92, 93, 309, 311, - 352, 388, 306, 352, 196, 197, 387, 210, 211, 212, - 524, 198, 213, 542, 403, 119, 218, 9, 221, 352, - 130, 131, 205, 118, 73, 74, 75, 76, 77, 78, - 79, 386, 204, 290, 342, 128, 129, 5, 6, 10, - 11, 5, 6, 12, 13, 138, 171, 14, 141, 142, - 143, 352, 5, 6, 144, 36, 37, 380, 436, 10, - 11, 554, 545, 12, 13, 10, 11, 14, 149, 12, - 13, 451, 291, 14, 556, 150, 279, 280, 281, 282, - 283, 284, 285, 163, 250, 251, 252, 173, 174, 552, - 214, 568, 164, 177, 178, 179, 180, 181, 182, 183, - 552, 185, 186, 352, 189, 165, 207, 552, 194, 253, - 254, 195, 552, 277, 255, 5, 6, 187, 250, 251, - 252, 202, 110, 10, 11, 111, 112, 12, 13, 117, - 219, 14, 215, 216, 10, 11, 344, 203, 12, 13, - 223, 224, 14, 253, 254, 500, 227, 228, 255, 208, - 5, 6, -217, 317, 209, -217, -217, 222, 431, 432, - 516, 5, 6, 382, 34, 35, 36, 37, 560, 247, - 248, 249, -217, 434, 258, 566, 260, 225, 262, 263, - 569, 535, 5, 6, 480, 565, 199, 200, 401, 402, - 231, 405, 188, 201, 547, 232, 548, 10, 11, 234, - 236, 12, 13, 238, 294, 14, 464, 465, 558, 240, - 110, 190, 191, 111, 112, 307, 564, 265, 241, 567, - 266, 467, 267, 242, 310, 312, 313, 314, 5, 6, - 147, 244, 10, 11, 151, 320, 12, 13, 5, 6, - 14, 153, 110, 10, 11, 111, 112, 12, 13, 449, - 450, 14, 453, 349, 110, 229, 230, 111, 112, 277, - 328, 328, 148, 286, 10, 11, -240, 287, 12, 13, - 373, 315, 14, 110, 151, 324, 111, 112, 288, 289, - 295, 379, 343, 381, 384, 348, 351, 110, 352, 345, - 111, 112, 346, 153, 347, 328, 328, 375, 385, 389, - 435, 400, 400, 400, 409, 400, 437, 226, 429, 430, - 10, 11, 328, -217, 12, 13, -217, -217, 14, 433, - 10, 11, 463, 466, 12, 325, 468, 30, 326, 469, - 470, 296, 471, -217, 483, 484, 38, 297, 485, 39, - 486, 487, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 488, 50, 51, 52, 489, 490, 448, 448, - 448, 491, 448, 501, 503, 504, 505, 457, 458, 459, - 460, 461, 462, 506, 298, 299, 110, 300, 301, 111, - 112, 268, 33, 34, 35, 36, 37, 331, 269, 270, - 271, 272, 507, 332, 509, 273, 302, 510, 522, 523, - 525, 472, 473, 474, 475, 476, 477, 478, 479, 482, - 53, 526, 527, 529, 54, 32, 33, 34, 35, 36, - 37, 492, 493, 494, 495, 482, 497, 498, 499, 537, - 333, 334, 110, 335, 336, 111, 112, 539, 86, 512, - 540, 513, 514, 515, 543, 517, 553, 518, 519, 520, - 555, 328, 337, 155, 156, 157, 158, 159, 160, 161, - 530, 531, 532, 533, 534, 521, 328, 536, 162, 561, - 120, 121, 122, 562, 246, 544, 316, 546, 256, 496, - 338, 549, 292, 261, 0, 0, 0, 328, 0, 0, - 0, 557, 0, 559, 0, 0, 0, 0, 127, 563, - 328, 0, 328, 132, 133, 0, 135, 136, 137, 0, - 139, 140, 0, 0, 328, 73, 74, 75, 76, 77, - 78, 79, 328, 0, 0, 328, 353, 354, 355, 356, + 192, 193, 167, 168, 169, 305, 387, 170, 210, 211, + 212, 204, 145, 213, 119, 218, 221, 9, 145, 130, + 131, 165, 344, 118, 73, 74, 75, 76, 77, 78, + 79, 5, 6, 187, 149, 128, 129, 341, 110, 10, + 11, 111, 112, 12, 13, 138, 233, 14, 141, 142, + 143, 205, 5, 6, 144, 199, 200, 380, 147, 10, + 11, 150, 201, 12, 13, 10, 11, 14, 306, 12, + 13, 5, 6, 14, 317, 163, 265, 36, 37, 266, + 545, 267, 190, 191, 164, 171, -217, 173, 174, -217, + -217, 214, 556, 177, 178, 179, 180, 181, 182, 183, + 342, 185, 186, 194, 189, 207, -217, 195, 188, 568, + 374, 229, 230, 10, 11, 560, 352, 12, 13, 565, + 242, 14, 566, 5, 6, 382, 552, 569, 386, 117, + 388, 202, 215, 216, 10, 11, 203, 552, 12, 13, + 223, 224, 14, 403, 552, 500, 227, 228, 208, 552, + 209, 5, 6, 10, 11, 219, 231, 12, 13, 222, + 516, 14, 5, 6, 480, 251, 252, 253, 225, 247, + 248, 249, 5, 6, 258, 232, 260, 236, 262, 263, + 538, 535, 110, 541, 238, 111, 112, 436, 352, 352, + 254, 255, 240, 550, 547, 256, 548, 352, 511, 524, + 451, 241, 148, 244, 294, 10, 11, 542, 558, 12, + 13, 352, 352, 14, 151, 307, 564, 431, 432, 567, + 153, 554, 277, 277, 310, 312, 313, 314, 120, 121, + 122, 286, 434, 10, 11, 320, 110, 12, 13, 111, + 112, 14, 315, 110, 10, 11, 111, 112, 12, 13, + -240, 324, 14, 349, 10, 11, 151, 287, 12, 325, + 328, 328, 326, 153, 288, 464, 465, 289, 110, 352, + 373, 111, 112, 73, 74, 75, 76, 77, 78, 79, + 467, 379, 295, 381, 384, 348, 351, 296, 226, 345, + -156, -156, 346, 297, 347, 328, 328, -156, 331, 409, + 375, 400, 400, 400, 332, 400, 385, 38, 389, 145, + 39, 429, 328, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 430, 50, 51, 52, 433, 435, 437, + 298, 299, 110, 300, 301, 111, 112, 34, 35, 36, + 37, 333, 334, 110, 335, 336, 111, 112, 401, 402, + 463, 405, 302, -217, 466, 468, -217, -217, 448, 448, + 448, 110, 448, 337, 111, 112, 469, 457, 458, 459, + 460, 461, 462, -217, 31, 32, 33, 34, 35, 36, + 37, 53, 470, 471, 30, 54, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 472, 473, 474, 475, 476, 477, 478, 479, 482, + 483, 109, -156, -156, 449, 450, 246, 453, -156, -156, + 484, 492, 493, 494, 495, 482, 497, 498, 499, 485, + 486, 145, 487, -156, -156, 488, 489, 490, 491, 512, + -156, 513, 514, 515, 501, 517, 503, 518, 519, 520, + 504, 328, 343, 155, 156, 157, 158, 159, 160, 161, + 530, 531, 532, 533, 534, 505, 328, 536, 162, 32, + 33, 34, 35, 36, 37, 544, 268, 546, 86, 506, + 507, 549, 509, 269, 270, 271, 272, 328, 510, 522, + 273, 557, 523, 559, 33, 34, 35, 36, 37, 563, + 328, 525, 328, 391, 392, 393, 394, 395, 396, 397, + 398, 526, 527, 529, 328, 537, 406, 407, 408, 539, + 540, 543, 328, 553, 555, 328, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 31, 32, 33, - 34, 35, 36, 37, 371, 0, 0, 109, 0, 84, - 391, 392, 393, 394, 395, 396, 397, 398, 0, 0, - 0, 0, 428, 406, 407, 408, 0, 439, 440, 441, - 442, 443, 444, 445, 446, 0, 0, 0, 0, 0, - 454, 455, 456, 31, 32, 33, 34, 35, 36, 37, - 73, 74, 75, 76, 77, 78, 79 + 426, 427, 439, 440, 441, 442, 443, 444, 445, 446, + 316, 561, 562, 127, 521, 454, 455, 456, 132, 133, + 496, 135, 136, 137, 371, 139, 140, 31, 32, 33, + 34, 35, 36, 37, 338, 250, 292, 261, 0, 84, + 0, 0, 428, 73, 74, 75, 76, 77, 78, 79 }; static const short yycheck[] = { - 2, 13, 172, 22, 276, 0, 6, 276, 6, 531, - 238, 80, 534, 296, 81, 301, 3, 4, 5, 83, - 7, 23, 544, 4, 5, 6, 93, 93, 9, 93, - 10, 11, 12, 20, 14, 93, 308, 4, 5, 308, - 326, 333, 41, 4, 5, 6, 7, 217, 331, 335, + 2, 13, 22, 276, 296, 6, 6, 118, 41, 42, + 238, 0, 74, 75, 80, 301, 3, 4, 5, 81, + 7, 23, 249, 80, 251, 252, 253, 254, 255, 256, + 10, 11, 12, 20, 14, 308, 93, 4, 5, 331, + 326, 4, 5, 4, 5, 6, 7, 93, 81, 335, 336, 31, 32, 33, 34, 35, 36, 37, 286, 287, - 83, 353, 276, 83, 74, 75, 352, 4, 5, 6, - 93, 81, 9, 93, 366, 94, 76, 64, 76, 83, - 99, 100, 81, 85, 51, 52, 53, 54, 55, 56, - 57, 95, 41, 42, 308, 97, 98, 4, 5, 86, - 87, 4, 5, 90, 91, 107, 87, 94, 110, 111, - 112, 83, 4, 5, 116, 88, 89, 345, 410, 86, - 87, 93, 538, 90, 91, 86, 87, 94, 93, 90, - 91, 423, 81, 94, 550, 93, 249, 250, 251, 252, - 253, 254, 255, 93, 47, 48, 49, 149, 150, 545, - 87, 567, 93, 155, 156, 157, 158, 159, 160, 161, - 556, 163, 164, 83, 166, 6, 185, 563, 93, 72, - 73, 93, 568, 93, 77, 4, 5, 6, 47, 48, - 49, 93, 60, 86, 87, 63, 64, 90, 91, 81, - 6, 94, 194, 195, 86, 87, 309, 93, 90, 91, - 202, 203, 94, 72, 73, 491, 208, 209, 77, 93, - 4, 5, 60, 7, 93, 63, 64, 6, 388, 389, - 506, 4, 5, 6, 86, 87, 88, 89, 556, 231, - 232, 233, 80, 403, 236, 563, 238, 6, 240, 241, - 568, 527, 4, 5, 6, 93, 74, 75, 364, 365, - 93, 367, 81, 81, 540, 93, 542, 86, 87, 93, - 93, 90, 91, 93, 266, 94, 436, 437, 554, 93, - 60, 4, 5, 63, 64, 277, 562, 76, 93, 565, - 79, 451, 81, 80, 286, 287, 288, 289, 4, 5, - 80, 93, 86, 87, 80, 297, 90, 91, 4, 5, - 94, 80, 60, 86, 87, 63, 64, 90, 91, 421, - 422, 94, 424, 325, 60, 4, 5, 63, 64, 93, - 300, 301, 80, 93, 86, 87, 93, 93, 90, 91, - 332, 6, 94, 60, 80, 6, 63, 64, 93, 93, - 93, 343, 93, 345, 346, 325, 326, 60, 83, 93, - 63, 64, 93, 80, 93, 335, 336, 6, 6, 6, - 6, 363, 364, 365, 93, 367, 6, 80, 93, 93, - 86, 87, 352, 60, 90, 91, 63, 64, 94, 93, - 86, 87, 93, 93, 90, 91, 93, 18, 94, 93, - 93, 15, 93, 80, 93, 93, 4, 21, 93, 7, - 93, 93, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 93, 21, 22, 23, 93, 93, 420, 421, - 422, 93, 424, 93, 93, 93, 93, 429, 430, 431, - 432, 433, 434, 93, 58, 59, 60, 61, 62, 63, - 64, 36, 85, 86, 87, 88, 89, 15, 43, 44, - 45, 46, 93, 21, 93, 50, 80, 93, 93, 93, - 93, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 78, 93, 93, 93, 82, 84, 85, 86, 87, 88, - 89, 483, 484, 485, 486, 487, 488, 489, 490, 93, - 58, 59, 60, 61, 62, 63, 64, 93, 30, 501, - 93, 503, 504, 505, 93, 507, 93, 509, 510, 511, - 93, 491, 80, 65, 66, 67, 68, 69, 70, 71, - 522, 523, 524, 525, 526, 513, 506, 529, 80, 93, - 6, 7, 8, 93, 228, 537, 295, 539, 235, 487, - 308, 543, 264, 239, -1, -1, -1, 527, -1, -1, - -1, 553, -1, 555, -1, -1, -1, -1, 96, 561, - 540, -1, 542, 101, 102, -1, 104, 105, 106, -1, - 108, 109, -1, -1, 554, 51, 52, 53, 54, 55, - 56, 57, 562, -1, -1, 565, 23, 24, 25, 26, + 81, 172, 4, 5, 6, 276, 352, 9, 4, 5, + 6, 41, 93, 9, 94, 76, 76, 64, 93, 99, + 100, 6, 309, 85, 51, 52, 53, 54, 55, 56, + 57, 4, 5, 6, 93, 97, 98, 308, 60, 86, + 87, 63, 64, 90, 91, 107, 217, 94, 110, 111, + 112, 81, 4, 5, 116, 74, 75, 345, 80, 86, + 87, 93, 81, 90, 91, 86, 87, 94, 276, 90, + 91, 4, 5, 94, 7, 93, 76, 88, 89, 79, + 538, 81, 4, 5, 93, 87, 60, 149, 150, 63, + 64, 87, 550, 155, 156, 157, 158, 159, 160, 161, + 308, 163, 164, 93, 166, 185, 80, 93, 81, 567, + 333, 4, 5, 86, 87, 556, 83, 90, 91, 93, + 80, 94, 563, 4, 5, 6, 545, 568, 95, 81, + 353, 93, 194, 195, 86, 87, 93, 556, 90, 91, + 202, 203, 94, 366, 563, 491, 208, 209, 93, 568, + 93, 4, 5, 86, 87, 6, 93, 90, 91, 6, + 506, 94, 4, 5, 6, 47, 48, 49, 6, 231, + 232, 233, 4, 5, 236, 93, 238, 93, 240, 241, + 531, 527, 60, 534, 93, 63, 64, 410, 83, 83, + 72, 73, 93, 544, 540, 77, 542, 83, 93, 93, + 423, 93, 80, 93, 266, 86, 87, 93, 554, 90, + 91, 83, 83, 94, 80, 277, 562, 388, 389, 565, + 80, 93, 93, 93, 286, 287, 288, 289, 6, 7, + 8, 93, 403, 86, 87, 297, 60, 90, 91, 63, + 64, 94, 6, 60, 86, 87, 63, 64, 90, 91, + 93, 6, 94, 325, 86, 87, 80, 93, 90, 91, + 300, 301, 94, 80, 93, 436, 437, 93, 60, 83, + 332, 63, 64, 51, 52, 53, 54, 55, 56, 57, + 451, 343, 93, 345, 346, 325, 326, 15, 80, 93, + 74, 75, 93, 21, 93, 335, 336, 81, 15, 93, + 6, 363, 364, 365, 21, 367, 6, 4, 6, 93, + 7, 93, 352, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 93, 21, 22, 23, 93, 6, 6, + 58, 59, 60, 61, 62, 63, 64, 86, 87, 88, + 89, 58, 59, 60, 61, 62, 63, 64, 364, 365, + 93, 367, 80, 60, 93, 93, 63, 64, 420, 421, + 422, 60, 424, 80, 63, 64, 93, 429, 430, 431, + 432, 433, 434, 80, 83, 84, 85, 86, 87, 88, + 89, 78, 93, 93, 18, 82, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 93, 65, 74, 75, 421, 422, 228, 424, 80, 81, + 93, 483, 484, 485, 486, 487, 488, 489, 490, 93, + 93, 93, 93, 74, 75, 93, 93, 93, 93, 501, + 81, 503, 504, 505, 93, 507, 93, 509, 510, 511, + 93, 491, 93, 65, 66, 67, 68, 69, 70, 71, + 522, 523, 524, 525, 526, 93, 506, 529, 80, 84, + 85, 86, 87, 88, 89, 537, 36, 539, 30, 93, + 93, 543, 93, 43, 44, 45, 46, 527, 93, 93, + 50, 553, 93, 555, 85, 86, 87, 88, 89, 561, + 540, 93, 542, 355, 356, 357, 358, 359, 360, 361, + 362, 93, 93, 93, 554, 93, 368, 369, 370, 93, + 93, 93, 562, 93, 93, 565, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 83, 84, 85, - 86, 87, 88, 89, 81, -1, -1, 65, -1, 95, - 355, 356, 357, 358, 359, 360, 361, 362, -1, -1, - -1, -1, 81, 368, 369, 370, -1, 412, 413, 414, - 415, 416, 417, 418, 419, -1, -1, -1, -1, -1, - 425, 426, 427, 83, 84, 85, 86, 87, 88, 89, - 51, 52, 53, 54, 55, 56, 57 + 39, 40, 412, 413, 414, 415, 416, 417, 418, 419, + 295, 93, 93, 96, 513, 425, 426, 427, 101, 102, + 487, 104, 105, 106, 81, 108, 109, 83, 84, 85, + 86, 87, 88, 89, 308, 234, 264, 239, -1, 95, + -1, -1, 81, 51, 52, 53, 54, 55, 56, 57 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1317,9 +1311,9 @@ static const unsigned char yystos[] = 75, 81, 93, 93, 41, 81, 158, 167, 93, 93, 4, 5, 6, 9, 87, 175, 175, 6, 76, 6, 6, 76, 6, 175, 175, 6, 80, 175, 175, 4, - 5, 93, 93, 154, 93, 145, 93, 149, 93, 150, + 5, 93, 93, 154, 145, 154, 93, 149, 93, 150, 93, 93, 80, 163, 93, 118, 118, 175, 175, 175, - 47, 48, 49, 72, 73, 77, 143, 174, 175, 174, + 143, 47, 48, 49, 72, 73, 77, 174, 175, 174, 175, 147, 175, 175, 159, 76, 79, 81, 36, 43, 44, 45, 46, 50, 119, 120, 122, 93, 139, 145, 145, 145, 145, 145, 145, 145, 93, 93, 93, 93, @@ -4131,7 +4125,7 @@ yyreduce: } /* Line 999 of yacc.c. */ -#line 4135 "y.tab.c" +#line 4129 "y.tab.c" yyvsp -= yylen; yyssp -= yylen; diff --git a/reactos/w32api/include/commctrl.h b/reactos/w32api/include/commctrl.h index e75116283b5..c50adfe18d1 100644 --- a/reactos/w32api/include/commctrl.h +++ b/reactos/w32api/include/commctrl.h @@ -2205,6 +2205,17 @@ typedef struct tagNMLVGETINFOTIPW LPARAM lParam; } NMLVGETINFOTIPW, *LPNMLVGETINFOTIPW; #endif /* _WIN32_IE >= 0x0400 */ +typedef struct tagNMLVODSTATECHANGE +{ + NMHDR hdr; + int iFrom; + int iTo; + UINT uNewState; + UINT uOldState; +} NMLVODSTATECHANGE, *LPNMLVODSTATECHANGE; +#define PNM_ODSTATECHANGE LPNMLVODSTATECHANGE +#define LPNM_ODSTATECHANGE LPNMLVODSTATECHANGE +#define NM_ODSTATECHANGE NMLVODSTATECHANGE typedef struct tagNMTVCUSTOMDRAW { NMCUSTOMDRAW nmcd; COLORREF clrText; diff --git a/reactos/w32api/include/ddk/ntapi.h b/reactos/w32api/include/ddk/ntapi.h index 275fe062e7b..f3506aef87e 100644 --- a/reactos/w32api/include/ddk/ntapi.h +++ b/reactos/w32api/include/ddk/ntapi.h @@ -264,48 +264,16 @@ typedef struct _VM_COUNTERS { } VM_COUNTERS; typedef enum _THREAD_STATE { - StateInitialized, - StateReady, - StateRunning, - StateStandby, - StateTerminated, - StateWait, - StateTransition, - StateUnknown + Initialized, + Ready, + Running, + Standby, + Terminated, + Wait, + Transition, + DeferredReady } THREAD_STATE; -typedef struct _SYSTEM_THREADS { - LARGE_INTEGER KernelTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER CreateTime; - ULONG WaitTime; - PVOID StartAddress; - CLIENT_ID ClientId; - KPRIORITY Priority; - KPRIORITY BasePriority; - ULONG ContextSwitchCount; - THREAD_STATE State; - KWAIT_REASON WaitReason; -} SYSTEM_THREADS, *PSYSTEM_THREADS; - -typedef struct _SYSTEM_PROCESSES { - ULONG NextEntryDelta; - ULONG ThreadCount; - ULONG Reserved1[6]; - LARGE_INTEGER CreateTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER KernelTime; - UNICODE_STRING ProcessName; - KPRIORITY BasePriority; - HANDLE ProcessId; - HANDLE InheritedFromProcessId; - ULONG HandleCount; - ULONG Reserved2[2]; - VM_COUNTERS VmCounters; - IO_COUNTERS IoCounters; - SYSTEM_THREADS Threads[1]; -} SYSTEM_PROCESSES, *PSYSTEM_PROCESSES; - typedef struct _SYSTEM_CALLS_INFORMATION { ULONG Size; ULONG NumberOfDescriptorTables; @@ -659,50 +627,67 @@ typedef struct _SYSTEM_MEMORY_USAGE_INFORMATION { SYSTEM_MEMORY_USAGE MemoryUsage[1]; } SYSTEM_MEMORY_USAGE_INFORMATION, *PSYSTEM_MEMORY_USAGE_INFORMATION; -typedef struct _SYSTEM_THREAD_INFORMATION +// SystemProcessThreadInfo (5) +typedef struct _SYSTEM_THREAD_INFORMATION { - LARGE_INTEGER KernelTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER CreateTime; - ULONG WaitTime; - PVOID StartAddress; - CLIENT_ID ClientId; - KPRIORITY Priority; - LONG BasePriority; - ULONG ContextSwitches; - ULONG ThreadState; - KWAIT_REASON WaitReason; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER CreateTime; + ULONG WaitTime; + PVOID StartAddress; + CLIENT_ID ClientId; + KPRIORITY Priority; + LONG BasePriority; + ULONG ContextSwitches; + ULONG ThreadState; + ULONG WaitReason; } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION; -typedef struct SYSTEM_PROCESS_INFORMATION +typedef struct _SYSTEM_PROCESS_INFORMATION { - ULONG NextEntryOffset; - ULONG NumberOfThreads; - LARGE_INTEGER SpareLi1; - LARGE_INTEGER SpareLi2; - LARGE_INTEGER SpareLi3; - LARGE_INTEGER CreateTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER KernelTime; - UNICODE_STRING ImageName; - ULONG BasePriority; - HANDLE UniqueProcessId; - HANDLE InheritedFromUniqueProcessId; - ULONG HandleCount; - ULONG SessionId; - ULONG SpareUl3; - ULONG PeakVirtualSize; - ULONG VirtualSize; - ULONG PageFaultCount; - ULONG PeakWorkingSetSize; - ULONG WorkingSetSize; - ULONG QuotaPeakPagedPoolUsage; - ULONG QuotaPagedPoolUsage; - ULONG QuotaPeakNonPagedPoolUsage; - ULONG QuotaNonPagedPoolUsage; - ULONG PagefileUsage; - ULONG PeakPagefileUsage; - ULONG PrivatePageCount; + ULONG NextEntryOffset; + ULONG NumberOfThreads; + LARGE_INTEGER SpareLi1; + LARGE_INTEGER SpareLi2; + LARGE_INTEGER SpareLi3; + LARGE_INTEGER CreateTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER KernelTime; + UNICODE_STRING ImageName; + KPRIORITY BasePriority; + HANDLE UniqueProcessId; + HANDLE InheritedFromUniqueProcessId; + ULONG HandleCount; + ULONG SessionId; + ULONG PageDirectoryFrame; + + /* + * This part corresponds to VM_COUNTERS_EX. + * NOTE: *NOT* THE SAME AS VM_COUNTERS! + */ + ULONG PeakVirtualSize; + ULONG VirtualSize; + ULONG PageFaultCount; + ULONG PeakWorkingSetSize; + ULONG WorkingSetSize; + ULONG QuotaPeakPagedPoolUsage; + ULONG QuotaPagedPoolUsage; + ULONG QuotaPeakNonPagedPoolUsage; + ULONG QuotaNonPagedPoolUsage; + ULONG PagefileUsage; + ULONG PeakPagefileUsage; + ULONG PrivateUsage; + + /* This part corresponds to IO_COUNTERS */ + LARGE_INTEGER ReadOperationCount; + LARGE_INTEGER WriteOperationCount; + LARGE_INTEGER OtherOperationCount; + LARGE_INTEGER ReadTransferCount; + LARGE_INTEGER WriteTransferCount; + LARGE_INTEGER OtherTransferCount; + + /* Finally, the array of Threads */ + SYSTEM_THREAD_INFORMATION TH[1]; } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION; NTOSAPI diff --git a/reactos/w32api/include/ddk/winddk.h b/reactos/w32api/include/ddk/winddk.h index bc8f1b2e6ba..08e88069dfe 100644 --- a/reactos/w32api/include/ddk/winddk.h +++ b/reactos/w32api/include/ddk/winddk.h @@ -529,7 +529,7 @@ typedef VOID IN PVOID Context, IN ULONG Count); -typedef NTSTATUS +typedef VOID (DDKAPI *PDRIVER_STARTIO)( IN struct _DEVICE_OBJECT *DeviceObject, IN struct _IRP *Irp); @@ -929,6 +929,21 @@ typedef struct _FAST_MUTEX { ULONG OldIrql; } FAST_MUTEX, *PFAST_MUTEX; +typedef struct _KGUARDED_MUTEX +{ + LONG Count; + struct _KTHREAD* Owner; + ULONG Contention; + struct _KGATE* Gate; + union { + struct { + SHORT KernelApcDisable; + SHORT SpecialApcDisable; + }; + ULONG CombinedApcDisable; + }; +} KGUARDED_MUTEX, *PKGUARDED_MUTEX, *RESTRICTED_POINTER PRKGUARDED_MUTEX; + typedef struct _KTIMER { DISPATCHER_HEADER Header; ULARGE_INTEGER DueTime; @@ -945,6 +960,11 @@ typedef struct _KMUTANT { UCHAR ApcDisable; } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX; +typedef struct _KGATE +{ + DISPATCHER_HEADER Header; +} KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE; + typedef enum _TIMER_TYPE { NotificationTimer, SynchronizationTimer @@ -1412,14 +1432,14 @@ typedef struct _CM_KEYBOARD_DEVICE_DATA { USHORT KeyboardFlags; } CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA; -#define KEYBOARD_INSERT_ON 0x80 -#define KEYBOARD_CAPS_LOCK_ON 0x40 -#define KEYBOARD_NUM_LOCK_ON 0x20 -#define KEYBOARD_SCROLL_LOCK_ON 0x10 -#define KEYBOARD_ALT_KEY_DOWN 0x08 -#define KEYBOARD_CTRL_KEY_DOWN 0x04 -#define KEYBOARD_LEFT_SHIFT_DOWN 0x02 -#define KEYBOARD_RIGHT_SHIFT_DOWN 0x01 +#define KEYBOARD_INSERT_ON 0x08 +#define KEYBOARD_CAPS_LOCK_ON 0x04 +#define KEYBOARD_NUM_LOCK_ON 0x02 +#define KEYBOARD_SCROLL_LOCK_ON 0x01 +#define KEYBOARD_ALT_KEY_DOWN 0x80 +#define KEYBOARD_CTRL_KEY_DOWN 0x40 +#define KEYBOARD_LEFT_SHIFT_DOWN 0x20 +#define KEYBOARD_RIGHT_SHIFT_DOWN 0x10 typedef struct _CM_MCA_POS_DATA { USHORT AdapterId; diff --git a/reactos/w32api/include/shlobj.h b/reactos/w32api/include/shlobj.h index 55308ffe07e..5c367ccdfc4 100644 --- a/reactos/w32api/include/shlobj.h +++ b/reactos/w32api/include/shlobj.h @@ -315,8 +315,15 @@ extern "C" { #define SBSP_OPENMODE 16 #define SBSP_EXPLOREMODE 32 #define SBSP_ABSOLUTE 0 +#define SBSP_HELPMODE 0x40 +#define SBSP_NOTRANSFERHIST 0x80 #define SBSP_RELATIVE 0x1000 #define SBSP_PARENT 0x2000 +#define SBSP_NAVIGATEBACK 0x4000 +#define SBSP_NAVIGATEFORWARD 0x8000 +#define SBSP_ALLOW_AUTONAVIGATE 0x10000 +#define SBSP_NOAUTOSELECT 0x4000000 +#define SBSP_WRITENOHISTORY 0x8000000 #define SBSP_INITIATEDBYHLINKFRAME 0x80000000 #define SBSP_REDIRECT 0x40000000 #define FCW_STATUS 1 diff --git a/reactos/w32api/include/winnt.h b/reactos/w32api/include/winnt.h index 35fdbc6785b..d5038b0766c 100644 --- a/reactos/w32api/include/winnt.h +++ b/reactos/w32api/include/winnt.h @@ -368,6 +368,7 @@ typedef DWORD FLONG; #define PROCESS_SET_QUOTA 256 #define PROCESS_SET_INFORMATION 512 #define PROCESS_QUERY_INFORMATION 1024 +#define PROCESS_SUSPEND_RESUME 2048 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF) #define THREAD_TERMINATE 1 #define THREAD_SUSPEND_RESUME 2