diff --git a/cpp/nativecall/Debug/IntCall.asm b/cpp/nativecall/Debug/IntCall.asm new file mode 100644 index 0000000..3ab588a --- /dev/null +++ b/cpp/nativecall/Debug/IntCall.asm @@ -0,0 +1,1766 @@ + TITLE C:\Documents and Settings\Administrator\My Documents\Software\NativeCall\src\cpp\IntCall.cpp + .386P +include listing.inc +if @Version gt 510 +.model FLAT +else +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT DWORD USE32 PUBLIC 'BSS' +_BSS ENDS +$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM' +$$SYMBOLS ENDS +$$TYPES SEGMENT BYTE USE32 'DEBTYP' +$$TYPES ENDS +_TLS SEGMENT DWORD USE32 PUBLIC 'TLS' +_TLS ENDS +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ??8@YAHABU_GUID@@0@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_IntCall_executeCall@8 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_IntCall_executeCall0@12 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +FLAT GROUP _DATA, CONST, _BSS + ASSUME CS: FLAT, DS: FLAT, SS: FLAT +endif +PUBLIC ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField +PUBLIC ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField +PUBLIC _Java_com_eaio_nativecall_IntCall_executeCall@8 +EXTRN __imp__GetLastError@0:NEAR +EXTRN ?fieldFunctionHandle@@3PAU_jfieldID@@A:DWORD ; fieldFunctionHandle +EXTRN ?fieldLastErrorCode@@3PAU_jfieldID@@A:DWORD ; fieldLastErrorCode +EXTRN __chkesp:NEAR +; COMDAT _Java_com_eaio_nativecall_IntCall_executeCall@8 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_functionHandle$ = -4 +_outVal$ = -8 +_Java_com_eaio_nativecall_IntCall_executeCall@8 PROC NEAR ; COMDAT + +; 79 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + sub esp, 72 ; 00000048H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-72] + mov ecx, 18 ; 00000012H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 80 : +; 81 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov eax, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField + mov DWORD PTR _functionHandle$[ebp], eax + +; 82 : jint outVal; +; 83 : +; 84 : #ifdef _WINDOWS +; 85 : #ifdef _X86_ +; 86 : +; 87 : __asm { +; 88 : +; 89 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 90 : mov outVal, eax + + mov DWORD PTR _outVal$[ebp], eax + +; 91 : +; 92 : } +; 93 : +; 94 : #endif +; 95 : #endif +; 96 : +; 97 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + mov esi, esp + call DWORD PTR __imp__GetLastError@0 + cmp esi, esp + call __chkesp + push eax + mov edx, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField + +; 98 : +; 99 : return outVal; + + mov eax, DWORD PTR _outVal$[ebp] + +; 100 : +; 101 : } + + pop edi + pop esi + pop ebx + add esp, 72 ; 00000048H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +_Java_com_eaio_nativecall_IntCall_executeCall@8 ENDP +_TEXT ENDS +PUBLIC ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField +PUBLIC ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ; JNIEnv_::SetObjectField +PUBLIC _Java_com_eaio_nativecall_IntCall_executeCall0@12 +PUBLIC ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z ; JNIEnv_::GetArrayLength +PUBLIC ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ; JNIEnv_::GetObjectArrayElement +PUBLIC ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' +PUBLIC ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical +PUBLIC ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ; JNIEnv_::ReleasePrimitiveArrayCritical +PUBLIC ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass +PUBLIC ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z ; JNIEnv_::ThrowNew +PUBLIC ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject +PUBLIC ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf +PUBLIC ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod +PUBLIC ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod +EXTRN ??2@YAPAXI@Z:NEAR ; operator new +EXTRN ??3@YAXPAX@Z:NEAR ; operator delete +EXTRN ?fieldHolderO@@3PAU_jfieldID@@A:DWORD ; fieldHolderO +EXTRN ?classBoolean@@3PAV_jclass@@A:DWORD ; classBoolean +EXTRN ?classInteger@@3PAV_jclass@@A:DWORD ; classInteger +EXTRN ?classByteArray@@3PAV_jclass@@A:DWORD ; classByteArray +EXTRN ?classCharArray@@3PAV_jclass@@A:DWORD ; classCharArray +EXTRN ?classHolder@@3PAV_jclass@@A:DWORD ; classHolder +EXTRN ?methodBooleanValue@@3PAU_jmethodID@@A:DWORD ; methodBooleanValue +EXTRN ?methodIntValue@@3PAU_jmethodID@@A:DWORD ; methodIntValue +EXTRN ?newIntegerInt@@3PAU_jmethodID@@A:DWORD ; newIntegerInt +EXTRN ?newBooleanBoolean@@3PAU_jmethodID@@A:DWORD ; newBooleanBoolean +EXTRN _memset:NEAR +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +; File c:\documents and settings\administrator\my documents\software\nativecall\src\cpp\intcall.cpp +CONST SEGMENT +??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ DB 'java/lang/OutOfMemor' + DB 'yError', 00H ; `string' +CONST ENDS +; COMDAT _Java_com_eaio_nativecall_IntCall_executeCall0@12 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_params$ = 16 +_len$ = -4 +_arrays$ = -8 +_param$ = -12 +_i$ = -16 +_intArg$56817 = -20 +_byteArrayArg$56820 = -24 +_charArrayArg$56826 = -28 +_booleanArg$56832 = -32 +_tempArg$56833 = -36 +_o$56836 = -40 +_intPtr$56838 = -44 +_byteArrayArg$56844 = -48 +_charArrayArg$56850 = -52 +_booleanArg$56856 = -56 +_tempPtr$56857 = -60 +_functionHandle$ = -64 +_outVal$ = -68 +_j$ = -72 +_o$56875 = -76 +_out$56877 = -80 +_out$56887 = -84 +$T56916 = -88 +$T56917 = -92 +$T56918 = -96 +$T56919 = -100 +$T56920 = -104 +$T56921 = -108 +_Java_com_eaio_nativecall_IntCall_executeCall0@12 PROC NEAR ; COMDAT + +; 109 : (JNIEnv *env, jobject obj, jobjectArray params) { + + push ebp + mov ebp, esp + sub esp, 172 ; 000000acH + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-172] + mov ecx, 43 ; 0000002bH + mov eax, -858993460 ; ccccccccH + rep stosd + +; 110 : +; 111 : const int len = env->GetArrayLength(params); + + mov eax, DWORD PTR _params$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z ; JNIEnv_::GetArrayLength + mov DWORD PTR _len$[ebp], eax + +; 112 : +; 113 : int* arrays = NULL; + + mov DWORD PTR _arrays$[ebp], 0 + +; 114 : if (!(arrays = new int[len])) { + + mov ecx, DWORD PTR _len$[ebp] + shl ecx, 2 + push ecx + call ??2@YAPAXI@Z ; operator new + add esp, 4 + mov DWORD PTR $T56916[ebp], eax + mov edx, DWORD PTR $T56916[ebp] + mov DWORD PTR _arrays$[ebp], edx + cmp DWORD PTR _arrays$[ebp], 0 + jne SHORT $L56806 + +; 115 : env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), NULL); + + push 0 + push OFFSET FLAT:??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z ; JNIEnv_::ThrowNew + +; 116 : return 0; + + xor eax, eax + jmp $L56801 +$L56806: + +; 118 : memset(arrays, 0, (sizeof(int) * len)); + + mov eax, DWORD PTR _len$[ebp] + shl eax, 2 + push eax + push 0 + mov ecx, DWORD PTR _arrays$[ebp] + push ecx + call _memset + add esp, 12 ; 0000000cH + +; 119 : +; 120 : jobject param; +; 121 : +; 122 : for (int i = len - 1; i >= 0; i--) { + + mov edx, DWORD PTR _len$[ebp] + sub edx, 1 + mov DWORD PTR _i$[ebp], edx + jmp SHORT $L56811 +$L56812: + mov eax, DWORD PTR _i$[ebp] + sub eax, 1 + mov DWORD PTR _i$[ebp], eax +$L56811: + cmp DWORD PTR _i$[ebp], 0 + jl $L56813 + +; 123 : +; 124 : param = env->GetObjectArrayElement(params, i); + + mov ecx, DWORD PTR _i$[ebp] + push ecx + mov edx, DWORD PTR _params$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ; JNIEnv_::GetObjectArrayElement + mov DWORD PTR _param$[ebp], eax + +; 125 : +; 126 : if (param == NULL) { + + cmp DWORD PTR _param$[ebp], 0 + jne SHORT $L56814 + +; 127 : _push(0); + + push 0 + +; 129 : else if (env->IsInstanceOf(param, classInteger)) { + + jmp $L56855 +$L56814: + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56816 + +; 130 : int intArg = env->CallIntMethod(param, methodIntValue); + + mov edx, DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + push ecx + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + add esp, 12 ; 0000000cH + mov DWORD PTR _intArg$56817[ebp], eax + +; 131 : _push(intArg) + + push DWORD PTR _intArg$56817[ebp] + +; 133 : else if (env->IsInstanceOf(param, classByteArray)) { + + jmp $L56855 +$L56816: + mov edx, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56819 + +; 134 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) param, 0); + + push 0 + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _byteArrayArg$56820[ebp], eax + +; 135 : arrays[i] = (int) &byteArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _byteArrayArg$56820[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 136 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$56820[ebp] + +; 138 : else if (env->IsInstanceOf(param, classCharArray)) { + + jmp $L56855 +$L56819: + mov edx, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56825 + +; 139 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 140 : (jarray) param, 0); + + push 0 + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _charArrayArg$56826[ebp], eax + +; 141 : arrays[i] = (int) &charArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _charArrayArg$56826[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 142 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$56826[ebp] + +; 144 : else if (env->IsInstanceOf(param, classBoolean)) { + + jmp $L56855 +$L56825: + mov edx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56831 + +; 145 : jboolean booleanArg = env->CallBooleanMethod(param, methodBooleanValue); + + mov ecx, DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov eax, DWORD PTR _env$[ebp] + push eax + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + add esp, 12 ; 0000000cH + mov BYTE PTR _booleanArg$56832[ebp], al + +; 146 : int tempArg = (booleanArg == JNI_FALSE ? 0 : 1); + + mov ecx, DWORD PTR _booleanArg$56832[ebp] + and ecx, 255 ; 000000ffH + neg ecx + sbb ecx, ecx + neg ecx + mov DWORD PTR _tempArg$56833[ebp], ecx + +; 147 : _push(tempArg) + + push DWORD PTR _tempArg$56833[ebp] + +; 149 : else if (env->IsInstanceOf(param, classHolder)) { + + jmp $L56855 +$L56831: + mov edx, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je $L56855 + +; 150 : +; 151 : /* Holder */ +; 152 : +; 153 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov ecx, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField + mov DWORD PTR _o$56836[ebp], eax + +; 154 : +; 155 : if (env->IsInstanceOf(o, classInteger)) { + + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + mov ecx, DWORD PTR _o$56836[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56837 + +; 156 : int *intPtr = new int; + + push 4 + call ??2@YAPAXI@Z ; operator new + add esp, 4 + mov DWORD PTR $T56917[ebp], eax + mov edx, DWORD PTR $T56917[ebp] + mov DWORD PTR _intPtr$56838[ebp], edx + +; 157 : *intPtr = env->CallIntMethod(o, methodIntValue); + + mov eax, DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push eax + mov ecx, DWORD PTR _o$56836[ebp] + push ecx + mov edx, DWORD PTR _env$[ebp] + push edx + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + add esp, 12 ; 0000000cH + mov ecx, DWORD PTR _intPtr$56838[ebp] + mov DWORD PTR [ecx], eax + +; 158 : arrays[i] = (int) intPtr; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + mov ecx, DWORD PTR _intPtr$56838[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 159 : _push(intPtr); + + push DWORD PTR _intPtr$56838[ebp] + +; 161 : else if (env->IsInstanceOf(o, classByteArray)) { + + jmp $L56855 +$L56837: + mov edx, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push edx + mov eax, DWORD PTR _o$56836[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56843 + +; 162 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) o, 0); + + push 0 + mov ecx, DWORD PTR _o$56836[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _byteArrayArg$56844[ebp], eax + +; 163 : arrays[i] = (int) &byteArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _byteArrayArg$56844[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 164 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$56844[ebp] + +; 166 : else if (env->IsInstanceOf(o, classCharArray)) { + + jmp $L56855 +$L56843: + mov edx, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push edx + mov eax, DWORD PTR _o$56836[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56849 + +; 167 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 168 : (jarray) o, 0); + + push 0 + mov ecx, DWORD PTR _o$56836[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _charArrayArg$56850[ebp], eax + +; 169 : arrays[i] = (int) &charArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _charArrayArg$56850[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 170 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$56850[ebp] + +; 172 : else if (env->IsInstanceOf(o, classBoolean)) { + + jmp SHORT $L56855 +$L56849: + mov edx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push edx + mov eax, DWORD PTR _o$56836[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56855 + +; 173 : jboolean booleanArg = env->CallBooleanMethod(o, methodBooleanValue); + + mov ecx, DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ecx + mov edx, DWORD PTR _o$56836[ebp] + push edx + mov eax, DWORD PTR _env$[ebp] + push eax + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + add esp, 12 ; 0000000cH + mov BYTE PTR _booleanArg$56856[ebp], al + +; 174 : int *tempPtr = new int; + + push 4 + call ??2@YAPAXI@Z ; operator new + add esp, 4 + mov DWORD PTR $T56918[ebp], eax + mov ecx, DWORD PTR $T56918[ebp] + mov DWORD PTR _tempPtr$56857[ebp], ecx + +; 175 : *tempPtr = (booleanArg == JNI_FALSE ? 0 : 1); + + mov edx, DWORD PTR _booleanArg$56856[ebp] + and edx, 255 ; 000000ffH + neg edx + sbb edx, edx + neg edx + mov eax, DWORD PTR _tempPtr$56857[ebp] + mov DWORD PTR [eax], edx + +; 176 : arrays[i] = (int) tempPtr; + + mov ecx, DWORD PTR _i$[ebp] + mov edx, DWORD PTR _arrays$[ebp] + mov eax, DWORD PTR _tempPtr$56857[ebp] + mov DWORD PTR [edx+ecx*4], eax + +; 177 : _push(tempPtr); + + push DWORD PTR _tempPtr$56857[ebp] +$L56855: + +; 183 : +; 184 : } + + jmp $L56812 +$L56813: + +; 185 : +; 186 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov ecx, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField + mov DWORD PTR _functionHandle$[ebp], eax + +; 187 : jint outVal; +; 188 : +; 189 : #ifdef _WINDOWS +; 190 : #ifdef _X86_ +; 191 : +; 192 : __asm { +; 193 : +; 194 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 195 : mov outVal, eax + + mov DWORD PTR _outVal$[ebp], eax + +; 196 : +; 197 : } +; 198 : +; 199 : #endif +; 200 : #endif +; 201 : +; 202 : for (int j = 0; j < len; ++j) { + + mov DWORD PTR _j$[ebp], 0 + jmp SHORT $L56864 +$L56865: + mov eax, DWORD PTR _j$[ebp] + add eax, 1 + mov DWORD PTR _j$[ebp], eax +$L56864: + mov ecx, DWORD PTR _j$[ebp] + cmp ecx, DWORD PTR _len$[ebp] + jge $L56866 + +; 203 : param = env->GetObjectArrayElement(params, j); + + mov edx, DWORD PTR _j$[ebp] + push edx + mov eax, DWORD PTR _params$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ; JNIEnv_::GetObjectArrayElement + mov DWORD PTR _param$[ebp], eax + +; 204 : if (param == NULL) {} + + cmp DWORD PTR _param$[ebp], 0 + jne SHORT $L56867 + +; 205 : else if (env->IsInstanceOf(param, classByteArray) || env->IsInstanceOf(param, classCharArray)) { + + jmp $L56886 +$L56867: + mov ecx, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + jne SHORT $L56870 + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56869 +$L56870: + +; 206 : env->ReleasePrimitiveArrayCritical((jarray) param, (void*) arrays[j], 0); + + push 0 + mov edx, DWORD PTR _j$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + mov ecx, DWORD PTR [eax+edx*4] + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ; JNIEnv_::ReleasePrimitiveArrayCritical + +; 208 : else if (env->IsInstanceOf(param, classHolder)) { + + jmp $L56886 +$L56869: + mov eax, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je $L56886 + +; 209 : +; 210 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov edx, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField + mov DWORD PTR _o$56875[ebp], eax + +; 211 : +; 212 : if (env->IsInstanceOf(o, classInteger)) { + + mov ecx, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push ecx + mov edx, DWORD PTR _o$56875[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56876 + +; 213 : int* out = (int*) arrays[j]; + + mov eax, DWORD PTR _j$[ebp] + mov ecx, DWORD PTR _arrays$[ebp] + mov edx, DWORD PTR [ecx+eax*4] + mov DWORD PTR _out$56877[ebp], edx + +; 214 : env->SetObjectField(param, fieldHolderO, env->NewObject(classInteger, newIntegerInt, *out)); + + mov eax, DWORD PTR _out$56877[ebp] + mov ecx, DWORD PTR [eax] + push ecx + mov edx, DWORD PTR ?newIntegerInt@@3PAU_jmethodID@@A ; newIntegerInt + push edx + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + mov ecx, DWORD PTR _env$[ebp] + push ecx + call ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject + add esp, 16 ; 00000010H + push eax + mov edx, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ; JNIEnv_::SetObjectField + +; 215 : delete out; + + mov ecx, DWORD PTR _out$56877[ebp] + mov DWORD PTR $T56919[ebp], ecx + mov edx, DWORD PTR $T56919[ebp] + push edx + call ??3@YAXPAX@Z ; operator delete + add esp, 4 + +; 217 : else if (env->IsInstanceOf(o, classByteArray) || env->IsInstanceOf(o, classCharArray)) { + + jmp $L56886 +$L56876: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push eax + mov ecx, DWORD PTR _o$56875[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + jne SHORT $L56882 + mov edx, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push edx + mov eax, DWORD PTR _o$56875[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56881 +$L56882: + +; 218 : env->ReleasePrimitiveArrayCritical((jarray) o, (void*) arrays[j], 0); + + push 0 + mov ecx, DWORD PTR _j$[ebp] + mov edx, DWORD PTR _arrays$[ebp] + mov eax, DWORD PTR [edx+ecx*4] + push eax + mov ecx, DWORD PTR _o$56875[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ; JNIEnv_::ReleasePrimitiveArrayCritical + +; 220 : else if (env->IsInstanceOf(o, classBoolean)) { + + jmp SHORT $L56886 +$L56881: + mov edx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push edx + mov eax, DWORD PTR _o$56875[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56886 + +; 221 : int* out = (int*) arrays[j]; + + mov ecx, DWORD PTR _j$[ebp] + mov edx, DWORD PTR _arrays$[ebp] + mov eax, DWORD PTR [edx+ecx*4] + mov DWORD PTR _out$56887[ebp], eax + +; 222 : env->SetObjectField(param, fieldHolderO, env->NewObject(classBoolean, newBooleanBoolean, (*out == 0 ? JNI_FALSE : JNI_TRUE))); + + mov ecx, DWORD PTR _out$56887[ebp] + xor edx, edx + cmp DWORD PTR [ecx], 0 + setne dl + push edx + mov eax, DWORD PTR ?newBooleanBoolean@@3PAU_jmethodID@@A ; newBooleanBoolean + push eax + mov ecx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push ecx + mov edx, DWORD PTR _env$[ebp] + push edx + call ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject + add esp, 16 ; 00000010H + push eax + mov eax, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ; JNIEnv_::SetObjectField + +; 223 : delete out; + + mov edx, DWORD PTR _out$56887[ebp] + mov DWORD PTR $T56920[ebp], edx + mov eax, DWORD PTR $T56920[ebp] + push eax + call ??3@YAXPAX@Z ; operator delete + add esp, 4 +$L56886: + +; 227 : +; 228 : } + + jmp $L56865 +$L56866: + +; 229 : +; 230 : delete [] arrays; + + mov ecx, DWORD PTR _arrays$[ebp] + mov DWORD PTR $T56921[ebp], ecx + mov edx, DWORD PTR $T56921[ebp] + push edx + call ??3@YAXPAX@Z ; operator delete + add esp, 4 + +; 231 : +; 232 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + mov esi, esp + call DWORD PTR __imp__GetLastError@0 + cmp esi, esp + call __chkesp + push eax + mov eax, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField + +; 233 : +; 234 : return outVal; + + mov eax, DWORD PTR _outVal$[ebp] +$L56801: + +; 235 : +; 236 : } + + pop edi + pop esi + pop ebx + add esp, 172 ; 000000acH + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +_Java_com_eaio_nativecall_IntCall_executeCall0@12 ENDP +_TEXT ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT +_this$ = -4 +_name$ = 8 +?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z PROC NEAR ; JNIEnv_::FindClass, COMDAT + +; 759 : jclass FindClass(const char *name) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 760 : return functions->FindClass(this, name); + + mov esi, esp + mov eax, DWORD PTR _name$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+24] + cmp esi, esp + call __chkesp + +; 761 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 4 +?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ENDP ; JNIEnv_::FindClass +_TEXT ENDS +; COMDAT ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z +_TEXT SEGMENT +_this$ = -4 +_clazz$ = 8 +_msg$ = 12 +?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z PROC NEAR ; JNIEnv_::ThrowNew, COMDAT + +; 787 : jint ThrowNew(jclass clazz, const char *msg) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 788 : return functions->ThrowNew(this, clazz, msg); + + mov esi, esp + mov eax, DWORD PTR _msg$[ebp] + push eax + mov ecx, DWORD PTR _clazz$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+56] + cmp esi, esp + call __chkesp + +; 789 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z ENDP ; JNIEnv_::ThrowNew +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_args$ = -4 +_result$ = -8 +_clazz$ = 12 +_methodID$ = 16 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::NewObject, COMDAT + +; 834 : jobject NewObject(jclass clazz, jmethodID methodID, ...) { + + push ebp + mov ebp, esp + sub esp, 72 ; 00000048H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-72] + mov ecx, 18 ; 00000012H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 835 : va_list args; +; 836 : jobject result; +; 837 : va_start(args, methodID); + + lea eax, DWORD PTR _methodID$[ebp+4] + mov DWORD PTR _args$[ebp], eax + +; 838 : result = functions->NewObjectV(this,clazz,methodID,args); + + mov esi, esp + mov ecx, DWORD PTR _args$[ebp] + push ecx + mov edx, DWORD PTR _methodID$[ebp] + push edx + mov eax, DWORD PTR _clazz$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+116] + cmp esi, esp + call __chkesp + mov DWORD PTR _result$[ebp], eax + +; 839 : va_end(args); + + mov DWORD PTR _args$[ebp], 0 + +; 840 : return result; + + mov eax, DWORD PTR _result$[ebp] + +; 841 : } + + pop edi + pop esi + pop ebx + add esp, 72 ; 00000048H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 0 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::NewObject +_TEXT ENDS +; COMDAT ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z +_TEXT SEGMENT +_this$ = -4 +_obj$ = 8 +_clazz$ = 12 +?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z PROC NEAR ; JNIEnv_::IsInstanceOf, COMDAT + +; 854 : jboolean IsInstanceOf(jobject obj, jclass clazz) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 855 : return functions->IsInstanceOf(this,obj,clazz); + + mov esi, esp + mov eax, DWORD PTR _clazz$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+128] + cmp esi, esp + call __chkesp + +; 856 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ENDP ; JNIEnv_::IsInstanceOf +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_args$ = -4 +_result$ = -8 +_obj$ = 12 +_methodID$ = 16 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallBooleanMethod, COMDAT + +; 881 : jmethodID methodID, ...) { + + push ebp + mov ebp, esp + sub esp, 72 ; 00000048H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-72] + mov ecx, 18 ; 00000012H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 882 : va_list args; +; 883 : jboolean result; +; 884 : va_start(args,methodID); + + lea eax, DWORD PTR _methodID$[ebp+4] + mov DWORD PTR _args$[ebp], eax + +; 885 : result = functions->CallBooleanMethodV(this,obj,methodID,args); + + mov esi, esp + mov ecx, DWORD PTR _args$[ebp] + push ecx + mov edx, DWORD PTR _methodID$[ebp] + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+152] + cmp esi, esp + call __chkesp + mov BYTE PTR _result$[ebp], al + +; 886 : va_end(args); + + mov DWORD PTR _args$[ebp], 0 + +; 887 : return result; + + mov al, BYTE PTR _result$[ebp] + +; 888 : } + + pop edi + pop esi + pop ebx + add esp, 72 ; 00000048H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 0 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallBooleanMethod +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_args$ = -4 +_result$ = -8 +_obj$ = 12 +_methodID$ = 16 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallIntMethod, COMDAT + +; 949 : jint CallIntMethod(jobject obj, jmethodID methodID, ...) { + + push ebp + mov ebp, esp + sub esp, 72 ; 00000048H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-72] + mov ecx, 18 ; 00000012H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 950 : va_list args; +; 951 : jint result; +; 952 : va_start(args,methodID); + + lea eax, DWORD PTR _methodID$[ebp+4] + mov DWORD PTR _args$[ebp], eax + +; 953 : result = functions->CallIntMethodV(this,obj,methodID,args); + + mov esi, esp + mov ecx, DWORD PTR _args$[ebp] + push ecx + mov edx, DWORD PTR _methodID$[ebp] + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+200] + cmp esi, esp + call __chkesp + mov DWORD PTR _result$[ebp], eax + +; 954 : va_end(args); + + mov DWORD PTR _args$[ebp], 0 + +; 955 : return result; + + mov eax, DWORD PTR _result$[ebp] + +; 956 : } + + pop edi + pop esi + pop ebx + add esp, 72 ; 00000048H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 0 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallIntMethod +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_this$ = -4 +?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z PROC NEAR ; JNIEnv_::GetObjectField, COMDAT + +; 1248 : jobject GetObjectField(jobject obj, jfieldID fieldID) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1249 : return functions->GetObjectField(this,obj,fieldID); + + mov esi, esp + mov eax, DWORD PTR _fieldID$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+380] + cmp esi, esp + call __chkesp + +; 1250 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ENDP ; JNIEnv_::GetObjectField +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_this$ = -4 +?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z PROC NEAR ; JNIEnv_::GetIntField, COMDAT + +; 1263 : jint GetIntField(jobject obj, jfieldID fieldID) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1264 : return functions->GetIntField(this,obj,fieldID); + + mov esi, esp + mov eax, DWORD PTR _fieldID$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+400] + cmp esi, esp + call __chkesp + +; 1265 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ENDP ; JNIEnv_::GetIntField +_TEXT ENDS +; COMDAT ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_val$ = 16 +_this$ = -4 +?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z PROC NEAR ; JNIEnv_::SetObjectField, COMDAT + +; 1276 : void SetObjectField(jobject obj, jfieldID fieldID, jobject val) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1277 : functions->SetObjectField(this,obj,fieldID,val); + + mov esi, esp + mov eax, DWORD PTR _val$[ebp] + push eax + mov ecx, DWORD PTR _fieldID$[ebp] + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+416] + cmp esi, esp + call __chkesp + +; 1278 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ENDP ; JNIEnv_::SetObjectField +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_val$ = 16 +_this$ = -4 +?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z PROC NEAR ; JNIEnv_::SetIntField, COMDAT + +; 1296 : jint val) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1297 : functions->SetIntField(this,obj,fieldID,val); + + mov esi, esp + mov eax, DWORD PTR _val$[ebp] + push eax + mov ecx, DWORD PTR _fieldID$[ebp] + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+436] + cmp esi, esp + call __chkesp + +; 1298 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ENDP ; JNIEnv_::SetIntField +_TEXT ENDS +; COMDAT ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z PROC NEAR ; JNIEnv_::GetArrayLength, COMDAT + +; 1589 : jsize GetArrayLength(jarray array) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1590 : return functions->GetArrayLength(this,array); + + mov esi, esp + mov eax, DWORD PTR _array$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+684] + cmp esi, esp + call __chkesp + +; 1591 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 4 +?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z ENDP ; JNIEnv_::GetArrayLength +_TEXT ENDS +; COMDAT ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +_index$ = 12 +?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z PROC NEAR ; JNIEnv_::GetObjectArrayElement, COMDAT + +; 1597 : jobject GetObjectArrayElement(jobjectArray array, jsize index) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1598 : return functions->GetObjectArrayElement(this,array,index); + + mov esi, esp + mov eax, DWORD PTR _index$[ebp] + push eax + mov ecx, DWORD PTR _array$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+692] + cmp esi, esp + call __chkesp + +; 1599 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ENDP ; JNIEnv_::GetObjectArrayElement +_TEXT ENDS +; COMDAT ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +_isCopy$ = 12 +?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z PROC NEAR ; JNIEnv_::GetPrimitiveArrayCritical, COMDAT + +; 1788 : void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1789 : return functions->GetPrimitiveArrayCritical(this,array,isCopy); + + mov esi, esp + mov eax, DWORD PTR _isCopy$[ebp] + push eax + mov ecx, DWORD PTR _array$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+888] + cmp esi, esp + call __chkesp + +; 1790 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ENDP ; JNIEnv_::GetPrimitiveArrayCritical +_TEXT ENDS +; COMDAT ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +_carray$ = 12 +_mode$ = 16 +?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z PROC NEAR ; JNIEnv_::ReleasePrimitiveArrayCritical, COMDAT + +; 1791 : void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1792 : functions->ReleasePrimitiveArrayCritical(this,array,carray,mode); + + mov esi, esp + mov eax, DWORD PTR _mode$[ebp] + push eax + mov ecx, DWORD PTR _carray$[ebp] + push ecx + mov edx, DWORD PTR _array$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+892] + cmp esi, esp + call __chkesp + +; 1793 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ENDP ; JNIEnv_::ReleasePrimitiveArrayCritical +_TEXT ENDS +END diff --git a/cpp/nativecall/Debug/IntCall.obj b/cpp/nativecall/Debug/IntCall.obj new file mode 100644 index 0000000..f33470a Binary files /dev/null and b/cpp/nativecall/Debug/IntCall.obj differ diff --git a/cpp/nativecall/Debug/NativeCall.asm b/cpp/nativecall/Debug/NativeCall.asm new file mode 100644 index 0000000..e8e2af8 --- /dev/null +++ b/cpp/nativecall/Debug/NativeCall.asm @@ -0,0 +1,1492 @@ + TITLE C:\Documents and Settings\Administrator\My Documents\Software\NativeCall\src\cpp\NativeCall.cpp + .386P +include listing.inc +if @Version gt 510 +.model FLAT +else +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT DWORD USE32 PUBLIC 'BSS' +_BSS ENDS +$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM' +$$SYMBOLS ENDS +$$TYPES SEGMENT BYTE USE32 'DEBTYP' +$$TYPES ENDS +_TLS SEGMENT DWORD USE32 PUBLIC 'TLS' +_TLS ENDS +; COMDAT ??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_08JJOG@function?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_06CODG@module?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_01FLOP@I?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0P@LKIL@functionHandle?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0N@EFAA@moduleHandle?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0O@OMHL@lastErrorCode?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_01PGHN@o?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0BB@LLFN@java?1lang?1String?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_02LOEJ@?$FLB?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_02BENO@?$FLC?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_03KJOK@?$CI?$CJZ?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_0N@KEBP@booleanValue?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_03PPCD@?$CI?$CJI?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_08JCMA@intValue?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_04ECLF@?$CII?$CJV?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_06KILP@?$DMinit?$DO?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ??_C@_04JFOE@?$CIZ?$CJV?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewStringUTF@JNIEnv_@@QAEPAV_jstring@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ??8@YAHABU_GUID@@0@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_NativeCall_initIDs@8 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_NativeCall_initHandles@8 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_NativeCall_getLastError@8 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_NativeCall_destroy@8 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +FLAT GROUP _DATA, CONST, _BSS + ASSUME CS: FLAT, DS: FLAT, SS: FLAT +endif +PUBLIC ?fieldFunction@@3PAU_jfieldID@@A ; fieldFunction +PUBLIC ?fieldModule@@3PAU_jfieldID@@A ; fieldModule +PUBLIC ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle +PUBLIC ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle +PUBLIC ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode +PUBLIC ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO +PUBLIC ?classBoolean@@3PAV_jclass@@A ; classBoolean +PUBLIC ?classInteger@@3PAV_jclass@@A ; classInteger +PUBLIC ?classString@@3PAV_jclass@@A ; classString +PUBLIC ?classByteArray@@3PAV_jclass@@A ; classByteArray +PUBLIC ?classCharArray@@3PAV_jclass@@A ; classCharArray +PUBLIC ?classHolder@@3PAV_jclass@@A ; classHolder +PUBLIC ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue +PUBLIC ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue +PUBLIC ?newIntegerInt@@3PAU_jmethodID@@A ; newIntegerInt +PUBLIC ?newBooleanBoolean@@3PAU_jmethodID@@A ; newBooleanBoolean +_BSS SEGMENT +?fieldFunction@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldFunction +?fieldModule@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldModule +?fieldFunctionHandle@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldFunctionHandle +?fieldModuleHandle@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldModuleHandle +?fieldLastErrorCode@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldLastErrorCode +?fieldHolderO@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldHolderO +?classBoolean@@3PAV_jclass@@A DD 01H DUP (?) ; classBoolean +?classInteger@@3PAV_jclass@@A DD 01H DUP (?) ; classInteger +?classString@@3PAV_jclass@@A DD 01H DUP (?) ; classString +?classByteArray@@3PAV_jclass@@A DD 01H DUP (?) ; classByteArray +?classCharArray@@3PAV_jclass@@A DD 01H DUP (?) ; classCharArray +?classHolder@@3PAV_jclass@@A DD 01H DUP (?) ; classHolder +?methodBooleanValue@@3PAU_jmethodID@@A DD 01H DUP (?) ; methodBooleanValue +?methodIntValue@@3PAU_jmethodID@@A DD 01H DUP (?) ; methodIntValue +?newIntegerInt@@3PAU_jmethodID@@A DD 01H DUP (?) ; newIntegerInt +?newBooleanBoolean@@3PAU_jmethodID@@A DD 01H DUP (?) ; newBooleanBoolean +_BSS ENDS +PUBLIC ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetFieldID +PUBLIC _Java_com_eaio_nativecall_NativeCall_initIDs@8 +PUBLIC ??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ ; `string' +PUBLIC ??_C@_08JJOG@function?$AA@ ; `string' +PUBLIC ??_C@_06CODG@module?$AA@ ; `string' +PUBLIC ??_C@_01FLOP@I?$AA@ ; `string' +PUBLIC ??_C@_0P@LKIL@functionHandle?$AA@ ; `string' +PUBLIC ??_C@_0N@EFAA@moduleHandle?$AA@ ; `string' +PUBLIC ??_C@_0O@OMHL@lastErrorCode?$AA@ ; `string' +PUBLIC ??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ ; `string' +PUBLIC ??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ ; `string' +PUBLIC ??_C@_01PGHN@o?$AA@ ; `string' +PUBLIC ??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ ; `string' +PUBLIC ??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ ; `string' +PUBLIC ??_C@_0BB@LLFN@java?1lang?1String?$AA@ ; `string' +PUBLIC ??_C@_02LOEJ@?$FLB?$AA@ ; `string' +PUBLIC ??_C@_02BENO@?$FLC?$AA@ ; `string' +PUBLIC ??_C@_03KJOK@?$CI?$CJZ?$AA@ ; `string' +PUBLIC ??_C@_0N@KEBP@booleanValue?$AA@ ; `string' +PUBLIC ??_C@_03PPCD@?$CI?$CJI?$AA@ ; `string' +PUBLIC ??_C@_08JCMA@intValue?$AA@ ; `string' +PUBLIC ??_C@_04ECLF@?$CII?$CJV?$AA@ ; `string' +PUBLIC ??_C@_06KILP@?$DMinit?$DO?$AA@ ; `string' +PUBLIC ??_C@_04JFOE@?$CIZ?$CJV?$AA@ ; `string' +PUBLIC ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass +PUBLIC ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ; JNIEnv_::NewGlobalRef +PUBLIC ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetMethodID +EXTRN __chkesp:NEAR +; COMDAT ??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ +; File c:\documents and settings\administrator\my documents\software\nativecall\src\cpp\nativecall.cpp +CONST SEGMENT +??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ DB 'Ljava/lang/String;', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_08JJOG@function?$AA@ +CONST SEGMENT +??_C@_08JJOG@function?$AA@ DB 'function', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_06CODG@module?$AA@ +CONST SEGMENT +??_C@_06CODG@module?$AA@ DB 'module', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_01FLOP@I?$AA@ +CONST SEGMENT +??_C@_01FLOP@I?$AA@ DB 'I', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0P@LKIL@functionHandle?$AA@ +CONST SEGMENT +??_C@_0P@LKIL@functionHandle?$AA@ DB 'functionHandle', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0N@EFAA@moduleHandle?$AA@ +CONST SEGMENT +??_C@_0N@EFAA@moduleHandle?$AA@ DB 'moduleHandle', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0O@OMHL@lastErrorCode?$AA@ +CONST SEGMENT +??_C@_0O@OMHL@lastErrorCode?$AA@ DB 'lastErrorCode', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ +CONST SEGMENT +??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ DB 'com/eaio/nativecall' + DB '/Holder', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ +CONST SEGMENT +??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ DB 'Ljava/lang/Object;', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_01PGHN@o?$AA@ +CONST SEGMENT +??_C@_01PGHN@o?$AA@ DB 'o', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ +CONST SEGMENT +??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ DB 'java/lang/Boolean', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ +CONST SEGMENT +??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ DB 'java/lang/Integer', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0BB@LLFN@java?1lang?1String?$AA@ +CONST SEGMENT +??_C@_0BB@LLFN@java?1lang?1String?$AA@ DB 'java/lang/String', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_02LOEJ@?$FLB?$AA@ +CONST SEGMENT +??_C@_02LOEJ@?$FLB?$AA@ DB '[B', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_02BENO@?$FLC?$AA@ +CONST SEGMENT +??_C@_02BENO@?$FLC?$AA@ DB '[C', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_03KJOK@?$CI?$CJZ?$AA@ +CONST SEGMENT +??_C@_03KJOK@?$CI?$CJZ?$AA@ DB '()Z', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_0N@KEBP@booleanValue?$AA@ +CONST SEGMENT +??_C@_0N@KEBP@booleanValue?$AA@ DB 'booleanValue', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_03PPCD@?$CI?$CJI?$AA@ +CONST SEGMENT +??_C@_03PPCD@?$CI?$CJI?$AA@ DB '()I', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_08JCMA@intValue?$AA@ +CONST SEGMENT +??_C@_08JCMA@intValue?$AA@ DB 'intValue', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_04ECLF@?$CII?$CJV?$AA@ +CONST SEGMENT +??_C@_04ECLF@?$CII?$CJV?$AA@ DB '(I)V', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_06KILP@?$DMinit?$DO?$AA@ +CONST SEGMENT +??_C@_06KILP@?$DMinit?$DO?$AA@ DB '', 00H ; `string' +CONST ENDS +; COMDAT ??_C@_04JFOE@?$CIZ?$CJV?$AA@ +CONST SEGMENT +??_C@_04JFOE@?$CIZ?$CJV?$AA@ DB '(Z)V', 00H ; `string' +CONST ENDS +; COMDAT _Java_com_eaio_nativecall_NativeCall_initIDs@8 +_TEXT SEGMENT +_env$ = 8 +_cls$ = 12 +_Java_com_eaio_nativecall_NativeCall_initIDs@8 PROC NEAR ; COMDAT + +; 71 : (JNIEnv *env, jclass cls) { + + push ebp + mov ebp, esp + sub esp, 64 ; 00000040H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-64] + mov ecx, 16 ; 00000010H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 72 : +; 73 : // NativeCall fields +; 74 : +; 75 : fieldFunction = env->GetFieldID(cls, "function", "Ljava/lang/String;"); + + push OFFSET FLAT:??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ ; `string' + push OFFSET FLAT:??_C@_08JJOG@function?$AA@ ; `string' + mov eax, DWORD PTR _cls$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetFieldID + mov DWORD PTR ?fieldFunction@@3PAU_jfieldID@@A, eax ; fieldFunction + +; 76 : fieldModule = env->GetFieldID(cls, "module", "Ljava/lang/String;"); + + push OFFSET FLAT:??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ ; `string' + push OFFSET FLAT:??_C@_06CODG@module?$AA@ ; `string' + mov ecx, DWORD PTR _cls$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetFieldID + mov DWORD PTR ?fieldModule@@3PAU_jfieldID@@A, eax ; fieldModule + +; 77 : +; 78 : fieldFunctionHandle = env->GetFieldID(cls, "functionHandle", "I"); + + push OFFSET FLAT:??_C@_01FLOP@I?$AA@ ; `string' + push OFFSET FLAT:??_C@_0P@LKIL@functionHandle?$AA@ ; `string' + mov edx, DWORD PTR _cls$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetFieldID + mov DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A, eax ; fieldFunctionHandle + +; 79 : fieldModuleHandle = env-> GetFieldID(cls, "moduleHandle", "I"); + + push OFFSET FLAT:??_C@_01FLOP@I?$AA@ ; `string' + push OFFSET FLAT:??_C@_0N@EFAA@moduleHandle?$AA@ ; `string' + mov eax, DWORD PTR _cls$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetFieldID + mov DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A, eax ; fieldModuleHandle + +; 80 : +; 81 : fieldLastErrorCode = env->GetFieldID(cls, "lastErrorCode", "I"); + + push OFFSET FLAT:??_C@_01FLOP@I?$AA@ ; `string' + push OFFSET FLAT:??_C@_0O@OMHL@lastErrorCode?$AA@ ; `string' + mov ecx, DWORD PTR _cls$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetFieldID + mov DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A, eax ; fieldLastErrorCode + +; 82 : +; 83 : // Holder fields +; 84 : +; 85 : classHolder = (jclass) env->NewGlobalRef(env->FindClass("com/eaio/nativecall/Holder")); + + push OFFSET FLAT:??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ; JNIEnv_::NewGlobalRef + mov DWORD PTR ?classHolder@@3PAV_jclass@@A, eax ; classHolder + +; 86 : fieldHolderO = env->GetFieldID(classHolder, "o", "Ljava/lang/Object;"); + + push OFFSET FLAT:??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ ; `string' + push OFFSET FLAT:??_C@_01PGHN@o?$AA@ ; `string' + mov edx, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetFieldID + mov DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A, eax ; fieldHolderO + +; 87 : +; 88 : // Other classes +; 89 : +; 90 : classBoolean = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Boolean")); + + push OFFSET FLAT:??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ; JNIEnv_::NewGlobalRef + mov DWORD PTR ?classBoolean@@3PAV_jclass@@A, eax ; classBoolean + +; 91 : /*classByte = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Byte")); +; 92 : classCharacter = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Character")); +; 93 : classShort = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Short"));*/ +; 94 : classInteger = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Integer")); + + push OFFSET FLAT:??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ; JNIEnv_::NewGlobalRef + mov DWORD PTR ?classInteger@@3PAV_jclass@@A, eax ; classInteger + +; 95 : /*classLong = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Long")); +; 96 : classFloat = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Float")); +; 97 : classDouble = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Double"));*/ +; 98 : classString = (jclass) env->NewGlobalRef(env->FindClass("java/lang/String")); + + push OFFSET FLAT:??_C@_0BB@LLFN@java?1lang?1String?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ; JNIEnv_::NewGlobalRef + mov DWORD PTR ?classString@@3PAV_jclass@@A, eax ; classString + +; 99 : classByteArray = (jclass) env->NewGlobalRef(env->FindClass("[B")); + + push OFFSET FLAT:??_C@_02LOEJ@?$FLB?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ; JNIEnv_::NewGlobalRef + mov DWORD PTR ?classByteArray@@3PAV_jclass@@A, eax ; classByteArray + +; 100 : classCharArray = (jclass) env->NewGlobalRef(env->FindClass("[C")); + + push OFFSET FLAT:??_C@_02BENO@?$FLC?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ; JNIEnv_::NewGlobalRef + mov DWORD PTR ?classCharArray@@3PAV_jclass@@A, eax ; classCharArray + +; 101 : /*classIntArray = (jclass) env->NewGlobalRef(env->FindClass("[I"));*/ +; 102 : +; 103 : // Wrapper class methods +; 104 : +; 105 : methodBooleanValue = env->GetMethodID(classBoolean, +; 106 : "booleanValue", "()Z"); + + push OFFSET FLAT:??_C@_03KJOK@?$CI?$CJZ?$AA@ ; `string' + push OFFSET FLAT:??_C@_0N@KEBP@booleanValue?$AA@ ; `string' + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetMethodID + mov DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A, eax ; methodBooleanValue + +; 107 : /*methodByteValue = env->GetMethodID(classByte, +; 108 : "byteValue", "()B"); +; 109 : methodCharValue = env->GetMethodID(classCharacter, +; 110 : "charValue", "()C"); +; 111 : methodShortValue = env->GetMethodID(classShort, +; 112 : "shortValue", "()S");*/ +; 113 : methodIntValue = env->GetMethodID(classInteger, +; 114 : "intValue", "()I"); + + push OFFSET FLAT:??_C@_03PPCD@?$CI?$CJI?$AA@ ; `string' + push OFFSET FLAT:??_C@_08JCMA@intValue?$AA@ ; `string' + mov ecx, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetMethodID + mov DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A, eax ; methodIntValue + +; 115 : /*methodLongValue = env->GetMethodID(classLong, +; 116 : "longValue", "()J"); +; 117 : methodFloatValue = env->GetMethodID(classFloat, +; 118 : "floatValue", "()F"); +; 119 : methodDoubleValue = env->GetMethodID(classDouble, +; 120 : "doubleValue", "()D");*/ +; 121 : +; 122 : // Constructors +; 123 : +; 124 : newIntegerInt = env->GetMethodID(classInteger, "", "(I)V"); + + push OFFSET FLAT:??_C@_04ECLF@?$CII?$CJV?$AA@ ; `string' + push OFFSET FLAT:??_C@_06KILP@?$DMinit?$DO?$AA@ ; `string' + mov edx, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetMethodID + mov DWORD PTR ?newIntegerInt@@3PAU_jmethodID@@A, eax ; newIntegerInt + +; 125 : newBooleanBoolean = env->GetMethodID(classBoolean, "", "(Z)V"); + + push OFFSET FLAT:??_C@_04JFOE@?$CIZ?$CJV?$AA@ ; `string' + push OFFSET FLAT:??_C@_06KILP@?$DMinit?$DO?$AA@ ; `string' + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z ; JNIEnv_::GetMethodID + mov DWORD PTR ?newBooleanBoolean@@3PAU_jmethodID@@A, eax ; newBooleanBoolean + +; 126 : +; 127 : } + + pop edi + pop esi + pop ebx + add esp, 64 ; 00000040H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +_Java_com_eaio_nativecall_NativeCall_initIDs@8 ENDP +_TEXT ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT +_this$ = -4 +_name$ = 8 +?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z PROC NEAR ; JNIEnv_::FindClass, COMDAT + +; 759 : jclass FindClass(const char *name) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 760 : return functions->FindClass(this, name); + + mov esi, esp + mov eax, DWORD PTR _name$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+24] + cmp esi, esp + call __chkesp + +; 761 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 4 +?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ENDP ; JNIEnv_::FindClass +_TEXT ENDS +PUBLIC ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField +PUBLIC ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField +PUBLIC _Java_com_eaio_nativecall_NativeCall_initHandles@8 +PUBLIC ?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z ; JNIEnv_::GetStringUTFChars +PUBLIC ?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z ; JNIEnv_::ReleaseStringUTFChars +EXTRN __imp__LoadLibraryA@4:NEAR +EXTRN __imp__GetLastError@0:NEAR +EXTRN __imp__FreeLibrary@4:NEAR +EXTRN __imp__GetProcAddress@8:NEAR +; COMDAT _Java_com_eaio_nativecall_NativeCall_initHandles@8 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_out$ = -4 +_moduleNameS$ = -8 +_functionNameS$ = -12 +_moduleName$ = -16 +_functionName$ = -20 +_mod$ = -24 +_addr$56841 = -28 +_Java_com_eaio_nativecall_NativeCall_initHandles@8 PROC NEAR ; COMDAT + +; 135 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + sub esp, 92 ; 0000005cH + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-92] + mov ecx, 23 ; 00000017H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 136 : +; 137 : bool out = JNI_TRUE; + + mov BYTE PTR _out$[ebp], 1 + +; 138 : +; 139 : jstring moduleNameS = (jstring) env->GetObjectField(obj, fieldModule); + + mov eax, DWORD PTR ?fieldModule@@3PAU_jfieldID@@A ; fieldModule + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField + mov DWORD PTR _moduleNameS$[ebp], eax + +; 140 : jstring functionNameS = (jstring) env->GetObjectField(obj, fieldFunction); + + mov edx, DWORD PTR ?fieldFunction@@3PAU_jfieldID@@A ; fieldFunction + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField + mov DWORD PTR _functionNameS$[ebp], eax + +; 141 : +; 142 : const char* moduleName = env->GetStringUTFChars(moduleNameS, 0); + + push 0 + mov ecx, DWORD PTR _moduleNameS$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z ; JNIEnv_::GetStringUTFChars + mov DWORD PTR _moduleName$[ebp], eax + +; 143 : const char* functionName = env->GetStringUTFChars(functionNameS, 0); + + push 0 + mov edx, DWORD PTR _functionNameS$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z ; JNIEnv_::GetStringUTFChars + mov DWORD PTR _functionName$[ebp], eax + +; 144 : +; 145 : #ifdef _WINDOWS +; 146 : +; 147 : HMODULE mod = LoadLibrary(moduleName); + + mov esi, esp + mov eax, DWORD PTR _moduleName$[ebp] + push eax + call DWORD PTR __imp__LoadLibraryA@4 + cmp esi, esp + call __chkesp + mov DWORD PTR _mod$[ebp], eax + +; 148 : +; 149 : if (mod == NULL) { + + cmp DWORD PTR _mod$[ebp], 0 + jne SHORT $L56839 + +; 150 : /* no such module or DllMain returned FALSE */ +; 151 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + mov esi, esp + call DWORD PTR __imp__GetLastError@0 + cmp esi, esp + call __chkesp + push eax + mov ecx, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField + +; 152 : out = JNI_FALSE; + + mov BYTE PTR _out$[ebp], 0 + +; 154 : else { + + jmp $L56843 +$L56839: + +; 155 : FARPROC addr = GetProcAddress(mod, functionName); + + mov esi, esp + mov eax, DWORD PTR _functionName$[ebp] + push eax + mov ecx, DWORD PTR _mod$[ebp] + push ecx + call DWORD PTR __imp__GetProcAddress@8 + cmp esi, esp + call __chkesp + mov DWORD PTR _addr$56841[ebp], eax + +; 156 : if (addr == NULL) { + + cmp DWORD PTR _addr$56841[ebp], 0 + jne SHORT $L56842 + +; 157 : /* function not found */ +; 158 : FreeLibrary(mod); + + mov esi, esp + mov edx, DWORD PTR _mod$[ebp] + push edx + call DWORD PTR __imp__FreeLibrary@4 + cmp esi, esp + call __chkesp + +; 159 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + mov esi, esp + call DWORD PTR __imp__GetLastError@0 + cmp esi, esp + call __chkesp + push eax + mov eax, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField + +; 160 : out = JNI_FALSE; + + mov BYTE PTR _out$[ebp], 0 + +; 162 : else { + + jmp SHORT $L56843 +$L56842: + +; 163 : /* all ok */ +; 164 : env->SetIntField(obj, fieldModuleHandle, (jint) mod); + + mov edx, DWORD PTR _mod$[ebp] + push edx + mov eax, DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField + +; 165 : env->SetIntField(obj, fieldFunctionHandle, (jint) addr); + + mov edx, DWORD PTR _addr$56841[ebp] + push edx + mov eax, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField +$L56843: + +; 168 : +; 169 : #endif +; 170 : +; 171 : env->ReleaseStringUTFChars(moduleNameS, moduleName); + + mov edx, DWORD PTR _moduleName$[ebp] + push edx + mov eax, DWORD PTR _moduleNameS$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z ; JNIEnv_::ReleaseStringUTFChars + +; 172 : env->ReleaseStringUTFChars(functionNameS, functionName); + + mov ecx, DWORD PTR _functionName$[ebp] + push ecx + mov edx, DWORD PTR _functionNameS$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z ; JNIEnv_::ReleaseStringUTFChars + +; 173 : +; 174 : return out; + + mov al, BYTE PTR _out$[ebp] + +; 175 : +; 176 : } + + pop edi + pop esi + pop ebx + add esp, 92 ; 0000005cH + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +_Java_com_eaio_nativecall_NativeCall_initHandles@8 ENDP +_TEXT ENDS +PUBLIC ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField +PUBLIC _Java_com_eaio_nativecall_NativeCall_getLastError@8 +PUBLIC ?NewStringUTF@JNIEnv_@@QAEPAV_jstring@@PBD@Z ; JNIEnv_::NewStringUTF +EXTRN __imp__FormatMessageA@28:NEAR +EXTRN __imp__LocalFree@4:NEAR +; COMDAT _Java_com_eaio_nativecall_NativeCall_getLastError@8 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_lastError$ = -4 +_out$ = -8 +_msgBufPtr$ = -12 +_Java_com_eaio_nativecall_NativeCall_getLastError@8 PROC NEAR ; COMDAT + +; 184 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + sub esp, 76 ; 0000004cH + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-76] + mov ecx, 19 ; 00000013H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 185 : +; 186 : jint lastError = env->GetIntField(obj, fieldLastErrorCode); + + mov eax, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField + mov DWORD PTR _lastError$[ebp], eax + +; 187 : +; 188 : if (lastError == 0) return NULL; + + cmp DWORD PTR _lastError$[ebp], 0 + jne SHORT $L56851 + xor eax, eax + jmp SHORT $L56849 +$L56851: + +; 189 : +; 190 : jstring out = NULL; + + mov DWORD PTR _out$[ebp], 0 + +; 191 : +; 192 : #ifdef _WINDOWS +; 193 : +; 194 : LPVOID msgBufPtr = NULL; + + mov DWORD PTR _msgBufPtr$[ebp], 0 + +; 195 : FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | +; 196 : FORMAT_MESSAGE_FROM_SYSTEM, NULL, lastError, 0, +; 197 : (LPSTR) &msgBufPtr, 0, NULL); + + mov esi, esp + push 0 + push 0 + lea edx, DWORD PTR _msgBufPtr$[ebp] + push edx + push 0 + mov eax, DWORD PTR _lastError$[ebp] + push eax + push 0 + push 4352 ; 00001100H + call DWORD PTR __imp__FormatMessageA@28 + cmp esi, esp + call __chkesp + +; 198 : +; 199 : out = env->NewStringUTF((char*) msgBufPtr); + + mov ecx, DWORD PTR _msgBufPtr$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?NewStringUTF@JNIEnv_@@QAEPAV_jstring@@PBD@Z ; JNIEnv_::NewStringUTF + mov DWORD PTR _out$[ebp], eax + +; 200 : +; 201 : LocalFree(msgBufPtr); + + mov esi, esp + mov edx, DWORD PTR _msgBufPtr$[ebp] + push edx + call DWORD PTR __imp__LocalFree@4 + cmp esi, esp + call __chkesp + +; 202 : +; 203 : #endif +; 204 : +; 205 : return out; + + mov eax, DWORD PTR _out$[ebp] +$L56849: + +; 206 : +; 207 : } + + pop edi + pop esi + pop ebx + add esp, 76 ; 0000004cH + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +_Java_com_eaio_nativecall_NativeCall_getLastError@8 ENDP +_TEXT ENDS +PUBLIC _Java_com_eaio_nativecall_NativeCall_destroy@8 +; COMDAT _Java_com_eaio_nativecall_NativeCall_destroy@8 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_module$ = -4 +_Java_com_eaio_nativecall_NativeCall_destroy@8 PROC NEAR ; COMDAT + +; 215 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 216 : +; 217 : jint module = env->GetIntField(obj, fieldModuleHandle); + + mov eax, DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField + mov DWORD PTR _module$[ebp], eax + +; 218 : +; 219 : if (module == 0) return; + + cmp DWORD PTR _module$[ebp], 0 + jne SHORT $L56861 + jmp SHORT $L56859 +$L56861: + +; 220 : +; 221 : #ifdef _WINDOWS +; 222 : +; 223 : if (FreeLibrary((HMODULE) module) == 0) { + + mov esi, esp + mov edx, DWORD PTR _module$[ebp] + push edx + call DWORD PTR __imp__FreeLibrary@4 + cmp esi, esp + call __chkesp + test eax, eax + jne SHORT $L56863 + +; 224 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + mov esi, esp + call DWORD PTR __imp__GetLastError@0 + cmp esi, esp + call __chkesp + push eax + mov eax, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField +$L56863: + +; 226 : +; 227 : #endif +; 228 : +; 229 : env->SetIntField(obj, fieldModuleHandle, 0); + + push 0 + mov edx, DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField + +; 230 : env->SetIntField(obj, fieldFunctionHandle, 0); + + push 0 + mov ecx, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField +$L56859: + +; 231 : +; 232 : return; +; 233 : +; 234 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +_Java_com_eaio_nativecall_NativeCall_destroy@8 ENDP +_TEXT ENDS +; COMDAT ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z +_TEXT SEGMENT +_this$ = -4 +_lobj$ = 8 +?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z PROC NEAR ; JNIEnv_::NewGlobalRef, COMDAT + +; 810 : jobject NewGlobalRef(jobject lobj) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 811 : return functions->NewGlobalRef(this,lobj); + + mov esi, esp + mov eax, DWORD PTR _lobj$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+84] + cmp esi, esp + call __chkesp + +; 812 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 4 +?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z ENDP ; JNIEnv_::NewGlobalRef +_TEXT ENDS +; COMDAT ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z +_TEXT SEGMENT +_this$ = -4 +_clazz$ = 8 +_name$ = 12 +_sig$ = 16 +?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z PROC NEAR ; JNIEnv_::GetMethodID, COMDAT + +; 859 : const char *sig) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 860 : return functions->GetMethodID(this,clazz,name,sig); + + mov esi, esp + mov eax, DWORD PTR _sig$[ebp] + push eax + mov ecx, DWORD PTR _name$[ebp] + push ecx + mov edx, DWORD PTR _clazz$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+132] + cmp esi, esp + call __chkesp + +; 861 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z ENDP ; JNIEnv_::GetMethodID +_TEXT ENDS +; COMDAT ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z +_TEXT SEGMENT +_clazz$ = 8 +_name$ = 12 +_sig$ = 16 +_this$ = -4 +?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z PROC NEAR ; JNIEnv_::GetFieldID, COMDAT + +; 1244 : const char *sig) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1245 : return functions->GetFieldID(this,clazz,name,sig); + + mov esi, esp + mov eax, DWORD PTR _sig$[ebp] + push eax + mov ecx, DWORD PTR _name$[ebp] + push ecx + mov edx, DWORD PTR _clazz$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+376] + cmp esi, esp + call __chkesp + +; 1246 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z ENDP ; JNIEnv_::GetFieldID +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_this$ = -4 +?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z PROC NEAR ; JNIEnv_::GetObjectField, COMDAT + +; 1248 : jobject GetObjectField(jobject obj, jfieldID fieldID) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1249 : return functions->GetObjectField(this,obj,fieldID); + + mov esi, esp + mov eax, DWORD PTR _fieldID$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+380] + cmp esi, esp + call __chkesp + +; 1250 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ENDP ; JNIEnv_::GetObjectField +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_this$ = -4 +?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z PROC NEAR ; JNIEnv_::GetIntField, COMDAT + +; 1263 : jint GetIntField(jobject obj, jfieldID fieldID) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1264 : return functions->GetIntField(this,obj,fieldID); + + mov esi, esp + mov eax, DWORD PTR _fieldID$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+400] + cmp esi, esp + call __chkesp + +; 1265 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ENDP ; JNIEnv_::GetIntField +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_val$ = 16 +_this$ = -4 +?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z PROC NEAR ; JNIEnv_::SetIntField, COMDAT + +; 1296 : jint val) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1297 : functions->SetIntField(this,obj,fieldID,val); + + mov esi, esp + mov eax, DWORD PTR _val$[ebp] + push eax + mov ecx, DWORD PTR _fieldID$[ebp] + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+436] + cmp esi, esp + call __chkesp + +; 1298 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ENDP ; JNIEnv_::SetIntField +_TEXT ENDS +; COMDAT ?NewStringUTF@JNIEnv_@@QAEPAV_jstring@@PBD@Z +_TEXT SEGMENT +_this$ = -4 +_utf$ = 8 +?NewStringUTF@JNIEnv_@@QAEPAV_jstring@@PBD@Z PROC NEAR ; JNIEnv_::NewStringUTF, COMDAT + +; 1576 : jstring NewStringUTF(const char *utf) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1577 : return functions->NewStringUTF(this,utf); + + mov esi, esp + mov eax, DWORD PTR _utf$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+668] + cmp esi, esp + call __chkesp + +; 1578 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 4 +?NewStringUTF@JNIEnv_@@QAEPAV_jstring@@PBD@Z ENDP ; JNIEnv_::NewStringUTF +_TEXT ENDS +; COMDAT ?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z +_TEXT SEGMENT +_this$ = -4 +_str$ = 8 +_isCopy$ = 12 +?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z PROC NEAR ; JNIEnv_::GetStringUTFChars, COMDAT + +; 1582 : const char* GetStringUTFChars(jstring str, jboolean *isCopy) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1583 : return functions->GetStringUTFChars(this,str,isCopy); + + mov esi, esp + mov eax, DWORD PTR _isCopy$[ebp] + push eax + mov ecx, DWORD PTR _str$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+676] + cmp esi, esp + call __chkesp + +; 1584 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z ENDP ; JNIEnv_::GetStringUTFChars +_TEXT ENDS +; COMDAT ?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z +_TEXT SEGMENT +_this$ = -4 +_str$ = 8 +_chars$ = 12 +?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z PROC NEAR ; JNIEnv_::ReleaseStringUTFChars, COMDAT + +; 1585 : void ReleaseStringUTFChars(jstring str, const char* chars) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1586 : functions->ReleaseStringUTFChars(this,str,chars); + + mov esi, esp + mov eax, DWORD PTR _chars$[ebp] + push eax + mov ecx, DWORD PTR _str$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+680] + cmp esi, esp + call __chkesp + +; 1587 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z ENDP ; JNIEnv_::ReleaseStringUTFChars +_TEXT ENDS +END diff --git a/cpp/nativecall/Debug/NativeCall.dll b/cpp/nativecall/Debug/NativeCall.dll new file mode 100644 index 0000000..fa9a51b Binary files /dev/null and b/cpp/nativecall/Debug/NativeCall.dll differ diff --git a/cpp/nativecall/Debug/NativeCall.obj b/cpp/nativecall/Debug/NativeCall.obj new file mode 100644 index 0000000..670355f Binary files /dev/null and b/cpp/nativecall/Debug/NativeCall.obj differ diff --git a/cpp/nativecall/Debug/RCa01372 b/cpp/nativecall/Debug/RCa01372 new file mode 100644 index 0000000..eb8e4b1 Binary files /dev/null and b/cpp/nativecall/Debug/RCa01372 differ diff --git a/cpp/nativecall/Debug/RCa01444 b/cpp/nativecall/Debug/RCa01444 new file mode 100644 index 0000000..eb8e4b1 Binary files /dev/null and b/cpp/nativecall/Debug/RCa01444 differ diff --git a/cpp/nativecall/Debug/RCa01468 b/cpp/nativecall/Debug/RCa01468 new file mode 100644 index 0000000..eb8e4b1 Binary files /dev/null and b/cpp/nativecall/Debug/RCa01468 differ diff --git a/cpp/nativecall/Debug/VoidCall.asm b/cpp/nativecall/Debug/VoidCall.asm new file mode 100644 index 0000000..de20049 --- /dev/null +++ b/cpp/nativecall/Debug/VoidCall.asm @@ -0,0 +1,1743 @@ + TITLE C:\Documents and Settings\Administrator\My Documents\Software\NativeCall\src\cpp\VoidCall.cpp + .386P +include listing.inc +if @Version gt 510 +.model FLAT +else +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT DWORD USE32 PUBLIC 'BSS' +_BSS ENDS +$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM' +$$SYMBOLS ENDS +$$TYPES SEGMENT BYTE USE32 'DEBTYP' +$$TYPES ENDS +_TLS SEGMENT DWORD USE32 PUBLIC 'TLS' +_TLS ENDS +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ??8@YAHABU_GUID@@0@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_VoidCall_executeCall@8 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT _Java_com_eaio_nativecall_VoidCall_executeCall0@12 +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +FLAT GROUP _DATA, CONST, _BSS + ASSUME CS: FLAT, DS: FLAT, SS: FLAT +endif +PUBLIC ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField +PUBLIC ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField +PUBLIC _Java_com_eaio_nativecall_VoidCall_executeCall@8 +EXTRN __imp__GetLastError@0:NEAR +EXTRN ?fieldFunctionHandle@@3PAU_jfieldID@@A:DWORD ; fieldFunctionHandle +EXTRN ?fieldLastErrorCode@@3PAU_jfieldID@@A:DWORD ; fieldLastErrorCode +EXTRN __chkesp:NEAR +; COMDAT _Java_com_eaio_nativecall_VoidCall_executeCall@8 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_functionHandle$ = -4 +_Java_com_eaio_nativecall_VoidCall_executeCall@8 PROC NEAR ; COMDAT + +; 79 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 80 : +; 81 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov eax, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField + mov DWORD PTR _functionHandle$[ebp], eax + +; 82 : +; 83 : #ifdef _WINDOWS +; 84 : #ifdef _X86_ +; 85 : +; 86 : __asm { +; 87 : +; 88 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 89 : +; 90 : } +; 91 : +; 92 : #endif +; 93 : #endif +; 94 : +; 95 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + mov esi, esp + call DWORD PTR __imp__GetLastError@0 + cmp esi, esp + call __chkesp + push eax + mov edx, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField + +; 96 : +; 97 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +_Java_com_eaio_nativecall_VoidCall_executeCall@8 ENDP +_TEXT ENDS +PUBLIC ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField +PUBLIC ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ; JNIEnv_::SetObjectField +PUBLIC _Java_com_eaio_nativecall_VoidCall_executeCall0@12 +PUBLIC ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z ; JNIEnv_::GetArrayLength +PUBLIC ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ; JNIEnv_::GetObjectArrayElement +PUBLIC ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' +PUBLIC ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical +PUBLIC ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ; JNIEnv_::ReleasePrimitiveArrayCritical +PUBLIC ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass +PUBLIC ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z ; JNIEnv_::ThrowNew +PUBLIC ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject +PUBLIC ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf +PUBLIC ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod +PUBLIC ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod +EXTRN ??2@YAPAXI@Z:NEAR ; operator new +EXTRN ??3@YAXPAX@Z:NEAR ; operator delete +EXTRN ?fieldHolderO@@3PAU_jfieldID@@A:DWORD ; fieldHolderO +EXTRN ?classBoolean@@3PAV_jclass@@A:DWORD ; classBoolean +EXTRN ?classInteger@@3PAV_jclass@@A:DWORD ; classInteger +EXTRN ?classByteArray@@3PAV_jclass@@A:DWORD ; classByteArray +EXTRN ?classCharArray@@3PAV_jclass@@A:DWORD ; classCharArray +EXTRN ?classHolder@@3PAV_jclass@@A:DWORD ; classHolder +EXTRN ?methodBooleanValue@@3PAU_jmethodID@@A:DWORD ; methodBooleanValue +EXTRN ?methodIntValue@@3PAU_jmethodID@@A:DWORD ; methodIntValue +EXTRN ?newIntegerInt@@3PAU_jmethodID@@A:DWORD ; newIntegerInt +EXTRN ?newBooleanBoolean@@3PAU_jmethodID@@A:DWORD ; newBooleanBoolean +EXTRN _memset:NEAR +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +; File c:\documents and settings\administrator\my documents\software\nativecall\src\cpp\voidcall.cpp +CONST SEGMENT +??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ DB 'java/lang/OutOfMemor' + DB 'yError', 00H ; `string' +CONST ENDS +; COMDAT _Java_com_eaio_nativecall_VoidCall_executeCall0@12 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_params$ = 16 +_len$ = -4 +_arrays$ = -8 +_param$ = -12 +_i$ = -16 +_intArg$56816 = -20 +_byteArrayArg$56819 = -24 +_charArrayArg$56825 = -28 +_booleanArg$56831 = -32 +_tempArg$56832 = -36 +_o$56835 = -40 +_intPtr$56837 = -44 +_byteArrayArg$56843 = -48 +_charArrayArg$56849 = -52 +_booleanArg$56855 = -56 +_tempPtr$56856 = -60 +_functionHandle$ = -64 +_j$ = -68 +_o$56873 = -72 +_out$56875 = -76 +_out$56885 = -80 +$T56914 = -84 +$T56915 = -88 +$T56916 = -92 +$T56917 = -96 +$T56918 = -100 +$T56919 = -104 +_Java_com_eaio_nativecall_VoidCall_executeCall0@12 PROC NEAR ; COMDAT + +; 105 : (JNIEnv *env, jobject obj, jobjectArray params) { + + push ebp + mov ebp, esp + sub esp, 168 ; 000000a8H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-168] + mov ecx, 42 ; 0000002aH + mov eax, -858993460 ; ccccccccH + rep stosd + +; 106 : +; 107 : const int len = env->GetArrayLength(params); + + mov eax, DWORD PTR _params$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z ; JNIEnv_::GetArrayLength + mov DWORD PTR _len$[ebp], eax + +; 108 : +; 109 : int* arrays = NULL; + + mov DWORD PTR _arrays$[ebp], 0 + +; 110 : if (!(arrays = new int[len])) { + + mov ecx, DWORD PTR _len$[ebp] + shl ecx, 2 + push ecx + call ??2@YAPAXI@Z ; operator new + add esp, 4 + mov DWORD PTR $T56914[ebp], eax + mov edx, DWORD PTR $T56914[ebp] + mov DWORD PTR _arrays$[ebp], edx + cmp DWORD PTR _arrays$[ebp], 0 + jne SHORT $L56805 + +; 111 : env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), NULL); + + push 0 + push OFFSET FLAT:??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' + mov ecx, DWORD PTR _env$[ebp] + call ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ; JNIEnv_::FindClass + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z ; JNIEnv_::ThrowNew + +; 112 : return; + + jmp $L56800 +$L56805: + +; 114 : memset(arrays, 0, (sizeof(int) * len)); + + mov eax, DWORD PTR _len$[ebp] + shl eax, 2 + push eax + push 0 + mov ecx, DWORD PTR _arrays$[ebp] + push ecx + call _memset + add esp, 12 ; 0000000cH + +; 115 : +; 116 : jobject param; +; 117 : +; 118 : for (int i = len - 1; i >= 0; i--) { + + mov edx, DWORD PTR _len$[ebp] + sub edx, 1 + mov DWORD PTR _i$[ebp], edx + jmp SHORT $L56810 +$L56811: + mov eax, DWORD PTR _i$[ebp] + sub eax, 1 + mov DWORD PTR _i$[ebp], eax +$L56810: + cmp DWORD PTR _i$[ebp], 0 + jl $L56812 + +; 119 : +; 120 : param = env->GetObjectArrayElement(params, i); + + mov ecx, DWORD PTR _i$[ebp] + push ecx + mov edx, DWORD PTR _params$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ; JNIEnv_::GetObjectArrayElement + mov DWORD PTR _param$[ebp], eax + +; 121 : +; 122 : if (param == NULL) { + + cmp DWORD PTR _param$[ebp], 0 + jne SHORT $L56813 + +; 123 : _push(0); + + push 0 + +; 125 : else if (env->IsInstanceOf(param, classInteger)) { + + jmp $L56854 +$L56813: + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56815 + +; 126 : int intArg = env->CallIntMethod(param, methodIntValue); + + mov edx, DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + push ecx + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + add esp, 12 ; 0000000cH + mov DWORD PTR _intArg$56816[ebp], eax + +; 127 : _push(intArg) + + push DWORD PTR _intArg$56816[ebp] + +; 129 : else if (env->IsInstanceOf(param, classByteArray)) { + + jmp $L56854 +$L56815: + mov edx, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56818 + +; 130 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) param, 0); + + push 0 + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _byteArrayArg$56819[ebp], eax + +; 131 : arrays[i] = (int) &byteArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _byteArrayArg$56819[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 132 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$56819[ebp] + +; 134 : else if (env->IsInstanceOf(param, classCharArray)) { + + jmp $L56854 +$L56818: + mov edx, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56824 + +; 135 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 136 : (jarray) param, 0); + + push 0 + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _charArrayArg$56825[ebp], eax + +; 137 : arrays[i] = (int) &charArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _charArrayArg$56825[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 138 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$56825[ebp] + +; 140 : else if (env->IsInstanceOf(param, classBoolean)) { + + jmp $L56854 +$L56824: + mov edx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56830 + +; 141 : jboolean booleanArg = env->CallBooleanMethod(param, methodBooleanValue); + + mov ecx, DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov eax, DWORD PTR _env$[ebp] + push eax + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + add esp, 12 ; 0000000cH + mov BYTE PTR _booleanArg$56831[ebp], al + +; 142 : int tempArg = (booleanArg == JNI_FALSE ? 0 : 1); + + mov ecx, DWORD PTR _booleanArg$56831[ebp] + and ecx, 255 ; 000000ffH + neg ecx + sbb ecx, ecx + neg ecx + mov DWORD PTR _tempArg$56832[ebp], ecx + +; 143 : _push(tempArg) + + push DWORD PTR _tempArg$56832[ebp] + +; 145 : else if (env->IsInstanceOf(param, classHolder)) { + + jmp $L56854 +$L56830: + mov edx, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je $L56854 + +; 146 : +; 147 : /* Holder */ +; 148 : +; 149 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov ecx, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField + mov DWORD PTR _o$56835[ebp], eax + +; 150 : +; 151 : if (env->IsInstanceOf(o, classInteger)) { + + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + mov ecx, DWORD PTR _o$56835[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56836 + +; 152 : int *intPtr = new int; + + push 4 + call ??2@YAPAXI@Z ; operator new + add esp, 4 + mov DWORD PTR $T56915[ebp], eax + mov edx, DWORD PTR $T56915[ebp] + mov DWORD PTR _intPtr$56837[ebp], edx + +; 153 : *intPtr = env->CallIntMethod(o, methodIntValue); + + mov eax, DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push eax + mov ecx, DWORD PTR _o$56835[ebp] + push ecx + mov edx, DWORD PTR _env$[ebp] + push edx + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + add esp, 12 ; 0000000cH + mov ecx, DWORD PTR _intPtr$56837[ebp] + mov DWORD PTR [ecx], eax + +; 154 : arrays[i] = (int) intPtr; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + mov ecx, DWORD PTR _intPtr$56837[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 155 : _push(intPtr); + + push DWORD PTR _intPtr$56837[ebp] + +; 157 : else if (env->IsInstanceOf(o, classByteArray)) { + + jmp $L56854 +$L56836: + mov edx, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push edx + mov eax, DWORD PTR _o$56835[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56842 + +; 158 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) o, 0); + + push 0 + mov ecx, DWORD PTR _o$56835[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _byteArrayArg$56843[ebp], eax + +; 159 : arrays[i] = (int) &byteArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _byteArrayArg$56843[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 160 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$56843[ebp] + +; 162 : else if (env->IsInstanceOf(o, classCharArray)) { + + jmp $L56854 +$L56842: + mov edx, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push edx + mov eax, DWORD PTR _o$56835[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56848 + +; 163 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 164 : (jarray) o, 0); + + push 0 + mov ecx, DWORD PTR _o$56835[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ; JNIEnv_::GetPrimitiveArrayCritical + mov DWORD PTR _charArrayArg$56849[ebp], eax + +; 165 : arrays[i] = (int) &charArrayArg; + + mov edx, DWORD PTR _i$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + lea ecx, DWORD PTR _charArrayArg$56849[ebp] + mov DWORD PTR [eax+edx*4], ecx + +; 166 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$56849[ebp] + +; 168 : else if (env->IsInstanceOf(o, classBoolean)) { + + jmp SHORT $L56854 +$L56848: + mov edx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push edx + mov eax, DWORD PTR _o$56835[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56854 + +; 169 : jboolean booleanArg = env->CallBooleanMethod(o, methodBooleanValue); + + mov ecx, DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ecx + mov edx, DWORD PTR _o$56835[ebp] + push edx + mov eax, DWORD PTR _env$[ebp] + push eax + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + add esp, 12 ; 0000000cH + mov BYTE PTR _booleanArg$56855[ebp], al + +; 170 : int *tempPtr = new int; + + push 4 + call ??2@YAPAXI@Z ; operator new + add esp, 4 + mov DWORD PTR $T56916[ebp], eax + mov ecx, DWORD PTR $T56916[ebp] + mov DWORD PTR _tempPtr$56856[ebp], ecx + +; 171 : *tempPtr = (booleanArg == JNI_FALSE ? 0 : 1); + + mov edx, DWORD PTR _booleanArg$56855[ebp] + and edx, 255 ; 000000ffH + neg edx + sbb edx, edx + neg edx + mov eax, DWORD PTR _tempPtr$56856[ebp] + mov DWORD PTR [eax], edx + +; 172 : arrays[i] = (int) tempPtr; + + mov ecx, DWORD PTR _i$[ebp] + mov edx, DWORD PTR _arrays$[ebp] + mov eax, DWORD PTR _tempPtr$56856[ebp] + mov DWORD PTR [edx+ecx*4], eax + +; 173 : _push(tempPtr); + + push DWORD PTR _tempPtr$56856[ebp] +$L56854: + +; 179 : +; 180 : } + + jmp $L56811 +$L56812: + +; 181 : +; 182 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov ecx, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ; JNIEnv_::GetIntField + mov DWORD PTR _functionHandle$[ebp], eax + +; 183 : +; 184 : #ifdef _WINDOWS +; 185 : #ifdef _X86_ +; 186 : +; 187 : __asm { +; 188 : +; 189 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 190 : +; 191 : } +; 192 : +; 193 : #endif +; 194 : #endif +; 195 : +; 196 : for (int j = 0; j < len; ++j) { + + mov DWORD PTR _j$[ebp], 0 + jmp SHORT $L56862 +$L56863: + mov eax, DWORD PTR _j$[ebp] + add eax, 1 + mov DWORD PTR _j$[ebp], eax +$L56862: + mov ecx, DWORD PTR _j$[ebp] + cmp ecx, DWORD PTR _len$[ebp] + jge $L56864 + +; 197 : param = env->GetObjectArrayElement(params, j); + + mov edx, DWORD PTR _j$[ebp] + push edx + mov eax, DWORD PTR _params$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ; JNIEnv_::GetObjectArrayElement + mov DWORD PTR _param$[ebp], eax + +; 198 : if (param == NULL) {} + + cmp DWORD PTR _param$[ebp], 0 + jne SHORT $L56865 + +; 199 : else if (env->IsInstanceOf(param, classByteArray) || env->IsInstanceOf(param, classCharArray)) { + + jmp $L56884 +$L56865: + mov ecx, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + jne SHORT $L56868 + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56867 +$L56868: + +; 200 : env->ReleasePrimitiveArrayCritical((jarray) param, (void*) arrays[j], 0); + + push 0 + mov edx, DWORD PTR _j$[ebp] + mov eax, DWORD PTR _arrays$[ebp] + mov ecx, DWORD PTR [eax+edx*4] + push ecx + mov edx, DWORD PTR _param$[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ; JNIEnv_::ReleasePrimitiveArrayCritical + +; 202 : else if (env->IsInstanceOf(param, classHolder)) { + + jmp $L56884 +$L56867: + mov eax, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je $L56884 + +; 203 : +; 204 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov edx, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ; JNIEnv_::GetObjectField + mov DWORD PTR _o$56873[ebp], eax + +; 205 : +; 206 : if (env->IsInstanceOf(o, classInteger)) { + + mov ecx, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push ecx + mov edx, DWORD PTR _o$56873[ebp] + push edx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56874 + +; 207 : int* out = (int*) arrays[j]; + + mov eax, DWORD PTR _j$[ebp] + mov ecx, DWORD PTR _arrays$[ebp] + mov edx, DWORD PTR [ecx+eax*4] + mov DWORD PTR _out$56875[ebp], edx + +; 208 : env->SetObjectField(param, fieldHolderO, env->NewObject(classInteger, newIntegerInt, *out)); + + mov eax, DWORD PTR _out$56875[ebp] + mov ecx, DWORD PTR [eax] + push ecx + mov edx, DWORD PTR ?newIntegerInt@@3PAU_jmethodID@@A ; newIntegerInt + push edx + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + mov ecx, DWORD PTR _env$[ebp] + push ecx + call ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject + add esp, 16 ; 00000010H + push eax + mov edx, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push edx + mov eax, DWORD PTR _param$[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ; JNIEnv_::SetObjectField + +; 209 : delete out; + + mov ecx, DWORD PTR _out$56875[ebp] + mov DWORD PTR $T56917[ebp], ecx + mov edx, DWORD PTR $T56917[ebp] + push edx + call ??3@YAXPAX@Z ; operator delete + add esp, 4 + +; 211 : else if (env->IsInstanceOf(o, classByteArray) || env->IsInstanceOf(o, classCharArray)) { + + jmp $L56884 +$L56874: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + push eax + mov ecx, DWORD PTR _o$56873[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + jne SHORT $L56880 + mov edx, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + push edx + mov eax, DWORD PTR _o$56873[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56879 +$L56880: + +; 212 : env->ReleasePrimitiveArrayCritical((jarray) o, (void*) arrays[j], 0); + + push 0 + mov ecx, DWORD PTR _j$[ebp] + mov edx, DWORD PTR _arrays$[ebp] + mov eax, DWORD PTR [edx+ecx*4] + push eax + mov ecx, DWORD PTR _o$56873[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ; JNIEnv_::ReleasePrimitiveArrayCritical + +; 214 : else if (env->IsInstanceOf(o, classBoolean)) { + + jmp SHORT $L56884 +$L56879: + mov edx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push edx + mov eax, DWORD PTR _o$56873[ebp] + push eax + mov ecx, DWORD PTR _env$[ebp] + call ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ; JNIEnv_::IsInstanceOf + and eax, 255 ; 000000ffH + test eax, eax + je SHORT $L56884 + +; 215 : int* out = (int*) arrays[j]; + + mov ecx, DWORD PTR _j$[ebp] + mov edx, DWORD PTR _arrays$[ebp] + mov eax, DWORD PTR [edx+ecx*4] + mov DWORD PTR _out$56885[ebp], eax + +; 216 : env->SetObjectField(param, fieldHolderO, env->NewObject(classBoolean, newBooleanBoolean, (*out == 0 ? JNI_FALSE : JNI_TRUE))); + + mov ecx, DWORD PTR _out$56885[ebp] + xor edx, edx + cmp DWORD PTR [ecx], 0 + setne dl + push edx + mov eax, DWORD PTR ?newBooleanBoolean@@3PAU_jmethodID@@A ; newBooleanBoolean + push eax + mov ecx, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push ecx + mov edx, DWORD PTR _env$[ebp] + push edx + call ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject + add esp, 16 ; 00000010H + push eax + mov eax, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push eax + mov ecx, DWORD PTR _param$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ; JNIEnv_::SetObjectField + +; 217 : delete out; + + mov edx, DWORD PTR _out$56885[ebp] + mov DWORD PTR $T56918[ebp], edx + mov eax, DWORD PTR $T56918[ebp] + push eax + call ??3@YAXPAX@Z ; operator delete + add esp, 4 +$L56884: + +; 221 : +; 222 : } + + jmp $L56863 +$L56864: + +; 223 : +; 224 : delete [] arrays; + + mov ecx, DWORD PTR _arrays$[ebp] + mov DWORD PTR $T56919[ebp], ecx + mov edx, DWORD PTR $T56919[ebp] + push edx + call ??3@YAXPAX@Z ; operator delete + add esp, 4 + +; 225 : +; 226 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + mov esi, esp + call DWORD PTR __imp__GetLastError@0 + cmp esi, esp + call __chkesp + push eax + mov eax, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov ecx, DWORD PTR _env$[ebp] + call ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ; JNIEnv_::SetIntField +$L56800: + +; 227 : +; 228 : } + + pop edi + pop esi + pop ebx + add esp, 168 ; 000000a8H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +_Java_com_eaio_nativecall_VoidCall_executeCall0@12 ENDP +_TEXT ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT +_this$ = -4 +_name$ = 8 +?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z PROC NEAR ; JNIEnv_::FindClass, COMDAT + +; 759 : jclass FindClass(const char *name) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 760 : return functions->FindClass(this, name); + + mov esi, esp + mov eax, DWORD PTR _name$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+24] + cmp esi, esp + call __chkesp + +; 761 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 4 +?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z ENDP ; JNIEnv_::FindClass +_TEXT ENDS +; COMDAT ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z +_TEXT SEGMENT +_this$ = -4 +_clazz$ = 8 +_msg$ = 12 +?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z PROC NEAR ; JNIEnv_::ThrowNew, COMDAT + +; 787 : jint ThrowNew(jclass clazz, const char *msg) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 788 : return functions->ThrowNew(this, clazz, msg); + + mov esi, esp + mov eax, DWORD PTR _msg$[ebp] + push eax + mov ecx, DWORD PTR _clazz$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+56] + cmp esi, esp + call __chkesp + +; 789 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z ENDP ; JNIEnv_::ThrowNew +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_args$ = -4 +_result$ = -8 +_clazz$ = 12 +_methodID$ = 16 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::NewObject, COMDAT + +; 834 : jobject NewObject(jclass clazz, jmethodID methodID, ...) { + + push ebp + mov ebp, esp + sub esp, 72 ; 00000048H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-72] + mov ecx, 18 ; 00000012H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 835 : va_list args; +; 836 : jobject result; +; 837 : va_start(args, methodID); + + lea eax, DWORD PTR _methodID$[ebp+4] + mov DWORD PTR _args$[ebp], eax + +; 838 : result = functions->NewObjectV(this,clazz,methodID,args); + + mov esi, esp + mov ecx, DWORD PTR _args$[ebp] + push ecx + mov edx, DWORD PTR _methodID$[ebp] + push edx + mov eax, DWORD PTR _clazz$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+116] + cmp esi, esp + call __chkesp + mov DWORD PTR _result$[ebp], eax + +; 839 : va_end(args); + + mov DWORD PTR _args$[ebp], 0 + +; 840 : return result; + + mov eax, DWORD PTR _result$[ebp] + +; 841 : } + + pop edi + pop esi + pop ebx + add esp, 72 ; 00000048H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 0 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::NewObject +_TEXT ENDS +; COMDAT ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z +_TEXT SEGMENT +_this$ = -4 +_obj$ = 8 +_clazz$ = 12 +?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z PROC NEAR ; JNIEnv_::IsInstanceOf, COMDAT + +; 854 : jboolean IsInstanceOf(jobject obj, jclass clazz) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 855 : return functions->IsInstanceOf(this,obj,clazz); + + mov esi, esp + mov eax, DWORD PTR _clazz$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+128] + cmp esi, esp + call __chkesp + +; 856 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z ENDP ; JNIEnv_::IsInstanceOf +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_args$ = -4 +_result$ = -8 +_obj$ = 12 +_methodID$ = 16 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallBooleanMethod, COMDAT + +; 881 : jmethodID methodID, ...) { + + push ebp + mov ebp, esp + sub esp, 72 ; 00000048H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-72] + mov ecx, 18 ; 00000012H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 882 : va_list args; +; 883 : jboolean result; +; 884 : va_start(args,methodID); + + lea eax, DWORD PTR _methodID$[ebp+4] + mov DWORD PTR _args$[ebp], eax + +; 885 : result = functions->CallBooleanMethodV(this,obj,methodID,args); + + mov esi, esp + mov ecx, DWORD PTR _args$[ebp] + push ecx + mov edx, DWORD PTR _methodID$[ebp] + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+152] + cmp esi, esp + call __chkesp + mov BYTE PTR _result$[ebp], al + +; 886 : va_end(args); + + mov DWORD PTR _args$[ebp], 0 + +; 887 : return result; + + mov al, BYTE PTR _result$[ebp] + +; 888 : } + + pop edi + pop esi + pop ebx + add esp, 72 ; 00000048H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 0 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallBooleanMethod +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_args$ = -4 +_result$ = -8 +_obj$ = 12 +_methodID$ = 16 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallIntMethod, COMDAT + +; 949 : jint CallIntMethod(jobject obj, jmethodID methodID, ...) { + + push ebp + mov ebp, esp + sub esp, 72 ; 00000048H + push ebx + push esi + push edi + lea edi, DWORD PTR [ebp-72] + mov ecx, 18 ; 00000012H + mov eax, -858993460 ; ccccccccH + rep stosd + +; 950 : va_list args; +; 951 : jint result; +; 952 : va_start(args,methodID); + + lea eax, DWORD PTR _methodID$[ebp+4] + mov DWORD PTR _args$[ebp], eax + +; 953 : result = functions->CallIntMethodV(this,obj,methodID,args); + + mov esi, esp + mov ecx, DWORD PTR _args$[ebp] + push ecx + mov edx, DWORD PTR _methodID$[ebp] + push edx + mov eax, DWORD PTR _obj$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+200] + cmp esi, esp + call __chkesp + mov DWORD PTR _result$[ebp], eax + +; 954 : va_end(args); + + mov DWORD PTR _args$[ebp], 0 + +; 955 : return result; + + mov eax, DWORD PTR _result$[ebp] + +; 956 : } + + pop edi + pop esi + pop ebx + add esp, 72 ; 00000048H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 0 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallIntMethod +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_this$ = -4 +?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z PROC NEAR ; JNIEnv_::GetObjectField, COMDAT + +; 1248 : jobject GetObjectField(jobject obj, jfieldID fieldID) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1249 : return functions->GetObjectField(this,obj,fieldID); + + mov esi, esp + mov eax, DWORD PTR _fieldID$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+380] + cmp esi, esp + call __chkesp + +; 1250 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z ENDP ; JNIEnv_::GetObjectField +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_this$ = -4 +?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z PROC NEAR ; JNIEnv_::GetIntField, COMDAT + +; 1263 : jint GetIntField(jobject obj, jfieldID fieldID) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1264 : return functions->GetIntField(this,obj,fieldID); + + mov esi, esp + mov eax, DWORD PTR _fieldID$[ebp] + push eax + mov ecx, DWORD PTR _obj$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+400] + cmp esi, esp + call __chkesp + +; 1265 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z ENDP ; JNIEnv_::GetIntField +_TEXT ENDS +; COMDAT ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_val$ = 16 +_this$ = -4 +?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z PROC NEAR ; JNIEnv_::SetObjectField, COMDAT + +; 1276 : void SetObjectField(jobject obj, jfieldID fieldID, jobject val) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1277 : functions->SetObjectField(this,obj,fieldID,val); + + mov esi, esp + mov eax, DWORD PTR _val$[ebp] + push eax + mov ecx, DWORD PTR _fieldID$[ebp] + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+416] + cmp esi, esp + call __chkesp + +; 1278 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z ENDP ; JNIEnv_::SetObjectField +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT +_obj$ = 8 +_fieldID$ = 12 +_val$ = 16 +_this$ = -4 +?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z PROC NEAR ; JNIEnv_::SetIntField, COMDAT + +; 1296 : jint val) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1297 : functions->SetIntField(this,obj,fieldID,val); + + mov esi, esp + mov eax, DWORD PTR _val$[ebp] + push eax + mov ecx, DWORD PTR _fieldID$[ebp] + push ecx + mov edx, DWORD PTR _obj$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+436] + cmp esi, esp + call __chkesp + +; 1298 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z ENDP ; JNIEnv_::SetIntField +_TEXT ENDS +; COMDAT ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z PROC NEAR ; JNIEnv_::GetArrayLength, COMDAT + +; 1589 : jsize GetArrayLength(jarray array) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1590 : return functions->GetArrayLength(this,array); + + mov esi, esp + mov eax, DWORD PTR _array$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + mov eax, DWORD PTR [edx] + call DWORD PTR [eax+684] + cmp esi, esp + call __chkesp + +; 1591 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 4 +?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z ENDP ; JNIEnv_::GetArrayLength +_TEXT ENDS +; COMDAT ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +_index$ = 12 +?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z PROC NEAR ; JNIEnv_::GetObjectArrayElement, COMDAT + +; 1597 : jobject GetObjectArrayElement(jobjectArray array, jsize index) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1598 : return functions->GetObjectArrayElement(this,array,index); + + mov esi, esp + mov eax, DWORD PTR _index$[ebp] + push eax + mov ecx, DWORD PTR _array$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+692] + cmp esi, esp + call __chkesp + +; 1599 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z ENDP ; JNIEnv_::GetObjectArrayElement +_TEXT ENDS +; COMDAT ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +_isCopy$ = 12 +?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z PROC NEAR ; JNIEnv_::GetPrimitiveArrayCritical, COMDAT + +; 1788 : void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1789 : return functions->GetPrimitiveArrayCritical(this,array,isCopy); + + mov esi, esp + mov eax, DWORD PTR _isCopy$[ebp] + push eax + mov ecx, DWORD PTR _array$[ebp] + push ecx + mov edx, DWORD PTR _this$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + mov ecx, DWORD PTR [eax] + call DWORD PTR [ecx+888] + cmp esi, esp + call __chkesp + +; 1790 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 8 +?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z ENDP ; JNIEnv_::GetPrimitiveArrayCritical +_TEXT ENDS +; COMDAT ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z +_TEXT SEGMENT +_this$ = -4 +_array$ = 8 +_carray$ = 12 +_mode$ = 16 +?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z PROC NEAR ; JNIEnv_::ReleasePrimitiveArrayCritical, COMDAT + +; 1791 : void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) { + + push ebp + mov ebp, esp + sub esp, 68 ; 00000044H + push ebx + push esi + push edi + push ecx + lea edi, DWORD PTR [ebp-68] + mov ecx, 17 ; 00000011H + mov eax, -858993460 ; ccccccccH + rep stosd + pop ecx + mov DWORD PTR _this$[ebp], ecx + +; 1792 : functions->ReleasePrimitiveArrayCritical(this,array,carray,mode); + + mov esi, esp + mov eax, DWORD PTR _mode$[ebp] + push eax + mov ecx, DWORD PTR _carray$[ebp] + push ecx + mov edx, DWORD PTR _array$[ebp] + push edx + mov eax, DWORD PTR _this$[ebp] + push eax + mov ecx, DWORD PTR _this$[ebp] + mov edx, DWORD PTR [ecx] + call DWORD PTR [edx+892] + cmp esi, esp + call __chkesp + +; 1793 : } + + pop edi + pop esi + pop ebx + add esp, 68 ; 00000044H + cmp ebp, esp + call __chkesp + mov esp, ebp + pop ebp + ret 12 ; 0000000cH +?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z ENDP ; JNIEnv_::ReleasePrimitiveArrayCritical +_TEXT ENDS +END diff --git a/cpp/nativecall/Debug/VoidCall.obj b/cpp/nativecall/Debug/VoidCall.obj new file mode 100644 index 0000000..9ba9ad6 Binary files /dev/null and b/cpp/nativecall/Debug/VoidCall.obj differ diff --git a/cpp/nativecall/IntCall.cpp b/cpp/nativecall/IntCall.cpp new file mode 100644 index 0000000..131e267 --- /dev/null +++ b/cpp/nativecall/IntCall.cpp @@ -0,0 +1,236 @@ +/* + * IntCall.cpp + * + * Created on 11.09.2004. + * + * $Id: IntCall.cpp,v 1.3 2006/04/19 20:54:55 grnull Exp $ + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include +#include "com_eaio_nativecall_IntCall.h" + +#ifdef _WINDOWS +#include +#include +#endif + +#ifdef _WINDOWS +#ifdef _X86_ + +#define _push(x) __asm { push x }; + +#endif +#endif + +// NativeCall fields + +extern jfieldID fieldFunction, fieldModule, fieldFunctionHandle, + fieldModuleHandle, fieldLastErrorCode; + +// Holder fields + +extern jfieldID fieldHolderO; + +// Classes + +extern jclass classBoolean,/* classByte, classCharacter, classShort,*/ + classInteger, /* classLong, classFloat, classDouble,*/ classString, + classByteArray, classCharArray, /*classIntArray,*/ classHolder; + +// Wrapper class methods + +extern jmethodID methodBooleanValue,/* methodByteValue, methodCharValue, +methodShortValue,*/ methodIntValue/*, methodLongValue, methodFloatValue, +methodDoubleValue*/; + +// Constructors + +extern jmethodID newIntegerInt, newBooleanBoolean; + +/* + * Class: com_eaio_nativecall_IntCall + * Method: executeCall + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_eaio_nativecall_IntCall_executeCall +(JNIEnv *env, jobject obj) { + + jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + jint outVal; + +#ifdef _WINDOWS +#ifdef _X86_ + + __asm { + + call functionHandle + mov outVal, eax + + } + +#endif +#endif + + env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + return outVal; + +} + +/* + * Class: com_eaio_nativecall_IntCall + * Method: executeCall0 + * Signature: ([Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_com_eaio_nativecall_IntCall_executeCall0 +(JNIEnv *env, jobject obj, jobjectArray params) { + + const int len = env->GetArrayLength(params); + + int* arrays = NULL; + if (!(arrays = new int[len])) { + env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), NULL); + return 0; + } + memset(arrays, 0, (sizeof(int) * len)); + + jobject param; + + for (int i = len - 1; i >= 0; i--) { + + param = env->GetObjectArrayElement(params, i); + + if (param == NULL) { + _push(0); + } + else if (env->IsInstanceOf(param, classInteger)) { + int intArg = env->CallIntMethod(param, methodIntValue); + _push(intArg) + } + else if (env->IsInstanceOf(param, classByteArray)) { + char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) param, 0); + arrays[i] = (int) &byteArrayArg; + _push(byteArrayArg) + } + else if (env->IsInstanceOf(param, classCharArray)) { + unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( + (jarray) param, 0); + arrays[i] = (int) &charArrayArg; + _push(charArrayArg) + } + else if (env->IsInstanceOf(param, classBoolean)) { + jboolean booleanArg = env->CallBooleanMethod(param, methodBooleanValue); + int tempArg = (booleanArg == JNI_FALSE ? 0 : 1); + _push(tempArg) + } + else if (env->IsInstanceOf(param, classHolder)) { + + /* Holder */ + + jobject o = env->GetObjectField(param, fieldHolderO); + + if (env->IsInstanceOf(o, classInteger)) { + int *intPtr = new int; + *intPtr = env->CallIntMethod(o, methodIntValue); + arrays[i] = (int) intPtr; + _push(intPtr); + } + else if (env->IsInstanceOf(o, classByteArray)) { + char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) o, 0); + arrays[i] = (int) &byteArrayArg; + _push(byteArrayArg) + } + else if (env->IsInstanceOf(o, classCharArray)) { + unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( + (jarray) o, 0); + arrays[i] = (int) &charArrayArg; + _push(charArrayArg) + } + else if (env->IsInstanceOf(o, classBoolean)) { + jboolean booleanArg = env->CallBooleanMethod(o, methodBooleanValue); + int *tempPtr = new int; + *tempPtr = (booleanArg == JNI_FALSE ? 0 : 1); + arrays[i] = (int) tempPtr; + _push(tempPtr); + } + + /* end Holder */ + + } + + } + + jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + jint outVal; + +#ifdef _WINDOWS +#ifdef _X86_ + + __asm { + + call functionHandle + mov outVal, eax + + } + +#endif +#endif + + for (int j = 0; j < len; ++j) { + param = env->GetObjectArrayElement(params, j); + if (param == NULL) {} + else if (env->IsInstanceOf(param, classByteArray) || env->IsInstanceOf(param, classCharArray)) { + env->ReleasePrimitiveArrayCritical((jarray) param, (void*) arrays[j], 0); + } + else if (env->IsInstanceOf(param, classHolder)) { + + jobject o = env->GetObjectField(param, fieldHolderO); + + if (env->IsInstanceOf(o, classInteger)) { + int* out = (int*) arrays[j]; + env->SetObjectField(param, fieldHolderO, env->NewObject(classInteger, newIntegerInt, *out)); + delete out; + } + else if (env->IsInstanceOf(o, classByteArray) || env->IsInstanceOf(o, classCharArray)) { + env->ReleasePrimitiveArrayCritical((jarray) o, (void*) arrays[j], 0); + } + else if (env->IsInstanceOf(o, classBoolean)) { + int* out = (int*) arrays[j]; + env->SetObjectField(param, fieldHolderO, env->NewObject(classBoolean, newBooleanBoolean, (*out == 0 ? JNI_FALSE : JNI_TRUE))); + delete out; + } + + } + + } + + delete [] arrays; + + env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + return outVal; + +} diff --git a/cpp/nativecall/NativeCall.cpp b/cpp/nativecall/NativeCall.cpp new file mode 100644 index 0000000..33fd45c --- /dev/null +++ b/cpp/nativecall/NativeCall.cpp @@ -0,0 +1,234 @@ +/* + * NativeCall.cpp + * + * Created on 11.09.2004. + * + * $Id: NativeCall.cpp,v 1.4 2006/04/19 20:54:55 grnull Exp $ + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include +#include "com_eaio_nativecall_NativeCall.h" + +#ifdef _WINDOWS +#include +#include +#endif + +// NativeCall fields + +jfieldID fieldFunction, fieldModule, fieldFunctionHandle, + fieldModuleHandle, fieldLastErrorCode; + +// Holder fields + +jfieldID fieldHolderO; + +// Classes + +jclass classBoolean,/* classByte, classCharacter, classShort,*/ + classInteger, /* classLong, classFloat, classDouble,*/ classString, + classByteArray, classCharArray, /*classIntArray,*/ classHolder; + +// Wrapper class methods + +jmethodID methodBooleanValue,/* methodByteValue, methodCharValue, +methodShortValue,*/ methodIntValue/*, methodLongValue, methodFloatValue, +methodDoubleValue*/; + +// Constructors + +jmethodID newIntegerInt, newBooleanBoolean; + +/* + * Class: com_eaio_nativecall_NativeCall + * Method: initIDs + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_NativeCall_initIDs +(JNIEnv *env, jclass cls) { + + // NativeCall fields + + fieldFunction = env->GetFieldID(cls, "function", "Ljava/lang/String;"); + fieldModule = env->GetFieldID(cls, "module", "Ljava/lang/String;"); + + fieldFunctionHandle = env->GetFieldID(cls, "functionHandle", "I"); + fieldModuleHandle = env-> GetFieldID(cls, "moduleHandle", "I"); + + fieldLastErrorCode = env->GetFieldID(cls, "lastErrorCode", "I"); + + // Holder fields + + classHolder = (jclass) env->NewGlobalRef(env->FindClass("com/eaio/nativecall/Holder")); + fieldHolderO = env->GetFieldID(classHolder, "o", "Ljava/lang/Object;"); + + // Other classes + + classBoolean = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Boolean")); + /*classByte = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Byte")); + classCharacter = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Character")); + classShort = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Short"));*/ + classInteger = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Integer")); + /*classLong = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Long")); + classFloat = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Float")); + classDouble = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Double"));*/ + classString = (jclass) env->NewGlobalRef(env->FindClass("java/lang/String")); + classByteArray = (jclass) env->NewGlobalRef(env->FindClass("[B")); + classCharArray = (jclass) env->NewGlobalRef(env->FindClass("[C")); + /*classIntArray = (jclass) env->NewGlobalRef(env->FindClass("[I"));*/ + + // Wrapper class methods + + methodBooleanValue = env->GetMethodID(classBoolean, + "booleanValue", "()Z"); + /*methodByteValue = env->GetMethodID(classByte, + "byteValue", "()B"); + methodCharValue = env->GetMethodID(classCharacter, + "charValue", "()C"); + methodShortValue = env->GetMethodID(classShort, + "shortValue", "()S");*/ + methodIntValue = env->GetMethodID(classInteger, + "intValue", "()I"); + /*methodLongValue = env->GetMethodID(classLong, + "longValue", "()J"); + methodFloatValue = env->GetMethodID(classFloat, + "floatValue", "()F"); + methodDoubleValue = env->GetMethodID(classDouble, + "doubleValue", "()D");*/ + + // Constructors + + newIntegerInt = env->GetMethodID(classInteger, "", "(I)V"); + newBooleanBoolean = env->GetMethodID(classBoolean, "", "(Z)V"); + +} + +/* + * Class: com_eaio_nativecall_NativeCall + * Method: initHandles + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_com_eaio_nativecall_NativeCall_initHandles +(JNIEnv *env, jobject obj) { + + bool out = JNI_TRUE; + + jstring moduleNameS = (jstring) env->GetObjectField(obj, fieldModule); + jstring functionNameS = (jstring) env->GetObjectField(obj, fieldFunction); + + const char* moduleName = env->GetStringUTFChars(moduleNameS, 0); + const char* functionName = env->GetStringUTFChars(functionNameS, 0); + +#ifdef _WINDOWS + + HMODULE mod = LoadLibrary(moduleName); + + if (mod == NULL) { + /* no such module or DllMain returned FALSE */ + env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + out = JNI_FALSE; + } + else { + FARPROC addr = GetProcAddress(mod, functionName); + if (addr == NULL) { + /* function not found */ + FreeLibrary(mod); + env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + out = JNI_FALSE; + } + else { + /* all ok */ + env->SetIntField(obj, fieldModuleHandle, (jint) mod); + env->SetIntField(obj, fieldFunctionHandle, (jint) addr); + } + } + +#endif + + env->ReleaseStringUTFChars(moduleNameS, moduleName); + env->ReleaseStringUTFChars(functionNameS, functionName); + + return out; + +} + +/* + * Class: com_eaio_nativecall_NativeCall + * Method: getLastError + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_eaio_nativecall_NativeCall_getLastError +(JNIEnv *env, jobject obj) { + + jint lastError = env->GetIntField(obj, fieldLastErrorCode); + + if (lastError == 0) return NULL; + + jstring out = NULL; + +#ifdef _WINDOWS + + LPVOID msgBufPtr = NULL; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, NULL, lastError, 0, + (LPSTR) &msgBufPtr, 0, NULL); + + out = env->NewStringUTF((char*) msgBufPtr); + + LocalFree(msgBufPtr); + +#endif + + return out; + +} + +/* + * Class: com_eaio_nativecall_NativeCall + * Method: destroy + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_NativeCall_destroy +(JNIEnv *env, jobject obj) { + + jint module = env->GetIntField(obj, fieldModuleHandle); + + if (module == 0) return; + +#ifdef _WINDOWS + + if (FreeLibrary((HMODULE) module) == 0) { + env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + } + +#endif + + env->SetIntField(obj, fieldModuleHandle, 0); + env->SetIntField(obj, fieldFunctionHandle, 0); + + return; + +} \ No newline at end of file diff --git a/cpp/nativecall/NativeCall.dsp b/cpp/nativecall/NativeCall.dsp new file mode 100644 index 0000000..8eb76c2 --- /dev/null +++ b/cpp/nativecall/NativeCall.dsp @@ -0,0 +1,132 @@ +# Microsoft Developer Studio Project File - Name="NativeCall" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=NativeCall - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "NativeCall.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "NativeCall.mak" CFG="NativeCall - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "NativeCall - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE "NativeCall - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "NativeCall - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVECALL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /G5 /MD /W3 /Oa /Og /Os /Oy /Ob2 /Gf /I "C:\Program Files\IBMJava13\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVECALL_EXPORTS" /D "WIN32_LEAN_AND_MEAN" /FAs /FR /YX /FD /c +# SUBTRACT CPP /Ox /Ot /Gy +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib libctiny.lib "C:\Program Files\Microsoft Visual Studio\VC98\Lib\libcmt.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\msvcrt.lib" /nologo /subsystem:console /dll /map /machine:I386 /nodefaultlib /MERGE:".rdata=.text" /OPT:REF /OPT:NOWIN98 +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "NativeCall - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVECALL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "C:\Program Files\IBMJava13\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVECALL_EXPORTS" /FAs /FR /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "NativeCall - Win32 Release" +# Name "NativeCall - Win32 Debug" +# Begin Group "Quellcodedateien" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\IntCall.cpp +# End Source File +# Begin Source File + +SOURCE=.\NativeCall.cpp +# End Source File +# Begin Source File + +SOURCE=.\version.rc +# End Source File +# Begin Source File + +SOURCE=.\VoidCall.cpp +# End Source File +# End Group +# Begin Group "Header-Dateien" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\com_eaio_nativecall_IntCall.h +# End Source File +# Begin Source File + +SOURCE=.\com_eaio_nativecall_NativeCall.h +# End Source File +# Begin Source File + +SOURCE=.\com_eaio_nativecall_VoidCall.h +# End Source File +# End Group +# Begin Group "Ressourcendateien" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/cpp/nativecall/NativeCall.dsw b/cpp/nativecall/NativeCall.dsw new file mode 100644 index 0000000..27e86f6 --- /dev/null +++ b/cpp/nativecall/NativeCall.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "NativeCall"=".\NativeCall.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/cpp/nativecall/Release/IntCall.asm b/cpp/nativecall/Release/IntCall.asm new file mode 100644 index 0000000..406ec6c --- /dev/null +++ b/cpp/nativecall/Release/IntCall.asm @@ -0,0 +1,943 @@ + TITLE C:\Documents and Settings\Administrator\My Documents\Software\NativeCall\src\cpp\IntCall.cpp + .386P +include listing.inc +if @Version gt 510 +.model FLAT +else +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT DWORD USE32 PUBLIC 'BSS' +_BSS ENDS +_TLS SEGMENT DWORD USE32 PUBLIC 'TLS' +_TLS ENDS +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +FLAT GROUP _DATA, CONST, _BSS + ASSUME CS: FLAT, DS: FLAT, SS: FLAT +endif +PUBLIC _Java_com_eaio_nativecall_IntCall_executeCall@8 +EXTRN ?fieldFunctionHandle@@3PAU_jfieldID@@A:DWORD ; fieldFunctionHandle +EXTRN ?fieldLastErrorCode@@3PAU_jfieldID@@A:DWORD ; fieldLastErrorCode +EXTRN __imp__GetLastError@0:NEAR +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_functionHandle$ = 8 +_outVal$ = -4 +_Java_com_eaio_nativecall_IntCall_executeCall@8 PROC NEAR + +; 79 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + push ecx + +; 80 : +; 81 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov eax, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push esi + mov esi, DWORD PTR _env$[ebp] + push eax + push DWORD PTR _obj$[ebp] + mov ecx, DWORD PTR [esi] + push esi + call DWORD PTR [ecx+400] + mov DWORD PTR _functionHandle$[ebp], eax + +; 82 : jint outVal; +; 83 : +; 84 : #ifdef _WINDOWS +; 85 : #ifdef _X86_ +; 86 : +; 87 : __asm { +; 88 : +; 89 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 90 : mov outVal, eax + + mov DWORD PTR _outVal$[ebp], eax + +; 91 : +; 92 : } +; 93 : +; 94 : #endif +; 95 : #endif +; 96 : +; 97 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + call DWORD PTR __imp__GetLastError@0 + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push DWORD PTR _obj$[ebp] + push esi + call DWORD PTR [ecx+436] + +; 98 : +; 99 : return outVal; + + mov eax, DWORD PTR _outVal$[ebp] + +; 100 : +; 101 : } + + pop esi + leave + ret 8 +_Java_com_eaio_nativecall_IntCall_executeCall@8 ENDP +_TEXT ENDS +PUBLIC ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' +PUBLIC _Java_com_eaio_nativecall_IntCall_executeCall0@12 +PUBLIC ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject +PUBLIC ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod +PUBLIC ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod +EXTRN ?fieldHolderO@@3PAU_jfieldID@@A:DWORD ; fieldHolderO +EXTRN ?classBoolean@@3PAV_jclass@@A:DWORD ; classBoolean +EXTRN ?classInteger@@3PAV_jclass@@A:DWORD ; classInteger +EXTRN ?classByteArray@@3PAV_jclass@@A:DWORD ; classByteArray +EXTRN ?classCharArray@@3PAV_jclass@@A:DWORD ; classCharArray +EXTRN ?classHolder@@3PAV_jclass@@A:DWORD ; classHolder +EXTRN ?methodBooleanValue@@3PAU_jmethodID@@A:DWORD ; methodBooleanValue +EXTRN ?methodIntValue@@3PAU_jmethodID@@A:DWORD ; methodIntValue +EXTRN ?newIntegerInt@@3PAU_jmethodID@@A:DWORD ; newIntegerInt +EXTRN ?newBooleanBoolean@@3PAU_jmethodID@@A:DWORD ; newBooleanBoolean +EXTRN ??2@YAPAXI@Z:NEAR ; operator new +EXTRN ??3@YAXPAX@Z:NEAR ; operator delete +EXTRN _memset:NEAR +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +; File C:\Program Files\IBMJava13\include\jni.h +_DATA SEGMENT +??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ DB 'java/lang/OutOfMemor' + DB 'yError', 00H ; `string' +_DATA ENDS +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_params$ = 16 +_len$ = -28 +_arrays$ = -20 +_param$ = -24 +_i$ = 8 +_intArg$27770 = -24 +_byteArrayArg$27773 = -4 +_charArrayArg$27779 = -8 +_tempArg$27786 = -24 +_intPtr$27791 = -24 +_byteArrayArg$27797 = -12 +_charArrayArg$27803 = -16 +_tempPtr$27810 = -24 +_functionHandle$ = 8 +_outVal$ = -32 +_j$ = 8 +_Java_com_eaio_nativecall_IntCall_executeCall0@12 PROC NEAR + +; 109 : (JNIEnv *env, jobject obj, jobjectArray params) { + + push ebp + mov ebp, esp + sub esp, 32 ; 00000020H + push ebx + push esi + +; 110 : +; 111 : const int len = env->GetArrayLength(params); + + mov esi, DWORD PTR _env$[ebp] + push edi + push DWORD PTR _params$[ebp] + mov eax, DWORD PTR [esi] + push esi + call DWORD PTR [eax+684] + mov ebx, eax + +; 112 : +; 113 : int* arrays = NULL; +; 114 : if (!(arrays = new int[len])) { + + mov edi, ebx + mov DWORD PTR _len$[ebp], ebx + shl edi, 2 + push edi + call ??2@YAPAXI@Z ; operator new + test eax, eax + pop ecx + mov DWORD PTR _arrays$[ebp], eax + jne SHORT $L27759 + +; 115 : env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), NULL); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push 0 + push eax + push esi + call DWORD PTR [ecx+56] + +; 116 : return 0; + + xor eax, eax + jmp $L27754 +$L27759: + +; 117 : } +; 118 : memset(arrays, 0, (sizeof(int) * len)); + + push edi + push 0 + push eax + call _memset + +; 119 : +; 120 : jobject param; +; 121 : +; 122 : for (int i = len - 1; i >= 0; i--) { + + lea eax, DWORD PTR [ebx-1] + add esp, 12 ; 0000000cH + test eax, eax + mov DWORD PTR _i$[ebp], eax + jl $L27766 + mov ecx, DWORD PTR _arrays$[ebp] + lea edi, DWORD PTR [ecx+eax*4] + jmp SHORT $L27764 +$L28030: + +; 117 : } +; 118 : memset(arrays, 0, (sizeof(int) * len)); + + mov eax, DWORD PTR _i$[ebp] +$L27764: + +; 123 : +; 124 : param = env->GetObjectArrayElement(params, i); + + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR _params$[ebp] + push esi + call DWORD PTR [ecx+692] + mov ebx, eax + +; 125 : +; 126 : if (param == NULL) { + + test ebx, ebx + jne SHORT $L27767 + +; 127 : _push(0); + + push 0 + +; 128 : } +; 129 : else if (env->IsInstanceOf(param, classInteger)) { + + jmp $L27765 +$L27767: + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27769 + +; 130 : int intArg = env->CallIntMethod(param, methodIntValue); + + push DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push ebx + push esi + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + add esp, 12 ; 0000000cH + mov DWORD PTR _intArg$27770[ebp], eax + +; 131 : _push(intArg) + + push DWORD PTR _intArg$27770[ebp] + +; 132 : } +; 133 : else if (env->IsInstanceOf(param, classByteArray)) { + + jmp $L27765 +$L27769: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27772 + +; 134 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) param, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _byteArrayArg$27773[ebp], eax + +; 135 : arrays[i] = (int) &byteArrayArg; + + lea eax, DWORD PTR _byteArrayArg$27773[ebp] + mov DWORD PTR [edi], eax + +; 136 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$27773[ebp] + +; 137 : } +; 138 : else if (env->IsInstanceOf(param, classCharArray)) { + + jmp $L27765 +$L27772: + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27778 + +; 139 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 140 : (jarray) param, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _charArrayArg$27779[ebp], eax + +; 141 : arrays[i] = (int) &charArrayArg; + + lea eax, DWORD PTR _charArrayArg$27779[ebp] + mov DWORD PTR [edi], eax + +; 142 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$27779[ebp] + +; 143 : } +; 144 : else if (env->IsInstanceOf(param, classBoolean)) { + + jmp $L27765 +$L27778: + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27784 + +; 145 : jboolean booleanArg = env->CallBooleanMethod(param, methodBooleanValue); + + push DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ebx + push esi + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + add esp, 12 ; 0000000cH + +; 146 : int tempArg = (booleanArg == JNI_FALSE ? 0 : 1); + + neg al + sbb eax, eax + neg eax + mov DWORD PTR _tempArg$27786[ebp], eax + +; 147 : _push(tempArg) + + push DWORD PTR _tempArg$27786[ebp] + +; 148 : } +; 149 : else if (env->IsInstanceOf(param, classHolder)) { + + jmp $L27765 +$L27784: + mov eax, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je $L27765 + +; 150 : +; 151 : /* Holder */ +; 152 : +; 153 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov eax, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+380] + +; 154 : +; 155 : if (env->IsInstanceOf(o, classInteger)) { + + mov ecx, DWORD PTR [esi] + mov ebx, eax + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27790 + +; 156 : int *intPtr = new int; + + push 4 + call ??2@YAPAXI@Z ; operator new + pop ecx + mov DWORD PTR _intPtr$27791[ebp], eax + +; 157 : *intPtr = env->CallIntMethod(o, methodIntValue); + + push DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push ebx + push esi + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + mov ecx, DWORD PTR _intPtr$27791[ebp] + add esp, 12 ; 0000000cH + +; 158 : arrays[i] = (int) intPtr; + + mov DWORD PTR [edi], ecx + mov DWORD PTR [ecx], eax + +; 159 : _push(intPtr); + + push DWORD PTR _intPtr$27791[ebp] + +; 160 : } +; 161 : else if (env->IsInstanceOf(o, classByteArray)) { + + jmp $L27765 +$L27790: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27796 + +; 162 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) o, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _byteArrayArg$27797[ebp], eax + +; 163 : arrays[i] = (int) &byteArrayArg; + + lea eax, DWORD PTR _byteArrayArg$27797[ebp] + mov DWORD PTR [edi], eax + +; 164 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$27797[ebp] + +; 165 : } +; 166 : else if (env->IsInstanceOf(o, classCharArray)) { + + jmp SHORT $L27765 +$L27796: + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27802 + +; 167 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 168 : (jarray) o, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _charArrayArg$27803[ebp], eax + +; 169 : arrays[i] = (int) &charArrayArg; + + lea eax, DWORD PTR _charArrayArg$27803[ebp] + mov DWORD PTR [edi], eax + +; 170 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$27803[ebp] + +; 171 : } +; 172 : else if (env->IsInstanceOf(o, classBoolean)) { + + jmp SHORT $L27765 +$L27802: + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27765 + +; 173 : jboolean booleanArg = env->CallBooleanMethod(o, methodBooleanValue); + + push DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ebx + push esi + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + +; 174 : int *tempPtr = new int; + + push 4 + mov bl, al + call ??2@YAPAXI@Z ; operator new + add esp, 16 ; 00000010H + +; 175 : *tempPtr = (booleanArg == JNI_FALSE ? 0 : 1); + + xor ecx, ecx + test bl, bl + setne cl + mov DWORD PTR _tempPtr$27810[ebp], eax + mov DWORD PTR [eax], ecx + +; 176 : arrays[i] = (int) tempPtr; + + mov DWORD PTR [edi], eax + +; 177 : _push(tempPtr); + + push DWORD PTR _tempPtr$27810[ebp] + +; 176 : arrays[i] = (int) tempPtr; + +$L27765: + dec DWORD PTR _i$[ebp] + sub edi, 4 + cmp DWORD PTR _i$[ebp], 0 + jge $L28030 + +; 119 : +; 120 : jobject param; +; 121 : +; 122 : for (int i = len - 1; i >= 0; i--) { + + mov ebx, DWORD PTR _len$[ebp] +$L27766: + +; 178 : } +; 179 : +; 180 : /* end Holder */ +; 181 : +; 182 : } +; 183 : +; 184 : } +; 185 : +; 186 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov eax, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR _obj$[ebp] + push esi + call DWORD PTR [ecx+400] + mov DWORD PTR _functionHandle$[ebp], eax + +; 187 : jint outVal; +; 188 : +; 189 : #ifdef _WINDOWS +; 190 : #ifdef _X86_ +; 191 : +; 192 : __asm { +; 193 : +; 194 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 195 : mov outVal, eax + + mov DWORD PTR _outVal$[ebp], eax + +; 196 : +; 197 : } +; 198 : +; 199 : #endif +; 200 : #endif +; 201 : +; 202 : for (int j = 0; j < len; ++j) { + + and DWORD PTR _j$[ebp], 0 + test ebx, ebx + jle $L27819 + +; 178 : } +; 179 : +; 180 : /* end Holder */ +; 181 : +; 182 : } +; 183 : +; 184 : } +; 185 : +; 186 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov ebx, DWORD PTR _arrays$[ebp] +$L27817: + +; 203 : param = env->GetObjectArrayElement(params, j); + + push DWORD PTR _j$[ebp] + mov eax, DWORD PTR [esi] + push DWORD PTR _params$[ebp] + push esi + call DWORD PTR [eax+692] + mov edi, eax + +; 204 : if (param == NULL) {} + + test edi, edi + mov DWORD PTR _param$[ebp], edi + je $L27818 + +; 205 : else if (env->IsInstanceOf(param, classByteArray) || env->IsInstanceOf(param, classCharArray)) { + + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne $L27835 + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne $L27835 + +; 207 : } +; 208 : else if (env->IsInstanceOf(param, classHolder)) { + + mov eax, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + je $L27818 + +; 209 : +; 210 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov eax, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+380] + +; 211 : +; 212 : if (env->IsInstanceOf(o, classInteger)) { + + mov ecx, DWORD PTR [esi] + mov edi, eax + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27829 + +; 213 : int* out = (int*) arrays[j]; + + mov edi, DWORD PTR [ebx] + +; 214 : env->SetObjectField(param, fieldHolderO, env->NewObject(classInteger, newIntegerInt, *out)); + + push DWORD PTR [edi] + push DWORD PTR ?newIntegerInt@@3PAU_jmethodID@@A ; newIntegerInt + push DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger +$L28033: + push esi + call ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject + add esp, 16 ; 00000010H + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push DWORD PTR _param$[ebp] + push esi + call DWORD PTR [ecx+416] + +; 215 : delete out; + + push edi + call ??3@YAXPAX@Z ; operator delete + pop ecx + +; 216 : } +; 217 : else if (env->IsInstanceOf(o, classByteArray) || env->IsInstanceOf(o, classCharArray)) { + + jmp SHORT $L27818 +$L27829: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne SHORT $L27835 + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne SHORT $L27835 + +; 218 : env->ReleasePrimitiveArrayCritical((jarray) o, (void*) arrays[j], 0); +; 219 : } +; 220 : else if (env->IsInstanceOf(o, classBoolean)) { + + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27818 + +; 221 : int* out = (int*) arrays[j]; + + mov edi, DWORD PTR [ebx] + +; 222 : env->SetObjectField(param, fieldHolderO, env->NewObject(classBoolean, newBooleanBoolean, (*out == 0 ? JNI_FALSE : JNI_TRUE))); + + xor eax, eax + cmp DWORD PTR [edi], eax + setne al + push eax + push DWORD PTR ?newBooleanBoolean@@3PAU_jmethodID@@A ; newBooleanBoolean + push DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + +; 223 : delete out; + + jmp SHORT $L28033 +$L27835: + +; 206 : env->ReleasePrimitiveArrayCritical((jarray) param, (void*) arrays[j], 0); + + mov eax, DWORD PTR [esi] + push 0 + push DWORD PTR [ebx] + push edi + push esi + call DWORD PTR [eax+892] +$L27818: + inc DWORD PTR _j$[ebp] + mov eax, DWORD PTR _j$[ebp] + add ebx, 4 + cmp eax, DWORD PTR _len$[ebp] + jl $L27817 +$L27819: + +; 224 : } +; 225 : +; 226 : } +; 227 : +; 228 : } +; 229 : +; 230 : delete [] arrays; + + push DWORD PTR _arrays$[ebp] + call ??3@YAXPAX@Z ; operator delete + pop ecx + +; 231 : +; 232 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + call DWORD PTR __imp__GetLastError@0 + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push DWORD PTR _obj$[ebp] + push esi + call DWORD PTR [ecx+436] + +; 233 : +; 234 : return outVal; + + mov eax, DWORD PTR _outVal$[ebp] +$L27754: + +; 235 : +; 236 : } + + pop edi + pop esi + pop ebx + leave + ret 12 ; 0000000cH +_Java_com_eaio_nativecall_IntCall_executeCall0@12 ENDP +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_clazz$ = 12 +_methodID$ = 16 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::NewObject, COMDAT + +; 835 : va_list args; +; 836 : jobject result; +; 837 : va_start(args, methodID); +; 838 : result = functions->NewObjectV(this,clazz,methodID,args); + + mov eax, DWORD PTR _this$[esp-4] + lea edx, DWORD PTR _methodID$[esp] + push edx + push DWORD PTR _methodID$[esp] + mov ecx, DWORD PTR [eax] + push DWORD PTR _clazz$[esp+4] + push eax + call DWORD PTR [ecx+116] + +; 839 : va_end(args); +; 840 : return result; +; 841 : } + + ret 0 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::NewObject +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_obj$ = 12 +_methodID$ = 16 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallBooleanMethod, COMDAT + +; 882 : va_list args; +; 883 : jboolean result; +; 884 : va_start(args,methodID); +; 885 : result = functions->CallBooleanMethodV(this,obj,methodID,args); + + mov eax, DWORD PTR _this$[esp-4] + lea edx, DWORD PTR _methodID$[esp] + push edx + push DWORD PTR _methodID$[esp] + mov ecx, DWORD PTR [eax] + push DWORD PTR _obj$[esp+4] + push eax + call DWORD PTR [ecx+152] + +; 886 : va_end(args); +; 887 : return result; +; 888 : } + + ret 0 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallBooleanMethod +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_obj$ = 12 +_methodID$ = 16 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallIntMethod, COMDAT + +; 950 : va_list args; +; 951 : jint result; +; 952 : va_start(args,methodID); +; 953 : result = functions->CallIntMethodV(this,obj,methodID,args); + + mov eax, DWORD PTR _this$[esp-4] + lea edx, DWORD PTR _methodID$[esp] + push edx + push DWORD PTR _methodID$[esp] + mov ecx, DWORD PTR [eax] + push DWORD PTR _obj$[esp+4] + push eax + call DWORD PTR [ecx+200] + +; 954 : va_end(args); +; 955 : return result; +; 956 : } + + ret 0 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallIntMethod +_TEXT ENDS +END diff --git a/cpp/nativecall/Release/IntCall.obj b/cpp/nativecall/Release/IntCall.obj new file mode 100644 index 0000000..4459fd4 Binary files /dev/null and b/cpp/nativecall/Release/IntCall.obj differ diff --git a/cpp/nativecall/Release/NativeCall.asm b/cpp/nativecall/Release/NativeCall.asm new file mode 100644 index 0000000..f2ee074 --- /dev/null +++ b/cpp/nativecall/Release/NativeCall.asm @@ -0,0 +1,859 @@ + TITLE C:\Documents and Settings\Administrator\My Documents\Software\NativeCall\src\cpp\NativeCall.cpp + .386P +include listing.inc +if @Version gt 510 +.model FLAT +else +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT DWORD USE32 PUBLIC 'BSS' +_BSS ENDS +_TLS SEGMENT DWORD USE32 PUBLIC 'TLS' +_TLS ENDS +; COMDAT ??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_08JJOG@function?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_06CODG@module?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_01FLOP@I?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0P@LKIL@functionHandle?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0N@EFAA@moduleHandle?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0O@OMHL@lastErrorCode?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_01PGHN@o?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0BB@LLFN@java?1lang?1String?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_02LOEJ@?$FLB?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_02BENO@?$FLC?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_03KJOK@?$CI?$CJZ?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_0N@KEBP@booleanValue?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_03PPCD@?$CI?$CJI?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_08JCMA@intValue?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_04ECLF@?$CII?$CJV?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_06KILP@?$DMinit?$DO?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ??_C@_04JFOE@?$CIZ?$CJV?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewGlobalRef@JNIEnv_@@QAEPAV_jobject@@PAV2@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetMethodID@JNIEnv_@@QAEPAU_jmethodID@@PAV_jclass@@PBD1@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetFieldID@JNIEnv_@@QAEPAU_jfieldID@@PAV_jclass@@PBD1@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewStringUTF@JNIEnv_@@QAEPAV_jstring@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetStringUTFChars@JNIEnv_@@QAEPBDPAV_jstring@@PAE@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ReleaseStringUTFChars@JNIEnv_@@QAEXPAV_jstring@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +FLAT GROUP _DATA, CONST, _BSS + ASSUME CS: FLAT, DS: FLAT, SS: FLAT +endif +PUBLIC ?fieldFunction@@3PAU_jfieldID@@A ; fieldFunction +PUBLIC ?fieldModule@@3PAU_jfieldID@@A ; fieldModule +PUBLIC ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle +PUBLIC ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle +PUBLIC ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode +PUBLIC ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO +PUBLIC ?classBoolean@@3PAV_jclass@@A ; classBoolean +PUBLIC ?classInteger@@3PAV_jclass@@A ; classInteger +PUBLIC ?classString@@3PAV_jclass@@A ; classString +PUBLIC ?classByteArray@@3PAV_jclass@@A ; classByteArray +PUBLIC ?classCharArray@@3PAV_jclass@@A ; classCharArray +PUBLIC ?classHolder@@3PAV_jclass@@A ; classHolder +PUBLIC ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue +PUBLIC ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue +PUBLIC ?newIntegerInt@@3PAU_jmethodID@@A ; newIntegerInt +PUBLIC ?newBooleanBoolean@@3PAU_jmethodID@@A ; newBooleanBoolean +_BSS SEGMENT +?fieldFunction@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldFunction +?fieldModule@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldModule +?fieldFunctionHandle@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldFunctionHandle +?fieldModuleHandle@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldModuleHandle +?fieldLastErrorCode@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldLastErrorCode +?fieldHolderO@@3PAU_jfieldID@@A DD 01H DUP (?) ; fieldHolderO +?classBoolean@@3PAV_jclass@@A DD 01H DUP (?) ; classBoolean +?classInteger@@3PAV_jclass@@A DD 01H DUP (?) ; classInteger +?classString@@3PAV_jclass@@A DD 01H DUP (?) ; classString +?classByteArray@@3PAV_jclass@@A DD 01H DUP (?) ; classByteArray +?classCharArray@@3PAV_jclass@@A DD 01H DUP (?) ; classCharArray +?classHolder@@3PAV_jclass@@A DD 01H DUP (?) ; classHolder +?methodBooleanValue@@3PAU_jmethodID@@A DD 01H DUP (?) ; methodBooleanValue +?methodIntValue@@3PAU_jmethodID@@A DD 01H DUP (?) ; methodIntValue +?newIntegerInt@@3PAU_jmethodID@@A DD 01H DUP (?) ; newIntegerInt +?newBooleanBoolean@@3PAU_jmethodID@@A DD 01H DUP (?) ; newBooleanBoolean +_BSS ENDS +PUBLIC ??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ ; `string' +PUBLIC ??_C@_08JJOG@function?$AA@ ; `string' +PUBLIC ??_C@_06CODG@module?$AA@ ; `string' +PUBLIC ??_C@_01FLOP@I?$AA@ ; `string' +PUBLIC ??_C@_0P@LKIL@functionHandle?$AA@ ; `string' +PUBLIC ??_C@_0N@EFAA@moduleHandle?$AA@ ; `string' +PUBLIC ??_C@_0O@OMHL@lastErrorCode?$AA@ ; `string' +PUBLIC ??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ ; `string' +PUBLIC ??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ ; `string' +PUBLIC ??_C@_01PGHN@o?$AA@ ; `string' +PUBLIC ??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ ; `string' +PUBLIC ??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ ; `string' +PUBLIC ??_C@_0BB@LLFN@java?1lang?1String?$AA@ ; `string' +PUBLIC ??_C@_02LOEJ@?$FLB?$AA@ ; `string' +PUBLIC ??_C@_02BENO@?$FLC?$AA@ ; `string' +PUBLIC ??_C@_03KJOK@?$CI?$CJZ?$AA@ ; `string' +PUBLIC ??_C@_0N@KEBP@booleanValue?$AA@ ; `string' +PUBLIC ??_C@_03PPCD@?$CI?$CJI?$AA@ ; `string' +PUBLIC ??_C@_08JCMA@intValue?$AA@ ; `string' +PUBLIC ??_C@_04ECLF@?$CII?$CJV?$AA@ ; `string' +PUBLIC ??_C@_06KILP@?$DMinit?$DO?$AA@ ; `string' +PUBLIC ??_C@_04JFOE@?$CIZ?$CJV?$AA@ ; `string' +PUBLIC _Java_com_eaio_nativecall_NativeCall_initIDs@8 +; COMDAT ??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ +; File C:\Program Files\IBMJava13\include\jni.h +_DATA SEGMENT +??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ DB 'Ljava/lang/String;', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_08JJOG@function?$AA@ +_DATA SEGMENT +??_C@_08JJOG@function?$AA@ DB 'function', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_06CODG@module?$AA@ +_DATA SEGMENT +??_C@_06CODG@module?$AA@ DB 'module', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_01FLOP@I?$AA@ +_DATA SEGMENT +??_C@_01FLOP@I?$AA@ DB 'I', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0P@LKIL@functionHandle?$AA@ +_DATA SEGMENT +??_C@_0P@LKIL@functionHandle?$AA@ DB 'functionHandle', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0N@EFAA@moduleHandle?$AA@ +_DATA SEGMENT +??_C@_0N@EFAA@moduleHandle?$AA@ DB 'moduleHandle', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0O@OMHL@lastErrorCode?$AA@ +_DATA SEGMENT +??_C@_0O@OMHL@lastErrorCode?$AA@ DB 'lastErrorCode', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ +_DATA SEGMENT +??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ DB 'com/eaio/nativecall' + DB '/Holder', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ +_DATA SEGMENT +??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ DB 'Ljava/lang/Object;', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_01PGHN@o?$AA@ +_DATA SEGMENT +??_C@_01PGHN@o?$AA@ DB 'o', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ +_DATA SEGMENT +??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ DB 'java/lang/Boolean', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ +_DATA SEGMENT +??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ DB 'java/lang/Integer', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0BB@LLFN@java?1lang?1String?$AA@ +_DATA SEGMENT +??_C@_0BB@LLFN@java?1lang?1String?$AA@ DB 'java/lang/String', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_02LOEJ@?$FLB?$AA@ +_DATA SEGMENT +??_C@_02LOEJ@?$FLB?$AA@ DB '[B', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_02BENO@?$FLC?$AA@ +_DATA SEGMENT +??_C@_02BENO@?$FLC?$AA@ DB '[C', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_03KJOK@?$CI?$CJZ?$AA@ +_DATA SEGMENT +??_C@_03KJOK@?$CI?$CJZ?$AA@ DB '()Z', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_0N@KEBP@booleanValue?$AA@ +_DATA SEGMENT +??_C@_0N@KEBP@booleanValue?$AA@ DB 'booleanValue', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_03PPCD@?$CI?$CJI?$AA@ +_DATA SEGMENT +??_C@_03PPCD@?$CI?$CJI?$AA@ DB '()I', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_08JCMA@intValue?$AA@ +_DATA SEGMENT +??_C@_08JCMA@intValue?$AA@ DB 'intValue', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_04ECLF@?$CII?$CJV?$AA@ +_DATA SEGMENT +??_C@_04ECLF@?$CII?$CJV?$AA@ DB '(I)V', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_06KILP@?$DMinit?$DO?$AA@ +_DATA SEGMENT +??_C@_06KILP@?$DMinit?$DO?$AA@ DB '', 00H ; `string' +_DATA ENDS +; COMDAT ??_C@_04JFOE@?$CIZ?$CJV?$AA@ +_DATA SEGMENT +??_C@_04JFOE@?$CIZ?$CJV?$AA@ DB '(Z)V', 00H ; `string' +_DATA ENDS +_TEXT SEGMENT +_env$ = 8 +_cls$ = 12 +_Java_com_eaio_nativecall_NativeCall_initIDs@8 PROC NEAR + +; 71 : (JNIEnv *env, jclass cls) { + + push ebx + +; 72 : +; 73 : // NativeCall fields +; 74 : +; 75 : fieldFunction = env->GetFieldID(cls, "function", "Ljava/lang/String;"); + + mov ebx, DWORD PTR _cls$[esp] + push esi + mov esi, DWORD PTR _env$[esp+4] + push edi + mov edi, OFFSET FLAT:??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ ; `string' + mov eax, DWORD PTR [esi] + push edi + push OFFSET FLAT:??_C@_08JJOG@function?$AA@ ; `string' + push ebx + push esi + call DWORD PTR [eax+376] + +; 76 : fieldModule = env->GetFieldID(cls, "module", "Ljava/lang/String;"); + + push edi + mov DWORD PTR ?fieldFunction@@3PAU_jfieldID@@A, eax ; fieldFunction + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_06CODG@module?$AA@ ; `string' + push ebx + push esi + call DWORD PTR [eax+376] + +; 77 : +; 78 : fieldFunctionHandle = env->GetFieldID(cls, "functionHandle", "I"); + + mov edi, OFFSET FLAT:??_C@_01FLOP@I?$AA@ ; `string' + mov DWORD PTR ?fieldModule@@3PAU_jfieldID@@A, eax ; fieldModule + mov eax, DWORD PTR [esi] + push edi + push OFFSET FLAT:??_C@_0P@LKIL@functionHandle?$AA@ ; `string' + push ebx + push esi + call DWORD PTR [eax+376] + +; 79 : fieldModuleHandle = env-> GetFieldID(cls, "moduleHandle", "I"); + + push edi + mov DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A, eax ; fieldFunctionHandle + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0N@EFAA@moduleHandle?$AA@ ; `string' + push ebx + push esi + call DWORD PTR [eax+376] + +; 80 : +; 81 : fieldLastErrorCode = env->GetFieldID(cls, "lastErrorCode", "I"); + + push edi + mov DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A, eax ; fieldModuleHandle + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0O@OMHL@lastErrorCode?$AA@ ; `string' + push ebx + push esi + call DWORD PTR [eax+376] + mov DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A, eax ; fieldLastErrorCode + +; 82 : +; 83 : // Holder fields +; 84 : +; 85 : classHolder = (jclass) env->NewGlobalRef(env->FindClass("com/eaio/nativecall/Holder")); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push eax + push esi + call DWORD PTR [ecx+84] + +; 86 : fieldHolderO = env->GetFieldID(classHolder, "o", "Ljava/lang/Object;"); + + mov ecx, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ ; `string' + push OFFSET FLAT:??_C@_01PGHN@o?$AA@ ; `string' + push eax + push esi + mov DWORD PTR ?classHolder@@3PAV_jclass@@A, eax ; classHolder + call DWORD PTR [ecx+376] + mov DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A, eax ; fieldHolderO + +; 87 : +; 88 : // Other classes +; 89 : +; 90 : classBoolean = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Boolean")); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push eax + push esi + call DWORD PTR [ecx+84] + mov DWORD PTR ?classBoolean@@3PAV_jclass@@A, eax ; classBoolean + +; 91 : /*classByte = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Byte")); +; 92 : classCharacter = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Character")); +; 93 : classShort = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Short"));*/ +; 94 : classInteger = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Integer")); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push eax + push esi + call DWORD PTR [ecx+84] + mov DWORD PTR ?classInteger@@3PAV_jclass@@A, eax ; classInteger + +; 95 : /*classLong = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Long")); +; 96 : classFloat = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Float")); +; 97 : classDouble = (jclass) env->NewGlobalRef(env->FindClass("java/lang/Double"));*/ +; 98 : classString = (jclass) env->NewGlobalRef(env->FindClass("java/lang/String")); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0BB@LLFN@java?1lang?1String?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push eax + push esi + call DWORD PTR [ecx+84] + mov DWORD PTR ?classString@@3PAV_jclass@@A, eax ; classString + +; 99 : classByteArray = (jclass) env->NewGlobalRef(env->FindClass("[B")); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_02LOEJ@?$FLB?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push eax + push esi + call DWORD PTR [ecx+84] + mov DWORD PTR ?classByteArray@@3PAV_jclass@@A, eax ; classByteArray + +; 100 : classCharArray = (jclass) env->NewGlobalRef(env->FindClass("[C")); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_02BENO@?$FLC?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push eax + push esi + call DWORD PTR [ecx+84] + +; 101 : /*classIntArray = (jclass) env->NewGlobalRef(env->FindClass("[I"));*/ +; 102 : +; 103 : // Wrapper class methods +; 104 : +; 105 : methodBooleanValue = env->GetMethodID(classBoolean, +; 106 : "booleanValue", "()Z"); + + mov ecx, DWORD PTR [esi] + mov DWORD PTR ?classCharArray@@3PAV_jclass@@A, eax ; classCharArray + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push OFFSET FLAT:??_C@_03KJOK@?$CI?$CJZ?$AA@ ; `string' + push OFFSET FLAT:??_C@_0N@KEBP@booleanValue?$AA@ ; `string' + push eax + push esi + call DWORD PTR [ecx+132] + +; 107 : /*methodByteValue = env->GetMethodID(classByte, +; 108 : "byteValue", "()B"); +; 109 : methodCharValue = env->GetMethodID(classCharacter, +; 110 : "charValue", "()C"); +; 111 : methodShortValue = env->GetMethodID(classShort, +; 112 : "shortValue", "()S");*/ +; 113 : methodIntValue = env->GetMethodID(classInteger, +; 114 : "intValue", "()I"); + + mov ecx, DWORD PTR [esi] + mov DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A, eax ; methodBooleanValue + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push OFFSET FLAT:??_C@_03PPCD@?$CI?$CJI?$AA@ ; `string' + push OFFSET FLAT:??_C@_08JCMA@intValue?$AA@ ; `string' + push eax + push esi + call DWORD PTR [ecx+132] + +; 115 : /*methodLongValue = env->GetMethodID(classLong, +; 116 : "longValue", "()J"); +; 117 : methodFloatValue = env->GetMethodID(classFloat, +; 118 : "floatValue", "()F"); +; 119 : methodDoubleValue = env->GetMethodID(classDouble, +; 120 : "doubleValue", "()D");*/ +; 121 : +; 122 : // Constructors +; 123 : +; 124 : newIntegerInt = env->GetMethodID(classInteger, "", "(I)V"); + + mov ecx, DWORD PTR [esi] + mov DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A, eax ; methodIntValue + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + mov edi, OFFSET FLAT:??_C@_06KILP@?$DMinit?$DO?$AA@ ; `string' + push OFFSET FLAT:??_C@_04ECLF@?$CII?$CJV?$AA@ ; `string' + push edi + push eax + push esi + call DWORD PTR [ecx+132] + +; 125 : newBooleanBoolean = env->GetMethodID(classBoolean, "", "(Z)V"); + + mov ecx, DWORD PTR [esi] + mov DWORD PTR ?newIntegerInt@@3PAU_jmethodID@@A, eax ; newIntegerInt + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + push OFFSET FLAT:??_C@_04JFOE@?$CIZ?$CJV?$AA@ ; `string' + push edi + push eax + push esi + call DWORD PTR [ecx+132] + pop edi + pop esi + mov DWORD PTR ?newBooleanBoolean@@3PAU_jmethodID@@A, eax ; newBooleanBoolean + pop ebx + +; 126 : +; 127 : } + + ret 8 +_Java_com_eaio_nativecall_NativeCall_initIDs@8 ENDP +_TEXT ENDS +PUBLIC _Java_com_eaio_nativecall_NativeCall_initHandles@8 +EXTRN __imp__LoadLibraryA@4:NEAR +EXTRN __imp__GetLastError@0:NEAR +EXTRN __imp__FreeLibrary@4:NEAR +EXTRN __imp__GetProcAddress@8:NEAR +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_out$ = -1 +_moduleNameS$ = 12 +_functionNameS$ = -12 +_moduleName$ = 8 +_functionName$ = -8 +_addr$27794 = -16 +_Java_com_eaio_nativecall_NativeCall_initHandles@8 PROC NEAR + +; 135 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + sub esp, 16 ; 00000010H + +; 136 : +; 137 : bool out = JNI_TRUE; +; 138 : +; 139 : jstring moduleNameS = (jstring) env->GetObjectField(obj, fieldModule); + + mov eax, DWORD PTR ?fieldModule@@3PAU_jfieldID@@A ; fieldModule + push ebx + push esi + mov esi, DWORD PTR _env$[ebp] + push edi + mov edi, DWORD PTR _obj$[ebp] + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + mov BYTE PTR _out$[ebp], 1 + call DWORD PTR [ecx+380] + +; 140 : jstring functionNameS = (jstring) env->GetObjectField(obj, fieldFunction); + + mov ecx, DWORD PTR [esi] + mov DWORD PTR _moduleNameS$[ebp], eax + mov eax, DWORD PTR ?fieldFunction@@3PAU_jfieldID@@A ; fieldFunction + push eax + push edi + push esi + call DWORD PTR [ecx+380] + +; 141 : +; 142 : const char* moduleName = env->GetStringUTFChars(moduleNameS, 0); + + push 0 + mov DWORD PTR _functionNameS$[ebp], eax + push DWORD PTR _moduleNameS$[ebp] + mov eax, DWORD PTR [esi] + push esi + call DWORD PTR [eax+676] + +; 143 : const char* functionName = env->GetStringUTFChars(functionNameS, 0); + + push 0 + mov DWORD PTR _moduleName$[ebp], eax + push DWORD PTR _functionNameS$[ebp] + mov eax, DWORD PTR [esi] + push esi + call DWORD PTR [eax+676] + +; 144 : +; 145 : #ifdef _WINDOWS +; 146 : +; 147 : HMODULE mod = LoadLibrary(moduleName); + + push DWORD PTR _moduleName$[ebp] + mov DWORD PTR _functionName$[ebp], eax + call DWORD PTR __imp__LoadLibraryA@4 + mov ebx, eax + +; 148 : +; 149 : if (mod == NULL) { + + test ebx, ebx + jne SHORT $L27792 +$L27990: + +; 150 : /* no such module or DllMain returned FALSE */ +; 151 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + call DWORD PTR __imp__GetLastError@0 + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push edi + push esi + call DWORD PTR [ecx+436] + +; 152 : out = JNI_FALSE; + + and BYTE PTR _out$[ebp], 0 + +; 153 : } +; 154 : else { + + jmp SHORT $L27982 +$L27792: + +; 155 : FARPROC addr = GetProcAddress(mod, functionName); + + push DWORD PTR _functionName$[ebp] + push ebx + call DWORD PTR __imp__GetProcAddress@8 + +; 156 : if (addr == NULL) { + + test eax, eax + mov DWORD PTR _addr$27794[ebp], eax + jne SHORT $L27795 + +; 157 : /* function not found */ +; 158 : FreeLibrary(mod); + + push ebx + call DWORD PTR __imp__FreeLibrary@4 + +; 159 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); +; 160 : out = JNI_FALSE; +; 161 : } +; 162 : else { + + jmp SHORT $L27990 +$L27795: + +; 163 : /* all ok */ +; 164 : env->SetIntField(obj, fieldModuleHandle, (jint) mod); + + mov eax, DWORD PTR [esi] + push ebx + push DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle + push edi + push esi + call DWORD PTR [eax+436] + +; 165 : env->SetIntField(obj, fieldFunctionHandle, (jint) addr); + + push DWORD PTR _addr$27794[ebp] + mov eax, DWORD PTR [esi] + push DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push edi + push esi + call DWORD PTR [eax+436] +$L27982: + +; 166 : } +; 167 : } +; 168 : +; 169 : #endif +; 170 : +; 171 : env->ReleaseStringUTFChars(moduleNameS, moduleName); + + push DWORD PTR _moduleName$[ebp] + mov eax, DWORD PTR [esi] + push DWORD PTR _moduleNameS$[ebp] + push esi + call DWORD PTR [eax+680] + +; 172 : env->ReleaseStringUTFChars(functionNameS, functionName); + + push DWORD PTR _functionName$[ebp] + mov eax, DWORD PTR [esi] + push DWORD PTR _functionNameS$[ebp] + push esi + call DWORD PTR [eax+680] + +; 173 : +; 174 : return out; + + mov al, BYTE PTR _out$[ebp] + pop edi + pop esi + pop ebx + +; 175 : +; 176 : } + + leave + ret 8 +_Java_com_eaio_nativecall_NativeCall_initHandles@8 ENDP +_TEXT ENDS +PUBLIC _Java_com_eaio_nativecall_NativeCall_getLastError@8 +EXTRN __imp__FormatMessageA@28:NEAR +EXTRN __imp__LocalFree@4:NEAR +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_msgBufPtr$ = 8 +_Java_com_eaio_nativecall_NativeCall_getLastError@8 PROC NEAR + +; 184 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + +; 185 : +; 186 : jint lastError = env->GetIntField(obj, fieldLastErrorCode); + + mov eax, DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push esi + mov esi, DWORD PTR _env$[ebp] + push eax + push DWORD PTR _obj$[ebp] + mov ecx, DWORD PTR [esi] + push esi + call DWORD PTR [ecx+400] + +; 187 : +; 188 : if (lastError == 0) return NULL; + + xor ecx, ecx + cmp eax, ecx + jne SHORT $L27804 + xor eax, eax + jmp SHORT $L27802 +$L27804: + +; 189 : +; 190 : jstring out = NULL; +; 191 : +; 192 : #ifdef _WINDOWS +; 193 : +; 194 : LPVOID msgBufPtr = NULL; +; 195 : FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | +; 196 : FORMAT_MESSAGE_FROM_SYSTEM, NULL, lastError, 0, +; 197 : (LPSTR) &msgBufPtr, 0, NULL); + + push ecx + lea edx, DWORD PTR _msgBufPtr$[ebp] + push ecx + push edx + push ecx + push eax + push ecx + push 4352 ; 00001100H + mov DWORD PTR _msgBufPtr$[ebp], ecx + call DWORD PTR __imp__FormatMessageA@28 + +; 198 : +; 199 : out = env->NewStringUTF((char*) msgBufPtr); + + push DWORD PTR _msgBufPtr$[ebp] + mov eax, DWORD PTR [esi] + push esi + call DWORD PTR [eax+668] + +; 200 : +; 201 : LocalFree(msgBufPtr); + + push DWORD PTR _msgBufPtr$[ebp] + mov esi, eax + call DWORD PTR __imp__LocalFree@4 + +; 202 : +; 203 : #endif +; 204 : +; 205 : return out; + + mov eax, esi +$L27802: + pop esi + +; 206 : +; 207 : } + + pop ebp + ret 8 +_Java_com_eaio_nativecall_NativeCall_getLastError@8 ENDP +_TEXT ENDS +PUBLIC _Java_com_eaio_nativecall_NativeCall_destroy@8 +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_Java_com_eaio_nativecall_NativeCall_destroy@8 PROC NEAR + +; 216 : +; 217 : jint module = env->GetIntField(obj, fieldModuleHandle); + + mov eax, DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle + push esi + mov esi, DWORD PTR _env$[esp] + push edi + mov edi, DWORD PTR _obj$[esp+4] + push eax + mov ecx, DWORD PTR [esi] + push edi + push esi + call DWORD PTR [ecx+400] + +; 218 : +; 219 : if (module == 0) return; + + test eax, eax + je SHORT $L28016 + +; 220 : +; 221 : #ifdef _WINDOWS +; 222 : +; 223 : if (FreeLibrary((HMODULE) module) == 0) { + + push eax + call DWORD PTR __imp__FreeLibrary@4 + test eax, eax + jne SHORT $L28007 + +; 224 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + call DWORD PTR __imp__GetLastError@0 + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push edi + push esi + call DWORD PTR [ecx+436] +$L28007: + +; 225 : } +; 226 : +; 227 : #endif +; 228 : +; 229 : env->SetIntField(obj, fieldModuleHandle, 0); + + mov eax, DWORD PTR [esi] + push 0 + push DWORD PTR ?fieldModuleHandle@@3PAU_jfieldID@@A ; fieldModuleHandle + push edi + push esi + call DWORD PTR [eax+436] + +; 230 : env->SetIntField(obj, fieldFunctionHandle, 0); + + mov eax, DWORD PTR [esi] + push 0 + push DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push edi + push esi + call DWORD PTR [eax+436] +$L28016: + pop edi + pop esi + +; 231 : +; 232 : return; +; 233 : +; 234 : } + + ret 8 +_Java_com_eaio_nativecall_NativeCall_destroy@8 ENDP +_TEXT ENDS +END diff --git a/cpp/nativecall/Release/NativeCall.dll b/cpp/nativecall/Release/NativeCall.dll new file mode 100644 index 0000000..6e2cad1 Binary files /dev/null and b/cpp/nativecall/Release/NativeCall.dll differ diff --git a/cpp/nativecall/Release/NativeCall.map b/cpp/nativecall/Release/NativeCall.map new file mode 100644 index 0000000..89e7bae --- /dev/null +++ b/cpp/nativecall/Release/NativeCall.map @@ -0,0 +1,101 @@ + NativeCall + + Timestamp is 44472064 (Thu Apr 20 07:47:16 2006) + + Preferred load address is 10000000 + + Start Length Name Class + 0001:00000000 00000028H .idata$5 CODE + 0001:00000030 00000d1eH .text CODE + 0001:00000d50 00000014H .idata$2 CODE + 0001:00000d64 00000014H .idata$3 CODE + 0001:00000d78 00000028H .idata$4 CODE + 0001:00000da0 00000096H .idata$6 CODE + 0001:00000e40 00000212H .edata CODE + 0002:00000000 00000004H .CRT$XCA DATA + 0002:00000004 00000004H .CRT$XCZ DATA + 0002:00000010 00000130H .data DATA + 0002:00000140 0000004cH .bss DATA + 0003:00000000 00000058H .rsrc$01 DATA + 0003:00000060 000002b0H .rsrc$02 DATA + + Address Publics by Value Rva+Base Lib:Object + + 0001:00000000 __imp__FormatMessageA@28 10001000 kernel32:KERNEL32.dll + 0001:00000004 __imp__FreeLibrary@4 10001004 kernel32:KERNEL32.dll + 0001:00000008 __imp__GetProcAddress@8 10001008 kernel32:KERNEL32.dll + 0001:0000000c __imp__LoadLibraryA@4 1000100c kernel32:KERNEL32.dll + 0001:00000010 __imp__LocalFree@4 10001010 kernel32:KERNEL32.dll + 0001:00000014 __imp__GetLastError@0 10001014 kernel32:KERNEL32.dll + 0001:00000018 __imp__HeapAlloc@12 10001018 kernel32:KERNEL32.dll + 0001:0000001c __imp__GetProcessHeap@0 1000101c kernel32:KERNEL32.dll + 0001:00000020 __imp__HeapFree@12 10001020 kernel32:KERNEL32.dll + 0001:00000024 \177KERNEL32_NULL_THUNK_DATA 10001024 kernel32:KERNEL32.dll + 0001:00000030 _Java_com_eaio_nativecall_IntCall_executeCall@8 10001030 f IntCall.obj + 0001:00000074 _Java_com_eaio_nativecall_IntCall_executeCall0@12 10001074 f IntCall.obj + 0001:0000045e ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ 1000145e f i IntCall.obj + 0001:00000476 ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ 10001476 f i IntCall.obj + 0001:00000491 ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ 10001491 f i IntCall.obj + 0001:000004ac _Java_com_eaio_nativecall_NativeCall_initIDs@8 100014ac f NativeCall.obj + 0001:00000648 _Java_com_eaio_nativecall_NativeCall_initHandles@8 10001648 f NativeCall.obj + 0001:00000735 _Java_com_eaio_nativecall_NativeCall_getLastError@8 10001735 f NativeCall.obj + 0001:0000078d _Java_com_eaio_nativecall_NativeCall_destroy@8 1000178d f NativeCall.obj + 0001:000007f6 _Java_com_eaio_nativecall_VoidCall_executeCall@8 100017f6 f VoidCall.obj + 0001:00000833 _Java_com_eaio_nativecall_VoidCall_executeCall0@12 10001833 f VoidCall.obj + 0001:00000c15 ??2@YAPAXI@Z 10001c15 f libctiny:NEWDEL.OBJ + 0001:00000c29 ??3@YAXPAX@Z 10001c29 f libctiny:NEWDEL.OBJ + 0001:00000c3d __DllMainCRTStartup@12 10001c3d f libctiny:DLLCRT0.OBJ + 0001:00000c7f ?_initterm@@YAXPAP6AXXZ0@Z 10001c7f f libctiny:INITTERM.OBJ + 0001:00000c99 ?_atexit_init@@YAXXZ 10001c99 f libctiny:INITTERM.OBJ + 0001:00000cb1 ?_DoExit@@YAXXZ 10001cb1 f libctiny:INITTERM.OBJ + 0001:00000ccd _calloc 10001ccd f libctiny:ALLOC2.OBJ + 0001:00000cf0 _memset 10001cf0 f libcmt:memset.obj + 0001:00000d48 _DllMain@12 10001d48 f libcmt:dllmain.obj + 0001:00000d50 __IMPORT_DESCRIPTOR_KERNEL32 10001d50 kernel32:KERNEL32.dll + 0001:00000d64 __NULL_IMPORT_DESCRIPTOR 10001d64 kernel32:KERNEL32.dll + 0002:00000000 ?__xc_a@@3PAP6AXXZA 10003000 libctiny:INITTERM.OBJ + 0002:00000004 ?__xc_z@@3PAP6AXXZA 10003004 libctiny:INITTERM.OBJ + 0002:00000010 ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ 10003010 IntCall.obj + 0002:0000002c ??_C@_04JFOE@?$CIZ?$CJV?$AA@ 1000302c NativeCall.obj + 0002:00000034 ??_C@_04ECLF@?$CII?$CJV?$AA@ 10003034 NativeCall.obj + 0002:0000003c ??_C@_06KILP@?$DMinit?$DO?$AA@ 1000303c NativeCall.obj + 0002:00000044 ??_C@_08JCMA@intValue?$AA@ 10003044 NativeCall.obj + 0002:00000050 ??_C@_03PPCD@?$CI?$CJI?$AA@ 10003050 NativeCall.obj + 0002:00000054 ??_C@_0N@KEBP@booleanValue?$AA@ 10003054 NativeCall.obj + 0002:00000064 ??_C@_03KJOK@?$CI?$CJZ?$AA@ 10003064 NativeCall.obj + 0002:00000068 ??_C@_02BENO@?$FLC?$AA@ 10003068 NativeCall.obj + 0002:0000006c ??_C@_02LOEJ@?$FLB?$AA@ 1000306c NativeCall.obj + 0002:00000070 ??_C@_0BB@LLFN@java?1lang?1String?$AA@ 10003070 NativeCall.obj + 0002:00000084 ??_C@_0BC@FBKL@java?1lang?1Integer?$AA@ 10003084 NativeCall.obj + 0002:00000098 ??_C@_0BC@IGNJ@java?1lang?1Boolean?$AA@ 10003098 NativeCall.obj + 0002:000000ac ??_C@_01PGHN@o?$AA@ 100030ac NativeCall.obj + 0002:000000b0 ??_C@_0BD@GEDI@Ljava?1lang?1Object?$DL?$AA@ 100030b0 NativeCall.obj + 0002:000000c4 ??_C@_0BL@DALH@com?1eaio?1nativecall?1Holder?$AA@ 100030c4 NativeCall.obj + 0002:000000e0 ??_C@_0O@OMHL@lastErrorCode?$AA@ 100030e0 NativeCall.obj + 0002:000000f0 ??_C@_0N@EFAA@moduleHandle?$AA@ 100030f0 NativeCall.obj + 0002:00000100 ??_C@_0P@LKIL@functionHandle?$AA@ 10003100 NativeCall.obj + 0002:00000110 ??_C@_01FLOP@I?$AA@ 10003110 NativeCall.obj + 0002:00000114 ??_C@_06CODG@module?$AA@ 10003114 NativeCall.obj + 0002:0000011c ??_C@_08JJOG@function?$AA@ 1000311c NativeCall.obj + 0002:00000128 ??_C@_0BD@DFD@Ljava?1lang?1String?$DL?$AA@ 10003128 NativeCall.obj + 0002:00000140 ?classString@@3PAV_jclass@@A 10003140 NativeCall.obj + 0002:00000144 ?fieldFunctionHandle@@3PAU_jfieldID@@A 10003144 NativeCall.obj + 0002:00000148 ?newIntegerInt@@3PAU_jmethodID@@A 10003148 NativeCall.obj + 0002:0000014c ?classCharArray@@3PAV_jclass@@A 1000314c NativeCall.obj + 0002:00000150 ?fieldFunction@@3PAU_jfieldID@@A 10003150 NativeCall.obj + 0002:00000154 ?classInteger@@3PAV_jclass@@A 10003154 NativeCall.obj + 0002:00000158 ?newBooleanBoolean@@3PAU_jmethodID@@A 10003158 NativeCall.obj + 0002:0000015c ?classBoolean@@3PAV_jclass@@A 1000315c NativeCall.obj + 0002:00000160 ?fieldModule@@3PAU_jfieldID@@A 10003160 NativeCall.obj + 0002:00000164 ?fieldModuleHandle@@3PAU_jfieldID@@A 10003164 NativeCall.obj + 0002:00000168 ?classHolder@@3PAV_jclass@@A 10003168 NativeCall.obj + 0002:0000016c ?fieldLastErrorCode@@3PAU_jfieldID@@A 1000316c NativeCall.obj + 0002:00000170 ?classByteArray@@3PAV_jclass@@A 10003170 NativeCall.obj + 0002:00000174 ?fieldHolderO@@3PAU_jfieldID@@A 10003174 NativeCall.obj + 0002:00000178 ?methodBooleanValue@@3PAU_jmethodID@@A 10003178 NativeCall.obj + 0002:0000017c ?methodIntValue@@3PAU_jmethodID@@A 1000317c NativeCall.obj + + entry point at 0001:00000c3d + + Static symbols + diff --git a/cpp/nativecall/Release/NativeCall.obj b/cpp/nativecall/Release/NativeCall.obj new file mode 100644 index 0000000..44a1efa Binary files /dev/null and b/cpp/nativecall/Release/NativeCall.obj differ diff --git a/cpp/nativecall/Release/RCa01380 b/cpp/nativecall/Release/RCa01380 new file mode 100644 index 0000000..eb8e4b1 Binary files /dev/null and b/cpp/nativecall/Release/RCa01380 differ diff --git a/cpp/nativecall/Release/VoidCall.asm b/cpp/nativecall/Release/VoidCall.asm new file mode 100644 index 0000000..5160082 --- /dev/null +++ b/cpp/nativecall/Release/VoidCall.asm @@ -0,0 +1,919 @@ + TITLE C:\Documents and Settings\Administrator\My Documents\Software\NativeCall\src\cpp\VoidCall.cpp + .386P +include listing.inc +if @Version gt 510 +.model FLAT +else +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT DWORD USE32 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT DWORD USE32 PUBLIC 'BSS' +_BSS ENDS +_TLS SEGMENT DWORD USE32 PUBLIC 'TLS' +_TLS ENDS +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' +_DATA ENDS +; COMDAT ?FindClass@JNIEnv_@@QAEPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ThrowNew@JNIEnv_@@QAEJPAV_jclass@@PBD@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?IsInstanceOf@JNIEnv_@@QAEEPAV_jobject@@PAV_jclass@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectField@JNIEnv_@@QAEPAV_jobject@@PAV2@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetIntField@JNIEnv_@@QAEJPAV_jobject@@PAU_jfieldID@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetObjectField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@0@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?SetIntField@JNIEnv_@@QAEXPAV_jobject@@PAU_jfieldID@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetArrayLength@JNIEnv_@@QAEJPAV_jarray@@@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetObjectArrayElement@JNIEnv_@@QAEPAV_jobject@@PAV_jobjectArray@@J@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?GetPrimitiveArrayCritical@JNIEnv_@@QAEPAXPAV_jarray@@PAE@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +; COMDAT ?ReleasePrimitiveArrayCritical@JNIEnv_@@QAEXPAV_jarray@@PAXJ@Z +_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' +_TEXT ENDS +FLAT GROUP _DATA, CONST, _BSS + ASSUME CS: FLAT, DS: FLAT, SS: FLAT +endif +PUBLIC _Java_com_eaio_nativecall_VoidCall_executeCall@8 +EXTRN ?fieldFunctionHandle@@3PAU_jfieldID@@A:DWORD ; fieldFunctionHandle +EXTRN ?fieldLastErrorCode@@3PAU_jfieldID@@A:DWORD ; fieldLastErrorCode +EXTRN __imp__GetLastError@0:NEAR +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_functionHandle$ = 8 +_Java_com_eaio_nativecall_VoidCall_executeCall@8 PROC NEAR + +; 79 : (JNIEnv *env, jobject obj) { + + push ebp + mov ebp, esp + +; 80 : +; 81 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov eax, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + push esi + mov esi, DWORD PTR _env$[ebp] + push eax + push DWORD PTR _obj$[ebp] + mov ecx, DWORD PTR [esi] + push esi + call DWORD PTR [ecx+400] + mov DWORD PTR _functionHandle$[ebp], eax + +; 82 : +; 83 : #ifdef _WINDOWS +; 84 : #ifdef _X86_ +; 85 : +; 86 : __asm { +; 87 : +; 88 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 89 : +; 90 : } +; 91 : +; 92 : #endif +; 93 : #endif +; 94 : +; 95 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + call DWORD PTR __imp__GetLastError@0 + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push DWORD PTR _obj$[ebp] + push esi + call DWORD PTR [ecx+436] + +; 96 : +; 97 : } + + pop esi + pop ebp + ret 8 +_Java_com_eaio_nativecall_VoidCall_executeCall@8 ENDP +_TEXT ENDS +PUBLIC ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' +PUBLIC _Java_com_eaio_nativecall_VoidCall_executeCall0@12 +PUBLIC ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject +PUBLIC ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod +PUBLIC ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod +EXTRN ?fieldHolderO@@3PAU_jfieldID@@A:DWORD ; fieldHolderO +EXTRN ?classBoolean@@3PAV_jclass@@A:DWORD ; classBoolean +EXTRN ?classInteger@@3PAV_jclass@@A:DWORD ; classInteger +EXTRN ?classByteArray@@3PAV_jclass@@A:DWORD ; classByteArray +EXTRN ?classCharArray@@3PAV_jclass@@A:DWORD ; classCharArray +EXTRN ?classHolder@@3PAV_jclass@@A:DWORD ; classHolder +EXTRN ?methodBooleanValue@@3PAU_jmethodID@@A:DWORD ; methodBooleanValue +EXTRN ?methodIntValue@@3PAU_jmethodID@@A:DWORD ; methodIntValue +EXTRN ?newIntegerInt@@3PAU_jmethodID@@A:DWORD ; newIntegerInt +EXTRN ?newBooleanBoolean@@3PAU_jmethodID@@A:DWORD ; newBooleanBoolean +EXTRN ??2@YAPAXI@Z:NEAR ; operator new +EXTRN ??3@YAXPAX@Z:NEAR ; operator delete +EXTRN _memset:NEAR +; COMDAT ??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ +; File C:\Program Files\IBMJava13\include\jni.h +_DATA SEGMENT +??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ DB 'java/lang/OutOfMemor' + DB 'yError', 00H ; `string' +_DATA ENDS +_TEXT SEGMENT +_env$ = 8 +_obj$ = 12 +_params$ = 16 +_len$ = -28 +_arrays$ = -20 +_param$ = -24 +_i$ = 8 +_intArg$27769 = -24 +_byteArrayArg$27772 = -4 +_charArrayArg$27778 = -8 +_tempArg$27785 = -24 +_intPtr$27790 = -24 +_byteArrayArg$27796 = -12 +_charArrayArg$27802 = -16 +_tempPtr$27809 = -24 +_functionHandle$ = 8 +_j$ = 8 +_Java_com_eaio_nativecall_VoidCall_executeCall0@12 PROC NEAR + +; 105 : (JNIEnv *env, jobject obj, jobjectArray params) { + + push ebp + mov ebp, esp + sub esp, 28 ; 0000001cH + push ebx + push esi + +; 106 : +; 107 : const int len = env->GetArrayLength(params); + + mov esi, DWORD PTR _env$[ebp] + push edi + push DWORD PTR _params$[ebp] + mov eax, DWORD PTR [esi] + push esi + call DWORD PTR [eax+684] + mov ebx, eax + +; 108 : +; 109 : int* arrays = NULL; +; 110 : if (!(arrays = new int[len])) { + + mov edi, ebx + mov DWORD PTR _len$[ebp], ebx + shl edi, 2 + push edi + call ??2@YAPAXI@Z ; operator new + test eax, eax + pop ecx + mov DWORD PTR _arrays$[ebp], eax + jne SHORT $L27758 + +; 111 : env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), NULL); + + mov eax, DWORD PTR [esi] + push OFFSET FLAT:??_C@_0BL@NKOM@java?1lang?1OutOfMemoryError?$AA@ ; `string' + push esi + call DWORD PTR [eax+24] + mov ecx, DWORD PTR [esi] + push 0 + push eax + push esi + call DWORD PTR [ecx+56] + +; 112 : return; + + jmp $L28021 +$L27758: + +; 113 : } +; 114 : memset(arrays, 0, (sizeof(int) * len)); + + push edi + push 0 + push eax + call _memset + +; 115 : +; 116 : jobject param; +; 117 : +; 118 : for (int i = len - 1; i >= 0; i--) { + + lea eax, DWORD PTR [ebx-1] + add esp, 12 ; 0000000cH + test eax, eax + mov DWORD PTR _i$[ebp], eax + jl $L27765 + mov ecx, DWORD PTR _arrays$[ebp] + lea edi, DWORD PTR [ecx+eax*4] + jmp SHORT $L27763 +$L28028: + +; 113 : } +; 114 : memset(arrays, 0, (sizeof(int) * len)); + + mov eax, DWORD PTR _i$[ebp] +$L27763: + +; 119 : +; 120 : param = env->GetObjectArrayElement(params, i); + + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR _params$[ebp] + push esi + call DWORD PTR [ecx+692] + mov ebx, eax + +; 121 : +; 122 : if (param == NULL) { + + test ebx, ebx + jne SHORT $L27766 + +; 123 : _push(0); + + push 0 + +; 124 : } +; 125 : else if (env->IsInstanceOf(param, classInteger)) { + + jmp $L27764 +$L27766: + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27768 + +; 126 : int intArg = env->CallIntMethod(param, methodIntValue); + + push DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push ebx + push esi + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + add esp, 12 ; 0000000cH + mov DWORD PTR _intArg$27769[ebp], eax + +; 127 : _push(intArg) + + push DWORD PTR _intArg$27769[ebp] + +; 128 : } +; 129 : else if (env->IsInstanceOf(param, classByteArray)) { + + jmp $L27764 +$L27768: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27771 + +; 130 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) param, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _byteArrayArg$27772[ebp], eax + +; 131 : arrays[i] = (int) &byteArrayArg; + + lea eax, DWORD PTR _byteArrayArg$27772[ebp] + mov DWORD PTR [edi], eax + +; 132 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$27772[ebp] + +; 133 : } +; 134 : else if (env->IsInstanceOf(param, classCharArray)) { + + jmp $L27764 +$L27771: + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27777 + +; 135 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 136 : (jarray) param, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _charArrayArg$27778[ebp], eax + +; 137 : arrays[i] = (int) &charArrayArg; + + lea eax, DWORD PTR _charArrayArg$27778[ebp] + mov DWORD PTR [edi], eax + +; 138 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$27778[ebp] + +; 139 : } +; 140 : else if (env->IsInstanceOf(param, classBoolean)) { + + jmp $L27764 +$L27777: + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27783 + +; 141 : jboolean booleanArg = env->CallBooleanMethod(param, methodBooleanValue); + + push DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ebx + push esi + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + add esp, 12 ; 0000000cH + +; 142 : int tempArg = (booleanArg == JNI_FALSE ? 0 : 1); + + neg al + sbb eax, eax + neg eax + mov DWORD PTR _tempArg$27785[ebp], eax + +; 143 : _push(tempArg) + + push DWORD PTR _tempArg$27785[ebp] + +; 144 : } +; 145 : else if (env->IsInstanceOf(param, classHolder)) { + + jmp $L27764 +$L27783: + mov eax, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je $L27764 + +; 146 : +; 147 : /* Holder */ +; 148 : +; 149 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov eax, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+380] + +; 150 : +; 151 : if (env->IsInstanceOf(o, classInteger)) { + + mov ecx, DWORD PTR [esi] + mov ebx, eax + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27789 + +; 152 : int *intPtr = new int; + + push 4 + call ??2@YAPAXI@Z ; operator new + pop ecx + mov DWORD PTR _intPtr$27790[ebp], eax + +; 153 : *intPtr = env->CallIntMethod(o, methodIntValue); + + push DWORD PTR ?methodIntValue@@3PAU_jmethodID@@A ; methodIntValue + push ebx + push esi + call ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallIntMethod + mov ecx, DWORD PTR _intPtr$27790[ebp] + add esp, 12 ; 0000000cH + +; 154 : arrays[i] = (int) intPtr; + + mov DWORD PTR [edi], ecx + mov DWORD PTR [ecx], eax + +; 155 : _push(intPtr); + + push DWORD PTR _intPtr$27790[ebp] + +; 156 : } +; 157 : else if (env->IsInstanceOf(o, classByteArray)) { + + jmp $L27764 +$L27789: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27795 + +; 158 : char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) o, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _byteArrayArg$27796[ebp], eax + +; 159 : arrays[i] = (int) &byteArrayArg; + + lea eax, DWORD PTR _byteArrayArg$27796[ebp] + mov DWORD PTR [edi], eax + +; 160 : _push(byteArrayArg) + + push DWORD PTR _byteArrayArg$27796[ebp] + +; 161 : } +; 162 : else if (env->IsInstanceOf(o, classCharArray)) { + + jmp SHORT $L27764 +$L27795: + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27801 + +; 163 : unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( +; 164 : (jarray) o, 0); + + mov eax, DWORD PTR [esi] + push 0 + push ebx + push esi + call DWORD PTR [eax+888] + mov DWORD PTR _charArrayArg$27802[ebp], eax + +; 165 : arrays[i] = (int) &charArrayArg; + + lea eax, DWORD PTR _charArrayArg$27802[ebp] + mov DWORD PTR [edi], eax + +; 166 : _push(charArrayArg) + + push DWORD PTR _charArrayArg$27802[ebp] + +; 167 : } +; 168 : else if (env->IsInstanceOf(o, classBoolean)) { + + jmp SHORT $L27764 +$L27801: + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + mov ecx, DWORD PTR [esi] + push eax + push ebx + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27764 + +; 169 : jboolean booleanArg = env->CallBooleanMethod(o, methodBooleanValue); + + push DWORD PTR ?methodBooleanValue@@3PAU_jmethodID@@A ; methodBooleanValue + push ebx + push esi + call ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ; JNIEnv_::CallBooleanMethod + +; 170 : int *tempPtr = new int; + + push 4 + mov bl, al + call ??2@YAPAXI@Z ; operator new + add esp, 16 ; 00000010H + +; 171 : *tempPtr = (booleanArg == JNI_FALSE ? 0 : 1); + + xor ecx, ecx + test bl, bl + setne cl + mov DWORD PTR _tempPtr$27809[ebp], eax + mov DWORD PTR [eax], ecx + +; 172 : arrays[i] = (int) tempPtr; + + mov DWORD PTR [edi], eax + +; 173 : _push(tempPtr); + + push DWORD PTR _tempPtr$27809[ebp] + +; 172 : arrays[i] = (int) tempPtr; + +$L27764: + dec DWORD PTR _i$[ebp] + sub edi, 4 + cmp DWORD PTR _i$[ebp], 0 + jge $L28028 + +; 115 : +; 116 : jobject param; +; 117 : +; 118 : for (int i = len - 1; i >= 0; i--) { + + mov ebx, DWORD PTR _len$[ebp] +$L27765: + +; 174 : } +; 175 : +; 176 : /* end Holder */ +; 177 : +; 178 : } +; 179 : +; 180 : } +; 181 : +; 182 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov eax, DWORD PTR ?fieldFunctionHandle@@3PAU_jfieldID@@A ; fieldFunctionHandle + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR _obj$[ebp] + push esi + call DWORD PTR [ecx+400] + mov DWORD PTR _functionHandle$[ebp], eax + +; 183 : +; 184 : #ifdef _WINDOWS +; 185 : #ifdef _X86_ +; 186 : +; 187 : __asm { +; 188 : +; 189 : call functionHandle + + call DWORD PTR _functionHandle$[ebp] + +; 190 : +; 191 : } +; 192 : +; 193 : #endif +; 194 : #endif +; 195 : +; 196 : for (int j = 0; j < len; ++j) { + + and DWORD PTR _j$[ebp], 0 + test ebx, ebx + jle $L27817 + +; 174 : } +; 175 : +; 176 : /* end Holder */ +; 177 : +; 178 : } +; 179 : +; 180 : } +; 181 : +; 182 : jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + + mov ebx, DWORD PTR _arrays$[ebp] +$L27815: + +; 197 : param = env->GetObjectArrayElement(params, j); + + push DWORD PTR _j$[ebp] + mov eax, DWORD PTR [esi] + push DWORD PTR _params$[ebp] + push esi + call DWORD PTR [eax+692] + mov edi, eax + +; 198 : if (param == NULL) {} + + test edi, edi + mov DWORD PTR _param$[ebp], edi + je $L27816 + +; 199 : else if (env->IsInstanceOf(param, classByteArray) || env->IsInstanceOf(param, classCharArray)) { + + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne $L27833 + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne $L27833 + +; 201 : } +; 202 : else if (env->IsInstanceOf(param, classHolder)) { + + mov eax, DWORD PTR ?classHolder@@3PAV_jclass@@A ; classHolder + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + je $L27816 + +; 203 : +; 204 : jobject o = env->GetObjectField(param, fieldHolderO); + + mov eax, DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+380] + +; 205 : +; 206 : if (env->IsInstanceOf(o, classInteger)) { + + mov ecx, DWORD PTR [esi] + mov edi, eax + mov eax, DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27827 + +; 207 : int* out = (int*) arrays[j]; + + mov edi, DWORD PTR [ebx] + +; 208 : env->SetObjectField(param, fieldHolderO, env->NewObject(classInteger, newIntegerInt, *out)); + + push DWORD PTR [edi] + push DWORD PTR ?newIntegerInt@@3PAU_jmethodID@@A ; newIntegerInt + push DWORD PTR ?classInteger@@3PAV_jclass@@A ; classInteger +$L28031: + push esi + call ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ; JNIEnv_::NewObject + add esp, 16 ; 00000010H + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldHolderO@@3PAU_jfieldID@@A ; fieldHolderO + push DWORD PTR _param$[ebp] + push esi + call DWORD PTR [ecx+416] + +; 209 : delete out; + + push edi + call ??3@YAXPAX@Z ; operator delete + pop ecx + +; 210 : } +; 211 : else if (env->IsInstanceOf(o, classByteArray) || env->IsInstanceOf(o, classCharArray)) { + + jmp SHORT $L27816 +$L27827: + mov eax, DWORD PTR ?classByteArray@@3PAV_jclass@@A ; classByteArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne SHORT $L27833 + mov eax, DWORD PTR ?classCharArray@@3PAV_jclass@@A ; classCharArray + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + jne SHORT $L27833 + +; 212 : env->ReleasePrimitiveArrayCritical((jarray) o, (void*) arrays[j], 0); +; 213 : } +; 214 : else if (env->IsInstanceOf(o, classBoolean)) { + + mov eax, DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + mov ecx, DWORD PTR [esi] + push eax + push edi + push esi + call DWORD PTR [ecx+128] + test al, al + je SHORT $L27816 + +; 215 : int* out = (int*) arrays[j]; + + mov edi, DWORD PTR [ebx] + +; 216 : env->SetObjectField(param, fieldHolderO, env->NewObject(classBoolean, newBooleanBoolean, (*out == 0 ? JNI_FALSE : JNI_TRUE))); + + xor eax, eax + cmp DWORD PTR [edi], eax + setne al + push eax + push DWORD PTR ?newBooleanBoolean@@3PAU_jmethodID@@A ; newBooleanBoolean + push DWORD PTR ?classBoolean@@3PAV_jclass@@A ; classBoolean + +; 217 : delete out; + + jmp SHORT $L28031 +$L27833: + +; 200 : env->ReleasePrimitiveArrayCritical((jarray) param, (void*) arrays[j], 0); + + mov eax, DWORD PTR [esi] + push 0 + push DWORD PTR [ebx] + push edi + push esi + call DWORD PTR [eax+892] +$L27816: + inc DWORD PTR _j$[ebp] + mov eax, DWORD PTR _j$[ebp] + add ebx, 4 + cmp eax, DWORD PTR _len$[ebp] + jl $L27815 +$L27817: + +; 218 : } +; 219 : +; 220 : } +; 221 : +; 222 : } +; 223 : +; 224 : delete [] arrays; + + push DWORD PTR _arrays$[ebp] + call ??3@YAXPAX@Z ; operator delete + pop ecx + +; 225 : +; 226 : env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + + call DWORD PTR __imp__GetLastError@0 + mov ecx, DWORD PTR [esi] + push eax + push DWORD PTR ?fieldLastErrorCode@@3PAU_jfieldID@@A ; fieldLastErrorCode + push DWORD PTR _obj$[ebp] + push esi + call DWORD PTR [ecx+436] +$L28021: + +; 227 : +; 228 : } + + pop edi + pop esi + pop ebx + leave + ret 12 ; 0000000cH +_Java_com_eaio_nativecall_VoidCall_executeCall0@12 ENDP +_TEXT ENDS +; COMDAT ?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_clazz$ = 12 +_methodID$ = 16 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::NewObject, COMDAT + +; 835 : va_list args; +; 836 : jobject result; +; 837 : va_start(args, methodID); +; 838 : result = functions->NewObjectV(this,clazz,methodID,args); + + mov eax, DWORD PTR _this$[esp-4] + lea edx, DWORD PTR _methodID$[esp] + push edx + push DWORD PTR _methodID$[esp] + mov ecx, DWORD PTR [eax] + push DWORD PTR _clazz$[esp+4] + push eax + call DWORD PTR [ecx+116] + +; 839 : va_end(args); +; 840 : return result; +; 841 : } + + ret 0 +?NewObject@JNIEnv_@@QAAPAV_jobject@@PAV_jclass@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::NewObject +_TEXT ENDS +; COMDAT ?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_obj$ = 12 +_methodID$ = 16 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallBooleanMethod, COMDAT + +; 882 : va_list args; +; 883 : jboolean result; +; 884 : va_start(args,methodID); +; 885 : result = functions->CallBooleanMethodV(this,obj,methodID,args); + + mov eax, DWORD PTR _this$[esp-4] + lea edx, DWORD PTR _methodID$[esp] + push edx + push DWORD PTR _methodID$[esp] + mov ecx, DWORD PTR [eax] + push DWORD PTR _obj$[esp+4] + push eax + call DWORD PTR [ecx+152] + +; 886 : va_end(args); +; 887 : return result; +; 888 : } + + ret 0 +?CallBooleanMethod@JNIEnv_@@QAAEPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallBooleanMethod +_TEXT ENDS +; COMDAT ?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ +_TEXT SEGMENT +_this$ = 8 +_obj$ = 12 +_methodID$ = 16 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ PROC NEAR ; JNIEnv_::CallIntMethod, COMDAT + +; 950 : va_list args; +; 951 : jint result; +; 952 : va_start(args,methodID); +; 953 : result = functions->CallIntMethodV(this,obj,methodID,args); + + mov eax, DWORD PTR _this$[esp-4] + lea edx, DWORD PTR _methodID$[esp] + push edx + push DWORD PTR _methodID$[esp] + mov ecx, DWORD PTR [eax] + push DWORD PTR _obj$[esp+4] + push eax + call DWORD PTR [ecx+200] + +; 954 : va_end(args); +; 955 : return result; +; 956 : } + + ret 0 +?CallIntMethod@JNIEnv_@@QAAJPAV_jobject@@PAU_jmethodID@@ZZ ENDP ; JNIEnv_::CallIntMethod +_TEXT ENDS +END diff --git a/cpp/nativecall/Release/VoidCall.obj b/cpp/nativecall/Release/VoidCall.obj new file mode 100644 index 0000000..3edebca Binary files /dev/null and b/cpp/nativecall/Release/VoidCall.obj differ diff --git a/cpp/nativecall/VoidCall.cpp b/cpp/nativecall/VoidCall.cpp new file mode 100644 index 0000000..8c9a1b9 --- /dev/null +++ b/cpp/nativecall/VoidCall.cpp @@ -0,0 +1,228 @@ +/* + * VoidCall.cpp + * + * Created on 16.09.2004. + * + * $Id: VoidCall.cpp,v 1.4 2006/04/20 05:50:15 grnull Exp $ + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include +#include "com_eaio_nativecall_VoidCall.h" + +#ifdef _WINDOWS +#include +#include +#endif + +#ifdef _WINDOWS +#ifdef _X86_ + +#define _push(x) __asm { push x }; + +#endif +#endif + +// NativeCall fields + +extern jfieldID fieldFunction, fieldModule, fieldFunctionHandle, + fieldModuleHandle, fieldLastErrorCode; + +// Holder fields + +extern jfieldID fieldHolderO; + +// Classes + +extern jclass classBoolean,/* classByte, classCharacter, classShort,*/ + classInteger, /* classLong, classFloat, classDouble,*/ classString, + classByteArray, classCharArray, /*classIntArray,*/ classHolder; + +// Wrapper class methods + +extern jmethodID methodBooleanValue,/* methodByteValue, methodCharValue, +methodShortValue,*/ methodIntValue/*, methodLongValue, methodFloatValue, +methodDoubleValue*/; + +// Constructors + +extern jmethodID newIntegerInt, newBooleanBoolean; + +/* + * Class: com_eaio_nativecall_VoidCall + * Method: executeCall + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_VoidCall_executeCall +(JNIEnv *env, jobject obj) { + + jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + +#ifdef _WINDOWS +#ifdef _X86_ + + __asm { + + call functionHandle + + } + +#endif +#endif + + env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + +} + +/* + * Class: com_eaio_nativecall_VoidCall + * Method: executeCall0 + * Signature: ([Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_VoidCall_executeCall0 +(JNIEnv *env, jobject obj, jobjectArray params) { + + const int len = env->GetArrayLength(params); + + int* arrays = NULL; + if (!(arrays = new int[len])) { + env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), NULL); + return; + } + memset(arrays, 0, (sizeof(int) * len)); + + jobject param; + + for (int i = len - 1; i >= 0; i--) { + + param = env->GetObjectArrayElement(params, i); + + if (param == NULL) { + _push(0); + } + else if (env->IsInstanceOf(param, classInteger)) { + int intArg = env->CallIntMethod(param, methodIntValue); + _push(intArg) + } + else if (env->IsInstanceOf(param, classByteArray)) { + char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) param, 0); + arrays[i] = (int) &byteArrayArg; + _push(byteArrayArg) + } + else if (env->IsInstanceOf(param, classCharArray)) { + unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( + (jarray) param, 0); + arrays[i] = (int) &charArrayArg; + _push(charArrayArg) + } + else if (env->IsInstanceOf(param, classBoolean)) { + jboolean booleanArg = env->CallBooleanMethod(param, methodBooleanValue); + int tempArg = (booleanArg == JNI_FALSE ? 0 : 1); + _push(tempArg) + } + else if (env->IsInstanceOf(param, classHolder)) { + + /* Holder */ + + jobject o = env->GetObjectField(param, fieldHolderO); + + if (env->IsInstanceOf(o, classInteger)) { + int *intPtr = new int; + *intPtr = env->CallIntMethod(o, methodIntValue); + arrays[i] = (int) intPtr; + _push(intPtr); + } + else if (env->IsInstanceOf(o, classByteArray)) { + char* byteArrayArg = (char*) env->GetPrimitiveArrayCritical((jarray) o, 0); + arrays[i] = (int) &byteArrayArg; + _push(byteArrayArg) + } + else if (env->IsInstanceOf(o, classCharArray)) { + unsigned short* charArrayArg = (unsigned short*) env->GetPrimitiveArrayCritical( + (jarray) o, 0); + arrays[i] = (int) &charArrayArg; + _push(charArrayArg) + } + else if (env->IsInstanceOf(o, classBoolean)) { + jboolean booleanArg = env->CallBooleanMethod(o, methodBooleanValue); + int *tempPtr = new int; + *tempPtr = (booleanArg == JNI_FALSE ? 0 : 1); + arrays[i] = (int) tempPtr; + _push(tempPtr); + } + + /* end Holder */ + + } + + } + + jint functionHandle = env->GetIntField(obj, fieldFunctionHandle); + +#ifdef _WINDOWS +#ifdef _X86_ + + __asm { + + call functionHandle + + } + +#endif +#endif + + for (int j = 0; j < len; ++j) { + param = env->GetObjectArrayElement(params, j); + if (param == NULL) {} + else if (env->IsInstanceOf(param, classByteArray) || env->IsInstanceOf(param, classCharArray)) { + env->ReleasePrimitiveArrayCritical((jarray) param, (void*) arrays[j], 0); + } + else if (env->IsInstanceOf(param, classHolder)) { + + jobject o = env->GetObjectField(param, fieldHolderO); + + if (env->IsInstanceOf(o, classInteger)) { + int* out = (int*) arrays[j]; + env->SetObjectField(param, fieldHolderO, env->NewObject(classInteger, newIntegerInt, *out)); + delete out; + } + else if (env->IsInstanceOf(o, classByteArray) || env->IsInstanceOf(o, classCharArray)) { + env->ReleasePrimitiveArrayCritical((jarray) o, (void*) arrays[j], 0); + } + else if (env->IsInstanceOf(o, classBoolean)) { + int* out = (int*) arrays[j]; + env->SetObjectField(param, fieldHolderO, env->NewObject(classBoolean, newBooleanBoolean, (*out == 0 ? JNI_FALSE : JNI_TRUE))); + delete out; + } + + } + + } + + delete [] arrays; + + env->SetIntField(obj, fieldLastErrorCode, GetLastError()); + +} \ No newline at end of file diff --git a/cpp/nativecall/com_eaio_nativecall_IntCall.h b/cpp/nativecall/com_eaio_nativecall_IntCall.h new file mode 100644 index 0000000..3940b16 --- /dev/null +++ b/cpp/nativecall/com_eaio_nativecall_IntCall.h @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_eaio_nativecall_IntCall */ + +#ifndef _Included_com_eaio_nativecall_IntCall +#define _Included_com_eaio_nativecall_IntCall +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_eaio_nativecall_IntCall + * Method: executeCall + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_eaio_nativecall_IntCall_executeCall + (JNIEnv *, jobject); + +/* + * Class: com_eaio_nativecall_IntCall + * Method: executeCall0 + * Signature: ([Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_com_eaio_nativecall_IntCall_executeCall0 + (JNIEnv *, jobject, jobjectArray); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/cpp/nativecall/com_eaio_nativecall_NativeCall.h b/cpp/nativecall/com_eaio_nativecall_NativeCall.h new file mode 100644 index 0000000..2e92b91 --- /dev/null +++ b/cpp/nativecall/com_eaio_nativecall_NativeCall.h @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_eaio_nativecall_NativeCall */ + +#ifndef _Included_com_eaio_nativecall_NativeCall +#define _Included_com_eaio_nativecall_NativeCall +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_eaio_nativecall_NativeCall + * Method: initIDs + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_NativeCall_initIDs + (JNIEnv *, jclass); + +/* + * Class: com_eaio_nativecall_NativeCall + * Method: initHandles + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_com_eaio_nativecall_NativeCall_initHandles + (JNIEnv *, jobject); + +/* + * Class: com_eaio_nativecall_NativeCall + * Method: getLastError + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_eaio_nativecall_NativeCall_getLastError + (JNIEnv *, jobject); + +/* + * Class: com_eaio_nativecall_NativeCall + * Method: destroy + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_NativeCall_destroy + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/cpp/nativecall/com_eaio_nativecall_VoidCall.h b/cpp/nativecall/com_eaio_nativecall_VoidCall.h new file mode 100644 index 0000000..e72afb9 --- /dev/null +++ b/cpp/nativecall/com_eaio_nativecall_VoidCall.h @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_eaio_nativecall_VoidCall */ + +#ifndef _Included_com_eaio_nativecall_VoidCall +#define _Included_com_eaio_nativecall_VoidCall +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_eaio_nativecall_VoidCall + * Method: executeCall + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_VoidCall_executeCall + (JNIEnv *, jobject); + +/* + * Class: com_eaio_nativecall_VoidCall + * Method: executeCall0 + * Signature: ([Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_com_eaio_nativecall_VoidCall_executeCall0 + (JNIEnv *, jobject, jobjectArray); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/cpp/nativecall/readme.txt b/cpp/nativecall/readme.txt new file mode 100644 index 0000000..7799a92 --- /dev/null +++ b/cpp/nativecall/readme.txt @@ -0,0 +1,25 @@ +# $Id: readme.txt,v 1.1 2006/01/05 19:55:58 grnull Exp $ + +Hi, + +this is the readme file for people who want to build the native libraries for +NativeCall themselves. + +Compiling the native libraries requires some header files (after all, it's +just C++). + +Search for + + jni.h + +which is required. You will most likey also need jni_md.h and +jniproto_md.h. Copy these files to this directory. + +The library has been compiled and is set up for libctiny.lib to make the +binaries even smaller. You can download libctiny.lib from + + + +After you downloaded it, extract libctiny.lib to this folder. You also might +have to change the paths for the compiler and the linker. + diff --git a/cpp/nativecall/resource.h b/cpp/nativecall/resource.h new file mode 100644 index 0000000..e9f970e --- /dev/null +++ b/cpp/nativecall/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by version.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/cpp/nativecall/version.rc b/cpp/nativecall/version.rc new file mode 100644 index 0000000..69ae71a --- /dev/null +++ b/cpp/nativecall/version.rc @@ -0,0 +1,104 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Deutsch (Deutschland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,4,1,0 + PRODUCTVERSION 0,4,1,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040704b0" + BEGIN + VALUE "CompanyName", "eaio\0" + VALUE "FileDescription", "NativeCall native library\0" + VALUE "FileVersion", "0, 4, 1, 0\0" + VALUE "LegalCopyright", "2003-2006 Johann Burkard\0" + VALUE "OriginalFilename", "NativeCall.dll\0" + VALUE "ProductName", "NativeCall\0" + VALUE "ProductVersion", "0, 4, 1, 0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x407, 1200 + END +END + +#endif // !_MAC + +#endif // Deutsch (Deutschland) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/java/src/com/eaio/nativecall/Holder.java b/java/src/com/eaio/nativecall/Holder.java new file mode 100644 index 0000000..6c1ee68 --- /dev/null +++ b/java/src/com/eaio/nativecall/Holder.java @@ -0,0 +1,133 @@ +/* + * Holder.java + * + * Created on 14.09.2004. + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.eaio.nativecall; + +/** + * Holder is a class that encapsulates another Object. Use this class for output + * parameters. + * + * @author Johann Burkard + * @version $Id: Holder.java,v 1.3 2006/04/19 20:54:58 grnull Exp $ + */ +public class Holder { + + /** + * The encapsulated object. + *

