Jump to content
Excelsior Forums

tkleiber

Members
  • Content count

    0
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About tkleiber

  • Rank
    Newbie
  • Birthday 02/19/70

Contact Methods

  • Website URL
    http://www.ikb.de
  1. Error: "Class <...> not found" at runtime

    Ok, I this helps me an step further. At this time I make my call: ... System.out.println("Start createProcess>" + lpCommandLine + "<"); System.out.println("lpStartupInfo.wShowWindow>" + lpStartupInfo.wShowWindow + "<"); System.out.println("lpStartupInfo.dwFlags>" + lpStartupInfo.dwFlags + "<"); xFunction oFunction = new xFunction("kernel32", "int CreateProcessA(CSTRING, CSTRING, de.ikb.forms.execLoader_jpi$securityAttributes*, " + "de.ikb.forms.execLoader_jpi$securityAttributes*, int, int, int, CSTRING, " + "de.ikb.forms.execLoader_jpi$startupInfo*, " + "de.ikb.forms.execLoader_jpi$processInformation*)"); System.out.println("create Arguments"); Argument[] arrArgs = new Argument[10]; arrArgs[0] = new Argument("", Argument.CSTRING); arrArgs[1] = new Argument(lpCommandLine, Argument.CSTRING); arrArgs[2] = Pointer.createPointerTo(new securityAttributes()); arrArgs[3] = Pointer.createPointerTo(new securityAttributes()); arrArgs[4] = new Argument(0); arrArgs[5] = new Argument(1); arrArgs[6] = new Argument(0); arrArgs[7] = new Argument("", Argument.CSTRING); arrArgs[8] = Pointer.createPointerTo(lpStartupInfo); arrArgs[9] = Pointer.createPointerTo(lpProcessInformation); int intRet = ((Integer) oFunction.invoke(arrArgs)).intValue(); System.out.println("intRet>" + intRet + "<"); ... My outputs shows following: ... Start createProcess>Notepad.exe< lpStartupInfo.wShowWindow>1< lpStartupInfo.dwFlags>1< create Arguments intRet>0< ... Return 0 should mean that notepad is opened. But notepad is not opened as I want. I cannot see it on desktop or in task manager as I want.
  2. Error: "Class <...> not found" at runtime

    Ok! Have changed the full name of the classes but get a new error yet: Structure subclass 'de.ikb.forms.execLoader_jpi$processInformation' must have constructor without arguments com.excelsior.xFunction.IllegalSignatureException: Structure subclass 'de.ikb.forms.execLoader_jpi$processInformation' must have constructor without arguments But I have defined the constructor: class processInformation extends Structure { int hProcess; int hThread; int dwProcessId; int dwThreadId; public processInformation() { } public String defineLayout() { return "int hProcess, int hThread, int dwProcessId, int dwThreadId"; } }
  3. Error: "Class <...> not found" at runtime

    Get the same error when I test the example where.java, which is the delivered with trial version of xFunction: com.excelsior.xFunction.IllegalSignatureException: Class 'WIN32_FIND_DATA' not found But sample11.java works. The only difference I see, in sample11.java in the default constructor of the class is initialized an array szCSDVersion. I'm using Sun SDK 1.4.2_03
  4. I define following in my code: public class execLoader_jpi extends VBean { ... ?private boolean createProcess(String lpCommandLine, int dwCreationFlags, ? ?startupInfo lpStartupInfo, processInformation lpProcessInformation) { ? ?try { ? ? ?System.out.println("Start createProcess"); ? ? ?xFunction oFunction = new xFunction("kernel32", ? ? ? ? ?"int CreateProcessA(CSTRING, CSTRING, de.ikb.forms.execLoader_jpi.securityAttributes*, " + ? ? ? ? ?"de.ikb.forms.execLoader_jpi.securityAttributes*, boolean, int, int, CSTRING, " + ? ? ? ? ?"de.ikb.forms.execLoader_jpi.startupInfo*, de.ikb.forms.execLoader_jpi.processInformation*)"); ? ? ?System.out.println("create Arguments"); ... ?class securityAttributes extends Structure { ? ?int nLength; ? ?int lpSecurityDescriptor; ? ?boolean bInheritHandle; ? ?public securityAttributes() { ? ?} ? ?public String defineLayout() { ? ? ?return "int nLength, int lpSecurityDescriptor, boolean bInheritHandle"; ? ?} ?} } I have tried with / without full package declaration in signature and with local class to createProcess method. I get always at runtime error messages similar to: Start createProcess Class 'de.ikb.forms.execLoader_jpi.securityAttributes' not found
  5. no result from kernel32l GetPrivateProfileS

    Thank you, I have successfully implemented the call.
  6. How to map windows types

    Thank you for your help! Have successfully build the call.
  7. How to map windows types

    Ok - have defined an array of Argument: Argument[] arrArgs = new Argument[6]; ... arrArgs[3] = (Pointer)Argument.create("int*", new int[4]); ... How I can cast this later back to a String? Class Argument does not contain deref or cast method! Thank you!
  8. How to map windows types

    How do I mix Pointer and Argument in my Array? I have 6 parameter for the function, so I think I have to use an array. If I create a Pointer array, how I have to define second parameter? Following code: Pointer[] arrPtr = new Pointer[6]; arrPtr[0] = Pointer.createPointerTo(i_intKey); arrPtr[1] = (Pointer) new Argument(i_sValueName, Argument.CSTRING); ... compiles fine, but gives runtime error java.lang.ClassCastExcepiton in the line for arrPtr[1].
  9. How to map windows types

    I have changed third argument to int in the signature and use Pointer.NULL: // arrArgs[2] = new Argument("", Argument.CSTRING); arrArgs[2] = Pointer.NULL; I get: The argument number '2' is not compatible with the one specified in signature. Could it be that an int can not be null?
  10. no result from kernel32l GetPrivateProfileS

    For this problem this was the solution. So I wrote a error formatting routine for reading system messages: public class error { public String formatMessage(int i_intMessageId) { try { xFunction oFunction = new xFunction("kernel32", "int FormatMessageA(CSTRING, int, int, int, CSTRING, int, CSTRING)"); System.out.println("i_intMessageId>" + i_intMessageId + "<"); Argument[] arrArgs = new Argument[7]; arrArgs[0] = new Argument("FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM ", Argument.CSTRING); arrArgs[1] = new Argument(0); arrArgs[2] = new Argument(i_intMessageId); arrArgs[3] = new Argument(0); arrArgs[4] = new Argument("", Argument.CSTRING, 65536); arrArgs[5] = new Argument(65536); arrArgs[6] = new Argument("", Argument.CSTRING); int intRet = ((Integer) oFunction.invoke(arrArgs)).intValue(); String sMessage = (String) arrArgs[4].getValue(); System.out.println("intRet>" + intRet + "<"); System.out.println("sMessage>" + sMessage + "<"); return sMessage; } catch (xFunctionException e) { System.out.println(e.getMessage()); return null; } } } But it does nor return the message: i_intMessageId>87< intRet>0< sMessage>< What is wrong here?
  11. How to map windows types

    Hi! Is there any documentation how I have to map windows types to java types for using xFunction? Especially I need examples for following types: HKEY DWORD REGSAM PHKEY LONG LPCVOID LPDWORD LPBYTE I need to read the registry, one example is: ?public String getKey(String i_sHKey, String i_sValueName) { ? ?try { ? ? ?// UNICODE-Variante RegQueryValueExW funtioniert nicht unter XP ? ? ?xFunction oFunction = new xFunction("advapi32", ? ? ? ? ?"int RegQueryValueExA(CSTRING, CSTRING, CSTRING, CSTRING, CSTRING, int)"); ? ? ?System.out.println("i_sHKey>" + i_sHKey + "<"); ? ? ?System.out.println("i_sValueName>" + i_sValueName + "<"); ? ? ?int intPcbData = 32000; ? ? ?Argument[] arrArgs = new Argument[6]; ? ? ?arrArgs[0] = new Argument(i_sHKey, Argument.CSTRING); ? ? ?arrArgs[1] = new Argument(i_sValueName, Argument.CSTRING); ? ? ?arrArgs[2] = new Argument("", Argument.CSTRING); ? ? ?arrArgs[3] = new Argument("", Argument.CSTRING); ? ? ?arrArgs[4] = new Argument("", Argument.CSTRING, intPcbData); ? ? ?arrArgs[5] = new Argument(intPcbData); ? ? ?int intRet = ((Integer) oFunction.invoke(arrArgs)).intValue(); ? ? ?String sData = (String) arrArgs[4].getValue(); ? ? ?System.out.println("intRet>" + intRet + "<"); ? ? ?System.out.println("sData>" + sData + "<"); ? ? ?return (sData); ? ?} catch (xFunctionException e) { ? ? ?System.out.println(e.getMessage()); ? ? ?return (null); ? ?} ?} But I get: i_sHKey>HKEY_CURRENT_USER< i_sValueName>Software\IKB\OracleFileServer< intRet>87< sData>< Return value of 87 means wrong parameter.
  12. Hi! I have successfully built an implementation of the kernel32.dll WritePrivateProfileStringA and create my ini file with sections and values. But when I build a n implemantation GetPrivateProfileStringA the procedure returns without results. In windows SDK this is defined as DWORD GetPrivateProfileString( ?LPCTSTR lpAppName, ?LPCTSTR lpKeyName, ?LPCTSTR lpDefault, ?LPTSTR lpReturnedString, ?DWORD nSize, ?LPCTSTR lpFileName ); This is the implemematation: ?private boolean getString(String i_sAppName, String i_sKeyName, ? ?String i_sDefault, String i_sReturnedString, int i_nSize, String i_sFileName) { ? ?try { ? ? ?xFunction oFunction = new xFunction("kernel32", ? ? ? ? ?"int GetPrivateProfileStringA(CSTRING, CSTRING, CSTRING, CSTRING, int, CSTRING)"); ? ? ?Argument[] arrArgs = new Argument[6]; ? ? ?arrArgs[0] = new Argument(i_sAppName, Argument.CSTRING); ? ? ?arrArgs[1] = new Argument(i_sKeyName, Argument.CSTRING); ? ? ?arrArgs[2] = new Argument(i_sDefault, Argument.CSTRING); ? ? ?arrArgs[3] = new Argument(i_sReturnedString, Argument.CSTRING); ? ? ?arrArgs[4] = new Argument(i_nSize); ? ? ?arrArgs[5] = new Argument(i_sFileName, Argument.CSTRING); ? ? ?int intRet = ((Integer) oFunction.invoke(arrArgs)).intValue(); ? ? ?System.out.println("intRet>" + intRet + "<"); ? ? ?String sValue0 = (String) arrArgs[0].getValue(); ? ? ?System.out.println("sValue0>" + sValue0 + "<"); ? ? ?String sValue1 = (String) arrArgs[1].getValue(); ? ? ?System.out.println("sValue1>" + sValue1 + "<"); ? ? ?String sValue2 = (String) arrArgs[2].getValue(); ? ? ?System.out.println("sValue2>" + sValue2 + "<"); ? ? ?String sValue3 = (String) arrArgs[3].getValue(); ? ? ?System.out.println("sValue3>" + sValue3 + "<"); ? ? ?int intValue4 = ((Integer) arrArgs[4].getValue()).intValue(); ? ? ?System.out.println("intValue4>" + intValue4 + "<"); ? ? ?String sValue5 = (String) arrArgs[5].getValue(); ? ? ?System.out.println("sValue5>" + sValue5 + "<"); ? ? ?return (true); ? ?} catch (xFunctionException e) { ? ? ?System.out.println(e.getMessage()); ? ? ?return (false); ? ?} ?} If I make a call to an existent ini file, with any combination of existent or nonexistent section and value combination I get: ... sValue3>< intValue4>0< ... I don't no what's wrong? Do I have to create the pointer for sValue3? How to this with 6 arguments? Or has it somthing to do with lpReturnedString, which should deliver a StringBuffer in my Opinion? regards Torsten Kleiber
×