Jump to content

pcuser_tom

Member
  • Posts

    19
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About pcuser_tom

Contact Methods

  • Website URL
    http://www.ezpcfix.net

pcuser_tom's Achievements

0

Reputation

  1. LLXX, I know this is an old thread but I was wondering if you'd be willing to share your ASM code and send it to me via email. I'm using ThunderVB to add inline ASM to some of my VB programs and it would be great to be able to use an MD5 function coded in ASM without using an external dll.
  2. I'm trying to convert this simple vb6 code to ASP but I just can't figure out how to do it. Open File1 For Binary As 1 Open File2 For Binary As 2 For i = 1 To LOF(1) Get #1, , mybyte ' Manipulate mybyte here Put #2, , mybyte Next Close 2 Close 1 How do I read/write a binary file in ASP? Tom
  3. What programming languages are you familiar with? HERE'S an example vb6 project that shows you how to start and stop a specific program. Add a timer control and you should atleast have enough to get you headed in the right direction.
  4. This one really has me stumped! SubinACL seems to be the only way I've seen to be able to take ownership of this key. The SetPerm example is the closest I've found but it seems to use the same method as regedit which results in "access denied". Does anyone know of a good api spy program that will show me the functions that subinacl uses to accomplish this?
  5. You can download any file using this simple code: Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long Private Sub Command1_Click() URLDownloadToFile 0, "http://www.yoursite.com/yourfile.txt", App.Path & "\" & "yourfile.txt", 0, 0 End Sub The first param is the URL and file to download and the second param is where you want to save it to.
  6. Thank you, expect an email from PCUSER. My project is working great but I'd love to see you're implementation even if it's just for knowledge. I have it hashing 100+ mb (around 4,500 files) in about 30 seconds now with no dll's or external depends but I'm curious to see the algorithm used in your dll. Tom
  7. I'm trying to figure out how to set registry permissions using the win32 api via vb6 but I'm not getting anywhere very fast. The problem is that some Dell oem xp cd's have a controlset001\services\iastor key that has 2 unknown/bogus DACL's set to: OWNER = S-1-5-21-846617511-297957836-1346600456-1005 GROUP = S-1-5-21-846617511-297957836-1346600456-513 If you mount the i386\setupreg.hiv in regedit and navigate to the iastor key, you get "Access Denied" and it causes trouble when building with BartPE. I would like to clear those SID's from the ACL and add the administrators group (S-1-5-32-544) and my own owner (currently logged in user). SubInAcl does this just fine using this from the commandline (uses the security attribs from it's parent key): subinacl /subkeyreg hkey_local_machine\dell\controlset001\services\iastor\ /objectcopysecurity=hkey_local_machine\dell\controlset001\services so I know it can be done (.NET is not an option). Any help would be greatly appreciated. Tom
  8. I found a better solution than what I was trying to do HERE. Hopefully it'll help someone else out that's looking for a good MD5 routine in VB6. It uses the builtin function of advapi.dll and is very fast. Thanks for all the help and suggestions Tom
  9. no If I admit it, will you help me figure out what I'm doing wrong in my code?
  10. Here's the example C++ program with the DigestFile( char *szFName ) function that I'm trying to convert to vb. #include "mdx.h" #include <stdlib.h> #include <stdio.h> #include <string.h> // READLEN % 64 must = 0 #define READLEN 1048576L // 2^20, 1MB void DigestFile( char * ); void DigestString(); void main(int argc, char *argv[]) { printf("%s\n\n", MDxGetVersion()); if( argc > 1 ) DigestFile( argv[1] ); else DigestString(); } /* I use the 'chunk' method for processing files not because of limitations of my dll, but think what would happen if you tried to load an entire cd image into memory. */ void DigestFile( char *szFName ) { FILE *file; void *lpData; long flen, mlen; MDxSum mdDataSum; MDxSum md4DataSum; // the 64 is for padding purposes lpData = malloc( READLEN + 64 ); printf( "MD4/5 Digests of \"%s\":\n", szFName ); file = fopen( szFName, "rb" ); if( file == NULL ) { printf("ERROR: File not found.\n"); return; } MDxInit( &mdDataSum ); MDxInit( &md4DataSum ); fseek( file, 0, SEEK_END ); //Get the file length flen = mlen = ftell( file ); fseek( file, 0, SEEK_SET ); // When it takes a while to process a large file, // remember that for each chunk it has to run // through the main translation loop 16384 times! printf("Processing %ld byte file: .", flen ); while( flen > READLEN ) { if( fread( lpData, 1, READLEN, file ) != READLEN) { printf("READ ERROR!\n"); return; } MD5Translate( lpData, READLEN, &mdDataSum ); MD4Translate( lpData, READLEN, &md4DataSum ); flen -= READLEN; printf("."); } if (fread( lpData, 1, flen, file ) != flen) { printf("READ ERROR!\n"); return; } // This is why I added the new argument to MDxPad // So we can pass the length of the data AND the // Total length of the message // Also it now returns the # of padding bytes added, // this is for files that are an exact multiple of the chunk // length. (Otherwise the padding isn't Translated) flen += MDxPad( lpData, flen, mlen ); MD5Translate( lpData, flen, &mdDataSum ); MD4Translate( lpData, flen, &md4DataSum ); // New step necessary because of the 'chunking' method MDxFinalize( &mdDataSum ); MDxFinalize( &md4DataSum ); printf("\nMD4: %08x%08x%08x%08x\n", md4DataSum.dwSum[0], md4DataSum.dwSum[1], md4DataSum.dwSum[2], md4DataSum.dwSum[3]); printf("MD5: %08x%08x%08x%08x\n", mdDataSum.dwSum[0], mdDataSum.dwSum[1], mdDataSum.dwSum[2], mdDataSum.dwSum[3]); fclose(file); } void DigestString() { //For our demo purposes, no strings bigger than 1024 :) unsigned char lpData[1024] = ""; long len = 0; MDxSum mdDataSum; printf("Enter the string to digest: "); scanf("%s", &lpData ); len = strlen(lpData); // Have to do this before the Padding...well...it's best anyway;) printf( "MD4/5 Digests of \n\"%s\":\n", lpData ); // For the strings, we're gonna pad and digest the string // in one pass. MDxInit( &mdDataSum ); MDxPad( lpData, len, len ); MD5Translate( lpData, len, &mdDataSum ); // New step necessary because of the 'chunking' method MDxFinalize( &mdDataSum ); printf("MD5: %08x%08x%08x%08x\n", mdDataSum.dwSum[0], mdDataSum.dwSum[1], mdDataSum.dwSum[2], mdDataSum.dwSum[3]); MDxInit( &mdDataSum ); MD4Translate( lpData, len, &mdDataSum ); printf("MD4: %08x%08x%08x%08x\n", mdDataSum.dwSum[0], mdDataSum.dwSum[1], mdDataSum.dwSum[2], mdDataSum.dwSum[3]); return; } and the include file: #ifndef __windows_h__ typedef unsigned long DWORD; #define STDCALL _stdcall #endif typedef struct { DWORD dwSum[4]; }MDxSum; DWORD STDCALL MDxPad ( unsigned char *, unsigned long, unsigned long ); void STDCALL MDxInit( MDxSum * ); void STDCALL MD5Translate( unsigned char *, long, MDxSum * ); void STDCALL MD4Translate( unsigned char *, long, MDxSum * ); const char * STDCALL MDxGetVersion(); void STDCALL MDxFinalize( MDxSum * );
  11. Thanks for sharing your code Tarun. I haven't tried it yet but I already have an md5 module but it's way too slow. I'm going to be hashing about 4,000 files and some of them are 5-8mb in size. I try out your module though.
  12. The MDxPad function pads the string to be divisable by 64 (and returns the number of bytes that it padded) so it shouldn't matter if you pass it 30000, 32768 or 3. A string in vb has a maximum value of 32768 so that's what I'm stuck with but that's ok. I already have a vb routine that shells out to md5deep and captures the output but doing it like that is painfully slow, that's why I was looking for a dll to use as an alternative. BTW. 30k isn't the same as 30kb Thanks again for the help.
  13. paraglider pointed me in the right direction on another forum. I had to change: Dim lpData as String to Dim lpData as String * 30000 The above function is working fine now and produces an md5 hash for files (under 30k) as fast as I can feed them to it I wanted to make sure the basic function was working with entire smaller files before moving on to splitting larger files and processing the chunks. Now I'm having trouble with it not returning the correct md5 hash for larger files that were processed in chunks. Here's the entire vb6 form that includes the all the code. Private Declare Function MD4Translate Lib "mdx.dll" (ByVal MyString As String, ByVal MyLong As Long, ByRef MySum As MDxSum) As Long Private Declare Function MD5Translate Lib "mdx.dll" (ByVal MyString As String, ByVal MyLong As Long, ByRef MySum As MDxSum) As Long Private Declare Function MDxFinalize Lib "mdx.dll" (ByRef MySum As MDxSum) As Long Private Declare Function MDxGetVersion Lib "mdx.dll" () As Long Private Declare Function MDxInit Lib "mdx.dll" (ByRef MySum As MDxSum) As Long Private Declare Function MDxPad Lib "mdx.dll" (ByVal MyString As String, ByVal MyLong As Long, ByVal MyLong As Long) As Long Private Type MDxSum dwSum(3) As Long End Type Dim md5DataSum As MDxSum Dim lpData As String * 30000 Dim MyFile As String Private Function GetHash(fName As String) MyFile = fName MDxInit md5DataSum If FileLen(MyFile) = 0 Then Exit Function If FileLen(MyFile) <= 30000 Then ' The file is less than or equal to 30k Open MyFile For Binary As #1 lpData = Input(LOF(1), 1) Close #1 DoEvents MDxInit md5DataSum MDxPad lpData, FileLen(MyFile), FileLen(MyFile) MD5Translate lpData, FileLen(MyFile), md5DataSum MDxFinalize md5DataSum GetHash = Hex(md5DataSum.dwSum(0)) & Hex(md5DataSum.dwSum(1)) & Hex(md5DataSum.dwSum(2)) & Hex(md5DataSum.dwSum(3)) Exit Function End If If FileLen(MyFile) > 30000 Then ' The file is greater that 30k - process it in 30k chunks Open MyFile For Binary As #1 For i = 1 To LOF(1) Step 30000 DoEvents If LOF(1) >= i + 30000 Then lpData = Input(30000, 1) MD5Translate lpData, Len(lpData), md5DataSum Else ' There's less than 30k until the end of the file so ' pad it then call translate one more time then finish up MDxPad lpData, Len(lpData), FileLen(MyFile) MD5Translate lpData, Len(lpData), md5DataSum MDxFinalize md5DataSum GetHash = Hex(md5DataSum.dwSum(0)) & Hex(md5DataSum.dwSum(1)) & Hex(md5DataSum.dwSum(2)) & Hex(md5DataSum.dwSum(3)) Close #1 Exit Function End If Next End If End Function Private Sub Form_Load() MsgBox GetHash("C:\ntdetect.com") End End Sub I'm sure it's something simple that I didn't translate correctly from the sample C++ program in the download but I can't figure out what it is. Any ideas? Thanks for the link to the .NET code, I'm sure I'll be using it for alot of other projects that need a MD5 routine but this one can't be .NET and will need to be ran from PE/BartPE as well as windows. Thanks for the help and suggestions so far.
  14. I've been trying to write a routine in VB that calculates an md5 hash for every file in a directory and all sub directories and outputs the results into a txt file. VB is WAY to slow to do anything like this but I found a dll called mdx.dll written in assembler by RudeBoy and is lightning fast! You can download his source files and binary dll HERE The zip file includes an example C++ program to demonstrate how to use the dll. I made a vb6 module to interface the dll and it works great to calculate the md5 for a single file. My problem is that I'm usung FindFirstFile and FindNextFile api's to enumerate files very fast and feed them to the the function and it crashes the dll. Here's my VB6 module to interface the dll. Private Declare Function MD4Translate Lib "mdx.dll" (ByVal MyString As String, ByVal MyLong As Long, ByRef MySum As MDxSum) As Long Private Declare Function MD5Translate Lib "mdx.dll" (ByVal MyString As String, ByVal MyLong As Long, ByRef MySum As MDxSum) As Long Private Declare Function MDxFinalize Lib "mdx.dll" (ByRef MySum As MDxSum) As Long Private Declare Function MDxGetVersion Lib "mdx.dll" () As Long Private Declare Function MDxInit Lib "mdx.dll" (ByRef MySum As MDxSum) As Long Private Declare Function MDxPad Lib "mdx.dll" (ByVal MyString As String, ByVal MyLong As Long, ByVal MyLong As Long) As Long Type MDxSum dwSum(3) As Long End Type Dim MyFile As String Dim md5DataSum As MDxSum Dim lpData As String Public Function GetHash(fName As String) MyFile = fName MDxInit md5DataSum If FileLen(MyFile) = 0 Then Exit Function Open MyFile For Binary As #1 If FileLen(MyFile) <= 30000 Then lpData = Input(LOF(1), 1) MDxPad lpData, FileLen(MyFile), FileLen(MyFile) MD5Translate lpData, FileLen(MyFile), md5DataSum MDxFinalize md5DataSum GetHash = Hex(md5DataSum.dwSum(0)) & Hex(md5DataSum.dwSum(1)) & Hex(md5DataSum.dwSum(2)) & Hex(md5DataSum.dwSum(3)) Close #1 Exit Function End If Close #1 End Function This code works great to hash a single file but crashes if I feed files to it too fast. BTW. It currently only hashes files less than 30k so it can read the entire file at one time. Can anyone compare my vb code to the sample C++ program that's included in the download to see what I'm doing wrong? I also want to add the ability to "chunk" larger files but I need to figure out what I'm doing wrong with the basic function first. Tom
×
×
  • Create New...