Fixed bug in include, Added submodule, Updated license, readme and help text

This commit is contained in:
2025-08-03 22:29:35 +02:00
parent cced101379
commit 1e5dde864b
18 changed files with 174 additions and 159 deletions
+2
View File
@@ -1,3 +1,5 @@
*.dll
*.exe
*.cfg
Trash/
+3
View File
@@ -0,0 +1,3 @@
[submodule "Includes/PB-Win32-GetConsoleProcessList"]
path = Includes/PB-Win32-GetConsoleProcessList
url = https://github.com/aziascreations/PB-Win32-GetConsoleProcessList
+10 -24
View File
@@ -1,17 +1,18 @@
;{- Code Header
; ==- Basic Info -================================
; Name: ImageNtHeaderHelper.pbi
; Version: 0.0.1
; Version: 0.0.2
; Author: Herwin Bozet (NibblePoker)
;
; ==- Compatibility -=============================
; Compiler version:
; * PureBasic 6.0 LTS
; * PureBasic 6.0 LTS - C Backend
; * PureBasic 5.73 LTS (x86/x64)
; * PureBasic 6.0 LTS (x64)
; * PureBasic 6.0 LTS - C Backend (x64)
;
; ==- Links & License -===========================
; License: Unlicense
; GitHub: ???
; License: CC0 1.0 Universal (Public Domain)
; GitHub: https://github.com/aziascreations/PB-PEArch
;}
@@ -26,6 +27,7 @@ DeclareModule ImageNtHeaderHelper
#INHH_ERROR_CannotCreateFileMapping
#INHH_ERROR_CannotMapViewOfFile
#INHH_ERROR_CannotRetrieveHeaders
#INHH_ERROR_InvalidId
EndEnumeration
; Loads the given file into memory, maps a view of it into memory and attempts to retrieve the IMAGE_NT_HEADERS32 structure.
@@ -64,10 +66,9 @@ Module ImageNtHeaderHelper
Define ImageNtHeaderId$
If ImageNtHeaderId = #PB_Any
Repeat
RandomData(@ImageNtHeaderId, SizeOf(ImageNtHeaderId))
ImageNtHeaderId$ = Str(ImageNtHeaderId)
Until FindMapElement(OpenImageNtHeaders(), ImageNtHeaderId$) = #Null
DebuggerError("Unable to us #PB_Any as 'ImageNtHeaderId' !")
LastErrorCode = #INHH_ERROR_InvalidId
Goto INHH_GetImageNtHeader32_BadEnding
Else
ImageNtHeaderId$ = Str(ImageNtHeaderId)
If FindMapElement(OpenImageNtHeaders(), ImageNtHeaderId$) <> #Null
@@ -157,18 +158,3 @@ Module ImageNtHeaderHelper
LastErrorCode = 0
EndProcedure
EndModule
;- Tests
CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf
; IDE Options = PureBasic 6.21 (Windows - x64)
; CursorPosition = 120
; FirstLine = 102
; Folding = --
; EnableXP
; DPIAware
-35
View File
@@ -1,35 +0,0 @@
;{- Code Header
; ==- Basic Info -================================
; Name: WinApi_GetConsoleProcessList.pbi
; Version: 0.0.1
; Author: Herwin Bozet (NibblePoker)
;
; ==- Compatibility -=============================
; Compiler version:
; * PureBasic 6.0 LTS
; * PureBasic 6.0 LTS - C Backend
;
; ==- Links & License -===========================
; License: Unlicense
; GitHub: ???
;}
EnableExplicit
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
#WinApi_GetConsoleProcessList_LibPath$ = "../Libs/X86/kernel32.lib"
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
#WinApi_GetConsoleProcessList_LibPath$ = "../Libs/X64/kernel32.lib"
CompilerElse
CompilerError "Please use x64 or x86 compilers for this include !"
CompilerEndIf
Import #WinApi_GetConsoleProcessList_LibPath$
GetConsoleProcessList_.l(*lpdwProcessList, dwProcessCount.l) As "GetConsoleProcessList"
EndImport
; IDE Options = PureBasic 6.21 (Windows - x64)
; CursorPosition = 27
; Folding = -
; EnableXP
; DPIAware
+117 -20
View File
@@ -1,24 +1,121 @@
This is free and unencumbered software released into the public domain.
Creative Commons Legal Code
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
CC0 1.0 Universal
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Statement of Purpose
For more information, please refer to <http://unlicense.org/>
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
-7
View File
@@ -1,7 +0,0 @@
@echo off
:: These variables should point to '.exe' files.
set MSVC_DUMPBIN="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\dumpbin.exe"
set MSVC_LIB="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\lib.exe"
exit /b
-43
View File
@@ -1,43 +0,0 @@
@echo off
setlocal
pushd %CD%
cd /D "%~dp0"
call "%~dp0\0_config.cmd"
echo Checking the PATH
IF NOT EXIST %MSVC_LIB% (
echo ^> Unable to find 'lib.exe' as indicated in '%%MSVC_DUMPBIN%%' !
echo ^> Please check the '0_config.cmd' script !
goto end
)
echo ^> Found 'lib.exe' at the given location !
echo Removing old '.lib' files
del /S /Q .\*.lib 2> nul
echo Iterating over all '.def' files in 'libs/' for 'x64', 'x86' and 'arm64'...
for /R ".\" %%i in (*.def) do call :sub-make-lib X64 %%i
for /R ".\" %%i in (*.def) do call :sub-make-lib X86 %%i
for /R ".\" %%i in (*.def) do call :sub-make-lib ARM64 %%i
echo Done !
:end
popd
endlocal
pause
exit /b
:sub-make-lib
echo ^> %2
pushd %~dp2
::set _RAW_DEF_NAME=%~nx2
::set _RAW_DEF_NAME=%_RAW_DEF_NAME:.raw.def=%
::echo lib.exe /nologo /def:%_RAW_DEF_NAME%.raw.def /out:%_RAW_DEF_NAME%.lib /machine:%1
::%MSVC_LIB% /nologo /def:%_RAW_DEF_NAME%.raw.def /out:%_RAW_DEF_NAME%.lib /machine:%1
mkdir .\%1
%MSVC_LIB% /nologo /def:%~nx2 /out:.\%1\%~n2.lib /machine:%1
popd
exit /b
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-4
View File
@@ -1,4 +0,0 @@
LIBRARY msvcrt.dll
EXPORTS
GetConsoleProcessList
+9 -7
View File
@@ -1,24 +1,26 @@
;{- Code Header
; ==- Basic Info -================================
; Name: Main_PEArch.pb
; Version: 0.0.1
; Version: 1.1.x
; Author: Herwin Bozet (NibblePoker)
;
; ==- Compatibility -=============================
; Compiler version:
; * PureBasic 6.0 LTS
; * PureBasic 6.0 LTS - C Backend
; * PureBasic 5.73 LTS (x86/x64)
; * PureBasic 6.0 LTS (x64)
; * PureBasic 6.0 LTS - C Backend (x64)
;
; ==- Links & License -===========================
; License: Unlicense
; GitHub: ???
; License: CC0 1.0 Universal (Public Domain)
; GitHub: https://github.com/aziascreations/PB-PEArch
;}
;- Compiler directive
EnableExplicit
XIncludeFile "./Includes/ImageNtHeaderHelper.pbi"
XIncludeFile "./Includes/WinApi_GetConsoleProcessList.pbi"
XIncludeFile "./Includes/PB-Win32-GetConsoleProcessList/Includes/Win32_GetConsoleProcessList.pbi"
;- Constants
@@ -322,7 +324,7 @@ DataSection
Data.s "PEArch.exe [/?] [/E|/AsError] [/H|/AsHex] [/F|/FullText] <File>" + #CRLF$ +
"" + #CRLF$ +
"Options:" + #CRLF$ +
" /? Prints this help text." + #CRLF$ +
" /? Prints this help text, and some additional details." + #CRLF$ +
" /E, /AsError Gives out the result as an error code." + #CRLF$ +
" /H, /AsHex Prints the architecture as a hex number." + #CRLF$ +
" /F, /FullText Prints a longer description of the architecture." + #CRLF$
+20 -18
View File
@@ -7,20 +7,20 @@
<section name="data">
<explorer view="C:\ProgramData\PureBasic\Examples\" pattern="0"/>
<log show="1"/>
<lastopen date="2025-08-03 20:57" user="Herwin" host="DESKTOP-15GVDJD"/>
<lastopen date="2025-08-03 22:28" user="Herwin" host="DESKTOP-15GVDJD"/>
</section>
<section name="files">
<file name="Main_PEArch.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
<fingerprint md5="0ae927874ebb9b5f278ab868cd2eaad6"/>
<fingerprint md5="3ba2b1cb13f258d1814071be7efdee72"/>
</file>
<file name="Includes\ImageNtHeaderHelper.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="++"/>
<fingerprint md5="a5b4cef967764153f8aed5a0ed6474c8"/>
<fingerprint md5="30a4ff6ed752b739cbd58ef364ad37d1"/>
</file>
<file name="Includes\WinApi_GetConsoleProcessList.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="++"/>
<fingerprint md5="4ac133fc47ad2e720131876fa54f876c"/>
<file name="Includes\PB-Win32-GetConsoleProcessList\Includes\Win32_GetConsoleProcessList.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="++++"/>
<fingerprint md5="595f375309908ff208c5ca21d1b35cfb"/>
</file>
</section>
<section name="targets">
@@ -33,17 +33,18 @@
<options debug="1" optimizer="1"/>
<temporaryexe value="source"/>
<format exe="console" cpu="0"/>
<compilecount enable="1" value="46"/>
<buildcount enable="1" value="15"/>
<compilecount enable="1" value="50"/>
<buildcount enable="1" value="18"/>
<versioninfo enable="1">
<field0 value="1,0,%BUILDCOUNT,%COMPILECOUNT"/>
<field1 value="1,0,%BUILDCOUNT,%COMPILECOUNT"/>
<field0 value="1,1,0,%BUILDCOUNT"/>
<field1 value="1,1,0,%BUILDCOUNT"/>
<field2 value="NibblePoker"/>
<field3 value="PEArch"/>
<field4 value="1.0.%BUILDCOUNT"/>
<field5 value="1.0.%BUILDCOUNT"/>
<field4 value="1.1.0"/>
<field5 value="1.1.0"/>
<field7 value="PEArch.exe"/>
<field8 value="pearch.exe"/>
<field14 value="https://github.com/aziascreations/PB-PEArch"/>
</versioninfo>
</target>
<target name="PEArch - x86" enabled="1" default="0">
@@ -55,17 +56,18 @@
<options debug="1" optimizer="1"/>
<temporaryexe value="source"/>
<format exe="console" cpu="0"/>
<compilecount enable="1" value="45"/>
<buildcount enable="1" value="14"/>
<compilecount enable="1" value="4"/>
<buildcount enable="1" value="4"/>
<versioninfo enable="1">
<field0 value="1,0,%BUILDCOUNT,%COMPILECOUNT"/>
<field1 value="1,0,%BUILDCOUNT,%COMPILECOUNT"/>
<field0 value="1,1,0,%BUILDCOUNT"/>
<field1 value="1,1,0,%BUILDCOUNT"/>
<field2 value="NibblePoker"/>
<field3 value="PEArch"/>
<field4 value="1.0.%BUILDCOUNT"/>
<field5 value="1.0.%BUILDCOUNT"/>
<field4 value="1.0.0"/>
<field5 value="1.0.0"/>
<field7 value="PEArch.exe"/>
<field8 value="pearch.exe"/>
<field14 value="https://github.com/aziascreations/PB-PEArch"/>
</versioninfo>
</target>
</section>
+12 -1
View File
@@ -3,7 +3,18 @@ A small tool that tells you which [CPU architecture](https://learn.microsoft.com
a given [Windows PE](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format) is made for.
## Usage
TODO
```
PEArch.exe [/?] [/E|/AsError] [/H|/AsHex] [/F|/FullText] <File>
Options:
/? Prints this help text, and some additional details.
/E, /AsError Gives out the result as an error code.
/H, /AsHex Prints the architecture as a hex number.
/F, /FullText Prints a longer description of the architecture.
```
## Cloning
**TODO: Add instructions related to the submodule**
## License
All the code in this repo is released in the [Public Domain](LICENSE).