Announcement

Collapse
No announcement yet.

VeriHash - Progress Bar Help Needed Please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • VeriHash - Progress Bar Help Needed Please

    Hi all.
    I have been on with a project for a little while now and I feel its coming together quite nicely. You may well have seen my other posts asking for help and advice as I got stuck.
    Not exactly stuck at this time but there is one thing I feel would just top things off and that's a progress bar.

    What happens is...

    A .svf or .iso image is browsed for and then loaded.
    Code:
    Image_Browse = Dialog.FileBrowse(true, "Locate File", "AutoPlay\\iso_iamge", "Image Files (*.iso,.svf)|*.iso;*.svf|", "", "dat", false, false);
    if (Image_Browse[1]) == "CANCEL" then
    Input.SetText("ImageInput", "");
    Paragraph.SetText("ImageName","");
    elseif (Image_Browse[1]) ~= "CANCEL" then
    for i,bFilePath in pairs(Image_Browse) do
    bFileParts = String.SplitPath(bFilePath);
    bDrive = bFileParts.Drive;
    bFolder = bFileParts.Folder;
    bFileName = bFileParts.Filename;
    bFileExtension = bFileParts.Extension;
    bFullFileName = bFileName..bFileExtension;
    bCurrentFolder = bDrive..bFolder
    Input.SetText("ImageInput", Image_Browse[1]);
    Paragraph.SetText("ImageName", bFullFileName);
    Label.SetEnabled("Calculate SHA1 Checksum Value", true);
    end
    end
    Once loaded we now can calculate the checksum value of the image. This is done using the existing Windows 10 Certutil.exe with lives in all Windows 10 machines. NO third party software.

    Calculate checksum value script
    Code:
    Paragraph.SetText("CalculatedSHA1ChecksumValue", "");
    
    
    -- Calculate SHA1 Checksum Value
    Image_input = Input.GetText("ImageInput");
    SHA1DOSCommand_bare = 'certutil -hashfile "#" SHA1'
    SHA1DOSCommand = String.Replace(SHA1DOSCommand_bare, "#", Image_input, false);
    StatusDlg.Show(MB_ICONNONE, false);
    StatusDlg.ShowProgressMeter(true);
    StatusDlg.SetTitle("Calculating SHA1 Checksum Value");
    StatusDlg.SetMessage("Please wait");
    SHA1DOSCommandOutput = CommandLine.Execute(SHA1DOSCommand, 0);
    if (SHA1DOSCommandOutput ~= nil ) then
    local my_string = (SHA1DOSCommandOutput.StdOut);
    local all_lines = {};
    for line in my_string:gmatch("[^\r\n]+") do
    all_lines[#all_lines + 1] = line;
    SHA1ChecksumValue = Table.Concat(all_lines, ";", 2, 2);
    -- Removes gaps from the calculated checksum value if run on Windows 7
    CalculatedSHA1ChecksumValue = String.Replace(SHA1ChecksumValue, " ", "", false);
    Paragraph.SetText("CalculatedSHA1ChecksumValue", CalculatedSHA1ChecksumValue);
    Label.SetEnabled("EnterKnownSHA1ChecksumValue", true);
    Image.SetEnabled("Search_png", true);
    Image.SetOpacity("Search_png", 100);
    StatusDlg.Hide();
    end
    else
    StatusDlg.Hide();
    Dialog.Message("Error", "Sorry. Failed to calculate the checksum value.", MB_OK, MB_ICONNONE, MB_DEFBUTTON1);
    end -- End Of Calculate SHA1 Checksum Value
    Hope this all makes some sort of sense and you have an idea of calculating checksum values via the command prompt.

    the process of calculating the checksum value depends on the size of the image and the speed of the PC. For me between 10 seconds to 1 minute.

    This is where I would like the progress bar to come in, to indicate how the calculation is going.

    Hope you can understand what I am after and somebody can help.

    I have made an example with a .iso image , under 400MB in size....

    Well never thought that would be too large to be honest.

    So my example will now NOT include the .iso image.

    Hoping somebody can help.....

    I do have a couple of examples downloaded. I will look at these some more. It may come to me..

    ​​​​​​​ Verihash - Progress Bar Help Example.apz

  • #2
    Been messing about and I thinks I got a way of doing it...
    Made a very simple version of my project and set up a progress bar.
    It's like a false one though which isn't really counting anything but it looks like it does..

    Have a look at the script. No laughing though..

    Code:
    Input.SetText("Input1", "");
    StatusDlg.Show(MB_ICONNONE, false);
    StatusDlg.ShowProgressMeter(true);
    StatusDlg.SetMeterRange(0, 100);
    StatusDlg.SetMeterPos(0);
    result = CommandLine.Execute('certutil -hashfile "C:\\Users\\Malcs\\Desktop\\Windows 10 Updated March 2021\\[en-gb]_en-gb_windows_10_consumer_editions_version_20h2_updat ed_march_2021_x64_dvd_0fa35355.svf" SHA1', 0);
    StatusDlg.SetMeterPos(10);
    StatusDlg.SetMeterPos(20);
    StatusDlg.SetMeterPos(30);
    StatusDlg.SetMeterPos(40);
    StatusDlg.SetMeterPos(50);
    StatusDlg.SetMeterPos(60);
    StatusDlg.SetMeterPos(70);
    StatusDlg.SetMeterPos(80);
    StatusDlg.SetMeterPos(90);
    StatusDlg.SetMeterPos(95);
    StatusDlg.SetMeterPos(98);
    StatusDlg.SetMeterPos(99);
    Application.Sleep(1000);
    Input.SetText("Input1", result.StdOut);
    StatusDlg.SetMeterPos(100);
    Application.Sleep(1000);
    StatusDlg.Hide();
    What do you recon ?

    Comment


    • #3
      It works on the smaller sized images but looks rubbish on larger ones...

      Thought I had it too...

      Comment

      Working...
      X