Hi, again,...MABDELOUAHAB,
I have another problem,...in fact,...
I'm completely stuck.
I'm going through the code in
__GetDefaultDomain,...and, I'm trying to make sense out of the purpose of both functions,
__ForEachAssemblyInIAppDomain and
CallBackFunction_GetMsCorLibAssembly. I think I understand what is supposed to happen in
__ForEachAssemblyInIAppDomain (the code iterates through all loaded assemblies in the AppDomain, calling
CallBackFunction_GetMsCorLibAssembly for each one). But,...what is supposed to happen in
CallBackFunction_GetMsCorLibAssembly ??? Specifically, I have absolutely no idea what this block of code is supposed to be doing:
; (from procedure, CallBackFunction_GetMsCorLibAssembly)
.IF __Asm ; __Asm is a pointer to the data returned in SAFEARRAY (returned from _APPDomain:GetAssemblies).
LEA ECX,__lpstrname
PUSH ECX
MOV EDX, __Asm
PUSH EDX
MOV EDX,[EDX]
CALL DWORD PTR [EDX+28] ; What the HECK are we calling here ??? GetType, or, GetName ???
...Right after the code calls:
CALL DWORD PTR [EDX+28],...the code then immediately calls: CompareStringW (which does NOT return CSTR_EQUAL), so the
CallBackFunction_GetMsCorLibAssembly function returns TRUE (meaning WHAT ???),...only that
__ForEachAssemblyInIAppDomain then returns.
Returning then, to
__GetDefaultDomain there is a long block of code that doesn't execute (which I assume is supposed to execute, or it wouldn't be there):
.IF MsCorLib
MOV EDX,BSTR$("System.AppDomain") ; If this block of code were executing the application would crash at the BSTR$ Macro.
LEA ECX,tAppDomain
PUSH ECX
PUSH EDX
MOV EDX, MsCorLib
PUSH EDX
MOV EDX,[EDX]
CALL DWORD PTR [EDX+68]
.IF !EAX
LEA ECX,aProperties
PUSH ECX
MOV EDX, tAppDomain
PUSH EDX
MOV EDX,[EDX]
CALL DWORD PTR [EDX+308]
.IF !EAX
MOV ECX,aProperties
MOV EDX,[ECX].SAFEARRAY.rgsabound.cElements
MOV ESI,[ECX].SAFEARRAY.pvData
XOR ECX,ECX
MOV CurrentDomainProperty,ECX
SPr__:
CMP ECX,EDX
JE EPr__
PUSH ECX
PUSH EDX
MOV EAX,[ESI]
LEA ECX,__lpstrname
PUSH ECX
MOV EDX, EAX
PUSH EDX
MOV EDX,[EDX]
CALL DWORD PTR [EDX+48]
.IF !EAX
invoke CompareString, LOCALE_USER_DEFAULT, NORM_IGNORECASE, __lpstrname,-1,BSTR$("CurrentDomain"),13
.IF EAX == CSTR_EQUAL
invoke SysFreeString,__lpstrname
MOV EAX,[ESI]
MOV CurrentDomainProperty,EAX
POP EDX
POP ECX
jmp EPr__
.ENDIF
invoke SysFreeString,__lpstrname
.ENDIF
POP EDX
POP ECX
INC ECX
ADD ESI,4
JMP SPr__
EPr__:
.IF CurrentDomainProperty
LEA ECX,vtDefaultDomain
PUSH ECX
PUSH 0
PUSH 0
PUSH 0
PUSH 0
PUSH 0
MOV EDX, CurrentDomainProperty
PUSH EDX
MOV EDX,[EDX]
CALL DWORD PTR [EDX+76]
.IF !EAX
MOV DefaultDomain ,offset vtDefaultDomain
MOV EAX,DefaultDomain
RET
.ELSE
__ExeptionMsg BSTR$("CurrentDomain.GetValue FAIL")
MOV EAX,FALSE
.ENDIF
.ELSE
__ExeptionMsg BSTR$("CurrentDomainProperty FAIL ")
MOV EAX,FALSE
.ENDIF
.ELSE
MOV EAX,FALSE
.ENDIF
.ELSE
MOV EAX,FALSE
.ENDIF
.ENDIF
Also, if the above block of code does NOT execute, then
__Private_GetBasicMethods doesn't execute,...:icon_eek:
Arrgh !!! I'm so confused here, that I'm not even sure I'm expressing the situation correctly,...:icon_eek:
...So,...I launched ProcessExplorer to see what DLLs were being loaded by the version 4 CLR when calling
__GetDefaultDomain, and, weirdly enough, the DLL:
mscorlib.ni.dll is loaded into the process address space.
...And,...so,...finally,...what is supposed to be happening here ???