Jump to content

CoderDunn

Active Members
  • Posts

    336
  • Joined

  • Last visited

About CoderDunn

  • Birthday 01/31/1991

Profile Information

  • Location
    Seattle, WA
  • Interests
    AutoIt3 ... of course!
    spending time with friends
    my electric guitar
    computer hardware

Recent Profile Visitors

628 profile views

CoderDunn's Achievements

Universalist

Universalist (7/7)

2

Reputation

  1. Thanks! It took a while to put it all together
  2. I'm currently taking an intermediate C++ course at college, and I wrote this file packer/unpacker for an assignment to showcase reading/writing binary files in C++. I figure some one here might have a use for it, so I converted it to a DLL and wrote the wrapper functions so you can use it in AutoIt3. Since I'm really bad at naming things, I'm calling it "Andy's File Packer" or "AFP" for short. I'm also using that as the file extension, but you can use any extension you want. Why use this over FileInstall? Well you can use a variable for the file name, and can extract all the files with a single loop, which is nice. Especially when you have a bunch of files. Unfortunately, it doesn't support compression. However, you could FileInstall() the AFP file and then extract it. Another advantage is that when you open an AFP file, only the embedded file table is loaded in memory. So no matter how big the AFP file is, it shouldn't use much memory (unless of course you pack thousands of files). All of the embedded files can be accessed and unpacked in any order. Example scripts are included to show how to pack and unpack files. It's pretty simple. The C++ source code for the DLL is included, and since I wrote this for a college course, practically every other line is commented. Here is a list of the functions: ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_CreateNew ; Description ...: Creates a new AFP file. Add files with _AFP_AddItem() and then compile the AFP with _AFP_Compile() ; Syntax.........: _AFP_CreateNew($dll, $filePath) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; $filePath - Path to the AFP file you wish to create ; Return values .: Success - 1 ; Failure - 0, sets @error and @extended (when needed) ; |1 - Error creating character array struct to hold the file name ; |2 - DLLCall encountered an error, more specific DLL error code is in @extended ; |3 - DLL function CreateAFPFile() encountered an error, specific error code is in @extended ; | @extended error codes: ; | 0 - Unable to open output file ($filePath) ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_CreateNew($dll, $filePath) ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_AddItem ; Description ...: Adds a file to the list of files that will be embedded in an AFP file (created via _AFP_CreateNew()) when ; _AFP_Compile() is called ; Syntax.........: _AFP_AddItem($dll, $descript, $type, $filePath) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; $descript - User defined string that describes the to-be-embedded file ; $type - User defined integer that describes the to-be-embedded file's type ; $filePath - Path to the file that will be embedded inside the AFP file ; Return values .: Success - 1 ; Failure - 0, sets @error and @extended (when needed) ; |1 - $filePath does not exist ; |2 - Error creating character array struct to hold the description ; |3 - Error creating character array struct to hold the file path ; |4 - $type is not an integer ; |5 - DLLCall encountered an error, more specific DLL error code is in @extended ; |6 - DLL function _AFP_AddItem() encountered an error, specific error code is in @extended ; | @extended error codes: ; | 0 - AFP file handle is closed or AFP file was opened via _AFP_Open() ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_AddItem($dll, $descript, $type, $filePath) ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_Compile ; Description ...: Takes all the files added via _AFP_AddItem() and packs them into a single AFP file ; Syntax.........: _AFP_Compile($dll, $bool_CloseHandle) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; $bool_CloseHandle - Boolean, use True if you want the AFP file handle to be closed when it's done being written ; Return values .: Success - 1 ; Failure - 0, sets @error and @extended (when needed) ; |1 - $bool_CloseHandle is not a boolean ; |2 - DLLCall encountered an error, more specific DLL error code is in @extended ; |3 - DLL function _AFP_Compile() encountered an error, specific error code is in @extended ; | @extended error codes: ; | 0 - AFP file handle is closed or AFP file was opened via _AFP_Open() ; | -1 - Error while writing the file header ; | -2 - Error while writing the embedded file table ; | -3 - Error while writing the embedded file's data (one of the files added via _AFP_AddItem() doesn't exist, ; or is inaccessible) ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_Compile($dll, $bool_CloseHandle = True) ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_Open ; Description ...: Opens an AFP file that was previously created via _AFP_CreateNew() ; Syntax.........: _AFP_Open($dll, $filePath) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; $filePath - Path to the AFP file you wish to open ; Return values .: Success - 1 ; Failure - 0, sets @error and @extended (when needed) ; |1 - Error creating character array struct to hold the file name ; |2 - DLLCall encountered an error, more specific DLL error code is in @extended ; |3 - DLL function OpenAFPFile() encountered an error, specific error code is in @extended ; | @extended error codes: ; | 0 - Unable to open input file ($filePath) ; | -1 - Unknown or corrupted file ; | -2 - Error while reading the file header ; | -3 - Error while reading the embedded file table ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_Open($dll, $filePath) ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_GetNumItems ; Description ...: Returns the number of embedded files within the AFP opened via _AFP_Open() ; Syntax.........: _AFP_GetNumItems($dll) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; Return values .: Success - The number of embedded files within the AFP file ; Failure - 0, sets @error and @extended (when needed) ; |1 - DLLCall encountered an error, more specific DLL error code is in @extended ; |2 - DLL function GetNumberOfItems() encountered an error, specific error code is in @extended ; | @extended error codes: ; | -1 - AFP file handle is closed ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_GetNumItems($dll) ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_GetItemInfo ; Description ...: Returns an array containing information about an embedded file within an AFP file that was opened via _AFP_Open() ; Syntax.........: _AFP_GetItemInfo($dll, $index) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; $index - Index of the embedded file (starting at 0) ; Return values .: Success - A four element array containing the following: ; $returnArr[0] - Description ; $returnArr[1] - Type ; $returnArr[2] - Position of the embedded file within the AFP (starting after the embedded file table's postion) ; $returnArr[3] - Size of the embedded file ; Failure - 0, sets @error and @extended (when needed) ; |1 - Index is out of range or AFP file handle is closed ; |2 - DLL function GetItemInfo() encountered an error ; |3 - Error creating a struct from the returned pointer, DllStructCreate() error code is in @extended ; |4 - Error creating description (char array) struct from pointer, DllStructCreate() error code is in @extended ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_GetItemInfo($dll, $index) ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_ExtractFile ; Description ...: Extracts a file from an AFP file that was opened via _AFP_Open() ; Syntax.........: _AFP_ExtractFile($dll, $index, $filePath) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; $index - Index of the file that you want to extract (starting at 0) ; $filePath - The file that it will be extracted to (Note: If file exists, it will be over written) ; Return values .: Success - 1 ; Failure - 0, sets @error and @extended (when needed) ; |1 - Error creating character array struct to hold the file name ; |2 - $index is not an integer ; |3 - DLLCall encountered an error, more specific DLL error code is in @extended ; |4 - DLL function ExtractFile() encountered an error, specific error code is in @extended ; | @extended error codes: ; | 0 - AFP file handle is closed or AFP file was opened via _AFP_CreateNew() ; | -1 - $index is out of bounds ; | -2 - Error opening output file path ; | -3 - Error reading embedded file data ; | -4 - Error writing embedded file data to output file ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_ExtractFile($dll, $index, $filePath) ; #FUNCTION# ==================================================================================================================== ; Name...........: _AFP_Close ; Description ...: Closes the AFP file handle that is opened after calling either _AFP_CreateNew() or _AFP_Open() ; Syntax.........: _AFP_Close($dll) ; Parameters ....: $dll - Handle to Andy's File Packer dll via DLLOpen() ; Return values .: Success - 1 ; Failure - 0, sets @error and @extended (when needed) ; |1 - DLLCall encountered an error, more specific DLL error code is in @extended ; Author ........: Andrew Dunn (forums: CoderDunn) ; =============================================================================================================================== Func _AFP_Close($dll) And for those interested, here is the binary format specifications for an AFP file The AFP Binary File Format Note for readability, I placed each separate piece on it's own line. However, in a real AFP file, they would all be on the same line with no delimiters. ======= Start of AFP File ======= [Null terminated string header, "Andy's File Packer 2.0"] [4 byte integer which holds the number of embedded files] ~ Begin Embedded File Table ~ [Embedded File 1 Description, null terminated string] [Embedded File 1 Type, 4 byte integer] [Embedded File 1 Position in AFP file, 4 byte integer] [Embedded File 1 Size, 4 byte integer] ... [Embedded File n Description, null terminated string] [Embedded File n Type, 4 byte integer] [Embedded File n Position in AFP file, 4 byte integer] [Embedded File n Size, 4 byte integer] ~ End Embedded File Table ~ ~ Start Embedded File Raw Data ~ [Embedded File 1 Raw Data] ... [Embedded File n Raw Data] ~ End Embedded File Raw Data ~ ======= End of AFP File ======= If you have any questions or run into any problems, let me know Download Here
  3. I figured it out, thanks! I changed the function to use a stdcall and a .def file to export the function, and now it works int _stdcall TestFunc(int x, int y) { return x + y; }
  4. I'm taking an intermediate C++ course in college, and I'm wondering how to write a DLL that can be called within AutoIt3. I tried to make a very simple dll with a function that adds two integers, however when I try to call it from within AutoIt, the script either locks up or throws an error 3 ("function" not found in the DLL file). I was able to compile an AutoIt plugin that worked fine, but I can't get a standard DLL to work ... Here is the dll (test dll.cpp): __declspec(dllexport) int TestFunc(int x, int y) { return x + y; } And here is the script: $dll = DllOpen("Test DLL.dll") if (@error) Then FatalError("Unable to open DLL") $result = DllCall($dll, "int", "TestFunc", "int", 3, "int", 4) if (@error) Then FatalError("Error calling DLL: " & @error) MsgBox(0, "Result", $result[0]) Func FatalError($msg) MsgBox(0, "Fatal Error", $msg) Exit EndFunc Any help would be much appreciated. Thanks, Andy
  5. Nope just been busy with school. It's my last year of highschool and I have a lot of after school activites, not to mention the massive 'Senior Project' we have to do. I'm not completely sure how do do a few things anyways so Iv'e been reading books I got from the local bookstore Thanks for letting me know, I'm completely rewriting my file transfer system so hopefully it will be fixed. About the screen shot thing ... That's wierd i'll try to re-create the error. Right now I'm looking into adding Lua support so people can make addons. ~ Hallman
  6. And mine was before yours XD http://www.autoitscript.com/forum/index.ph...c=42829&hl= Anyways looks great. Mine is very plain ...
  7. It's hard to say since I don't have a regular schedule, I just work on it when I can. Here's about how much I've done. Main UI = 70% done Other forms = 40% done Network engine = 95% done Network functions = 15% done I'll try to keep this updated ... CODE === September 11, 2008 === Sorry for no update in a while, first two weeks of school has kept me busy! - Planned out most of the server - Started working on the "File Transfer Service" which moves all file transfers into the same thread independent from the rest of the server. === August 30, 2008 === Going up in the mountains with my friend to ride quads, be back on Monday. School starts on Tuesday >.< === August 28, 2008 - Began to completely re-design the System Info tab so it's more organized, has more information, and takes less time to load === August 27, 2008 === - Added more functions for the Client List View Context Menu - Created a few methods for getting the selected client's info - Added Log off, hibernate, shut down, etc commands - Changed the wording of a few console messages - The IP column in the client list now includes the remote end point in parentheses EX: "192.168.1.100 (65.42.10.96:50431)" === August 26, 2008 === - Split client list view into two lists. One for online users, the other for offline users. - Added a context menu to the client list view with the "Set User Name" item - Ran a few stress tests, and fixed some major bugs causing the server to completely lock up if more than one user connected at the same time. === August 25, 2008 === After playing around with a few different ways to store data, I decided (at least for now) to use the registry to store settings and client information =O I know many people will complain about this but it works very well, and is less likely to have problems or get manually edited. === August 24, 2008 === Huge set back today, I just discovered my XML write method has some major problems. I need to rewrite it or find a better storage format. === August 23, 2008 === Just trying some new things out - Created template for "clients.xml" I plan on using this file to store client data when they are offline. - The client list is now "grouped" - Connected clients are under the "Online" group, disconnected users are under the "Offline" group - I'm in the process of removing all the message boxes, and replacing them with a "Message Log" tab on the main form. - Experimenting with a PCID filter - Experimenting with a "Status" tab that shows the current and total net usage. I'm thinking about adding an individual client net usage monitor. === August 22, 2008 === - Finished most of the network engine - Started the "Skin Editor" form - Added method to invoke functions on the UI thread ~ Hallman
  8. lol ... First of all, don't double post. Especially an inconsiderate post like yours. Second, if you want someone to get your point, it's proabably best not to contradict yourself in your first few, incomplete sentences. My "damn program sucks", and yet it's great? Third, before you complain about my FREE open source application, think about how much work it is to create what I have, or just the simple fact that you have not contributed a single thing to this forum. Fourth, If you could read, you would notice quite clearly the title says BETA, which means it's still in development. ~ Hallman
  9. You all are going to think I'm crazy but ... I have started to rewrite the server for a 4th time! Why? The previous one was fine but because the way it was set up, adding some of the newer features I wanted was next to impossible without fundamentally changing how the core of it works. What can I expect in the next version? A few of the things I'm working on right now: I finally figured out how to make the server resizable!Skin Editor to make your own skins for the serverA little more organizedThere will be a File Transfer tab with a queue for downloads/uploadsI should be ready with a release in a few weeks as I'm working on it in my free time between fixing up the house and getting it ready for sale. ~ Hallman
  10. Hey all sorry for the late reply. Iv'e been really busy lately because my dad has decided he hates the big city and he wants to move to Noth Dakota It sucks because I don't want to leave all my freinds behind We have been fixing up the house and getting it ready to sell. We still have a lot to do. Don't worry! I'll be back with in update in a few weeks. In my free time, iv'e been learning more of C# so I can fix many of the things I have done wrong, for example I never used the lock{ } keyword on objects shared between threads Anyways take care and wish me luck! ~ Hallman
  11. Hey guys muttley Just letting you know that I'm leaving on a road trip (I think my dad is crazy with the price of gas and all) and I won't be back until about the 28th. So, unfortunately the next release will have to wait until then. Happy coding! ~ Hallman
  12. Very nice GUI I could learn a thing or two from you I'll test the burning part later when I buy some CD-RW's. ~ Hallman PS Thank you very much for putting my app in your sig! muttley
  13. Ok I'll see if I can find a possible cause anyways. And your welcome muttley I'm glad to know that my work isn't all to waste
  14. Ok next step: Try running the client as a script and as a compiled script and see if they both don't work.
  15. lol Good Luck then! Cool muttley I'm glad it's fixed (I didn't so anything so yay it fixed itself ) Aha well it looks like the client isn't connecting for some reason. On the client machine, can you verify that when you start a new file transfer, there are two clients running in the task manager? I plan on doing a complete re-write of the "File Transfer" code for the next update. Hopefully it will fix this! lol good point. I think I will ... I agree, and I have already started working on it for the next version Your Welcome I'm glad it helped you. I am going to post the latest source code when I get it more stable. Right now I'm just updating to often. ~ Hallman
×
×
  • Create New...