⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wmi.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 2 页
字号:

; 239  :    PAGED_CODE();

  00056	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0005c	ff d6		 call	 esi
  0005e	3c 01		 cmp	 al, 1
  00060	76 29		 jbe	 SHORT $L15064
  00062	ff d6		 call	 esi
  00064	0f b6 c0	 movzx	 eax, al
  00067	50		 push	 eax
  00068	68 00 00 00 00	 push	 OFFSET FLAT:$SG15063
  0006d	e8 00 00 00 00	 call	 _DbgPrint
  00072	59		 pop	 ecx
  00073	59		 pop	 ecx
  00074	6a 00		 push	 0
  00076	68 ef 00 00 00	 push	 239			; 000000efH
  0007b	68 00 00 00 00	 push	 OFFSET FLAT:$SG15066
  00080	68 00 00 00 00	 push	 OFFSET FLAT:$SG15067
  00085	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15064:

; 240  : 
; 241  :    //
; 242  :    // Toss this request -- we don't support anything for it
; 243  :    //
; 244  : 
; 245  :    return SerialTossWMIRequest(PDevObj, PIrp, GuidIndex);

  0008b	ff 75 10	 push	 DWORD PTR _GuidIndex$[ebp]
  0008e	ff 75 0c	 push	 DWORD PTR _PIrp$[ebp]
  00091	ff 75 08	 push	 DWORD PTR _PDevObj$[ebp]
  00094	e8 00 00 00 00	 call	 _SerialTossWMIRequest@12
  00099	5e		 pop	 esi

; 246  : }

  0009a	5d		 pop	 ebp
  0009b	c2 18 00	 ret	 24			; 00000018H
_SerialSetWmiDataBlock@24 ENDP
PAGESRP0	ENDS
PUBLIC	_SerialQueryWmiDataBlock@32
EXTRN	_SerialGetProperties@8:NEAR
;	COMDAT _SerialQueryWmiDataBlock@32
PAGESRP0	SEGMENT
$SG15090 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG15093 DB	'f:\w2ddk\src\kernel\serial\wmi.c', 00H
	ORG $+3
$SG15094 DB	'FALSE', 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_PIrp$ = 12
_GuidIndex$ = 16
_InstanceLengthArray$ = 28
_OutBufferSize$ = 32
_PBuffer$ = 36
_SerialQueryWmiDataBlock@32 PROC NEAR			; COMDAT

