1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
/*Ansi与Unicode字符串初始化与打印 by exchen 2009-10-02 */ #include <ntddk.h> VOID DriverUnload( IN PDRIVER_OBJECT DriverObject ) { DbgPrint("驱动已经被卸载了\n"); } NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) { CHAR *cstr = "My CHAR"; //定义ANIS字符指针 WCHAR *wstr = L"MY WCHAR"; //定义Unicode字符指针 UNICODE_STRING usStr; //定义Unicode字符串 RtlInitUnicodeString(&usStr,L"My String"); //初化始Unicode字符串 DbgPrint("%s",cstr); //打印ANIS字符 DbgPrint("%S",wstr); //打印Unicode字符 DbgPrint("%wZ",&usStr); //打印Unicode字符串 DriverObject->DriverUnload = DriverUnload; return STATUS_SUCCESS; } |