English
Forum

MapFileAndCheckSum

 

Georg
Teles
Hello on all sides,
Have me here since the Login unfortunately never geblickt, but hobbymäßig nevertheless some programs written (Perhaps poste I The with opportunity time), nu Have I a question
white someone as function MapFileAndCheckSum very functions ?
CompileMarkSeparation
DEF MapFileAndCheckSum(3) ! "Imagehlp","MapFileAndCheckSumA"
>

... through try have I a code written, but with conscience sizes rechnet it me The "Checksumme" wrong circa: (in byte) 8, 12, 16, 20, 28, 32, ... 722 moreover Have I do not ausprobiert ...

by then Have I it with Text files probiert, but too with others File Types, EXE JPG and thereby has it too with some Files correctly., with others wrong calculated ...

... the reason wozu ch the need is, I instead of each Time the File To write circa these with the supra named function abzurufen, these function through area intern to charge let would like.

here naturally the whole code inklusive Window Drag & Drop and everything Schnickschnack, The function, The "MapFileAndChecksum" supplant should, means "CR2", The values go in the list under "meine CRC" aufgelistet, The with "MapFileCheckSum" under "CheckSum" naturally
CompileMarkSeparation
 $H windows.ph
'Set("ErrorLevel", 0)
Def DragAcceptFiles(2) !"SHELL32","DragAcceptFiles"
Def DragFinish(1) !"SHELL32","DragFinish"
Def DragQueryFile(4) !"SHELL32","DragQueryFileA"
DEF MapFileAndCheckSum(3) ! "Imagehlp","MapFileAndCheckSumA"
Declare HeadSum&,CheckSum&
Declare E%, PFn#, anz&, zah&, B01%, lstB&, winico&, lst$
WinMain(510,260)
Cls ~Getsyscolor(15)
Objects()
Activities()

Proc WinMain

    Parameters x&,y&
    Windowtitle "Checksum - Drag & Drop"
    Windowstyle 8+16+512
    Window ((%MaxX/2)-(x&/2)),((%MaxY/2)-(y&/2))-x&,y&
    winico& = Create("hIcon",Par$(0),0)
    SendMessage(%hwnd,$80,1,winico&)
    ~SetWindowLong(%hwnd,-16,$92CA0000)
    PopUp "&Datei"
    AppendMenu 100,"Öffne Liste"
    AppendMenu 101,"Speichere Liste"
    Separator
    AppendMenu 102,"Beenden"
    PopUp "&Liste"
    AppendMenu 200,"Auswahl löschen"
    AppendMenu 201,"Löschen"

Endproc

Proc Objects

    lstB& = Create("GridBox",%HWnd,"Datei;0;115;Größe in Byte;1;100;CheckSum;1;80;meine CRC;1;80;Vergleich;1;75",2,5,5,493,200)
    DragAcceptFiles(%HWnd,1)

EndProc

Proc Activities

    Usermessages 563
    CheckList
    Clear E%

    WhileNot E%

        Waitinput

        If %Message = 563

            Drag()

        ElseIf %Key = 2

            Inc E%

        ElseIf MenuItem(100)

            lst$ = LoadFile$("Öffne Datei:","Alle Dateien |*.*")

            If %Button = 1

                op_(lst$)

            EndIf

        ElseIf MenuItem(101)

            sa_()

        ElseIf MenuItem(102)

            Inc E%

        ElseIf MenuItem(200)

            del_(GetCount(lstB&),1)

        ElseIf MenuItem(201)

            del_(GetCount(lstB&))

        EndIf

        CheckList()

    Endwhile

    DragAcceptFiles(%HWnd,0)

EndProc