; 297  : {

  00052	55		 push	 ebp
  00053	8b ec		 mov	 ebp, esp

; 298  :     NTSTATUS status;
; 299  :     ULONG size = 0;
; 300  :     PSERIAL_DEVICE_EXTENSION pDevExt
; 301  :        = (PSERIAL_DEVICE_EXTENSION)PDevObj->DeviceExtension;

  00055	8b 45 08	 mov	 eax, DWORD PTR _PDevObj$[ebp]
  00058	53		 push	 ebx
  00059	56		 push	 esi
  0005a	57		 push	 edi
  0005b	8b 70 28	 mov	 esi, DWORD PTR [eax+40]
  0005e	33 db		 xor	 ebx, ebx

; 302  : 
; 303  :     PAGED_CODE();

  00060	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  00066	3c 01		 cmp	 al, 1
  00068	76 2c		 jbe	 SHORT $L15091
  0006a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  00070	0f b6 c0	 movzx	 eax, al
  00073	50		 push	 eax
  00074	68 00 00 00 00	 push	 OFFSET FLAT:$SG15090
  00079	e8 00 00 00 00	 call	 _DbgPrint
  0007e	59		 pop	 ecx
  0007f	59		 pop	 ecx
  00080	53		 push	 ebx
  00081	68 2f 01 00 00	 push	 303			; 0000012fH
  00086	68 00 00 00 00	 push	 OFFSET FLAT:$SG15093
  0008b	68 00 00 00 00	 push	 OFFSET FLAT:$SG15094
  00090	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15091:

; 304  : 
; 305  :     switch (GuidIndex) {

  00096	8b 45 10	 mov	 eax, DWORD PTR _GuidIndex$[ebp]
  00099	83 e8 00	 sub	 eax, 0
  0009c	0f 84 82 00 00
	00		 je	 $L15099
  000a2	48		 dec	 eax
  000a3	74 62		 je	 SHORT $L15113
  000a5	48		 dec	 eax
  000a6	74 4d		 je	 SHORT $L15119
  000a8	48		 dec	 eax
  000a9	74 38		 je	 SHORT $L15125
  000ab	48		 dec	 eax
  000ac	74 0a		 je	 SHORT $L15131

; 404  : 
; 405  :     default:
; 406  :         status = STATUS_WMI_GUID_NOT_FOUND;

  000ae	b8 95 02 00 c0	 mov	 eax, -1073741163	; c0000295H

; 407  :         break;

  000b3	e9 b5 00 00 00	 jmp	 $L15096
$L15131:

; 384  : 
; 385  :     case WMI_SERIAL_PORT_PROPERTIES: 
; 386  :       size = sizeof(SERIAL_COMMPROP) + sizeof(ULONG);

  000b8	6a 44		 push	 68			; 00000044H
  000ba	5b		 pop	 ebx

; 387  : 
; 388  :       if (OutBufferSize < size) {

  000bb	39 5d 20	 cmp	 DWORD PTR _OutBufferSize$[ebp], ebx
  000be	73 0a		 jae	 SHORT $L15134
$L15199:

; 389  :          status = STATUS_BUFFER_TOO_SMALL;

  000c0	b8 23 00 00 c0	 mov	 eax, -1073741789	; c0000023H

; 390  :          break;

  000c5	e9 a3 00 00 00	 jmp	 $L15096
$L15134:

; 391  :       }
; 392  : 
; 393  :       *InstanceLengthArray = size;
; 394  :       SerialGetProperties(
; 395  :                 pDevExt,
; 396  :                 (PSERIAL_COMMPROP)PBuffer
; 397  :                 );

  000ca	8b 7d 24	 mov	 edi, DWORD PTR _PBuffer$[ebp]
  000cd	8b 45 1c	 mov	 eax, DWORD PTR _InstanceLengthArray$[ebp]
  000d0	57		 push	 edi
  000d1	56		 push	 esi
  000d2	89 18		 mov	 DWORD PTR [eax], ebx
  000d4	e8 00 00 00 00	 call	 _SerialGetProperties@8

; 398  : 	
; 399  :       *((PULONG)(((PSERIAL_COMMPROP)PBuffer)->ProvChar)) = 0;

  000d9	33 c0		 xor	 eax, eax
  000db	89 47 3c	 mov	 DWORD PTR [edi+60], eax

; 400  : 
; 401  :       status = STATUS_SUCCESS;
; 402  : 
; 403  :       break;

  000de	e9 8a 00 00 00	 jmp	 $L15096
$L15125:

; 369  : 
; 370  :     case WMI_SERIAL_PORT_PERF_INFORMATION: 
; 371  :       size = sizeof(SERIAL_WMI_PERF_DATA);

  000e3	6a 18		 push	 24			; 00000018H
  000e5	5b		 pop	 ebx

; 372  : 
; 373  :       if (OutBufferSize < size) {

  000e6	39 5d 20	 cmp	 DWORD PTR _OutBufferSize$[ebp], ebx

; 374  :          status = STATUS_BUFFER_TOO_SMALL;
; 375  :          break;

  000e9	72 d5		 jb	 SHORT $L15199

; 376  :       }
; 377  : 
; 378  :       *InstanceLengthArray = size;
; 379  :       *(PSERIAL_WMI_PERF_DATA)PBuffer = pDevExt->WmiPerfData;

  000eb	81 c6 18 06 00
	00		 add	 esi, 1560		; 00000618H
  000f1	6a 06		 push	 6

; 380  : 
; 381  :       status = STATUS_SUCCESS;
; 382  : 
; 383  :       break;

  000f3	eb 22		 jmp	 SHORT $L15200
$L15119:

; 354  : 
; 355  :     case WMI_SERIAL_PORT_HW_INFORMATION:
; 356  :        size = sizeof(SERIAL_WMI_HW_DATA);

  000f5	6a 20		 push	 32			; 00000020H
  000f7	5b		 pop	 ebx

; 357  : 
; 358  :        if (OutBufferSize < size) {

  000f8	39 5d 20	 cmp	 DWORD PTR _OutBufferSize$[ebp], ebx

; 359  :           status = STATUS_BUFFER_TOO_SMALL;
; 360  :           break;

  000fb	72 c3		 jb	 SHORT $L15199

; 361  :        }
; 362  : 
; 363  :        *InstanceLengthArray = size;
; 364  :        *(PSERIAL_WMI_HW_DATA)PBuffer = pDevExt->WmiHwData;

  000fd	81 c6 f8 05 00
	00		 add	 esi, 1528		; 000005f8H
  00103	6a 08		 push	 8

; 365  : 
; 366  :        status = STATUS_SUCCESS;
; 367  : 
; 368  :        break;

  00105	eb 10		 jmp	 SHORT $L15200
$L15113:

; 337  : 
; 338  :         break;
; 339  : 
; 340  :     case WMI_SERIAL_PORT_COMM_INFORMATION: 
; 341  :        size = sizeof(SERIAL_WMI_COMM_DATA);

  00107	6a 40		 push	 64			; 00000040H
  00109	5b		 pop	 ebx

; 342  : 
; 343  :        if (OutBufferSize < size) {

  0010a	39 5d 20	 cmp	 DWORD PTR _OutBufferSize$[ebp], ebx

; 344  :           status = STATUS_BUFFER_TOO_SMALL;
; 345  :           break;

  0010d	72 b1		 jb	 SHORT $L15199

; 346  :         }
; 347  : 
; 348  :         *InstanceLengthArray = size;
; 349  :         *(PSERIAL_WMI_COMM_DATA)PBuffer = pDevExt->WmiCommData;

  0010f	81 c6 b4 05 00
	00		 add	 esi, 1460		; 000005b4H
  00115	6a 10		 push	 16			; 00000010H
$L15200:
  00117	8b 45 1c	 mov	 eax, DWORD PTR _InstanceLengthArray$[ebp]
  0011a	8b 7d 24	 mov	 edi, DWORD PTR _PBuffer$[ebp]
  0011d	59		 pop	 ecx
  0011e	89 18		 mov	 DWORD PTR [eax], ebx
  00120	f3 a5		 rep movsd

; 350  : 
; 351  :         status = STATUS_SUCCESS;
; 352  : 
; 353  :         break;

  00122	eb 47		 jmp	 SHORT $L15197
$L15099:

; 306  :     case WMI_SERIAL_PORT_NAME_INFORMATION:
; 307  :        size = pDevExt->WmiIdentifier.Length;

  00124	0f b7 9e ac 05
	00 00		 movzx	 ebx, WORD PTR [esi+1452]

; 308  : 
; 309  :        if (OutBufferSize < (size + sizeof(USHORT))) {

  0012b	8d 53 02	 lea	 edx, DWORD PTR [ebx+2]
  0012e	39 55 20	 cmp	 DWORD PTR _OutBufferSize$[ebp], edx
  00131	73 04		 jae	 SHORT $L15101

; 310  :             size += sizeof(USHORT);

  00133	8b da		 mov	 ebx, edx

; 311  :             status = STATUS_BUFFER_TOO_SMALL;
; 312  :             break;

  00135	eb 89		 jmp	 SHORT $L15199
$L15101:

; 313  :         }
; 314  : 
; 315  :        if (pDevExt->WmiIdentifier.Buffer == NULL) {

  00137	81 c6 b0 05 00
	00		 add	 esi, 1456		; 000005b0H
  0013d	83 3e 00	 cmp	 DWORD PTR [esi], 0
  00140	75 07		 jne	 SHORT $L15105

; 316  :            status = STATUS_INSUFFICIENT_RESOURCES;

  00142	b8 9a 00 00 c0	 mov	 eax, -1073741670	; c000009aH

; 317  :            break;

  00147	eb 24		 jmp	 SHORT $L15096
$L15105:

; 318  :         }
; 319  : 
; 320  :         //
; 321  :         // First, copy the string over containing our identifier
; 322  :         //
; 323  : 
; 324  :         *(USHORT *)PBuffer = (USHORT)size;

  00149	8b 45 24	 mov	 eax, DWORD PTR _PBuffer$[ebp]

; 325  :         (UCHAR *)PBuffer += sizeof(USHORT);
; 326  : 
; 327  :         RtlCopyMemory(PBuffer, pDevExt->WmiIdentifier.Buffer, size);

  0014c	8b cb		 mov	 ecx, ebx
  0014e	66 89 18	 mov	 WORD PTR [eax], bx
  00151	8b 36		 mov	 esi, DWORD PTR [esi]
  00153	8d 78 02	 lea	 edi, DWORD PTR [eax+2]
  00156	8b c1		 mov	 eax, ecx
  00158	c1 e9 02	 shr	 ecx, 2
  0015b	f3 a5		 rep movsd
  0015d	8b c8		 mov	 ecx, eax

; 328  : 
; 329  :         //
; 330  :         // Increment total size to include the WORD containing our len
; 331  :         //
; 332  : 
; 333  :         size += sizeof(USHORT);
; 334  :         *InstanceLengthArray = size;

  0015f	8b 45 1c	 mov	 eax, DWORD PTR _InstanceLengthArray$[ebp]
  00162	83 e1 03	 and	 ecx, 3
  00165	8b da		 mov	 ebx, edx
  00167	f3 a4		 rep movsb
  00169	89 18		 mov	 DWORD PTR [eax], ebx
$L15197:

; 335  :                 
; 336  :         status = STATUS_SUCCESS;

  0016b	33 c0		 xor	 eax, eax
$L15096:

; 408  :     }
; 409  : 
; 410  :     status = WmiCompleteRequest( PDevObj, PIrp,
; 411  :                                   status, size, IO_NO_INCREMENT);

  0016d	6a 00		 push	 0
  0016f	53		 push	 ebx
  00170	50		 push	 eax
  00171	ff 75 0c	 push	 DWORD PTR _PIrp$[ebp]
  00174	ff 75 08	 push	 DWORD PTR _PDevObj$[ebp]
  00177	e8 00 00 00 00	 call	 _WmiCompleteRequest@20
  0017c	5f		 pop	 edi
  0017d	5e		 pop	 esi
  0017e	5b		 pop	 ebx

; 412  : 
; 413  :     return status;
; 414  : }

  0017f	5d		 pop	 ebp
  00180	c2 20 00	 ret	 32			; 00000020H
