Cyberworld Posted August 14, 2006 Share Posted August 14, 2006 I have made a test.dll, compiled it with MinGw/GCC and used it in AU3 without problems. So far so good, but there are still a couple of things(at the moment ) I need to know more about... 1. How do I pass my error code to "@error"? Should I use "AU3_PLUGIN_ERR for this?? (Can someone show me an example that sends the @error and exit the plugin?) 2. Is there a way to get an int directly? (Can I use AU3_GetInt32 for this or is the only way to use AU3_GetString and convert it back to an int?) (In that case, how can I check that the received parameter actually is an int and not a string?) I have looked at JSThePatriot's hash.dll for clues but that did not help me much since the error handling there does not work properly, it just hardcrashes au3. (Is he doing something wrong or is the SDK outdated?) Are there any plans to update the Plugin SDK with more detailed source examples in the near future? Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 15, 2006 Administrators Share Posted August 15, 2006 I have made a test.dll, compiled it with MinGw/GCC and used it in AU3 without problems. So far so good, but there are still a couple of things(at the moment ) I need to know more about...I've not looked at it for a while... 1. How do I pass my error code to "@error"? Should I use "AU3_PLUGIN_ERR for this?? (Can someone show me an example that sends the @error and exit the plugin?)In this part of example.c /* Pass back the result, error code and extended code. * Note: AutoIt is responsible for freeing the memory used in p_AU3_Result */ *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 0; *n_AU3_ExtCode = 0; return AU3_PLUGIN_OK; Just replace *n_AU3_ErrorCode = 0, with the error code you want to return. 2. Is there a way to get an int directly? (Can I use AU3_GetInt32 for this or is the only way to use AU3_GetString and convert it back to an int?) (In that case, how can I check that the received parameter actually is an int and not a string?)Yes, you can just use AU3_GetInt32(). Use AU3_GetType() if you want to see what the type is, but GetInt32 will force it anyway. Are there any plans to update the Plugin SDK with more detailed source examples in the near future?Yes, it's still only a prototype atm. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 ...In this part of example.c /* Pass back the result, error code and extended code. * Note: AutoIt is responsible for freeing the memory used in p_AU3_Result */ *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 0; *n_AU3_ExtCode = 0; return AU3_PLUGIN_OK; Just replace *n_AU3_ErrorCode = 0, with the error code you want to return. Have there been any changes to this in AU3 lately? Because if I change it to: "*n_AU3_ErrorCode = 1;" (or any of the other return codes) and then use this code from the example: msgbox(0,""," @error: " & @error & " @extended: " & @extended) Nothing happens. It still give me @error = 0. I have also tried to cancel the execution of the rest of the code and exit the plugin but that does just result in a hardcrash. Example... *n_AU3_ErrorCode = 1; return AU3_PLUGIN_ERR; Yes, you can just use AU3_GetInt32(). Use AU3_GetType() if you want to see what the type is, but GetInt32 will force it anyway. I tried with this but that doesn't compile... int test; ... test = AU3_GetInt32(&p_AU3_Params[1]); .... What's wrong Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 15, 2006 Administrators Share Posted August 15, 2006 *n_AU3_ErrorCode = 1; return AU3_PLUGIN_ERR; should be: *n_AU3_ErrorCode = 1; return AU3_PLUGIN_OK; If that doesn't work then the plugin sdk is broken. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 *n_AU3_ErrorCode = 1; return AU3_PLUGIN_ERR; should be: *n_AU3_ErrorCode = 1; return AU3_PLUGIN_OK; If that doesn't work then the plugin sdk is broken. I see.. no that will not change anything. The error code returned is always "0". Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 15, 2006 Administrators Share Posted August 15, 2006 Hmm, works here. I downloaded the sdk, changed the 0 to 1 in the example.c. Compiled it and then ran the autoit code $handle = PluginOpen("example.dll") $retval = PluginFunc1("Hello", "Test") msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended) PluginClose($handle) And it printed @error = 1 Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 Hmm. Strange, It seems that there is something in my source that force the @error to 0 somehow. I tried with an unmodified code and it worked better. How about AU3_GetInt32 do you have any hints there? Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 15, 2006 Administrators Share Posted August 15, 2006 /**************************************************************************** * PluginFunc1() * * PluginFunc1(number) * ****************************************************************************/ AU3_PLUGIN_DEFINE(PluginFunc1) { AU3_PLUGIN_VAR *pMyResult; int nNum; nNum = AU3_GetInt32(&p_AU3_Params[0]); /* Do the message box */ if (nNum == 100) MessageBox(NULL, "You passed the number 100", "Test", MB_OK); /* Allocate and build the return variable */ pMyResult = AU3_AllocVar(); /* Set the return variable */ AU3_SetInt32(pMyResult, 0); /* Pass back the result, error code and extended code. * Note: AutoIt is responsible for freeing the memory used in p_AU3_Result */ *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 0; *n_AU3_ExtCode = 0; return AU3_PLUGIN_OK; } It works but I get a compiler warning, i need to add some const keywords to au3plugins.h I think. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 15, 2006 Share Posted August 15, 2006 @Cyberworld I have been unable to get the AU3_GetInt32() to work properly. I have used AU3_GetString(), and converted the returned value to an int and a bool as shown in my updated source code. Have you tried the new version of my DLL? Is that still crashing? I havent had any problems with it. I had to re-write alot of it between my first release and this last one. Thanks, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 OK, I continue to play around little with the SDK until the next update. I solved the mystery with the returned error code. If I convert the result ($retval) to hex then the error code returned will always be "0". I change the example to return an int. AU3_SetInt32(pMyResult, 1234); Then did I make my AU3 code convert the result to hex. msgbox(0,"",Hex($retval) & " @error: " & @error & " @extended: " & @extended) The returned error code I got was the one from the hex conversation and not the one from the plugin. Since the Hex conversation succeeded was the error code set to "0" and the error returned from the plugin was never displayed! Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 @JSThePatriotThe one I have tried is the one included with the source, that is linked from the first message here: http://www.autoitscript.com/forum/index.php?showtopic=21010 Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 15, 2006 Administrators Share Posted August 15, 2006 I've upload a new sdk to http://www.autoitscript.com/autoit3/files/beta/plugin_sdk/I've tested it with devc++ and it works fine.It comes with two examples: PluginMsgBox (same as last time) and PluginAdd which just adds two int32 numbers together, shows how to use the GetType and GetInt32 functions. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 15, 2006 Share Posted August 15, 2006 @JSThePatriotThe one I have tried is the one included with the source, that is linked from the first message here: http://www.autoitscript.com/forum/index.php?showtopic=21010Before or after I updated on Aug 12 2006, 05:20 AM?Thanks,JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 15, 2006 Share Posted August 15, 2006 I've upload a new sdk to http://www.autoitscript.com/autoit3/files/beta/plugin_sdk/I've tested it with devc++ and it works fine.It comes with two examples: PluginMsgBox (same as last time) and PluginAdd which just adds two int32 numbers together, shows how to use the GetType and GetInt32 functions.Thanks Jon, I'll look at it right now. For some reason I cant ever get them to work with either Dev's C++ nor Code::Blocks, but both are using the same compiler.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 Well done Jon, Now can I continue to play with MinGW and the plugins Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 JSThePatriot, I did download the source again today. The .dll included was modified: 12 augusti 2006, 04:59:42. Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 15, 2006 Share Posted August 15, 2006 JSThePatriot,I did download the source again today. The .dll included was modified: 12 augusti 2006, 04:59:42.Still giving you troubles?JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 Yes. The plugin will crash if I don't create the file "nada.txt" before I run it. Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 15, 2006 Share Posted August 15, 2006 Yes. The plugin will crash if I don't create the file "nada.txt" before I run it.Ah okay... so it is missing a bit of error handling if the file doesnt exist.Well I am trying to get the new plugin sdk under control. I am fixing to post a question for Jon regarding this.If you have any more trouble after my next update then please post in the thread. I would be more than happy to work through things.Thanks,JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Cyberworld Posted August 15, 2006 Author Share Posted August 15, 2006 Yes, the problem is: (dllHash.cpp)Line 124: Here do you call the "FileSHAEncrypt function"... else if (i_Hash == 2) {s_Hash = FileSHAEncrypt(s_FileName);} And check for errors here: (JSsha.cpp) Line 97-98: fIn = fopen(sFilename, "rb"); if(fIn == NULL) return false; I'm not sure if your check against the NULL pointer works, if it does then you don't have any further check that takes care of the error anyway.. that's the reason for the crash. I use to check if a file was found/opened successfully like this: if (!file) return false; ...And you don't need to set: fIn = NULL; at line 127. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now