+ * Accessed by native code. DO NOT RENAME THIS FIELD. + */ + private Object o; + + /** + * Constructor for Holder. + * + * @param o the Object to encapsulate, may be null, but cannot + * be of type Holder + * @throws ClassCastException if o is of type Holder + */ + public Holder(Object o) { + if (o instanceof Holder) { + throw new ClassCastException(); + } + else if (o == null) { + o = new Integer(0); + } + this.o = o; + } + + /** + * Returns the referenced Object. + * + * @return an Object + */ + public final Object get() { + return o; + } + + /** + * Returns the hashCode of the encapsulated Object or + * {@link java.lang.Object#hashCode()} if the Object is null. + * + * @return the hashCode + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return getClass().getName().hashCode() ^ (o == null ? 0 : o.hashCode()); + } + + /** + * Returns if this Object is equal to another Object. + * + * @param obj the other Object, may be null + * @return if both Objects are equal + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof Holder)) { + return false; + } + Holder h = (Holder) obj; + return o == null ? h.o == null : o.equals(h.o); + } + + /** + * Returns a String representation of this Object. + * + * @return a String, never null + * @see java.lang.Object#toString() + * @see #toStringBuffer(StringBuffer) + */ + public final String toString() { + return toStringBuffer(null).toString(); + } + + /** + * Appends a String representation of this Object to the given + * {@link StringBuffer} or creates a new one if none is given. + * + * @param in the StringBuffer to append to, may be null + * @return a StringBuffer, never null + */ + public StringBuffer toStringBuffer(StringBuffer in) { + if (in == null) { + in = new StringBuffer(32); + } + else { + in.ensureCapacity(in.length() + 32); + } + in.append("{ Holder: o = "); + in.append(o); + in.append(" }"); + return in; + } + +} diff --git a/java/src/com/eaio/nativecall/IntCall.java b/java/src/com/eaio/nativecall/IntCall.java new file mode 100644 index 0000000..97c6362 --- /dev/null +++ b/java/src/com/eaio/nativecall/IntCall.java @@ -0,0 +1,143 @@ +/* + * IntCall.java + * + * Created on 07.09.2004. + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.eaio.nativecall; + +/** + * An IntCall instance encapsulates an operating system method that returns + * an integer. + * + * @author Johann Burkard + * @version $Id: IntCall.java,v 1.1 2006/01/05 20:02:44 grnull Exp $ + */ +public class IntCall extends NativeCall { + + /** + * Constructor for IntCall. + * + * @see NativeCall#NativeCall(String) + */ + public IntCall(String function) throws SecurityException, + IllegalArgumentException, NullPointerException { + super(function); + } + + /** + * Constructor for IntCall. + * + * @see NativeCall#NativeCall(String, String) + */ + public IntCall(String module, String function) throws SecurityException, + IllegalArgumentException, NullPointerException { + super(module, function); + } + + /** + * Returns false if calling {@link #executeCall()} returned + * 0, true otherwise. + *

+ * Updates the error code field. See {@link #getLastError()}. + * + * @return true or false + */ + public boolean executeBooleanCall() { + return executeCall() == 0 ? false : true; + } + + /** + * Returns false if calling {@link #executeCall(Object)} + * returned 0, true otherwise. + *

+ * Updates the error code field. See {@link #getLastError()}. + * + * @param param the parameter, may be null + * @return true or false + * @see #executeBooleanCall(Object[]) + */ + public boolean executeBooleanCall(Object param) { + return executeCall(param) == 0 ? false : true; + } + + /** + * Returns false if calling + * {@link #executeCall(Object[])} returned 0, true otherwise. + *

+ * Updates the error code field. See {@link #getLastError()}. + *

+ * During this operation, the contents of the array might be changed. + * + * @param params the parameter array, may be null + * @return true or false + */ + public boolean executeBooleanCall(Object[] params) { + return executeCall(params) == 0 ? false : true; + } + + /** + * Calls the function, returning its output. + *

+ * Updates the error code field. See {@link #getLastError()}. + * + * @return an int + */ + public native int executeCall(); + + /** + * Calls the function using the given parameter. + *

+ * Updates the error code field. See {@link #getLastError()}. + * + * @param param the parameter, may be null + * @return an int + * @see #executeCall(Object[]) + */ + public int executeCall(Object param) { + return executeCall(new Object[] { param }); + } + + /** + * Calls the function using the given parameters. + *

+ * Updates the error code field. See {@link #getLastError()}. + *

+ * During this operation, the contents of the array might be changed. + * + * @param params the parameter array, may be null + * @return an int + */ + public int executeCall(Object[] params) { + if (params == null || params.length == 0) { + return executeCall(); + } + check(params); + return executeCall0(params); + } + + private native int executeCall0(Object[] params); + +} diff --git a/java/src/com/eaio/nativecall/NativeCall.java b/java/src/com/eaio/nativecall/NativeCall.java new file mode 100644 index 0000000..ce1c820 --- /dev/null +++ b/java/src/com/eaio/nativecall/NativeCall.java @@ -0,0 +1,355 @@ +/* + * NativeCall.java + * + * Created on 07.09.2004. + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.eaio.nativecall; + +import java.io.IOException; + +import sun.misc.ServiceConfigurationError; + +import com.eaio.util.lang.NativeLoader; + +/** + * NativeCall loads the native library and prepares the matching + * {@link com.eaio.nativecall.Verifier}. + *

+ * Before being able to use NativeCall, the {@link #init()} method must have + * been called: + *

+ * try {
+ *     NativeCall.init();
+ * }
+ * catch (IOException ex) { ... }
+ * catch (SecurityException ex) { ... }
+ * catch (UnsatisfiedLinkError er) { ... }
+ * catch (sun.misc.ServiceConfigurationError) { ... }
+ * catch (UnsupportedOperationException) { ... }
+ * 
+ * After usage, each NativeCall object must be destroyed to release + * resources. This is done by calling the {@link #destroy()} method. Failure + * to call this method might result in memory leaks. + * + * @see #destroy() + * @see #init() + * @author Johann Burkard + * @version $Id: NativeCall.java,v 1.3 2006/04/19 20:54:58 grnull Exp $ + */ +public abstract class NativeCall { + + /** + * The error code of the last call. + *

+ * Accessed by native code. DO NOT RENAME THIS FIELD. + */ + private int lastErrorCode; + + /** + * The internal handle to the function and the module. + *

+ * These are set in native code, so ignore any warnings. + *

+ * Accessed by native code. DO NOT RENAME THIS FIELD. + */ + private int functionHandle, moduleHandle; + + /** + * The name of the function to call. + *

+ * Accessed by native code. DO NOT RENAME THIS FIELD. + */ + private String function; + + /** + * The name of the module to call. + *

+ * Accessed by native code. DO NOT RENAME THIS FIELD. + */ + private String module; + + /** + * Initialize JNI field and method IDs + */ + private static native void initIDs(); + + /** + * Whether the class has been initialized properly. + */ + private static boolean initialized = false; + + /** + * Before NativeCall may be used, this method must be called. + * It loads the native library, prepares JNI field and method IDs and loads + * the matching {@link Verifier}. + *

+ * Multiple calls are ignored. + * + * @throws IOException if an IOException occured during unpacking of + * the native library + * @throws SecurityException if accessing system properties was forbidden + * by the {@link SecurityManager} + * @throws UnsatisfiedLinkError if the NativeCall.dll could + * not be found + * @throws sun.misc.ServiceConfigurationError + * @throws UnsupportedOperationException if no matching + * {@link Verifier} could be found + */ + public static synchronized void init() + throws + IOException, + SecurityException, + UnsatisfiedLinkError, + ServiceConfigurationError, + UnsupportedOperationException { + if (!initialized) { + Verifiers.init(); + if (Verifiers.getInstance() == null) { + throw new UnsupportedOperationException(); + } + new NativeLoader("NativeCall").load(); + initIDs(); + initialized = true; + } + } + + /** + * Constructor for NativeCall. + * + * @param function the name of the function to use, may not be + * null + * @throws IllegalArgumentException if the function could not be found + * @throws NullPointerException if function is null + * @see Verifier#getDefaultModule() + * @see NativeCall#NativeCall(String, String) + */ + public NativeCall(String function) + throws IllegalArgumentException, NullPointerException { + this(Verifiers.getInstance().getDefaultModule(), function); + } + + /** + * Constructor for NativeCall. + * + * @param module the name of the module the function is stored in, may be + * null + * @param function the name of the function to use, may not be + * null + * @throws IllegalArgumentException if the function could not be found + * @throws NullPointerException if function is null + */ + public NativeCall(String module, String function) + throws IllegalArgumentException, NullPointerException { + Verifier v = Verifiers.getInstance(); + this.function = v.verifyFunctionName(function); + this.module = v.verifyModuleName(module); + if (!initHandles()) { + if (lastErrorCode != 0) { + throw new IllegalArgumentException(getLastError()); + } + throw new IllegalArgumentException(); + } + } + + /** + * Attempts to acquire handles to the functions. Returns if these could be + * acquired. + * + * @return if the handles could be acquired + */ + private native boolean initHandles(); + + /** + * Returns the error code that was returned during the last method call or + * 0 if the last method call did not produce an error. + * + * @see #getLastError() + * @return the last error code or 0 + */ + public final int getLastErrorCode() { + return lastErrorCode; + } + + /** + * Returns a formatted String containing the last error code or + * null if the last call did not produce an error. + * + * @see #getLastErrorCode() + * @return a String or null if the last error code is 0 + */ + public final native String getLastError(); + + /** + * Releases acquired module handles. This method must be called if the + * instance is not used anymore. After this method is called, methods of this + * NativeCall Object cannot be called anymore. + *

+ * Failure to call this method might result in memory leaks. + *

+ * Updates the error code field. See {@link #getLastError()}. + */ + public native synchronized void destroy(); + + /** + * Checks the supplied Object array for illegal/unsupported types. + *

+ * During the verification, the contents of the array might be + * changed. + * + * @param params the Object array, may be null + * @throws ClassCastException if the type of one argument is not supported + */ + protected void check(Object[] params) throws ClassCastException { + if (params == null) { + return; + } + for (int i = 0; i < params.length; ++i) { + checkParam(params[i]); + if (params[i] instanceof String) { + params[i] = + Verifiers.getInstance().handleString( + (String) params[i], + module, + function); + } + } + } + + /** + * Checks one Object for illegal/unsupported types. + * + * @param o the Object, may be null + * @throws ClassCastException if the type of one argument is not supported + */ + protected void checkParam(Object o) throws ClassCastException { + if (o == null + || o instanceof Boolean + || o instanceof Integer + || o instanceof byte[] + || o instanceof char[] + || o instanceof String) { + return; + } + if (o instanceof Holder) { + checkParam(((Holder) o).get()); + return; + } + throw new ClassCastException(o.getClass().getName()); + } + + /** + * Returns if this Object is equal to another Object. The other Object must + * be an instance of the same type as this Object. Also, both the module + * and the function field must be equal. + * + * @param obj the other Object + * @return if this and the other Object are equal + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NativeCall)) { + return false; + } + if (!getClass().getName().equals(obj.getClass().getName())) { + return false; + } + NativeCall c = (NativeCall) obj; + return module.equals(c.module) && function.equals(c.function); + } + + /** + * Returns the hashCode of this Object. The hashCode is computed by XOR'ing + * the hash codes of the function and the module names. + * + * @return the hashCode + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + int out = function.hashCode(); + out ^= module.hashCode(); + return out; + } + + /** + * Calls {@link #destroy()}. + * + * @see java.lang.Object#finalize() + */ + protected void finalize() throws Throwable { + try { + destroy(); + } + finally { + super.finalize(); + // in case NativeCall is a subclass of a class other than Object + } + } + + /** + * Returns a String representation of this Object. + * + * @return a String, never null + * @see java.lang.Object#toString() + * @see #toStringBuffer(StringBuffer) + */ + public final String toString() { + return toStringBuffer(null).toString(); + } + + /** + * Appends a String representation of this Object to the given + * {@link StringBuffer} or creates a new one if none is given. + * + * @param in the StringBuffer to append to, may be null + * @return a StringBuffer, never null + */ + public StringBuffer toStringBuffer(StringBuffer in) { + if (in == null) { + in = new StringBuffer(64); + } + else { + in.ensureCapacity(in.length() + 64); + } + in.append("{ "); + int idx = getClass().getName().lastIndexOf("."); + if (idx > -1) { + in.append(getClass().getName().substring(++idx)); + } + else { + in.append(getClass().getName()); + } + in.append(": module = "); + in.append(module); + in.append(", function = "); + in.append(function); + in.append(" }"); + return in; + } + +} diff --git a/java/src/com/eaio/nativecall/Verifier.java b/java/src/com/eaio/nativecall/Verifier.java new file mode 100644 index 0000000..1780cfc --- /dev/null +++ b/java/src/com/eaio/nativecall/Verifier.java @@ -0,0 +1,101 @@ +/* + * Verifier.java + * + * Created on 07.09.2004. + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.eaio.nativecall; + +/** + * A Verifier implements method and module name checking for one given + * operating system. Classes implementing Verifier must be public and have + * a public no-argument constructor. + * + * @author Johann Burkard + * @version $Id: Verifier.java,v 1.1 2006/01/05 20:02:44 grnull Exp $ + */ +public interface Verifier { + + /** + * If there is a default module that system functions are stored in, the + * module's name may be returned here. + * + * @return the name of a default module or null + * @see NativeCall#NativeCall(String) + */ + String getDefaultModule(); + + /** + * Returns if this Verifier supports the given operating system. + * + * @return if this operating system is supported + * @throws SecurityException because {@link java.lang.System} properties + * may be queried + */ + boolean supports() throws SecurityException; + + /** + * Verifies that the given module name is correct. + * + * @param module the module name, may be null + * @return a module name, possibly modified, never null + * @throws NullPointerException if the module name is null + * and there is no default module defined + * @throws IllegalArgumentException if the module is illegal in the + * operating system + * @see #getDefaultModule() + */ + String verifyModuleName(String module) + throws NullPointerException, IllegalArgumentException; + + /** + * Verifies that the given function name is correct. + * + * @param function the function name, may be null + * @return a function name, possibly modified, never null + * @throws NullPointerException if the function name is null + * @throws IllegalArgumentException if the function is illegal in the + * operating system + */ + String verifyFunctionName(String function) + throws NullPointerException, IllegalArgumentException; + + /** + * Converts the given String to one of the following data types, based on the + * module and the function name: + *
+ *

    + *
  • a byte array
  • + *
  • a char array
  • + *
+ * + * @param val the String, never null + * @param module the module name, never null + * @param function the function name, never null + * @return the String converted, never null + */ + Object handleString(String val, String module, String function); + +} diff --git a/java/src/com/eaio/nativecall/Verifiers.java b/java/src/com/eaio/nativecall/Verifiers.java new file mode 100644 index 0000000..5fc674b --- /dev/null +++ b/java/src/com/eaio/nativecall/Verifiers.java @@ -0,0 +1,83 @@ +/* + * Verifiers.java + * + * Created on 07.09.2004. + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.eaio.nativecall; + +import java.util.Iterator; + +import sun.misc.Service; +import sun.misc.ServiceConfigurationError; + +/** + * Verifiers instantiates the matching {@link com.eaio.nativecall.Verifier} for + * the current operating system. + * + * @author Johann Burkard + * @version $Id: Verifiers.java,v 1.2 2006/01/06 10:58:33 grnull Exp $ + */ +final class Verifiers { + + /** + * No instances needed. + */ + private Verifiers() {} + + /** + * The Verifier. + */ + private static Verifier v = null; + + /** + * Find the matching Verifier. + * + * @throws ServiceConfigurationError + * @throws SecurityException + */ + static void init() throws ServiceConfigurationError, SecurityException { + Iterator i = + Service.providers(Verifier.class, Verifier.class.getClassLoader()); + Verifier ver = null; + while (i.hasNext()) { + ver = (Verifier) i.next(); + if (ver.supports()) { + v = ver; + break; + } + } + } + + /** + * Returns the Verifier. + * + * @return a Verifier or null + */ + static Verifier getInstance() { + return v; + } + +} diff --git a/java/src/com/eaio/nativecall/VoidCall.java b/java/src/com/eaio/nativecall/VoidCall.java new file mode 100644 index 0000000..21ea7a0 --- /dev/null +++ b/java/src/com/eaio/nativecall/VoidCall.java @@ -0,0 +1,99 @@ +/* + * VoidCall.java + * + * Created on 16.09.2004 + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.eaio.nativecall; + +/** + * A VoidCall instance encapsulates an operating system method that returns + * nothing. + * + * @author Johann Burkard + * @version $Id: VoidCall.java,v 1.1 2006/01/05 20:02:44 grnull Exp $ + */ +public class VoidCall extends NativeCall { + + /** + * Constructor for VoidCall. + * + * @see NativeCall#NativeCall(String) + */ + public VoidCall(String function) throws SecurityException, + IllegalArgumentException, NullPointerException { + super(function); + } + + /** + * Constructor for VoidCall. + * + * @see NativeCall#NativeCall(String, String) + */ + public VoidCall(String module, String function) throws SecurityException, + IllegalArgumentException, NullPointerException { + super(module, function); + } + + /** + * Calls the function. + *

+ * Updates the error code field. See {@link #getLastError()}. + */ + public native void executeCall(); + + /** + * Calls the function using the given parameter. + *

+ * Updates the error code field. See {@link #getLastError()}. + * + * @param param the parameter, may be null + * @see #executeCall(Object[]) + */ + public void executeCall(Object param) { + executeCall(new Object[] { param }); + } + + /** + * Calls the function using the given parameters. + *

+ * Updates the error code field. See {@link #getLastError()}. + *

+ * During this operation, the contents of the array might be changed. + * + * @param params the parameter array, may be null + */ + public void executeCall(Object[] params) { + if (params == null || params.length == 0) { + executeCall(); + return; + } + check(params); + executeCall0(params); + } + + private native void executeCall0(Object[] params); + +} diff --git a/java/src/com/eaio/nativecall/Win32Verifier.java b/java/src/com/eaio/nativecall/Win32Verifier.java new file mode 100644 index 0000000..b07f2cc --- /dev/null +++ b/java/src/com/eaio/nativecall/Win32Verifier.java @@ -0,0 +1,122 @@ +/* + * Win32Verifier.java + * + * Created on 08.09.2004. + * + * eaio: NativeCall - calling operating system methods from Java + * Copyright (c) 2004-2006 Johann Burkard () + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.eaio.nativecall; + +/** + * A {@link com.eaio.nativecall.Verifier} for the Windows environment. + * + * @author Johann Burkard + * @version $Id: Win32Verifier.java,v 1.3 2006/04/19 20:54:58 grnull Exp $ + */ +public class Win32Verifier implements Verifier { + + /** + * Constructor for Win32Verifier. Does nothing. + */ + public Win32Verifier() {} + + /** + * Verifies that the {@link java.lang.System} property "os.name" starts + * with "Windows". + * + * @see Verifier#supports() + */ + public boolean supports() throws SecurityException { + return System.getProperty("os.name").startsWith("Windows"); + } + + /** + * Returns the default module name if the module name is null + * or an empty String. If the module name contains forward slashes (/), they + * are converted to backward slashes (\). + * + * @see + * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp + * + * @see com.eaio.nativecall.Verifier#verifyModuleName(java.lang.String) + */ + public String verifyModuleName(String module) { + if (module == null || module.length() == 0) { + return getDefaultModule(); + } + if (module.indexOf('/') != -1) { + module = module.replace('/', '\\'); + } + return module; + } + + /** + * Throws a {@link java.lang.NullPointerException} if the function + * name is null or an empty String. No further processing is + * done. + * + * @see com.eaio.nativecall.Verifier#verifyFunctionName(java.lang.String) + */ + public String verifyFunctionName(String function) { + if (function == null || function.length() == 0) { + throw new NullPointerException(); + } + return function; + } + + /** + * Returns "kernel32". + * + * @return "kernel32" + * @see com.eaio.nativecall.Verifier#getDefaultModule() + */ + public String getDefaultModule() { + return "kernel32"; + } + + /** + * If the function name ends on 'W' (Windows' Unicode functions), a + * char array is returned, otherwise a byte array + * is returned. + *

+ * The arrays are always null-terminated. + * + * @see com.eaio.nativecall.Verifier#handleString(java.lang.String, + * java.lang.String, + * java.lang.String) + */ + public Object handleString(String val, String module, String function) { + if (function.charAt(function.length() - 1) == 'W') { + char[] buf = new char[val.length() + 1]; + val.getChars(0, val.length(), buf, 0); + return buf; + } + byte[] buf = new byte[val.length() + 1]; + val.getBytes(0, val.length(), buf, 0); + return buf; + } + +} diff --git a/java/src/com/eaio/nativecall/package.html b/java/src/com/eaio/nativecall/package.html new file mode 100644 index 0000000..ebbd694 --- /dev/null +++ b/java/src/com/eaio/nativecall/package.html @@ -0,0 +1,15 @@ + + + +Untitled Document + + +

Contains the main NativeCall classes.

+

For instant API information, see:

+
    +
  • {@link com.eaio.nativecall.NativeCall}
  • +
  • {@link com.eaio.nativecall.IntCall}
  • +
  • {@link com.eaio.nativecall.VoidCall}
  • +
+ +