_SerialQueryWmiDataBlock@32 ENDP
PAGESRP0	ENDS
PUBLIC	_SerialQueryWmiRegInfo@24
EXTRN	_SerialGlobals:BYTE
;	COMDAT _SerialQueryWmiRegInfo@24
PAGESRP0	SEGMENT
$SG15158 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG15161 DB	'f:\w2ddk\src\kernel\serial\wmi.c', 00H
	ORG $+3
$SG15162 DB	'FALSE', 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_PRegFlags$ = 12
_PRegistryPath$ = 20
_Pdo$ = 28
_SerialQueryWmiRegInfo@24 PROC NEAR			; COMDAT

; 468  : {

  00052	55		 push	 ebp
  00053	8b ec		 mov	 ebp, esp

; 469  :    PSERIAL_DEVICE_EXTENSION pDevExt
; 470  :        = (PSERIAL_DEVICE_EXTENSION)PDevObj->DeviceExtension;

  00055	8b 45 08	 mov	 eax, DWORD PTR _PDevObj$[ebp]
  00058	56		 push	 esi

; 471  :    
; 472  :    PAGED_CODE();

  00059	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0005f	57		 push	 edi
  00060	8b 78 28	 mov	 edi, DWORD PTR [eax+40]
  00063	ff d6		 call	 esi
  00065	3c 01		 cmp	 al, 1
  00067	76 29		 jbe	 SHORT $L15159
  00069	ff d6		 call	 esi
  0006b	0f b6 c0	 movzx	 eax, al
  0006e	50		 push	 eax
  0006f	68 00 00 00 00	 push	 OFFSET FLAT:$SG15158
  00074	e8 00 00 00 00	 call	 _DbgPrint
  00079	59		 pop	 ecx
  0007a	59		 pop	 ecx
  0007b	6a 00		 push	 0
  0007d	68 d8 01 00 00	 push	 472			; 000001d8H
  00082	68 00 00 00 00	 push	 OFFSET FLAT:$SG15161
  00087	68 00 00 00 00	 push	 OFFSET FLAT:$SG15162
  0008c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15159:

; 473  : 
; 474  :    *PRegFlags = WMIREG_FLAG_INSTANCE_PDO;

  00092	8b 45 0c	 mov	 eax, DWORD PTR _PRegFlags$[ebp]

; 475  :    *PRegistryPath = &SerialGlobals.RegistryPath;
; 476  :    *Pdo = pDevExt->Pdo;

  00095	8b 4d 1c	 mov	 ecx, DWORD PTR _Pdo$[ebp]
  00098	c7 00 20 00 00
	00		 mov	 DWORD PTR [eax], 32	; 00000020H
  0009e	8b 45 14	 mov	 eax, DWORD PTR _PRegistryPath$[ebp]
  000a1	c7 00 0c 00 00
	00		 mov	 DWORD PTR [eax], OFFSET FLAT:_SerialGlobals+12
  000a7	8b 87 80 05 00
	00		 mov	 eax, DWORD PTR [edi+1408]
  000ad	89 01		 mov	 DWORD PTR [ecx], eax
  000af	5f		 pop	 edi

; 477  : 
; 478  :    return STATUS_SUCCESS;

  000b0	33 c0		 xor	 eax, eax
  000b2	5e		 pop	 esi

; 479  : }

  000b3	5d		 pop	 ebp
  000b4	c2 18 00	 ret	 24			; 00000018H
_SerialQueryWmiRegInfo@24 ENDP
PAGESRP0	ENDS
END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -