Actually if the condition of the foor loop in the free build is iCount >= 0
then in the m/c code there is no comparision at all there will be a
unconditional jump to the beginig of the foor loop like this
000b9 83 ef 08 sub edi, 8
000bc eb ce jmp SHORT $L13115
- so it goes to infinite loop. Where are in the condition of for loop in the
free build is iCount > -1 thne in the machine code there is a comparision and
then this a “ja” [jump if above ??] to the begining of the for loop…
like this
000ba 83 ef 08 sub edi, 8
000bd 83 ff f8 cmp edi, -8 ; fffffff8H
000c0 77 cb ja SHORT $L13115
so this wont be an infinite loop !!! [This is the optimisation of the
compiler ??]
I’ve given the code and the generated m/c code for that…
Here are the two, genetated m/c codes…
The original source code was :-
BOOLEAN WfcInetNtoA(in_addr dwIpAddr, char * cBufPtr)
{
ULONG dwTempIpAddr;
ULONG iTotalLength=0;
ANSI_STRING DestinationString;
UNICODE_STRING OutPutString;
UNICODE_STRING UniCodeString;
UNICODE_STRING DotUniString;
CHAR OutputCharString = “000.000.000.000”;
WCHAR WideStr[100];
WCHAR TempIntStr[20];
int iCount;
RtlInitAnsiString(
(PANSI_STRING)&DestinationString,(PCSZ)OutputCharString);
RtlInitUnicodeString((PUNICODE_STRING)&UniCodeString,
(PCWSTR)WideStr);
*(UniCodeString.Buffer) = 0;
UniCodeString.Length =0;
UniCodeString.MaximumLength = 100;
RtlInitUnicodeString((PUNICODE_STRING)&OutPutString,
(PCWSTR)TempIntStr);
*(OutPutString.Buffer) =0;
OutPutString.Length =0;
OutPutString.MaximumLength =20;
RtlInitUnicodeString((PUNICODE_STRING)&DotUniString, L".");
for(iCount = 3;iCount > -1;iCount–)
{
dwTempIpAddr = dwIpAddr.S_un.S_addr;
dwTempIpAddr = (dwTempIpAddr >> 8*iCount) & 0x000000ff;
RtlIntegerToUnicodeString( dwTempIpAddr,10, &OutPutString );
RtlAppendUnicodeStringToString( &UniCodeString, &OutPutString );
RtlAppendUnicodeStringToString( &UniCodeString,&DotUniString );
}
RtlUnicodeStringToAnsiString( &DestinationString, &UniCodeString,
FALSE);
RtlCopyBytes(cBufPtr, DestinationString.Buffer,
DestinationString.Length);
return(TRUE);
}
The machine code when the for free build of loop is (iCount = 3; iCount >= 0;
iCount --) is ----
; COMDAT _WfcInetNtoA@8
; File e:\wfckrnl\nbt\wfcnbt.c
_TEXT SEGMENT
$SG13103 DB ‘000.000.000.000’, 00H
$SG13114 DB ‘.’, 00H, 00H, 00H
_dwIpAddr$ = 8
_DestinationString$ = -32
_OutPutString$ = -16
_UniCodeString$ = -8
_DotUniString$ = -24
_OutputCharString$ = -48
_WideStr$ = -288
_TempIntStr$ = -88
xxxxx@8 PROC NEAR ; COMDAT
; 6694 : {
00014 55 push ebp
00015 8b ec mov ebp, esp
00017 81 ec 20 01 00
00 sub esp, 288 ; 00000120H
0001d 56 push esi
0001e 57 push edi
; 6695 :
; 6696 : ULONG dwTempIpAddr;
; 6697 : ULONG iTotalLength=0;
; 6698 : ANSI_STRING DestinationString;
; 6699 : UNICODE_STRING OutPutString;
; 6700 : UNICODE_STRING UniCodeString;
; 6701 : UNICODE_STRING DotUniString;
; 6702 : CHAR OutputCharString = “000.000.000.000”;
0001f be 00 00 00 00 mov esi, OFFSET FLAT:$SG13103
00024 8d 7d d0 lea edi, DWORD PTR _OutputCharString$[ebp]
00027 a5 movsd
00028 a5 movsd
; 6703 : WCHAR WideStr[100];
; 6704 : WCHAR TempIntStr[20];
; 6705 : int iCount;
; 6706 :
; 6707 :
; 6708 : RtlInitAnsiString(
(PANSI_STRING)&DestinationString,(PCSZ)OutputCharString);
00029 8d 45 d0 lea eax, DWORD PTR _OutputCharString$[ebp]
0002c a5 movsd
0002d 50 push eax
0002e 8d 45 e0 lea eax, DWORD PTR _DestinationString$[ebp]
00031 50 push eax
00032 a5 movsd
00033 ff 15 00 00 00
00 call DWORD PTR __imp__RtlInitAnsiString@8
; 6709 : RtlInitUnicodeString((PUNICODE_STRING)&UniCodeString,
(PCWSTR)WideStr);
00039 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__RtlInitUnicodeString@8
0003f 8d 85 e0 fe ff
ff lea eax, DWORD PTR _WideStr$[ebp]
00045 50 push eax
00046 8d 45 f8 lea eax, DWORD PTR _UniCodeString$[ebp]
00049 50 push eax
0004a ff d6 call esi
; 6710 : *(UniCodeString.Buffer) = 0;
0004c 8b 45 fc mov eax, DWORD PTR _UniCodeString$[ebp+4]
0004f 33 ff xor edi, edi
00051 66 89 38 mov WORD PTR [eax], di
; 6711 : UniCodeString.Length =0;
; 6712 : UniCodeString.MaximumLength = 100;
; 6713 :
; 6714 :
; 6715 : RtlInitUnicodeString((PUNICODE_STRING)&OutPutString,
(PCWSTR)TempIntStr);
00054 8d 45 a8 lea eax, DWORD PTR _TempIntStr$[ebp]
00057 50 push eax
00058 8d 45 f0 lea eax, DWORD PTR _OutPutString$[ebp]
0005b 50 push eax
0005c 66 89 7d f8 mov WORD PTR _UniCodeString$[ebp], di
00060 66 c7 45 fa 64
00 mov WORD PTR _UniCodeString$[ebp+2], 100 ; 00000064H
00066 ff d6 call esi
; 6716 : *(OutPutString.Buffer) =0;
00068 8b 45 f4 mov eax, DWORD PTR _OutPutString$[ebp+4]
; 6717 : OutPutString.Length =0;
; 6718 : OutPutString.MaximumLength =20;
; 6719 :
; 6720 : RtlInitUnicodeString((PUNICODE_STRING)&DotUniString, L".");
0006b 68 00 00 00 00 push OFFSET FLAT:$SG13114
00070 66 89 38 mov WORD PTR [eax], di
00073 8d 45 e8 lea eax, DWORD PTR _DotUniString$[ebp]
00076 50 push eax
00077 66 89 7d f0 mov WORD PTR _OutPutString$[ebp], di
0007b 66 c7 45 f2 14
00 mov WORD PTR _OutPutString$[ebp+2], 20 ; 00000014H
00081 ff d6 call esi
00083 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__RtlAppendUnicodeStringToString@8
00089 6a 18 push 24 ; 00000018H
0008b 5f pop edi
$L13115:
; 6721 :
; 6722 : for(iCount = 3;iCount >= 0;iCount–)
; 6723 : {
; 6724 :
; 6725 : dwTempIpAddr = dwIpAddr.S_un.S_addr;
; 6726 :
; 6727 : dwTempIpAddr = (dwTempIpAddr >> 8*iCount) & 0x000000ff;
; 6728 :
; 6729 : RtlIntegerToUnicodeString( dwTempIpAddr,
; 6730 : 10,
; 6731 : &OutPutString
; 6732 : );
0008c 8d 45 f0 lea eax, DWORD PTR _OutPutString$[ebp]
0008f 8b cf mov ecx, edi
00091 50 push eax
00092 8b 45 08 mov eax, DWORD PTR _dwIpAddr$[ebp]
00095 d3 e8 shr eax, cl
00097 6a 0a push 10 ; 0000000aH
00099 25 ff 00 00 00 and eax, 255 ; 000000ffH
0009e 50 push eax
0009f ff 15 00 00 00
00 call DWORD PTR __imp__RtlIntegerToUnicodeString@12
; 6733 :
; 6734 : RtlAppendUnicodeStringToString(
; 6735 : &UniCodeString,
; 6736 : &OutPutString
; 6737 : );
000a5 8d 45 f0 lea eax, DWORD PTR _OutPutString$[ebp]
000a8 50 push eax
000a9 8d 45 f8 lea eax, DWORD PTR _UniCodeString$[ebp]
000ac 50 push eax
000ad ff d6 call esi
; 6738 :
; 6739 :
; 6740 : RtlAppendUnicodeStringToString(
; 6741 : &UniCodeString,
; 6742 : &DotUniString
; 6743 : );
000af 8d 45 e8 lea eax, DWORD PTR _DotUniString$[ebp]
000b2 50 push eax
000b3 8d 45 f8 lea eax, DWORD PTR _UniCodeString$[ebp]
000b6 50 push eax
000b7 ff d6 call esi
000b9 83 ef 08 sub edi, 8
000bc eb ce jmp SHORT $L13115
xxxxx@8 ENDP
_TEXT ENDS
EXTRN __imp__RtlUnicodeStringToInteger@12:NEAR
EXTRN __imp__RtlAnsiStringToUnicodeString@12:NEAR
EXTRN xxxxx@4:NEAR
; COMDAT _WfcInetAddr@4
when the for loop ishe free build with the for loop as you said (iCount = 3;
iCount >-1;iCount–) the m/c code for free build will be
; COMDAT _WfcInetNtoA@8
; File e:\wfckrnl\nbt\wfcnbt.c
_TEXT SEGMENT
$SG13103 DB ‘000.000.000.000’, 00H
$SG13114 DB ‘.’, 00H, 00H, 00H
_dwIpAddr$ = 8
_cBufPtr$ = 12
_DestinationString$ = -24
_OutPutString$ = -16
_UniCodeString$ = -8
_DotUniString$ = -32
_OutputCharString$ = -48
_WideStr$ = -288
_TempIntStr$ = -88
xxxxx@8 PROC NEAR ; COMDAT
; 6694 : {
00014 55 push ebp
00015 8b ec mov ebp, esp
00017 81 ec 20 01 00
00 sub esp, 288 ; 00000120H
0001d 53 push ebx
0001e 56 push esi
0001f 57 push edi
; 6695 :
; 6696 : ULONG dwTempIpAddr;
; 6697 : ULONG iTotalLength=0;
; 6698 : ANSI_STRING DestinationString;
; 6699 : UNICODE_STRING OutPutString;
; 6700 : UNICODE_STRING UniCodeString;
; 6701 : UNICODE_STRING DotUniString;
; 6702 : CHAR OutputCharString = “000.000.000.000”;
00020 be 00 00 00 00 mov esi, OFFSET FLAT:$SG13103
00025 8d 7d d0 lea edi, DWORD PTR _OutputCharString$[ebp]
; 6703 : WCHAR WideStr[100];
; 6704 : WCHAR TempIntStr[20];
; 6705 : int iCount;
; 6706 :
; 6707 :
; 6708 : RtlInitAnsiString(
(PANSI_STRING)&DestinationString,(PCSZ)OutputCharString);
00028 8d 45 d0 lea eax, DWORD PTR _OutputCharString$[ebp]
0002b a5 movsd
0002c a5 movsd
0002d a5 movsd
0002e 50 push eax
0002f 8d 45 e8 lea eax, DWORD PTR _DestinationString$[ebp]
00032 50 push eax
00033 a5 movsd
00034 ff 15 00 00 00
00 call DWORD PTR __imp__RtlInitAnsiString@8
; 6709 : RtlInitUnicodeString((PUNICODE_STRING)&UniCodeString,
(PCWSTR)WideStr);
0003a 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__RtlInitUnicodeString@8
00040 8d 85 e0 fe ff
ff lea eax, DWORD PTR _WideStr$[ebp]
00046 50 push eax
00047 8d 45 f8 lea eax, DWORD PTR _UniCodeString$[ebp]
0004a 50 push eax
0004b ff d6 call esi
; 6710 : *(UniCodeString.Buffer) = 0;
0004d 8b 45 fc mov eax, DWORD PTR _UniCodeString$[ebp+4]
00050 33 db xor ebx, ebx
00052 66 89 18 mov WORD PTR [eax], bx
; 6711 : UniCodeString.Length =0;
; 6712 : UniCodeString.MaximumLength = 100;
; 6713 :
; 6714 :
; 6715 : RtlInitUnicodeString((PUNICODE_STRING)&OutPutString,
(PCWSTR)TempIntStr);
00055 8d 45 a8 lea eax, DWORD PTR _TempIntStr$[ebp]
00058 50 push eax
00059 8d 45 f0 lea eax, DWORD PTR _OutPutString$[ebp]
0005c 50 push eax
0005d 66 89 5d f8 mov WORD PTR _UniCodeString$[ebp], bx
00061 66 c7 45 fa 64
00 mov WORD PTR _UniCodeString$[ebp+2], 100 ; 00000064H
00067 ff d6 call esi
; 6716 : *(OutPutString.Buffer) =0;
00069 8b 45 f4 mov eax, DWORD PTR _OutPutString$[ebp+4]
; 6717 : OutPutString.Length =0;
; 6718 : OutPutString.MaximumLength =20;
; 6719 :
; 6720 : RtlInitUnicodeString((PUNICODE_STRING)&DotUniString, L".");
0006c 68 00 00 00 00 push OFFSET FLAT:$SG13114
00071 66 89 18 mov WORD PTR [eax], bx
00074 8d 45 e0 lea eax, DWORD PTR _DotUniString$[ebp]
00077 50 push eax
00078 66 89 5d f0 mov WORD PTR _OutPutString$[ebp], bx
0007c 66 c7 45 f2 14
00 mov WORD PTR _OutPutString$[ebp+2], 20 ; 00000014H
00082 ff d6 call esi
00084 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__RtlAppendUnicodeStringToString@8
0008a 6a 18 push 24 ; 00000018H
0008c 5f pop edi
$L13115:
; 6721 :
; 6722 : for(iCount = 3;iCount > -1;iCount–)
; 6723 : {
; 6724 :
; 6725 : dwTempIpAddr = dwIpAddr.S_un.S_addr;
; 6726 :
; 6727 : dwTempIpAddr = (dwTempIpAddr >> 8*iCount) & 0x000000ff;
; 6728 :
; 6729 : RtlIntegerToUnicodeString( dwTempIpAddr,
; 6730 : 10,
; 6731 : &OutPutString
; 6732 : );
0008d 8d 45 f0 lea eax, DWORD PTR _OutPutString$[ebp]
00090 8b cf mov ecx, edi
00092 50 push eax
00093 8b 45 08 mov eax, DWORD PTR _dwIpAddr$[ebp]
00096 d3 e8 shr eax, cl
00098 6a 0a push 10 ; 0000000aH
0009a 25 ff 00 00 00 and eax, 255 ; 000000ffH
0009f 50 push eax
000a0 ff 15 00 00 00
00 call DWORD PTR __imp__RtlIntegerToUnicodeString@12
; 6733 :
; 6734 : RtlAppendUnicodeStringToString(
; 6735 : &UniCodeString,
; 6736 : &OutPutString
; 6737 : );
000a6 8d 45 f0 lea eax, DWORD PTR _OutPutString$[ebp]
000a9 50 push eax
000aa 8d 45 f8 lea eax, DWORD PTR _UniCodeString$[ebp]
000ad 50 push eax
000ae ff d6 call esi
; 6738 :
; 6739 :
; 6740 : RtlAppendUnicodeStringToString(
; 6741 : &UniCodeString,
; 6742 : &DotUniString
; 6743 : );
000b0 8d 45 e0 lea eax, DWORD PTR _DotUniString$[ebp]
000b3 50 push eax
000b4 8d 45 f8 lea eax, DWORD PTR _UniCodeString$[ebp]
000b7 50 push eax
000b8 ff d6 call esi
000ba 83 ef 08 sub edi, 8
000bd 83 ff f8 cmp edi, -8 ; fffffff8H
000c0 77 cb ja SHORT $L13115
; 6744 : }
; 6745 :
; 6746 : RtlUnicodeStringToAnsiString( &DestinationString,
; 6747 : &UniCodeString,
; 6748 : FALSE);
000c2 8d 45 f8 lea eax, DWORD PTR _UniCodeString$[ebp]
000c5 53 push ebx
000c6 50 push eax
000c7 8d 45 e8 lea eax, DWORD PTR _DestinationString$[ebp]
000ca 50 push eax
000cb ff 15 00 00 00
00 call DWORD PTR __imp__RtlUnicodeStringToAnsiString@12
; 6749 :
; 6750 : RtlCopyBytes(cBufPtr, DestinationString.Buffer,
DestinationString.Length);
000d1 0f b7 4d e8 movzx ecx, WORD PTR _DestinationString$[ebp]
000d5 8b 75 ec mov esi, DWORD PTR _DestinationString$[ebp+4]
000d8 8b 7d 0c mov edi, DWORD PTR _cBufPtr$[ebp]
000db 8b c1 mov eax, ecx
000dd c1 e9 02 shr ecx, 2
000e0 f3 a5 rep movsd
000e2 8b c8 mov ecx, eax
; 6751 :
; 6752 : return(TRUE);
000e4 b0 01 mov al, 1
000e6 83 e1 03 and ecx, 3
000e9 f3 a4 rep movsb
000eb 5f pop edi
000ec 5e pop esi
000ed 5b pop ebx
; 6753 : }
000ee c9 leave
000ef c2 08 00 ret 8
xxxxx@8 ENDP
_TEXT ENDS
EXTRN __imp__RtlUnicodeStringToInteger@12:NEAR
EXTRN __imp__RtlAnsiStringToUnicodeString@12:NEAR
EXTRN xxxxx@4:NEAR
; COMDAT _WfcInetAddr@4
- If the for loop is (iCount = 3; iCount > =0 ; iCount --) and the m/c code
for checked build will be
; COMDAT _WfcInetNtoA@8
; File e:\wfckrnl\nbt\wfcnbt.c
_TEXT SEGMENT
$SG13112 DB ‘000.000.000.000’, 00H
$SG13123 DB ‘.’, 00H, 00H, 00H
_dwIpAddr$ = 8
_cBufPtr$ = 12
_dwTempIpAddr$ = -300
_iTotalLength$ = -264
_DestinationString$ = -260
_OutPutString$ = -280
_UniCodeString$ = -252
_DotUniString$ = -272
_OutputCharString$ = -296
_WideStr$ = -244
_TempIntStr$ = -44
_iCount$ = -4
xxxxx@8 PROC NEAR ; COMDAT
; 6694 : {
00014 55 push ebp
00015 8b ec mov ebp, esp
00017 81 ec 2c 01 00
00 sub esp, 300 ; 0000012cH
0001d 56 push esi
0001e 57 push edi
; 6695 :
; 6696 : ULONG dwTempIpAddr;
; 6697 : ULONG iTotalLength=0;
0001f c7 85 f8 fe ff
ff 00 00 00 00 mov DWORD PTR _iTotalLength$[ebp], 0
; 6698 : ANSI_STRING DestinationString;
; 6699 : UNICODE_STRING OutPutString;
; 6700 : UNICODE_STRING UniCodeString;
; 6701 : UNICODE_STRING DotUniString;
; 6702 : CHAR OutputCharString = “000.000.000.000”;
00029 a1 00 00 00 00 mov eax, DWORD PTR $SG13112
0002e 89 85 d8 fe ff
ff mov DWORD PTR _OutputCharString$[ebp], eax
00034 8b 0d 04 00 00
00 mov ecx, DWORD PTR $SG13112+4
0003a 89 8d dc fe ff
ff mov DWORD PTR _OutputCharString$[ebp+4], ecx
00040 8b 15 08 00 00
00 mov edx, DWORD PTR $SG13112+8
00046 89 95 e0 fe ff
ff mov DWORD PTR _OutputCharString$[ebp+8], edx
0004c a1 0c 00 00 00 mov eax, DWORD PTR $SG13112+12
00051 89 85 e4 fe ff
ff mov DWORD PTR _OutputCharString$[ebp+12], eax
; 6703 : WCHAR WideStr[100];
; 6704 : WCHAR TempIntStr[20];
; 6705 : int iCount;
; 6706 :
; 6707 :
; 6708 : RtlInitAnsiString(
(PANSI_STRING)&DestinationString,(PCSZ)OutputCharString);
00057 8d 8d d8 fe ff
ff lea ecx, DWORD PTR _OutputCharString$[ebp]
0005d 51 push ecx
0005e 8d 95 fc fe ff
ff lea edx, DWORD PTR _DestinationString$[ebp]
00064 52 push edx
00065 ff 15 00 00 00
00 call DWORD PTR __imp__RtlInitAnsiString@8
; 6709 : RtlInitUnicodeString((PUNICODE_STRING)&UniCodeString,
(PCWSTR)WideStr);
0006b 8d 85 0c ff ff
ff lea eax, DWORD PTR _WideStr$[ebp]
00071 50 push eax
00072 8d 8d 04 ff ff
ff lea ecx, DWORD PTR _UniCodeString$[ebp]
00078 51 push ecx
00079 ff 15 00 00 00
00 call DWORD PTR __imp__RtlInitUnicodeString@8
; 6710 : *(UniCodeString.Buffer) = 0;
0007f 8b 95 08 ff ff
ff mov edx, DWORD PTR _UniCodeString$[ebp+4]
00085 66 c7 02 00 00 mov WORD PTR [edx], 0
; 6711 : UniCodeString.Length =0;
0008a 66 c7 85 04 ff
ff ff 00 00 mov WORD PTR _UniCodeString$[ebp], 0
; 6712 : UniCodeString.MaximumLength = 100;
00093 66 c7 85 06 ff
ff ff 64 00 mov WORD PTR _UniCodeString$[ebp+2], 100 ; 00000064H
; 6713 :
; 6714 :
; 6715 : RtlInitUnicodeString((PUNICODE_STRING)&OutPutString,
(PCWSTR)TempIntStr);
0009c 8d 45 d4 lea eax, DWORD PTR _TempIntStr$[ebp]
0009f 50 push eax
000a0 8d 8d e8 fe ff
ff lea ecx, DWORD PTR _OutPutString$[ebp]
000a6 51 push ecx
000a7 ff 15 00 00 00
00 call DWORD PTR __imp__RtlInitUnicodeString@8
; 6716 : *(OutPutString.Buffer) =0;
000ad 8b 95 ec fe ff
ff mov edx, DWORD PTR _OutPutString$[ebp+4]
000b3 66 c7 02 00 00 mov WORD PTR [edx], 0
; 6717 : OutPutString.Length =0;
000b8 66 c7 85 e8 fe
ff ff 00 00 mov WORD PTR _OutPutString$[ebp], 0
; 6718 : OutPutString.MaximumLength =20;
000c1 66 c7 85 ea fe
ff ff 14 00 mov WORD PTR _OutPutString$[ebp+2], 20 ; 00000014H
; 6719 :
; 6720 : RtlInitUnicodeString((PUNICODE_STRING)&DotUniString, L".");
000ca 68 00 00 00 00 push OFFSET FLAT:$SG13123
000cf 8d 85 f0 fe ff
ff lea eax, DWORD PTR _DotUniString$[ebp]
000d5 50 push eax
000d6 ff 15 00 00 00
00 call DWORD PTR __imp__RtlInitUnicodeString@8
; 6721 :
; 6722 : for(iCount = 3;iCount >= 0;iCount–)
000dc c7 45 fc 03 00
00 00 mov DWORD PTR _iCount$[ebp], 3
000e3 eb 09 jmp SHORT $L13124
$L13125:
000e5 8b 4d fc mov ecx, DWORD PTR _iCount$[ebp]
000e8 83 e9 01 sub ecx, 1
000eb 89 4d fc mov DWORD PTR _iCount$[ebp], ecx
$L13124:
000ee 83 7d fc 00 cmp DWORD PTR _iCount$[ebp], 0
000f2 7c 62 jl SHORT $L13126
; 6724 :
; 6725 : dwTempIpAddr = dwIpAddr.S_un.S_addr;
000f4 8b 55 08 mov edx, DWORD PTR _dwIpAddr$[ebp]
000f7 89 95 d4 fe ff
ff mov DWORD PTR _dwTempIpAddr$[ebp], edx
; 6726 :
; 6727 : dwTempIpAddr = (dwTempIpAddr >> 8*iCount) & 0x000000ff;
000fd 8b 4d fc mov ecx, DWORD PTR _iCount$[ebp]
00100 c1 e1 03 shl ecx, 3
00103 8b 85 d4 fe ff
ff mov eax, DWORD PTR _dwTempIpAddr$[ebp]
00109 d3 e8 shr eax, cl
0010b 25 ff 00 00 00 and eax, 255 ; 000000ffH
00110 89 85 d4 fe ff
ff mov DWORD PTR _dwTempIpAddr$[ebp], eax
; 6728 :
; 6729 : RtlIntegerToUnicodeString( dwTempIpAddr,
; 6730 : 10,
; 6731 : &OutPutString
; 6732 : );
00116 8d 8d e8 fe ff
ff lea ecx, DWORD PTR _OutPutString$[ebp]
0011c 51 push ecx
0011d 6a 0a push 10 ; 0000000aH
0011f 8b 95 d4 fe ff
ff mov edx, DWORD PTR _dwTempIpAddr$[ebp]
00125 52 push edx
00126 ff 15 00 00 00
00 call DWORD PTR __imp__RtlIntegerToUnicodeString@12
; 6733 :
; 6734 : RtlAppendUnicodeStringToString(
; 6735 : &UniCodeString,
; 6736 : &OutPutString
; 6737 : );
0012c 8d 85 e8 fe ff
ff lea eax, DWORD PTR _OutPutString$[ebp]
00132 50 push eax
00133 8d 8d 04 ff ff
ff lea ecx, DWORD PTR _UniCodeString$[ebp]
00139 51 push ecx
0013a ff 15 00 00 00
00 call DWORD PTR __imp__RtlAppendUnicodeStringToString@8
; 6738 :
; 6739 :
; 6740 : RtlAppendUnicodeStringToString(
; 6741 : &UniCodeString,
; 6742 : &DotUniString
; 6743 : );
00140 8d 95 f0 fe ff
ff lea edx, DWORD PTR _DotUniString$[ebp]
00146 52 push edx
00147 8d 85 04 ff ff
ff lea eax, DWORD PTR _UniCodeString$[ebp]
0014d 50 push eax
0014e ff 15 00 00 00
00 call DWORD PTR __imp__RtlAppendUnicodeStringToString@8
; 6744 : }
00154 eb 8f jmp SHORT $L13125
$L13126:
; 6745 :
; 6746 : RtlUnicodeStringToAnsiString( &DestinationString,
; 6747 : &UniCodeString,
; 6748 : FALSE);
00156 6a 00 push 0
00158 8d 8d 04 ff ff
ff lea ecx, DWORD PTR _UniCodeString$[ebp]
0015e 51 push ecx
0015f 8d 95 fc fe ff
ff lea edx, DWORD PTR _DestinationString$[ebp]
00165 52 push edx
00166 ff 15 00 00 00
00 call DWORD PTR __imp__RtlUnicodeStringToAnsiString@12
; 6749 :
; 6750 : RtlCopyBytes(cBufPtr, DestinationString.Buffer,
DestinationString.Length);
0016c 8b 8d fc fe ff
ff mov ecx, DWORD PTR _DestinationString$[ebp]
00172 81 e1 ff ff 00
00 and ecx, 65535 ; 0000ffffH
00178 8b b5 00 ff ff
ff mov esi, DWORD PTR _DestinationString$[ebp+4]
0017e 8b 7d 0c mov edi, DWORD PTR _cBufPtr$[ebp]
00181 8b c1 mov eax, ecx
00183 c1 e9 02 shr ecx, 2
00186 f3 a5 rep movsd
00188 8b c8 mov ecx, eax
0018a 83 e1 03 and ecx, 3
0018d f3 a4 rep movsb
; 6751 :
; 6752 : return(TRUE);
0018f b0 01 mov al, 1
; 6753 : }
00191 5f pop edi
00192 5e pop esi
00193 8b e5 mov esp, ebp
00195 5d pop ebp
00196 c2 08 00 ret 8
xxxxx@8 ENDP
_TEXT ENDS
EXTRN __imp__RtlUnicodeStringToInteger@12:NEAR
EXTRN __imp__RtlAnsiStringToUnicodeString@12:NEAR
EXTRN xxxxx@4:NEAR
; COMDAT _WfcInetAddr@4
Duncan Hume wrote:
That is true, but as the variable was declared as int (should be signed),
0xffffffff is -1. The code generated by the compiler for the var >= 0
should do a signed compare.
Duncan
-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: 23 June 2000 00:39
To: NT Developers Interest List
Subject: [ntdev] RE: Can we declare a variable as ‘int’ in the driver
???
>And I’ve found it then This loop is infinite, 'cause uCount is always >=
0.
:-)))))
Surely, it will be 0 - and will overflow to 0xffffffff (which is MAX_ULONG
which is > 0) on next iteration.
Max
You are currently subscribed to ntdev as: xxxxx@des.co.uk
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
You are currently subscribed to ntdev as: xxxxx@procsys.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)