-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from tedsmith/v3Branch
V3 branch to master
- Loading branch information
Showing
35 changed files
with
19,883 additions
and
14,649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,6 @@ ppas.bat | |
# generated by Makefile | ||
/project1 | ||
/project1.ico | ||
/project1.lpi | ||
/lazarus_cfg | ||
*.lrs.backup | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,134 @@ | ||
// Original Delphi code supplied by David Heffernan as answer to Stack Overflow URL | ||
// http://stackoverflow.com/a/17132506 | ||
// Adjusted for use with sister project YAFFI and Freepascal and then converted | ||
// to GPTMBR unit and added to QuickHash v2.7.0 Dec 2016 by T Smith | ||
|
||
unit GPTMBR; | ||
|
||
{$mode objfpc}{$H+} | ||
|
||
interface | ||
|
||
uses | ||
Windows, SysUtils; | ||
|
||
type | ||
TDriveLayoutInformationMbr = record | ||
Signature: DWORD; | ||
end; | ||
|
||
TDriveLayoutInformationGpt = record | ||
DiskId: TGuid; | ||
StartingUsableOffset: Int64; | ||
UsableLength: Int64; | ||
MaxPartitionCount: DWORD; | ||
end; | ||
|
||
TPartitionInformationMbr = record | ||
PartitionType: Byte; | ||
BootIndicator: Boolean; | ||
RecognizedPartition: Boolean; | ||
HiddenSectors: DWORD; | ||
end; | ||
|
||
TPartitionInformationGpt = record | ||
PartitionType: TGuid; | ||
PartitionId: TGuid; | ||
Attributes: Int64; | ||
Name: array [0..35] of WideChar; | ||
end; | ||
|
||
TPartitionInformationEx = record | ||
PartitionStyle: Integer; | ||
StartingOffset: Int64; | ||
PartitionLength: Int64; | ||
PartitionNumber: DWORD; | ||
RewritePartition: Boolean; | ||
case Integer of | ||
0: (Mbr: TPartitionInformationMbr); | ||
1: (Gpt: TPartitionInformationGpt); | ||
end; | ||
|
||
TDriveLayoutInformationEx = record | ||
PartitionStyle: DWORD; | ||
PartitionCount: DWORD; | ||
DriveLayoutInformation: record | ||
case Integer of | ||
0: (Mbr: TDriveLayoutInformationMbr); | ||
1: (Gpt: TDriveLayoutInformationGpt); | ||
end; | ||
PartitionEntry: array [0..15] of TPartitionInformationGpt; | ||
//hard-coded maximum of 16 partitions | ||
end; | ||
|
||
|
||
function MBR_or_GPT(SelectedDisk : widestring) : string; | ||
|
||
implementation | ||
|
||
// Returns the partitioning style of a physical disk by utilising sector 0 | ||
// offset 440 for MBR or offset 38 of sector 1 for GPT. Returns resulting | ||
// text string and Windows signature | ||
function MBR_or_GPT(SelectedDisk : widestring) : string; | ||
|
||
const | ||
PARTITION_STYLE_MBR = 0; | ||
PARTITION_STYLE_GPT = 1; | ||
PARTITION_STYLE_RAW = 2; | ||
|
||
IOCTL_DISK_GET_DRIVE_LAYOUT_EX = $00070050; | ||
var | ||
i: Integer; | ||
Drive: widestring; | ||
hDevice: THandle; | ||
DriveLayoutInfo: TDriveLayoutInformationEx; | ||
BytesReturned: DWORD; | ||
begin | ||
result := ''; | ||
Drive := SelectedDisk; | ||
// This particular handle assignment does not require admin rights as it allows | ||
// simply to query the device attributes without accessing actual disk data as such | ||
hDevice := CreateFileW(PWideChar(Drive), | ||
0, | ||
FILE_SHARE_READ or FILE_SHARE_WRITE, | ||
nil, | ||
OPEN_EXISTING, | ||
0, | ||
0); | ||
|
||
if hDevice <> INVALID_HANDLE_VALUE then | ||
begin | ||
if DeviceIoControl(hDevice, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, nil, 0, | ||
@DriveLayoutInfo, SizeOf(DriveLayoutInfo), BytesReturned, nil) then | ||
begin | ||
if DriveLayoutInfo.PartitionStyle = 0 then result := 'MBR (sig: ' + IntToHex(SwapEndian(DriveLayoutInfo.DriveLayoutInformation.Mbr.Signature), 8) + ')'; | ||
if DriveLayoutInfo.PartitionStyle = 1 then result := 'GPT (sig: ' + GUIDToString(DriveLayoutInfo.DriveLayoutInformation.Gpt.DiskId) + ')'; | ||
if DriveLayoutInfo.PartitionStyle = 2 then result := 'RAW (no signature)'; | ||
end; | ||
end; | ||
CloseHandle(hDevice); | ||
end; | ||
|
||
end. | ||
|
||
// Original Delphi code supplied by David Heffernan as answer to Stack Overflow URL | ||
// http://stackoverflow.com/a/17132506 | ||
// Adjusted for use with sister project YAFFI and Freepascal and then converted | ||
// to GPTMBR unit and added to QuickHash v2.7.0 Dec 2016 by T Smith | ||
{ | ||
Quick Hash GUI - A Linux, Windows and Apple Mac GUI for quickly selecting one or more files | ||
and generating hash values for them. | ||
Copyright (C) 2011-2018 Ted Smith www.quickhash-gui.org | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
any later version. This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You can read a copy of the GNU General Public License at | ||
http://www.gnu.org/licenses/>. Also, http://www.gnu.org/copyleft/gpl.html | ||
Use of the name 'QuickHash GUI' must refer to this utility | ||
only and must not be re-used in another tool if based upon this code. | ||
The code is Copyright of Ted Smith 2011 - 2018 (www.quickhash-gui.org) | ||
} | ||
|
||
unit GPTMBR; | ||
|
||
{$mode objfpc}{$H+} | ||
|
||
interface | ||
|
||
uses | ||
Windows, SysUtils; | ||
|
||
type | ||
TDriveLayoutInformationMbr = record | ||
Signature: DWORD; | ||
end; | ||
|
||
TDriveLayoutInformationGpt = record | ||
DiskId: TGuid; | ||
StartingUsableOffset: Int64; | ||
UsableLength: Int64; | ||
MaxPartitionCount: DWORD; | ||
end; | ||
|
||
TPartitionInformationMbr = record | ||
PartitionType: Byte; | ||
BootIndicator: Boolean; | ||
RecognizedPartition: Boolean; | ||
HiddenSectors: DWORD; | ||
end; | ||
|
||
TPartitionInformationGpt = record | ||
PartitionType: TGuid; | ||
PartitionId: TGuid; | ||
Attributes: Int64; | ||
Name: array [0..35] of WideChar; | ||
end; | ||
|
||
TPartitionInformationEx = record | ||
PartitionStyle: Integer; | ||
StartingOffset: Int64; | ||
PartitionLength: Int64; | ||
PartitionNumber: DWORD; | ||
RewritePartition: Boolean; | ||
case Integer of | ||
0: (Mbr: TPartitionInformationMbr); | ||
1: (Gpt: TPartitionInformationGpt); | ||
end; | ||
|
||
TDriveLayoutInformationEx = record | ||
PartitionStyle: DWORD; | ||
PartitionCount: DWORD; | ||
DriveLayoutInformation: record | ||
case Integer of | ||
0: (Mbr: TDriveLayoutInformationMbr); | ||
1: (Gpt: TDriveLayoutInformationGpt); | ||
end; | ||
PartitionEntry: array [0..15] of TPartitionInformationGpt; | ||
//hard-coded maximum of 16 partitions | ||
end; | ||
|
||
|
||
function MBR_or_GPT(SelectedDisk : widestring) : string; | ||
|
||
implementation | ||
|
||
// Returns the partitioning style of a physical disk by utilising sector 0 | ||
// offset 440 for MBR or offset 38 of sector 1 for GPT. Returns resulting | ||
// text string and Windows signature | ||
function MBR_or_GPT(SelectedDisk : widestring) : string; | ||
|
||
const | ||
PARTITION_STYLE_MBR = 0; | ||
PARTITION_STYLE_GPT = 1; | ||
PARTITION_STYLE_RAW = 2; | ||
|
||
IOCTL_DISK_GET_DRIVE_LAYOUT_EX = $00070050; | ||
var | ||
i: Integer; | ||
Drive: widestring; | ||
hDevice: THandle; | ||
DriveLayoutInfo: TDriveLayoutInformationEx; | ||
BytesReturned: DWORD; | ||
begin | ||
result := ''; | ||
Drive := SelectedDisk; | ||
// This particular handle assignment does not require admin rights as it allows | ||
// simply to query the device attributes without accessing actual disk data as such | ||
hDevice := CreateFileW(PWideChar(Drive), | ||
0, | ||
FILE_SHARE_READ or FILE_SHARE_WRITE, | ||
nil, | ||
OPEN_EXISTING, | ||
0, | ||
0); | ||
|
||
if hDevice <> INVALID_HANDLE_VALUE then | ||
begin | ||
if DeviceIoControl(hDevice, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, nil, 0, | ||
@DriveLayoutInfo, SizeOf(DriveLayoutInfo), BytesReturned, nil) then | ||
begin | ||
if DriveLayoutInfo.PartitionStyle = 0 then result := 'MBR (sig: ' + IntToHex(SwapEndian(DriveLayoutInfo.DriveLayoutInformation.Mbr.Signature), 8) + ')'; | ||
if DriveLayoutInfo.PartitionStyle = 1 then result := 'GPT (sig: ' + GUIDToString(DriveLayoutInfo.DriveLayoutInformation.Gpt.DiskId) + ')'; | ||
if DriveLayoutInfo.PartitionStyle = 2 then result := 'RAW (no signature)'; | ||
end; | ||
end; | ||
CloseHandle(hDevice); | ||
end; | ||
|
||
end. | ||
|
Oops, something went wrong.