From 3d1f2d98baf6c35de4ce3dd226b35f43041aeed6 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 12 Jan 2000 19:05:32 +0000 Subject: [PATCH] Added missing printf() functions Changed format %w to %S and %W to %wZ svn path=/trunk/; revision=931 --- reactos/drivers/fs/ext2/dir.c | 2 +- reactos/drivers/fs/minix/dir.c | 8 +- reactos/drivers/fs/minix/minix.c | 6 +- reactos/drivers/fs/vfat/create.c | 16 +- reactos/drivers/fs/vfat/dir.c | 4 +- reactos/drivers/fs/vfat/dirwr.c | 4 +- reactos/ntoskrnl/dbg/errinfo.c | 2 +- reactos/ntoskrnl/io/create.c | 6 +- reactos/ntoskrnl/io/device.c | 6 +- reactos/ntoskrnl/io/symlink.c | 6 +- reactos/ntoskrnl/ke/i386/exp.c | 2 +- reactos/ntoskrnl/ldr/init.c | 4 +- reactos/ntoskrnl/ldr/loader.c | 22 +-- reactos/ntoskrnl/mm/section.c | 4 +- reactos/ntoskrnl/nt/ntevent.c | 2 +- reactos/ntoskrnl/nt/ntsem.c | 2 +- reactos/ntoskrnl/nt/port.c | 4 +- reactos/ntoskrnl/ntoskrnl.def | 6 +- reactos/ntoskrnl/ntoskrnl.edf | 6 +- reactos/ntoskrnl/ob/dirobj.c | 4 +- reactos/ntoskrnl/ob/namespc.c | 8 +- reactos/ntoskrnl/ob/object.c | 6 +- reactos/ntoskrnl/rtl/vsprintf.c | 243 +++++++++++++++++-------------- reactos/ntoskrnl/rtl/wstring.c | 2 +- 24 files changed, 203 insertions(+), 172 deletions(-) diff --git a/reactos/drivers/fs/ext2/dir.c b/reactos/drivers/fs/ext2/dir.c index 8441dba9bc0..cf52d613cec 100644 --- a/reactos/drivers/fs/ext2/dir.c +++ b/reactos/drivers/fs/ext2/dir.c @@ -275,7 +275,7 @@ NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, PEXT2_FCB Fcb; ULONG StartIndex = 0; - DPRINT("Ext2OpenFile(DeviceExt %x, FileObject %x, FileName %w)\n", + DPRINT("Ext2OpenFile(DeviceExt %x, FileObject %x, FileName %S)\n", DeviceExt,FileObject,FileName); Fcb = ExAllocatePool(NonPagedPool, sizeof(EXT2_FCB)); diff --git a/reactos/drivers/fs/minix/dir.c b/reactos/drivers/fs/minix/dir.c index 423a77ecf21..c361663a2cc 100644 --- a/reactos/drivers/fs/minix/dir.c +++ b/reactos/drivers/fs/minix/dir.c @@ -53,7 +53,7 @@ ULONG MinixDirLookup(PMINIX_DEVICE_EXTENSION DeviceExt, unsigned int inode; PCCB Ccb = NULL; - DPRINT("MinixDirLookup(DeviceExt %x, dir %x, Name %w)\n",DeviceExt,dir, + DPRINT("MinixDirLookup(DeviceExt %x, dir %x, Name %S)\n",DeviceExt,dir, Name); for (i=0;i<(dir->i_size/MINIX_DIR_ENTRY_SIZE);i++) @@ -111,7 +111,7 @@ NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject, DeviceName = FileObject->FileName.Buffer; - DbgPrint("MinixOpen(DeviceObject %x, DeviceName %w, result %x)\n", + DbgPrint("MinixOpen(DeviceObject %x, DeviceName %S, result %x)\n", DeviceObject,DeviceName,result); DPRINT("DeviceName %x\n",DeviceName); @@ -125,7 +125,7 @@ NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject, { MinixReadInode(DeviceObject,DeviceExt,current_ino,¤t_dir); - DPRINT("current %w next %x\n",current,next); + DPRINT("current %S next %x\n",current,next); *next = '\\'; current = next+1; @@ -199,7 +199,7 @@ NTSTATUS MinixCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) MINIX_DEVICE_EXTENSION* DeviceExt; DPRINT("MinixCreate(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); - DPRINT("Opening file %x %w\n",FileObject->FileName.Buffer, + DPRINT("Opening file %x %S\n",FileObject->FileName.Buffer, FileObject->FileName.Buffer); DPRINT("FileObject->FileName.Buffer %x\n", FileObject->FileName.Buffer); diff --git a/reactos/drivers/fs/minix/minix.c b/reactos/drivers/fs/minix/minix.c index 6fd0c835870..95660dc43a5 100644 --- a/reactos/drivers/fs/minix/minix.c +++ b/reactos/drivers/fs/minix/minix.c @@ -249,7 +249,7 @@ NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject, struct minix_inode current_dir; unsigned int current_ino; - DbgPrint("MinixOpen(DeviceObject %x, DeviceName %w, result %x)\n", + DbgPrint("MinixOpen(DeviceObject %x, DeviceName %S, result %x)\n", DeviceObject,DeviceName,result); DPRINT("DeviceName %x\n",DeviceName); @@ -262,7 +262,7 @@ NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject, { MinixReadInode(DeviceObject,DeviceExt,current_ino,¤t_dir); - DPRINT("current %w next %x\n",current,next); + DPRINT("current %S next %x\n",current,next); *next = '\\'; current = next+1; @@ -387,7 +387,7 @@ NTSTATUS MinixCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) MINIX_DEVICE_EXTENSION* DeviceExt; DPRINT("MinixCreate(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); - DPRINT("Opening file %x %w\n",FileObject->FileName.Buffer, + DPRINT("Opening file %x %S\n",FileObject->FileName.Buffer, FileObject->FileName.Buffer); DPRINT("FileObject->FileName.Buffer %x\n", FileObject->FileName.Buffer); diff --git a/reactos/drivers/fs/vfat/create.c b/reactos/drivers/fs/vfat/create.c index 88082c037cd..f6c261c6f43 100644 --- a/reactos/drivers/fs/vfat/create.c +++ b/reactos/drivers/fs/vfat/create.c @@ -1,4 +1,4 @@ -/* $Id: create.c,v 1.1 1999/12/11 21:14:48 dwelch Exp $ +/* $Id: create.c,v 1.2 2000/01/12 19:05:32 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -213,7 +213,7 @@ NTSTATUS FindFile(PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb, ULONG NextCluster; WCHAR TempStr[2]; - DPRINT("FindFile(Parent %x, FileToFind '%w')\n",Parent,FileToFind); + DPRINT("FindFile(Parent %x, FileToFind '%S')\n",Parent,FileToFind); if (wcslen(FileToFind)==0) { @@ -227,7 +227,7 @@ NTSTATUS FindFile(PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb, DPRINT("Parent->entry.FirstCluster %d\n",Parent->entry.FirstCluster); } - DPRINT("FindFile '%w'\n", FileToFind); + DPRINT("FindFile '%S'\n", FileToFind); if (Parent == NULL||Parent->entry.FirstCluster==1) { CHECKPOINT; @@ -294,7 +294,7 @@ NTSTATUS FindFile(PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb, } if (GetEntryName((PVOID)block,&i,name,&j,DeviceExt,&StartingSector)) { - DPRINT("Comparing '%w' '%w'\n",name,FileToFind); + DPRINT("Comparing '%S' '%S'\n",name,FileToFind); if (wstrcmpjoki(name,FileToFind)) { /* In the case of a long filename, the firstcluster is stored in @@ -403,7 +403,7 @@ NTSTATUS FsdOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, PLIST_ENTRY current_entry; KIRQL oldIrql; - DPRINT("FsdOpenFile(%08lx, %08lx, %w)\n", + DPRINT("FsdOpenFile(%08lx, %08lx, %S)\n", DeviceExt, FileObject, FileName); @@ -411,7 +411,7 @@ NTSTATUS FsdOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, /* FIXME : treat relative name */ if(FileObject->RelatedFileObject) { - DbgPrint("try related for %w\n",FileName); + DbgPrint("try related for %S\n",FileName); pRelFileObject=FileObject->RelatedFileObject; pRelCcb=pRelFileObject->FsContext2; assert(pRelCcb); @@ -450,7 +450,7 @@ NTSTATUS FsdOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, Fcb = CONTAINING_RECORD(current_entry, VFATFCB, FcbListEntry); DPRINT("Scanning %x\n", Fcb); - DPRINT("Scanning %w\n", Fcb->PathName); + DPRINT("Scanning %S\n", Fcb->PathName); if (DeviceExt==Fcb->pDevExt && wstrcmpi(FileName,Fcb->PathName)) @@ -491,7 +491,7 @@ NTSTATUS FsdOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, { *next=0; } - DPRINT("current '%w'\n",current); + DPRINT("current '%S'\n",current); Status = FindFile(DeviceExt,Fcb,ParentFcb,current,NULL,NULL); if (Status != STATUS_SUCCESS) { diff --git a/reactos/drivers/fs/vfat/dir.c b/reactos/drivers/fs/vfat/dir.c index ded821f5e78..8615e2d76cd 100644 --- a/reactos/drivers/fs/vfat/dir.c +++ b/reactos/drivers/fs/vfat/dir.c @@ -248,7 +248,7 @@ NTSTATUS DoQuery(PDEVICE_OBJECT DeviceObject, PIRP Irp,PIO_STACK_LOCATION Stack) Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); else Buffer = Irp->UserBuffer; - DPRINT("Buffer=%x tofind=%w\n",Buffer,pSearchPattern->Buffer); + DPRINT("Buffer=%x tofind=%S\n",Buffer,pSearchPattern->Buffer); if (pSearchPattern==NULL) { star[0]='*'; @@ -263,7 +263,7 @@ NTSTATUS DoQuery(PDEVICE_OBJECT DeviceObject, PIRP Irp,PIO_STACK_LOCATION Stack) OldEntry=pCcb->StartEntry; if(OldSector)pCcb->StartEntry++; RC=FindFile(DeviceExt,&tmpFcb,pFcb,pCharPattern,&pCcb->StartSector,&pCcb->StartEntry); -DPRINT("Found %w,RC=%x, sector %x entry %x\n",tmpFcb.ObjectName,RC +DPRINT("Found %S,RC=%x, sector %x entry %x\n",tmpFcb.ObjectName,RC ,pCcb->StartSector,pCcb->StartEntry); if (NT_SUCCESS(RC)) { diff --git a/reactos/drivers/fs/vfat/dirwr.c b/reactos/drivers/fs/vfat/dirwr.c index e0ef794c778..407c17f5f44 100644 --- a/reactos/drivers/fs/vfat/dirwr.c +++ b/reactos/drivers/fs/vfat/dirwr.c @@ -50,7 +50,7 @@ NTSTATUS updEntry(PDEVICE_EXTENSION DeviceExt,PFILE_OBJECT pFileObject) if(FileName[0]==0 && DirName[0]==0) return STATUS_SUCCESS;//root : nothing to do ? memset(&FileObject,0,sizeof(FILE_OBJECT)); -DPRINT("open directory %w for update of entry %w\n",DirName,FileName); +DPRINT("open directory %S for update of entry %S\n",DirName,FileName); status=FsdOpenFile(DeviceExt,&FileObject,DirName); pDirCcb=(PVFATCCB)FileObject.FsContext2; assert(pDirCcb); @@ -95,7 +95,7 @@ NTSTATUS addEntry(PDEVICE_EXTENSION DeviceExt KIRQL oldIrql; PathFileName=pFileObject->FileName.Buffer; - DPRINT("addEntry: Pathname=%w\n",PathFileName); + DPRINT("addEntry: Pathname=%S\n",PathFileName); //find last \ in PathFileName posCar=-1; for(i=0;PathFileName[i];i++) diff --git a/reactos/ntoskrnl/dbg/errinfo.c b/reactos/ntoskrnl/dbg/errinfo.c index 212adc4ad8c..5c09457fa9c 100644 --- a/reactos/ntoskrnl/dbg/errinfo.c +++ b/reactos/ntoskrnl/dbg/errinfo.c @@ -255,7 +255,7 @@ VOID DbgPrintErrorMessage(NTSTATUS ErrorCode) UNICODE_STRING ErrorText; DbgGetErrorText(ErrorCode, &ErrorText, 0xf); - DbgPrint("%W\n", &ErrorText); + DbgPrint("%wZ\n", &ErrorText); RtlFreeUnicodeString(&ErrorText); } diff --git a/reactos/ntoskrnl/io/create.c b/reactos/ntoskrnl/io/create.c index 4c694da3296..4fae8a52dcc 100644 --- a/reactos/ntoskrnl/io/create.c +++ b/reactos/ntoskrnl/io/create.c @@ -59,7 +59,7 @@ NTSTATUS IopCreateFile(PVOID ObjectBody, PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody; NTSTATUS Status; - DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %w)\n", + DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %S)\n", ObjectBody,Parent,RemainingPath); if (DeviceObject == NULL) @@ -116,7 +116,7 @@ NTSTATUS IopCreateFile(PVOID ObjectBody, } RtlInitUnicodeString(&(FileObject->FileName),wcsdup(RemainingPath)); } - DPRINT("FileObject->FileName.Buffer %w\n",FileObject->FileName.Buffer); + DPRINT("FileObject->FileName.Buffer %S\n",FileObject->FileName.Buffer); FileObject->DeviceObject = DeviceObject; DPRINT("FileObject %x DeviceObject %x\n", FileObject, DeviceObject); FileObject->Vpb = DeviceObject->Vpb; @@ -205,7 +205,7 @@ NtCreateFile ( PIO_STACK_LOCATION StackLoc; DPRINT("NtCreateFile(FileHandle %x, DesiredAccess %x, " - "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %w)\n", + "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", FileHandle,DesiredAccess,ObjectAttributes, ObjectAttributes->ObjectName->Buffer); diff --git a/reactos/ntoskrnl/io/device.c b/reactos/ntoskrnl/io/device.c index 425560ab1fd..ebe99f43286 100644 --- a/reactos/ntoskrnl/io/device.c +++ b/reactos/ntoskrnl/io/device.c @@ -1,4 +1,4 @@ -/* $Id: device.c,v 1.13 1999/11/24 11:51:50 dwelch Exp $ +/* $Id: device.c,v 1.14 2000/01/12 19:02:40 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -189,7 +189,7 @@ NTSTATUS IopCreateDevice(PVOID ObjectBody, POBJECT_ATTRIBUTES ObjectAttributes) { - DPRINT("IopCreateDevice(ObjectBody %x, Parent %x, RemainingPath %w)\n", + DPRINT("IopCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n", ObjectBody, Parent, RemainingPath); if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL) @@ -239,7 +239,7 @@ NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject, if (DeviceName != NULL) { - DPRINT("IoCreateDevice(DriverObject %x, DeviceName %w)\n",DriverObject, + DPRINT("IoCreateDevice(DriverObject %x, DeviceName %S)\n",DriverObject, DeviceName->Buffer); } else diff --git a/reactos/ntoskrnl/io/symlink.c b/reactos/ntoskrnl/io/symlink.c index 8204acda38f..ddbc840a4a4 100644 --- a/reactos/ntoskrnl/io/symlink.c +++ b/reactos/ntoskrnl/io/symlink.c @@ -1,4 +1,4 @@ -/* $Id: symlink.c,v 1.9 1999/08/29 06:59:08 ea Exp $ +/* $Id: symlink.c,v 1.10 2000/01/12 19:02:40 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -324,7 +324,7 @@ IoCreateSymbolicLink ( assert_irql(PASSIVE_LEVEL); DPRINT( - "IoCreateSymbolicLink(SymbolicLinkName %w, DeviceName %w)\n", + "IoCreateSymbolicLink(SymbolicLinkName %S, DeviceName %S)\n", SymbolicLinkName->Buffer, DeviceName->Buffer ); @@ -362,7 +362,7 @@ IoCreateSymbolicLink ( DeviceName ); - DPRINT("DeviceName %w\n", SymbolicLink->TargetName.Buffer); + DPRINT("DeviceName %S\n", SymbolicLink->TargetName.Buffer); InitializeObjectAttributes( & (SymbolicLink->Target), diff --git a/reactos/ntoskrnl/ke/i386/exp.c b/reactos/ntoskrnl/ke/i386/exp.c index bd5796bd7e4..fb0f5387618 100644 --- a/reactos/ntoskrnl/ke/i386/exp.c +++ b/reactos/ntoskrnl/ke/i386/exp.c @@ -146,7 +146,7 @@ static void print_address(PVOID address) if (address >= current->Base && address < (current->Base + current->Length)) { - DbgPrint("<%w: %x>", current->Name, + DbgPrint("<%S: %x>", current->Name, address - current->Base); return; } diff --git a/reactos/ntoskrnl/ldr/init.c b/reactos/ntoskrnl/ldr/init.c index 71740508921..7d6b9dba275 100644 --- a/reactos/ntoskrnl/ldr/init.c +++ b/reactos/ntoskrnl/ldr/init.c @@ -344,7 +344,7 @@ NTSTATUS LdrLoadImage(HANDLE ProcessHandle, NULL ); DPRINT( - "Opening image file %w\n", + "Opening image file %S\n", FileObjectAttributes.ObjectName->Buffer ); Status = ZwOpenFile( @@ -649,7 +649,7 @@ NTSTATUS LdrLoadInitialProcess (VOID) Status = LdrLoadImage(ProcessHandle, &ProcessName); if (!NT_SUCCESS(Status)) { - DbgPrint("Failed to load %W\n",&ProcessName); + DbgPrint("Failed to load %wZ\n",&ProcessName); } return Status; } diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index cde5c848fb7..cd28b60d13c 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -1,4 +1,4 @@ -/* $Id: loader.c,v 1.41 1999/12/22 14:48:24 dwelch Exp $ +/* $Id: loader.c,v 1.42 2000/01/12 19:03:27 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -115,7 +115,7 @@ VOID LdrInitModuleManagement(VOID) 0, NULL, NULL); - DPRINT("Create dir: %W\n", &ModuleName); + DPRINT("Create dir: %wZ\n", &ModuleName); Status = ZwCreateDirectoryObject(&DirHandle, 0, &ObjectAttributes); assert(NT_SUCCESS(Status)); @@ -124,7 +124,7 @@ VOID LdrInitModuleManagement(VOID) wcscat(NameBuffer, L"ntoskrnl.exe"); ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer); ModuleName.Buffer = NameBuffer; - DPRINT("Kernel's Module name is: %W\n", &ModuleName); + DPRINT("Kernel's Module name is: %wZ\n", &ModuleName); /* Initialize ObjectAttributes for ModuleObject */ InitializeObjectAttributes(&ObjectAttributes, @@ -174,7 +174,7 @@ static VOID LdrLoadAutoConfigDriver (LPWSTR RelativeDriverName) NTSTATUS Status; UNICODE_STRING DriverName; - DbgPrint("Loading %w\n",RelativeDriverName); + DbgPrint("Loading %S\n",RelativeDriverName); LdrGetSystemDirectory(TmpFileName, (MAX_PATH * sizeof(WCHAR))); wcscat(TmpFileName, L"\\drivers\\"); @@ -223,7 +223,7 @@ LdrCreateModule(PVOID ObjectBody, PWSTR RemainingPath, POBJECT_ATTRIBUTES ObjectAttributes) { - DPRINT("LdrCreateModule(ObjectBody %x, Parent %x, RemainingPath %w)\n", + DPRINT("LdrCreateModule(ObjectBody %x, Parent %x, RemainingPath %S)\n", ObjectBody, Parent, RemainingPath); @@ -281,7 +281,7 @@ LdrLoadModule(PUNICODE_STRING Filename) return ModuleObject; } - DPRINT("Loading Module %W...\n", Filename); + DPRINT("Loading Module %wZ...\n", Filename); /* Open the Module */ InitializeObjectAttributes(&ObjectAttributes, @@ -297,7 +297,7 @@ LdrLoadModule(PUNICODE_STRING Filename) CHECKPOINT; if (!NT_SUCCESS(Status)) { - DbgPrint("Could not open module file: %W\n", Filename); + DbgPrint("Could not open module file: %wZ\n", Filename); return 0; } CHECKPOINT; @@ -437,7 +437,7 @@ LdrOpenModule(PUNICODE_STRING Filename) CHECKPOINT; if (NT_SUCCESS(Status) && (RemainingPath == NULL || *RemainingPath == 0)) { - DPRINT("Module %W at %p\n", Filename, ModuleObject); + DPRINT("Module %wZ at %p\n", Filename, ModuleObject); return ModuleObject; } @@ -679,11 +679,11 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName) NameBuffer[Idx + Idx2] = 0; ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer); ModuleName.Buffer = NameBuffer; - DPRINT("Import module: %W\n", &ModuleName); + DPRINT("Import module: %wZ\n", &ModuleName); LibraryModuleObject = LdrLoadModule(&ModuleName); if (LibraryModuleObject == 0) { - DbgPrint("Unknown import module: %W\n", &ModuleName); + DbgPrint("Unknown import module: %wZ\n", &ModuleName); } /* Get the import address list */ ImportAddressList = (PVOID *) ((DWORD)DriverBase + @@ -766,7 +766,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName) } ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer); ModuleName.Buffer = NameBuffer; - DbgPrint("Module name is: %W\n", &ModuleName); + DbgPrint("Module name is: %wZ\n", &ModuleName); /* Initialize ObjectAttributes for ModuleObject */ InitializeObjectAttributes(&ObjectAttributes, diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 337bf928bc9..60e802fa6b4 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -1,4 +1,4 @@ -/* $Id: section.c,v 1.21 1999/12/30 01:51:39 dwelch Exp $ +/* $Id: section.c,v 1.22 2000/01/12 19:03:42 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -81,7 +81,7 @@ NTSTATUS MmpCreateSection(PVOID ObjectBody, { NTSTATUS Status; - DPRINT("MmpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %w)\n", + DPRINT("MmpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n", ObjectBody, Parent, RemainingPath); if (RemainingPath == NULL) diff --git a/reactos/ntoskrnl/nt/ntevent.c b/reactos/ntoskrnl/nt/ntevent.c index 1a4ddab3921..6ec52b265a8 100644 --- a/reactos/ntoskrnl/nt/ntevent.c +++ b/reactos/ntoskrnl/nt/ntevent.c @@ -28,7 +28,7 @@ NTSTATUS NtpCreateEvent(PVOID ObjectBody, POBJECT_ATTRIBUTES ObjectAttributes) { - DPRINT("NtpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %w)\n", + DPRINT("NtpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n", ObjectBody, Parent, RemainingPath); if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL) diff --git a/reactos/ntoskrnl/nt/ntsem.c b/reactos/ntoskrnl/nt/ntsem.c index 97f24fdcc75..8292b0097a1 100644 --- a/reactos/ntoskrnl/nt/ntsem.c +++ b/reactos/ntoskrnl/nt/ntsem.c @@ -27,7 +27,7 @@ NTSTATUS NtpCreateSemaphore(PVOID ObjectBody, POBJECT_ATTRIBUTES ObjectAttributes) { - DPRINT("NtpCreateSemaphore(ObjectBody %x, Parent %x, RemainingPath %w)\n", + DPRINT("NtpCreateSemaphore(ObjectBody %x, Parent %x, RemainingPath %S)\n", ObjectBody, Parent, RemainingPath); if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL) diff --git a/reactos/ntoskrnl/nt/port.c b/reactos/ntoskrnl/nt/port.c index f71e7c9f6ed..9950ee4e77a 100644 --- a/reactos/ntoskrnl/nt/port.c +++ b/reactos/ntoskrnl/nt/port.c @@ -1,4 +1,4 @@ -/* $Id: port.c,v 1.15 1999/12/30 01:51:40 dwelch Exp $ +/* $Id: port.c,v 1.16 2000/01/12 19:04:01 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -265,7 +265,7 @@ NTSTATUS STDCALL NtConnectPort (OUT PHANDLE ConnectedPort, KIRQL oldIrql; DPRINT("PortName %x\n", PortName); - DPRINT("NtConnectPort(PortName %w)\n", PortName->Buffer); + DPRINT("NtConnectPort(PortName %S)\n", PortName->Buffer); /* * Copy in user parameters diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 2847a1be189..8aed5afcc87 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.def,v 1.38 2000/01/10 22:46:37 ea Exp $ +; $Id: ntoskrnl.def,v 1.39 2000/01/12 19:01:56 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -392,7 +392,7 @@ ZwYieldExecution@0 _itoa ;_local_unwind2 ;_purecall -;_snprintf +_snprintf ;_snwprintf _stricmp _strlwr @@ -401,7 +401,7 @@ _strnset _strrev _strset _strupr -;_vsnprintf +_vsnprintf _wcsicmp _wcslwr _wcsnicmp diff --git a/reactos/ntoskrnl/ntoskrnl.edf b/reactos/ntoskrnl/ntoskrnl.edf index 9b393da625a..9ad87b0fbe8 100644 --- a/reactos/ntoskrnl/ntoskrnl.edf +++ b/reactos/ntoskrnl/ntoskrnl.edf @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.edf,v 1.25 2000/01/10 22:46:37 ea Exp $ +; $Id: ntoskrnl.edf,v 1.26 2000/01/12 19:01:56 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -390,7 +390,7 @@ ZwYieldExecution=ZwYieldExecution@0 _itoa ;_local_unwind2 ;_purecall -;_snprintf +_snprintf ;_snwprintf _stricmp _strlwr @@ -399,7 +399,7 @@ _strnset _strrev _strset _strupr -;_vsnprintf +_vsnprintf _wcsicmp _wcslwr _wcsnicmp diff --git a/reactos/ntoskrnl/ob/dirobj.c b/reactos/ntoskrnl/ob/dirobj.c index c573f2ad2d7..ea9ac745936 100644 --- a/reactos/ntoskrnl/ob/dirobj.c +++ b/reactos/ntoskrnl/ob/dirobj.c @@ -1,4 +1,4 @@ -/* $Id: dirobj.c,v 1.6 1999/11/27 03:31:08 ekohl Exp $ +/* $Id: dirobj.c,v 1.7 2000/01/12 19:04:22 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -202,7 +202,7 @@ NtQueryDirectoryObject ( Entry ); DPRINT( - "Scanning %w\n", + "Scanning %S\n", current->Name.Buffer ); diff --git a/reactos/ntoskrnl/ob/namespc.c b/reactos/ntoskrnl/ob/namespc.c index 12d873c1afd..8912d1b2d45 100644 --- a/reactos/ntoskrnl/ob/namespc.c +++ b/reactos/ntoskrnl/ob/namespc.c @@ -88,7 +88,7 @@ PVOID ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject, PLIST_ENTRY current = DirectoryObject->head.Flink; POBJECT_HEADER current_obj; - DPRINT("ObDirLookup(dir %x, name %w)\n",DirectoryObject, Name); + DPRINT("ObDirLookup(dir %x, name %S)\n",DirectoryObject, Name); if (Name[0]==0) { @@ -105,7 +105,7 @@ PVOID ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject, while (current!=(&(DirectoryObject->head))) { current_obj = CONTAINING_RECORD(current,OBJECT_HEADER,Entry); - DPRINT("Scanning %w %w\n",current_obj->Name.Buffer, Name); + DPRINT("Scanning %S %S\n",current_obj->Name.Buffer, Name); if (Attributes & OBJ_CASE_INSENSITIVE) { if (_wcsicmp(current_obj->Name.Buffer, Name)==0) @@ -134,7 +134,7 @@ PVOID ObpParseDirectory(PVOID Object, PWSTR* Path) PWSTR end; PVOID FoundObject; - DPRINT("ObpParseDirectory(Object %x, Path %x, *Path %w)\n", + DPRINT("ObpParseDirectory(Object %x, Path %x, *Path %S)\n", Object,Path,*Path); if ((*Path) == NULL) @@ -184,7 +184,7 @@ NTSTATUS ObpCreateDirectory(PVOID ObjectBody, { PDIRECTORY_OBJECT DirectoryObject = (PDIRECTORY_OBJECT)ObjectBody; - DPRINT("ObpCreateDirectory(ObjectBody %x, Parent %x, RemainingPath %w)\n", + DPRINT("ObpCreateDirectory(ObjectBody %x, Parent %x, RemainingPath %S)\n", ObjectBody, Parent, RemainingPath); if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL) diff --git a/reactos/ntoskrnl/ob/object.c b/reactos/ntoskrnl/ob/object.c index cf14510f950..93b822ba0bc 100644 --- a/reactos/ntoskrnl/ob/object.c +++ b/reactos/ntoskrnl/ob/object.c @@ -107,7 +107,7 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes, while (TRUE) { - DPRINT("current %w\n",current); + DPRINT("current %S\n",current); CurrentHeader = BODY_TO_HEADER(CurrentObject); if (CurrentHeader->ObjectType->Parse == NULL) { @@ -146,7 +146,7 @@ PVOID ObCreateObject(PHANDLE Handle, if (ObjectAttributes != NULL && ObjectAttributes->ObjectName != NULL) { - DPRINT("ObjectAttributes->ObjectName->Buffer %w\n", + DPRINT("ObjectAttributes->ObjectName->Buffer %S\n", ObjectAttributes->ObjectName->Buffer); } @@ -205,7 +205,7 @@ NTSTATUS ObReferenceObjectByPointer(PVOID ObjectBody, if (ObjectType != NULL && ObjectHeader->ObjectType != ObjectType) { - DPRINT("Failed %x (type was %x %w) should %x\n", + DPRINT("Failed %x (type was %x %S) should %x\n", ObjectHeader, ObjectHeader->ObjectType, ObjectHeader->ObjectType->TypeName.Buffer, diff --git a/reactos/ntoskrnl/rtl/vsprintf.c b/reactos/ntoskrnl/rtl/vsprintf.c index 884e8b11e03..50e2a9ac203 100644 --- a/reactos/ntoskrnl/rtl/vsprintf.c +++ b/reactos/ntoskrnl/rtl/vsprintf.c @@ -13,48 +13,20 @@ * Appropiated for the reactos kernel, March 1998 -- David Welch */ +#include #include - -#include #include -#include #include -#include +#define NDEBUG +#include -unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) -{ - unsigned long result = 0,value; - - if (!base) { - base = 10; - if (*cp == '0') { - base = 8; - cp++; - if ((*cp == 'x') && isxdigit(cp[1])) { - cp++; - base = 16; - } - } - } - while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp) - ? toupper(*cp) : *cp)-'A'+10) < base) { - result = result*base + value; - cp++; - } - if (endp) - *endp = (char *)cp; - return result; -} - -/* we use this so that we can do without the ctype library */ -#define is_digit(c) ((c) >= '0' && (c) <= '9') static int skip_atoi(const char **s) { int i=0; - while (is_digit(**s)) + while (isdigit(**s)) i = i*10 + *((*s)++) - '0'; return i; } @@ -73,8 +45,8 @@ __res = ((unsigned long) n) % (unsigned) base; \ n = ((unsigned long) n) / (unsigned) base; \ __res; }) -static char * number(char * str, long num, int base, int size, int precision - ,int type) +static char * +number (char * str, long num, int base, int size, int precision, int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; @@ -86,8 +58,10 @@ static char * number(char * str, long num, int base, int size, int precision type &= ~ZEROPAD; if (base < 2 || base > 36) return 0; + c = (type & ZEROPAD) ? '0' : ' '; sign = 0; + if (type & SIGN) { if (num < 0) { sign = '-'; @@ -101,12 +75,14 @@ static char * number(char * str, long num, int base, int size, int precision size--; } } + if (type & SPECIAL) { if (base == 16) size -= 2; else if (base == 8) size--; } + i = 0; if (num == 0) tmp[i++]='0'; @@ -127,7 +103,7 @@ static char * number(char * str, long num, int base, int size, int precision *str++ = '0'; *str++ = digits[33]; } - } + } if (!(type & LEFT)) while (size-- > 0) *str++ = c; @@ -140,15 +116,14 @@ static char * number(char * str, long num, int base, int size, int precision return str; } -int vsprintf(char *buf, const char *fmt, va_list args) +int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args) { int len; unsigned long num; int i, base; char * str; const char *s; - const short int *sw; - PUNICODE_STRING pus; + const short int* sw; int flags; /* flags to number() */ @@ -156,13 +131,13 @@ int vsprintf(char *buf, const char *fmt, va_list args) int precision; /* min. # of digits for integers; max number of chars for from string */ int qualifier; /* 'h', 'l', or 'L' for integer fields */ - + for (str=buf ; *fmt ; ++fmt) { if (*fmt != '%') { *str++ = *fmt; continue; } - + /* process flags */ flags = 0; repeat: @@ -173,11 +148,11 @@ int vsprintf(char *buf, const char *fmt, va_list args) case ' ': flags |= SPACE; goto repeat; case '#': flags |= SPECIAL; goto repeat; case '0': flags |= ZEROPAD; goto repeat; - } - + } + /* get field width */ field_width = -1; - if (is_digit(*fmt)) + if (isdigit(*fmt)) field_width = skip_atoi(&fmt); else if (*fmt == '*') { ++fmt; @@ -192,8 +167,8 @@ int vsprintf(char *buf, const char *fmt, va_list args) /* get the precision */ precision = -1; if (*fmt == '.') { - ++fmt; - if (is_digit(*fmt)) + ++fmt; + if (isdigit(*fmt)) precision = skip_atoi(&fmt); else if (*fmt == '*') { ++fmt; @@ -206,7 +181,8 @@ int vsprintf(char *buf, const char *fmt, va_list args) /* get the conversion qualifier */ qualifier = -1; - if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') { + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'w' || + (*fmt == 'I' && *(fmt+1) == '6' && *(fmt+2) == '4')) { qualifier = *fmt; ++fmt; } @@ -219,54 +195,26 @@ int vsprintf(char *buf, const char *fmt, va_list args) if (!(flags & LEFT)) while (--field_width > 0) *str++ = ' '; - *str++ = (unsigned char) va_arg(args, int); + if (qualifier == 'l' || qualifier == 'w') + *str++ = (unsigned char) va_arg(args, wchar_t); + else + *str++ = (unsigned char) va_arg(args, int); + while (--field_width > 0) + *str++ = ' '; + continue; + + case 'C': + if (!(flags & LEFT)) + while (--field_width > 0) + *str++ = ' '; + if (qualifier == 'h') + *str++ = (unsigned char) va_arg(args, int); + else + *str++ = (unsigned char) va_arg(args, wchar_t); while (--field_width > 0) *str++ = ' '; continue; - case 'w': - sw = va_arg(args,short int *); -// DPRINT("L %x\n",sw); - if (sw==NULL) - { -// CHECKPOINT; - s = ""; - while ((*s)!=0) - { - *str++ = *s++; - } -// CHECKPOINT; -// DbgPrint("str %x\n",str); - } - else - { - while ((*sw)!=0) - { - *str++ = (char)(*sw++); - } - } -// CHECKPOINT; - continue; - - case 'W': - pus = va_arg(args, PUNICODE_STRING); - if (pus == NULL) - { - s = ""; - while ((*s) != 0) - { - *str++ = *s++; - } - } - else - { - for (i = 0; pus->Buffer[i] && i < pus->Length; i++) - { - *str++ = (char)(pus->Buffer[i]); - } - } - continue; - case 's': s = va_arg(args, char *); if (!s) @@ -283,9 +231,78 @@ int vsprintf(char *buf, const char *fmt, va_list args) *str++ = ' '; continue; +/* + case 'w': + sw = va_arg(args,short int *); +// DPRINT("L %x\n",sw); + if (sw==NULL) { +// CHECKPOINT; + s = ""; + while ((*s)!=0) + *str++ = *s++; +// CHECKPOINT; +// DbgPrint("str %x\n",str); + } else { + while ((*sw)!=0) + *str++ = (char)(*sw++); + } +// CHECKPOINT; + continue; +*/ + + case 'S': + sw = va_arg(args,short int *); + if (sw==NULL) { + s = ""; + while ((*s)!=0) + *str++ = *s++; + } else { + while ((*sw)!=0) + *str++ = (char)(*sw++); + } + continue; + +/* + case 'W': + pus = va_arg(args, PUNICODE_STRING); + if (pus == NULL) { + s = ""; + while ((*s) != 0) + *str++ = *s++; + } else { + for (i = 0; pus->Buffer[i] && i < pus->Length; i++) + *str++ = (char)(pus->Buffer[i]); + } + continue; +*/ + + case 'Z': + if (qualifier == 'w') { + PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING); + if (pus == NULL) { + s = ""; + while ((*s) != 0) + *str++ = *s++; + } else { + for (i = 0; pus->Buffer[i] && i < pus->Length; i++) + *str++ = (char)(pus->Buffer[i]); + } + } else { + PANSI_STRING pus = va_arg(args, PANSI_STRING); + if (pus == NULL) { + s = ""; + while ((*s) != 0) + *str++ = *s++; + } else { + for (i = 0; pus->Buffer[i] && i < pus->Length; i++) + *str++ = pus->Buffer[i]; + } + } + continue; + case 'p': if (field_width == -1) { - field_width = 2*sizeof(void *); + field_width = 2 * sizeof(void *); flags |= ZEROPAD; } str = number(str, @@ -293,7 +310,6 @@ int vsprintf(char *buf, const char *fmt, va_list args) field_width, precision, flags); continue; - case 'n': if (qualifier == 'l') { long * ip = va_arg(args, long *); @@ -308,11 +324,11 @@ int vsprintf(char *buf, const char *fmt, va_list args) case 'o': base = 8; break; - - case 'b': - base = 2; - break; - + + case 'b': + base = 2; + break; + case 'X': flags |= LARGE; case 'x': @@ -334,19 +350,17 @@ int vsprintf(char *buf, const char *fmt, va_list args) --fmt; continue; } - if (qualifier == 'l') { + if (qualifier == 'l') num = va_arg(args, unsigned long); - } else if (qualifier == 'h') { - if (flags & SIGN) { + else if (qualifier == 'h') + if (flags & SIGN) num = va_arg(args, short); - } else { + else num = va_arg(args, unsigned short); - } - } else if (flags & SIGN) { + else if (flags & SIGN) num = va_arg(args, int); - } else { + else num = va_arg(args, unsigned int); - } str = number(str, num, base, field_width, precision, flags); } *str = '\0'; @@ -359,8 +373,25 @@ int sprintf(char * buf, const char *fmt, ...) int i; va_start(args, fmt); - i=vsprintf(buf,fmt,args); + i=_vsnprintf(buf,INT_MAX,fmt,args); va_end(args); return i; } +int _snprintf(char * buf, size_t cnt, const char *fmt, ...) +{ + va_list args; + int i; + + va_start(args, fmt); + i=_vsnprintf(buf,cnt,fmt,args); + va_end(args); + return i; +} + +int vsprintf(char *buf, const char *fmt, va_list args) +{ + return _vsnprintf(buf,INT_MAX,fmt,args); +} + +/* EOF */ diff --git a/reactos/ntoskrnl/rtl/wstring.c b/reactos/ntoskrnl/rtl/wstring.c index e3c89ea2bd3..42625eb2727 100644 --- a/reactos/ntoskrnl/rtl/wstring.c +++ b/reactos/ntoskrnl/rtl/wstring.c @@ -148,7 +148,7 @@ int wcscmp(const wchar_t *cs, const wchar_t *ct) wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2) { wchar_t* s = str1; - DPRINT("wcscpy(str1 %w, str2 %w)\n",str1,str2); + DPRINT("wcscpy(str1 %S, str2 %S)\n",str1,str2); while ((*str2)!=0) { *s = *str2;