Solved

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

Posted on 2008-06-19
6
555 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
  • 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 500 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

803 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