3GL   4GL   5GL  

OutputDebugString

  1. LIMODS
  2. LIMODS
  3. MFC
  4. LIMODS
  5. LIMODS
  6. LOM-
  7. LOM-
  8. LIMODSDLL.DLL
  9. _cdecl-
  10. ,
  11. LIMODS?

" " , , , , , , 10 000 . , , . . 3, , : *. .

, . , , , .

, , , , ? LIMODS (LIMit OutputDebugStrings), , Visual C++ Visual Basic. , , . LIMODS, , , .

 

. , #define. , #define . , , , - .

. , . "" . MFC (Microsoft Foundation Class), TRACER.EXE. MFC -, , , , Output . , , MFC- (wizards) , . , , TRACE ( #undef), , , , -, . , . , . . , Visual Basic.

, , , . , ( ) , , . .

, , , . , , . , (. " LIMODS" ).

 

LIMODS

, , , LIMODS . . , , . :

LIMODS, , . .

 

LIMODS

LIMODS ( LIMODS -) LIMODS-. LIMODS (LIMODS.INI) %SYSTEMROOT% Windows. LIMODS (*.LOM) , , LIMODS. LOMDirectory [LIMODS] LIMODS.INI, GENLIMODS.EXE LOM- . LIMODSDLL.DLL, BUGSLAYERUTIL.DLL, GENLIMODS.EXE LIMODS.EXE , PATH.

 

MFC

LIMODS , MFC42D.DLL, MFC42UD.DLL, . , 1001 DLL. LIMODS , AfxTrace DLL- MFC. , AfxTrace , , DLL , . LIMODS.INI MFC42(U)D.DLL, Visual C++ 5 Service Pack, Visual C++ 6 Service Pack, Visual C++ 6 Service Pack 1 (SP1), Visual C++ 6 Service Pack 2 (SP2) Visual C++ 6 Service Pack 3 (SP3).

Visual C++ LIMODS.INI ( Service Pack), , LIMODS MFC42D.DLL MFC42UD.DLL. %SYSTEMROOT%\System32\MFC42(U)D.DLL , Windows . . ( ) . , MFC42D.DLL, Visual C++ 6.0 SP3, 6.00.8447.0.

\MFC\SRC\Intel Visual C++. DEF-, MFC. DEF- . , MFC42D.DEF DEF- MFC42D.DLL. DEF- ?AfxTrace@@YAXPBpzz MFC42D.DLL. MFC42UD.DLL ?AfxTrace@@YAXPBGZZ. :

?AfxTrace@@YAXPBDZZ @ 1179 NONAME

@ AfxTrace. : LIMODS.INI.

LIMODS.INI. MFC42D.DLL [MFC42D.DLL Hack-0-Rama],   MFC42UD.DLL [MFC42UD.DLLHack-o-Rama]. MFC42D.DLL ( MFC42UD.DLL ):

[MFC42D.DLL Hack-0-Rama] 

VerCount=3

; VC 6.0 SP3 

VerO=6.00.8447.0,1179 ;

VC 6.0 SP1 and SP2.

Verl=6.00.8267.0,1179 ; 

VC 6.0 NO SERVICE PACKS

Ver2=6.00.8168.0,1179

verN . MFC-, AfxTrace. 1 MFC- AfxTrace [MFC42D.DLL Hack-0-Rama] [MFC42UD.DLL Hack-0-Rama]. , Visual C++ 5 Service Pack, ver3=4.21.7022,1253 ( MFC42D.DLL). 1 vercount (vercount=4). MFC42UD.DLL Visual C++ 5 Service Pack :

Ver3=4.21.7022,1256.

MFC MFC42(U)D.DLL, , . , , MFC MFC (, , MFC- ).

  , ParN . .

LIMODS MFC-, MFC42(U)D.DLL . LIMODS.INI , ( Output) , . LIMODS (\SourceCode\LIMODS\TestLIMODS), -, , LIMODS.

 

LIMODS

MFC DLL, , , LIMODS , /++- :

LoadLibrary ( "LIMODSDLL.DLL");

LIMODSDLL.DLL DllMain, . , LIMODS.

Visual Basic-, LIMODS , . LIMODS.CLS INDESIGNMOD.BAS \SourceCode \LIMODS\VB - . CISLIMODS, 14-1. CLIMODS. CISLIMODS ; Trace, , Debug.Print. Debug.Print, , LIMODS Visual Basic, . IDE, Trace CISLIMODS Debug. Print, Immediate.

, LIMODS=-1, . , . LIMODS , , , ClsLIMODS .

14-1. LIMDOS.CLS

VERSION 1.0 CLASS 

BEGIN

MultiUse = -1 'True

Persistable = 0 'NotPersistable

DataBindingBehavior = 0 'vbNone

DataSourceBehavior = 0 'vbNone

MTSTransactionMode = 0 'NotAnMTSObject

 END

Attribute VB_Name = "clsLIMODS" 

Attribute VB_GlobalNameSpace = False 

Attribute VB_Creatable = True 

Attribute VB_PredeclaredId = False

 Attribute VB_Exposed = False

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'Copyright (c) 1997-2000 John Robbins All rights reserved. 

' "Debugging Applications" (Microsoft Press)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' LIMODS Visual Basic

' 1. Visual Basic-

' . (

' "cLIMODS".)

' 2. ,

' cLIMODS.Trace.

' 3. LIMODS Visual Basic-.

' VB-IDE,

'

' Debug.Print.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Option Explicit

Private Declare Function LoadLibrary Lib "kerne!32" _

 Alias "LoadLibraryA" _

(ByVal IpLibFileName As String) As Long

 Private Declare Sub OutputDebugString Lib "kerne!32" _

 Alias "OutputDebugStringA" _ 

(ByVal IpOutputString As String)

Private Declare Function GetModuleFileName Lib "kerne!32" _ 

Alias "GetModuleFileNameA"

 _ (ByVal hModule As Long, _ 

ByVal IpFileName As String, _ 

ByVal nSize As Long) As Long

Private Declare Function GetModuleHandle Lib "kerne!32" _ 

Alias "GetModuleHandleA" _

(ByVal IpModuleName As String) As Long

Private m_Is!nIDE As Boolean

#If LIMODS Then 

Private Sub Class_Initialize()

 Dim blsInlDE As Boolean 

blsInlDE = InDesign()

' If blsInlDE is False, the main module isn't the Visual Basic IDE, 

' so I can load LIMODSDLL.DLL. 

If (False = blsInlDE) Then

LoadLibrary "LIMODSDLL.DLL" 

m_Is!nIDE = False Else

m_IsInIDE = True 

End If 

End Sub

#End If

#If LIMODS Then

Public Sub Trace(sOut As Variant) 

If (True = m_Is!nIDE) Then

Debug.Print sOut

 Else

Dim s As String 

s = sOut

OutputDebugString s 

End If 

End Sub

#Else ' LIMODS is *not* conditionally defined.

 Public Sub Trace(sOut As Variant)

 End Sub

#End If

 

*.LOM , , LIMODSDLL.DLL, . LIMODS LOM- , - . LOM- , GENLIMODS.EXE. GENLIMODS.EXE, . LOM- , LIMODS.EXE , . . 14.1 LIMODS.EXE . , .

. 14.1. LIMODS.EXE

 

LIMODS

LIMODS . , DBGHELP.DLL, , _cdeci-, , .

, , , DBGHELP.DLL ( 4). , , , ( ). , 12, OutputDebugString , , . , .

API-, , , SymEnumerateSymbols. , ( ) ( SymGetLinePrev) symGetLineNext. SymEnumerateSymbols , GENLIMODS.EXE, , , SymEnumerateSymbols, , GENLIMODS.EXE. , .

, . 14.1. - , SymGetLineNext SymGetLinePrev () . 14.1 , (inline) GENLIMODS.CPP. , , . : , .

14.1. GENLIMODS.EXE

0x00401900

0x0040 1A8A

COMMANDLINE.CPP

0x00401000

Ox00402F1F

GENLIMODS.CPP

0x00403450

0x00403774

RESSTRING.H

0x00403700

0x00403700

GENLIMODS.H

0x00403060

Ox004040F9

SYMBOLENGINE.H

0x00404690

Ox004046AC

GENLIMODS.CPP

0x00407080

Ox0040852E

LOMFILE.CPP

0x00409050

Ox0040A532

READIGNOREFILES.CPP

Ox0040C800

0x00400894

VERBOSE.CPP

 

LOM-

14.2, , LOM-, GENLIMODS.EXE, *.INI. ([Module info]) , LOM- ( , /). LIMODSDLL.DLL , LOM-; / LOM- LIMODSDLL.DLL, GENLIMODS.EXE LOM- . , LIMODSDLL.DLL , " " ( ). LIMODSDLL.DLL ( outputoebugstring), .

14-2. LOM- 

[Module Info] 

DateTimeStamp=380b75e8

BaseAddress=400000 

ModuleName=LIMODS.exe

[Ranges]

RangeCount=11

Range0=0x004017D0|0x00401C8E|0 ID:\Book\SourceCode\LIMODS\About.cpp

Rangel=0x00401EF0|0x00402313|0 ID:\Book\SourceCode\LIMODS\BigIcon.CPP

Range2=0x00402430|0x00402A5E|0|D:\Book\SourceCode\LIMODS\LIMODS.cpp

Range3=0x00402D60| 0x00403727111D:\Book\SourceCode\LIMODS\LIMODSDoc.cpp

Range4=0x004044B0 0x0040480010|D:\Book\SourceCode\LIMODS\LIMODSOptions.cpp

Range5=0x00404950I 0x00405823|0 ID:\Book\SourceCode\LIMODS\LIMODSView.cpp

Range6=0x00405D70|0x00405DB0|0 ID:\Book\SourceCode\LIMODS\LIMODSDoc.h

Range7=0x00406150|0x0040752110 ID:\Book\SourceCode\LIMODS\LOMFile.cpp

Range8=0x00408D00|0x004090FF|0|D:\Book\SourceCode\LIMODS\MainFrm.cpp

Range9=0x00409270 I 0x00409516|0 ID:\Book\SourceCode\LIMODS\OptionsDialog.cpp

RangelO=0x0040A0A0|0x0040A140I 0 Iappmodul.cpp

[Sources]

Source0=0|D:\Book\SourceCode\LIMODS\About.cpp

Sourcel=0|D:\Book\SourceCode\LIMODS\BigIcon.CPP

Source2=0|D:\Book\SourceCode\LIMODS\LIMODS.cpp

Source3=lID:\Book\SourceCode\LIMODS\LIMODSDoc.cpp

Source4=0|D:\Book\SourceCode\LIMODS\LIMODSOptions.cpp

Source5=0ID:\Book\SourceCode\LIMODS\LIMODSView.cpp

Source6=0|D:\Book\SourceCode\LIMODS\LIMODSDoc.h

Source7=0|D:\Book\SourceCode\LIMODS\LOMFile.cpp

Source8=0|D:\Book\SourceCode\LIMODS\MainFrm.cpp

Source9=0|D:\Book\SourceCode\LIMODS\OptionsDialog.cpp

Sourcel0=0|appmodul.cpp

SourceCount=l1

[Ranges] ( ) . , , LIMODSDLL.DLL, , . : , , () . [Sources] LIMODS.EXE, ( ). INI- , LOMFILE.H LOMFILE.CPP. , LIMODS.EXE , " .

 

LOM-

GENLIMODS.EXE LOM- , . , (Standard Template Library STL), , , LIMODSDLL.DLL, LOM-. GENLIMODS.EXE SYSINCL.DAT MSVCINCL.DAT. Visual C++ . SYSINCL.DAT , \Include (<VC98>\Include <VC98>\MFC\Include). , MSVCINCL.DAT , . , GENLIMODS.EXE , PATH, LIMODSINCL.DAT, , LOM-. , LOM- , LIMODSINCL.DAT. - \SourceCode\LIMODS LIMODSINCL.DAT, LOM- .

 

LIMODSDLL.DLL

LIMODSDLL.DLL , . LIMODS OutputDebugStringA OutputDebugStringW KERNEL32.DLL, DiagOutputA DiagOutputW BUGSLAYERUTIL.DLL, _CrtDbgReport MSVCRTD.DLL AfxTrace MFC42(U)D.DLL. , LoadLibrary, .

LIMODS Visual Basic, GetProcAddress, , MSVBVM60.DLL OutputDebugStringA. 12 , , . DiagOutputA, DiagOutputW AfxTrace . -, _cdeci ( _stdcaii), 12 , . , AfxTrace ( ).

 

_dl-

12, _stdcail- , ; _cdeci- .

_stdcaii _cdeci C/C++ (. . 6.3 6).

  , DiagOutputA, DiagOutputW AfxTrace, , . , _stdcaii-, _cdeci- . LIMODSDLL.DLL , , , . , , . _stdcaii- . , . _cdeci- , , ( !).

  14-3. cdecl-  

VOID NAKEDDEF LIMODS_DiagOutputA ( void)

{

//

DWORD_PTR dwRet;

// ESI,

// Visual C++ 6 . (ESI chkesp,

// /GZ.)

DWORD_PTR dwESI;

_asm PUSH EBP /* . */

_asm MOV EBP, ESP

_asm SUB ESP, _LOCAL_SIZE /* */

/* . */

_asm MOV EAX, EBP /* EBP .*/

 _asm ADD EAX, 4 /* PUSH EBP. */ 

_asm MOV EAX, [EAX] /* . */ 

_asm MOV [dwRet], EAX /* . */

 _asm MOV [dwESI], ESI /* ESI, */

/* chkesp. */

// , ,

// .

 // . TRUE

 // , a FALSE .

 ChecklfAddressIsOn ( dwRet);

_asm MOV ESI, [dwESI] /* ESI. */

 _asm ADD ESP, _LOCAL_SIZE /*

/* . */

_asm MOV ESP, EBP /* . */

 _asm POP EBP

// !

 // ,

 // ,  

// . pReadDiagOutputA  

// , .

 _asm TEST , /* 0. */

 _asm JZ IblDiagOutputA /* 0,

/* .*/ 

_asm JMP pReadDiagOutputA /* ! JUMP */

/* , . */

 IblDiagOutputA:

/* TRACE! */

_asm RET /* . */

 }

14-3 , DiagOutputA BUGSLAYERUTIL.DLL. , _cdeci- , LIMODSDLL.CPP ( ). Disassembly Visual C++, .

 

,

, , , (- , MFC DLL ). , , . HookordinaiExport, 14-4, HookimportedFunctionsByName, 12, , .

14-4. HookordinaiExport 

BOOL BUGSUTILJ3LLINTERFACE _stdcall

HookordinaiExport ( HMODULE hModule , 

LPCTSTR szImportMod, 

DWORD dwOrdinal ,

 PROC pHookFunc , 

PROC * ppOrigAddr )

{

// .

 ASSERT ( NULL != hModule);

ASSERT ( FALSE == IsBadStringPtr ( szImportMod, MAX_PATH)); 

ASSERT ( 0 != dwOrdinal);

ASSERT ( FALSE = IsBadCodePtr ( pHookFunc));

 // .

if ( ( NULL == hModule ' ) | |

 ( TRUE == IsBadStringPtr ( szImportMod, MAX_PATH)) || 

( 0 == dwOrdinal ) I I ( TRUE == IsBadCodePtr ( pHookFunc) ) )

 {

SetLastErrorEx ( ERROR_INVALID_PARAMETER, SLE_ERROR);

 return ( FALSE); 

}

if ( NULL != ppOrigAddr)

{

ASSERT ( FALSE ==

IsBadWritePtr ( ppOrigAddr, sizeof ( PROG))); 

if ( TRUE == IsBadWritePtr ( ppOrigAddr, sizeof ( PROC)))

 {

SetLastErrorEx ( ERROR_INVALID_PARAMETER, SLE_ERROR);

 return ( FALSE);

 }

 }

// .

 PIMAGE_IMPORT_DESCRIPTOR plmportDesc =

GetNamedlmportDescriptor ( hModule, szImportMod);

 if ( NULL == plmportDesc) 

{

// . ,

 return ( TRUE); 

}

// DLL

. // ,

 // pImportDesc->FirstThunk, . .  

// .

 // .

 PIMAGE_THUNK_DATA pOrigThunk =

MakePtr ( PIMAGE_THUNK_DATA

hModule , 

pImportDesc->OriginalFirstThunk );

// p!mportDesc->FirstThunk,

 // .

PIMAGE_THUNK_DATA pRealThunk = MakePtr ( PIMAGE_THUNK_DATA ,

hModule , 

pImportDesc->FirstThunk );

// ,

// .

DWORD dwCompareOrdinal = IMAGE JDRDINAL_FLAG | dwOrdinal;

// .

while ( NULL != pOrigThunk->ul.Function)

{

// ,

 // , , 

if ( IMAGE__ORDINAL_FLAG ==

( pOrigThunk->ul.Ordinal & IMAGE_ORDINAL_FLAG))

 {

// ? 

if ( dwCompareOrdinal == pOrigThunk->ul.Ordinal) . 

{

// .

 // "read-write" ( ),

 // . ,

 //  

// !

MEMORY_BASIC__IN FORMATION mbi_thunk ; 

VirtualQuery ( pRealThunk , 

 &mbi_thunk , 

sizeof ( MEMORY_BASIC_INFORMATION) ); 

if ( FALSE == VirtualProtect ( mbi_thunk.BaseAddress,

rabi_thunk.RegionSize ,

 PAGE_READWRITE ,

&mbi_thunk.Protect ))

 {

ASSERT ( !"VirtualProtect failed!");

 //  

// ( FALSE),

 // .

 SetLastErrorEx ( ERROR__INVALID_PARAMETER,

SLE^ERROR );

return ( FALSE); 

}

// ,

 if ( NULL != ppOrigAddr)

 {

*ppOrigAddr = (PROC)pRealThunk->ul.Function; 

}

// Microsoft  

// I_ع_- Win64

 //

// W2K RC2 Platform SDK,

 // Visual C++ 6 Service Pack 3.

// (DWORD*)SpRealThunk->ul.Function; 

*pTemp = (DWORD)(pHookFunc); 

DWORD dwOldProtect;

// ,

 // .

 VERIFY ( VirtualProtect ( mbi_thunk.BaseAddress,

mbi_thunk.RegionSize ,

 mbi_thunk.Protect , 

sdwOldProtect )); 

// ! 

SetLastError ( ERROR_SUCCESS);

 return ( TRUE);

 } 

}

// . pOrigThunk++; pRealThunk++;

 }

// . .

 // , , .

 SetLastError ( ERROR_SDCCESS);

 return ( FALSE); 

}

AfxTrace , , OutputDebugstring. , AfxTrace. , AfxTrace, LIMODS , , MFC-. , , LIMODS , , MFC DLL.

 

, - LIMODS . , LIMODS.EXE, (. . 14.1). ( ), ( ) ( ). . LIMODSVIEW.CPP, -.

, LIMODS, (STL). , STL , , , , Visual ++- STL . . , , , - . 2, 4- , STL 4786 ("'identifier': identifier was truncated to '255' characters in the debug information" '"1: '255' ") STL, .

4786 , #pragma warning STL. , , #pragma warning, , STL-, . , , STL (map classes).

, , , . LIMODSDLL.DLL HOOKFUNCDESC, DiagOutputA DiagOutputw BUGSLAYERUTIL.DLL. . , .

JMP g_stBugslayerUtilRealFuncs [0] .

JMP g_stBugslayerUtilRealFuncs+4h

. , :

JMP g_stBugslayerUtilRealFuncs[l].pProc

 

JMP g_stBugslayerUtilRealFuncs+5h,

,

JMP g_stBugslayerUtilRealFuncs+OCh

, "" . ,

JMP g_stBugslayerUtilRealFuncs[0x8].

, , LIMODSDLL.DLL . , BUGSLAYERUTIL.DLL.

 

LIMODS?

LIMODS (, 1.1) , . ( ):

, , , LIMODS, , . LIMODS . LIMODS Visual ++- Visual Basic.

LIMODS . LIMODS , . LIMODS , .

  (nonintrusive) , , . .

        3GL   4GL   5GL  

, - - , . COM, CORBA, .Net.




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution