?
Solved

ADDING A CHECKSUM TO A VB6 ACTIVEX MODULE AND CHECK AT PROGRAM START IF STILL VALID CHECKSUM

Posted on 2008-06-19
6
Medium Priority
?
588 Views
Last Modified: 2008-06-22
I use a activex module to control the comport connected to a scale and a scanner.
By Dutch law it must be impossible for a user to change the activex module in any way, so that after the tested it, they can control later on
if the software version is different then the one they tested.
How to add a checksum to the Activex and then when starting the program wich uses it,  check for valid checksum, so I can abort if changed
0
Comment
Question by:BIAPRO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:peetm
ID: 21823321
MapFileAndCheckSum is what I always use:

http://msdn.microsoft.com/en-us/library/ms680355(VS.85).aspx

0
 

Author Comment

by:BIAPRO
ID: 21823386
I took a look at this link, I believe it will do what I need, but far above my level of understandimg without some source code sample how to use this while/after compiling the ocx file, and when starting my vb program how to check if still ok.
But thanks for time anyway
0
 
LVL 10

Accepted Solution

by:
peetm earned 1500 total points
ID: 21823499
Here's a cut 'n paste from one of my projects.

Public Declare Function MapFileAndCheckSum Lib "imagehlp.dll" Alias "MapFileAndCheckSumA" (ByVal fileName As String, ByRef HeaderSum As Long, ByRef CheckSum As Long) As Long


' ================================================
' Uses imghelp.dll to calculate a file's checksum.
'
' This routine could be used to verify that files have been copied/moved ok.
'
Public Function CheckSumOfFile(ByRef fileName As String) As Long

    Dim CalcedCheckSum As Long
    Dim HeaderCheckSum As Long

    ' MapFileAndCheckSum returns this f it worked.  Can't see much point in testing this here though.
    '
    Const CHECKSUM_SUCCESS As Long = 0

    ' HeaderCheckSum will only be non-zero if the file being checksumed is a binary [exe, dll, ocx, ...]
    ' that contains checksum info, e.g., the stuff that dumpbin.exe would list by 'checksum' when used
    ' like this for example ... dumpbin /headers c:\windows\system32\systray.exe
   
    Call MapFileAndCheckSum(fileName, HeaderCheckSum, CalcedCheckSum)

    CheckSumOfFile = CalcedCheckSum
   
End Function
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:BIAPRO
ID: 21823602
just plain copy this to start with in a new project, i got error at start run

Constants,fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules
0
 
LVL 10

Expert Comment

by:peetm
ID: 21824186
You've put it into a Module, yes?  Not a Form, and you're using VB6?
0
 

Author Comment

by:BIAPRO
ID: 21824234
oops!,  no i did form will retry, thanks
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question