Proc Drag

    DIM PFn#,261
    anz& = DragQueryFile(&UWParam,$FFFFFFFF,PFn#,261)
    Clear zah&

    While zah&<anz&

        Clear PFn#
        DragQueryFile(&UWParam,zah&,PFn#,261)
        Ad_(String$(PFn#,0))
        Inc zah&

    EndWhile

    Dispose PFn#
    DragFinish(&UWParam)

EndProc

Proc op_

    parameters file$, z$
    Assign #1,file$
    Reset #1

    If %IOResult

        Messagebox("Datei kann nicht gelesen werden!","Fehler",16)

    Else

        WhileNot EOF(#1)

            Input #1, z$
            AddString(lstB&,z$)

        EndWhile

    EndIf

    Close #1

EndProc

Proc sa_

    Parameters file$
    file$ = $progdir+"list_"+Date$(3)+"_"+Left$(Time$(0),2)+"."+Right$(Time$(0),2)+"."+Left$(Time$(1),2)+".txt"
    Assign #1,file$
    OpenRw #1
    Close #1
    Assign #1,file$
    Append #1

    WhileLoop 0,GetCount(lstB&)-1

        Print #1,GetText$(lstB&,&loop,0)+"|"+GetText$(lstB&,&loop,1)+"|"+GetText$(lstB&,&loop,2)+"|"+GetText$(lstB&,&loop,3)+"|"+GetText$(lstB&,&loop,4)

    EndWhile

    Close #1

EndProc

Proc Ad_

    Parameters file$, size&, crc&, cr2&, msg$
    crc& = crc(file$)
    cr2& = cr2(file$)
    size& = FileSize(file$)
    file$ = SubStr$(file$,-1,"\\")

    If crc& = cr2&

        msg$ = "gleich"

    Else

        msg$ = "UNgleich"

    EndIf

    AddString(lstB&,file$+"|"+Str$(size&)+"|"+Str$(crc&)+"|"+Str$(cr2&)+"|"+msg$)

EndProc

Proc crc

    Parameters File$
    Clear Headsum&, Checksum&
    MapFileAndCheckSum(Addr(File$),addr(Headsum&),addr(Checksum&))
    Return Checksum&

EndProc

Proc cr2

    Parameters File$,fs&,fs#,p%
    Clear fs&,p%
    fs& = Filesize(file$)
    Dim fs#, fs&
    Clear fs#
    Assign #2,file$
    Openrw #2
    Blockread(#2,fs#,0,fs&)
    Close #2

    WhileLoop 0,fs&\2

        p% = p%+word(fs#,&loop*2)

        If p% >= 65535

            p% = (p%-65535)

        endif

    EndWhile

    p% = (p%+fs&)
    Dispose fs#
    Return p%

EndProc

proc del_

    Parameters c&, p&

    If p& = 1

        WhileLoop 0,(c&-1)

            If GetState(lstB&,(c&-1)-&loop) >= 2

                DeleteString(lstB&,(c&-1)-&loop)

            EndIf

        EndWHile

    Else

        WhileLoop 0,(c&-1)

            DeleteString(lstB&,(c&-1)-&loop)

        EndWHile

    EndIf

EndProc

Proc CheckList

    If GetCount(lstB&)

        EnableMenu 200,0
        EnableMenu 201,0

    Else

        EnableMenu 200,1
        EnableMenu >201,1

    EndIf

ENDPROC

END

The function shining not simply To his, but More as try can I not, in the network standing neither More above.
 
XProfan 10
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

03/16/13  
 



Hello Georg,

as i understood goes it therefore of Exen or DLLs a Signatur To produce,
sooner not of others Files.
MSDN
Diese function is used by any application that creates or modifies on executable image. Checksums are required for kernel-fashion drivers and some system DLLs.


What exactly want You letztendlich to achieve?
 
03/17/13  
 




Georg
Teles
Hi iF,

Yes correctly, it deals itself circa DLL and EXE, The Checksumme becomes under Anderem in the Header the DLL / EXE "mitgeschleppt" and to the Perform becomes The Checksumme formed and the compared, it'll means examined, whether the program manipulating watts or whether it at all compatible is on the jeweiligen PC, it would Yes unschön if it at Perform the program to that crash the PC come would neech ...

former Have I a Posting here red, it went therefore these function To benefit, circa Own programs or Files protect, changes one at least 1 byte, so changes the complete amount, and these "Summe" is the I my, these function can apparently for each Dateityp use, only becomes these amount not in the File hinterlegt example TXT, one can profane said The amount of beliebigen Files form.

what I to achieve would like comment I again short: there The CheckSum function zwangsläufig a way to File needed would like I through the own function the same Result bring up, in a Bereichs instead of the File.

The function should even intern in the program The Checksumme form can without a File To write ... I observe straight, that it with more Files quite long lasts To I The amount have ... naja alike, I have to a Archivierer To write, and these function I will for very small reaches use, and of course for the Password I have already 2 Archivierer written, of/ one with Passwortschutz but whom save it unfortunately with, what about me wants these function somehow instead of the Passwortes benefit ...

I observe Yes yet what, I custom The function so Yes not at all How Checksum, it functions already How I it wants, I teste time whether it correctly. kodiert and dekodiert ...
 
XProfan 10
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

03/17/13  
 



Perhaps would what Findus here posted has helpful(it): [...] 
 
03/17/13  
 




Georg
Teles
Schöner code, unfortunately work I with XProfan 10 and "encode64" there there not
naja the example shows Textverschlüsselung through Umsortieren, the I will Yes avoid, fit already, I tüftel time moreover ...
 
XProfan 10
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

03/17/13  
 



Nimm still FreeProfan: [...] 
 
03/17/13  
 




Georg
Teles
thanks iF, 64 bit there indeed Juhuuuu

Have now The Solution ...
my function power very the, what MapFileAndCheckSum too though very slow, for 1 MByte need the program 22,875 sec, but this is alike, I contact the only for small reaches on

apparently rechnet The function whom remainder the amount of/ one File WORD for WORD together...
BZW so How I it understood have, once The amount the first WORD with the second Max. access or larger is (65535), becomes it abgezogen, thereafter becomes the remainder the remaining with the next WORD add, to eachone amount becomes it again examined, whether The amount Max. access or larger is, in this drop becomes the worth again abgezogen etc ...
CompileMarkSeparation
Proc cr2

    Parameters File$,fs&,fs#,p%,s%
    Clear fs&,p%,s%
    fs& = Filesize(file$)
    Dim fs#, fs&
    Clear fs#
    Assign #2,file$
    Openrw #2
    Blockread(#2,fs#,0,fs&)
    Close #2

    If fs& MOD 2 = 0

        s% = (fs&\2)-1

    ElseIf fs& MOD 2 = 1

        s% = (fs&\2)

    EndIf

    WhileLoop 0,s%

        p% = p%+word(fs#,&loop*2)

        If p% > 65534

            p% = (p%-65535)

        endif

    EndWhile

    p% = (p%+fs&)
    Dispose fs#
    Return p%

ENDPROC

 
XProfan 10
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

03/21/13  
 



then would I The function (the part the rechnet) in a nProc pack -

the goes then faster as the lightning.
 
03/21/13  
 




Georg
Teles
Hello, I will time here the Topic freshen Have times for my Archivierer one Passwortsystem consider, functions vaguely to this principle...

who pleasure to that testing has ^^ the Test writes only whom Head of my Archivierers and Password + open and Passwortabfrage ... it'll a File laid out asd.tew

Download

214 kB
Hochgeladen:05/07/13
Downloadcounter160
Download
 
XProfan 10
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

05/07/13  
 



I am not sure, whether the Password sure hinterlegt becomes.

If I the Bytewert one individual Passwortzeichens circa 1 erhöhe then
ought to itself in the File not too just 1 Bytewert circa 1 raise. so
ought to the Password self not at all in the File stand separate sooner a
Prüfsumme and only if Prüfsummen coincide then voices The
Passworte überein.
 
05/07/13  
 




Georg
Teles
Well this is Yes The thing, that the Passowrt not at all with drin is can times the File with Notepad open and to whom Password search, there find You nothing.

have almost forget, one space ought to one not using, the functions then usually not, I teste time moreover ...

Edit: drin standing too only The Prüfsumme, though is tappt im dunkeln with all others Parameters verknüpft so if one attempts whom Header To manipulating, becomes the program hereon too react, theoretical Have I me the already consider
 
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

05/07/13  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

11.069 Views

Untitledvor 0 min.
Georg Teles07/25/23
Michael W.03/01/23
RudiB.10/27/21
Thomas Zielinski10/23/21
More...

Themeninformationen

this Topic has 2 subscriber:

Georg Teles (6x)
iF (5x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie