Squashed 'third_party/allwpilib/' changes from e4b91005cf..83f1860047
83f1860047 [wpilib] Add/update documentation to PneumaticBase and subclasses (NFC) (#4881)
9872e676d8 [commands] Make Subsystem destructor virtual (#4892)
25db20e49d [hal] Fix segfault in various HAL functions (#4891)
b0c6724eed [glass] Add hamburger menu icon to titlebars (#4874)
f0fa8205ac Add missing compiler flags and fix warnings (#4889)
42fc4cb6bc [wpiutil] SafeThread: Provide start/stop hooks (#4880)
cc166c98d2 [templates] Add Command-based skeleton template (#4861)
3f51f10ad3 [build] Update to 2023v3 image (#4886)
1562eae74a [ntcore] Refactor meta-topic decoding from glass (#4809)
b632b288a3 Fix usages of std::min and std::max to be windows safe (#4887)
c11bd2720f [wpilibc] Add internal function to reset Shuffleboard instance (#4884)
f1151d375f [ntcore] Add method to get server time offset (#4847)
fe1b62647f [hal,wpilib] Update documentation for getComments (NFC) (#4879)
c49a45abbd [build] Fix examples linking in incorrect jni library (#4873)
bc3d01a721 [build] Add platform check to doxygen plugin (#4862)
bc473240ae Add Jetbrains Fleet folder to .gitignore (#4872)
2121bd5fb8 [wpimath] Remove RKF45 (#4870)
835f8470d6 [build] Fix roborio cross-compiler on arm hosts (#4864)
6cfe5de00d [ntcore] Don't deadlock server on early destroy (#4863)
2ac41f3edc [hal, wpilib] Add RobotController.getComments() (#4463)
26bdbf3d41 Java optimization and formatting fixes (#4857)
92149efa11 Spelling and grammar cleanups (#4849)
176fddeb4c [commands] Add functions to HID classes to allow use of axes as BooleanEvents/Triggers (#4762)
87a34af367 [templates] Add bindings to command-based template (#4838)
4534e75787 [examples] Remove redundant MotorControl example (#4837)
1cbebaa2f7 [commands] Remove final semicolon from test macro definition (#4859)
6efb9ee405 [commands] Add constructor for SwerveControllerCommand that takes a HolonomicDriveController (#4785)
1e7fcd5637 [cscore] Change run loop functions to not be mac specific (#4854)
1f940e2b60 [apriltag] Add C++ wrappers, rewrite Java/JNI to match (#4842)
a6d127aedf [build] Add missing task dependency in wpilibjExamples (#4852)
b893b3d6d3 [cscore] Add support for USB cameras on macOS (#4846)
1696a490fa [glass] Add support for alternate NT ports (#4848)
40a22d69bc [glass] Add support for alternate NT ports (#4848)
e84dbfede0 [wpilib] GenericHID: Add rumble both option (#4843)
8aa9dbfa90 [examples] Link apriltag package in examples build.gradle (#4845)
eda2fa8a17 [build] Update Spotless (#4840)
d20594db0d Fix typos (#4839)
dd8ecfdd54 [commands] Fix typo in waitUntil docs (NFC) (#4841)
17ceebfff4 [apriltag] Clean up apriltag JNI (#4823)
8b74ab389d [examples] RapidReactCommandBot: Fix array indices (#4833)
1aad3489c2 [sim] Implement PD total current and power (#4830)
2744991771 [wpimath] Fix docs in SwerveModulePosition (#4825)
ffbf6a1fa2 [commands] Disable regularly failing unit test (#4824)
fbabd0ef15 [commands] Enhance Command Sendable implementations (#4822)
7713f68772 [hal] Use atomic rather then mutex for DS Data updates (#4787)
701995d6cc [examples] Update Command-based starter project (#4778)
bf7068ac27 [wpilibc] Add missing PPS implementation for C++ (#4821)
aae0f52ca6 [ntcore] NetworkTable: fix visibility of get/set value (#4820)
ee02fb7ba7 [hal] Add support for Pulse-Per-Second signal (#4819)
518916ba02 [wpilib] Fix DS mode thread event being manual reset accidentally (#4818)
3997c6635b [hal] Update to new image, use new TCP notify callback and new duty cycle API (#4774)
cc8675a4e5 [examples] Add comment on how to view elevator sim (NFC) (#4482)
fb2c170b6e [ntcore] Simplify local startup (#4803)
7ba8a9ee1f [wpimath] ProfiledPIDController: Add to SendableRegistry (#4656)
c569d8e523 [wpilib] Joystick.getMagnitude(): use hypot() function (#4816)
2a5e89fa97 [apriltag] Improve description of pose coordinates (NFC) (#4810)
cc003c6c38 [apriltag] Fix AprilTagFieldLayout JSON name (#4814)
5522916123 [commands] CommandXBoxController bumper documentation fix (NFC) (#4815)
967b30de3a [glass] Fix NT view UpdateClients() bug (#4808)
3270d4fc86 [wpimath] Rewrite pose estimator docs (#4807)
be39678447 [apriltag] Add test to ensure apriltagjni loads (#4805)
61c75deb2a [commands] Test no-op behavior of scheduling a scheduled command (#4806)
a865f48e96 [ntcore] Pass pub/sub options as a unified PubSubOptions struct (#4794)
f66a667321 [commands] Fix incorrect Trigger docs (NFC) (#4792)
f8d4e9866e [ntcore] Clean up ntcore_test.h (#4804)
7e84ea891f [wpimath] Fix ComputerVisionUtil transform example in parameter docs (NFC) (#4800)
da3ec1be10 [wpimath] Change terminology for ArmFeedforward gravity gain (NFC) (#4791)
944dd7265d [wpilibc] Add C++ Notifier error handling, update java notifier error message (#4795)
6948cea67a [wpiutil] Fix MemoryBuffer initialization (#4797)
a31459bce6 [wpiutil] Fix UnescapeCString overflow when inputSize < 2 (#4796)
4a0ad6b48c [wpimath] Rotation2d: Add reference to angleModulus in docs (NFC) (#4786)
e6552d272e [ntcore] Remove table multi-subscriber (#4789)
bde383f763 [hal] Replace const char* with std::string_view in Driver Station sim functions (#4532)
5a52b51443 [hal] Add RobotController.getSerialNumber() (#4783)
69a66ec5ec [wpilib] Fix multiple motor safety issues (#4784)
989c9fb29a [wpimath] Revert Rotation2D change that limits angles (#4781)
0f5b08ec69 [wpigui] Update imgui to 1.89.1+ (#4780)
fba191099c [examples] AddressableLED: Add unit test (#4779)
b390cad095 [wpilibj] Consistently use ErrorMessages.requireNonNullParam (#4776)
b9772214d9 [wpilib] Sendable: Don't call setter for getter changes
342c375a71 [ntcore] Add subscriber option to exclude single publisher
b0e4053087 [ntcore] Use int for options instead of double
f3e666b7bb [cscore] Convert YUYV and UYVY directly to grayscale (#4777)
b300518bd1 [hal] Add CAN Stream API to Java through JNI bindings (#4193)
be27171236 [wpilibj] Shuffleboard: Check for null sendable (#4772)
4bbdbdfb48 [commands] Move GroupedCommands to CommandScheduler (#4728)
f18fd41ac3 [wpimath] Remove broken and obsoleted ComputerVisionUtil functions (#4775)
2d0faecf4f [glass] DataSource: Add spinlock to protect value (#4771)
348bd107fc [hal] Add CANManufacturer for The Thrifty Bot (#4773)
3149dc64b8 [examples] HatchbotInlined: Use Subsystem factories (#4765)
8618dd4160 [glass, wpilib] Replace remaining references to Speed Controller with Motor Controller (#4769)
72e21a1ed1 [apriltag] Use wpilibsuite fork of apriltag (#4764)
eab0d929e6 [commands] CommandGenericHID POV methods: Fix docs (NFC) (#4760)
6789869663 [wpilib] Call set(0) rather than disable for stopMotor (#4763)
c9dea2968d [cscore] Emit warning that USB Camera isn't supported on OSX (#4766)
8f402645f5 [commands] Fix PIDSubsystem setSetpoint behavior (#4759)
f24ad1d715 [build] Upgrade to googletest 1.12.1 (#4752)
ff88756864 [wpimath] Add new DCMotor functions for alternative calculations and reduction calculation (#4749)
f58873db8e [wpimath] Remove extra terms in matrix for pose estimator docs (#4756)
37e969b41a [wpimath] Add constructors to pose estimators with default standard deviations (#4754)
13cdc29382 [ci] Rename comment command from "/wpiformat" to "/format" (#4755)
6e23985ae6 [examples] Add main include directory to test builds (#4751)
66bb0ffb2c [examples] Add unit testing infrastructure (#4646)
74cc86c4c5 [wpimath] Make transform tests use pose/transform equality operators (#4675)
e22d8cc343 [wpimath] Use Odometry for internal state in Pose Estimation (#4668)
68dba92630 [ci] Update mac and windows builds to Java 17 (#4750)
23bfc2d9ab [sim] Remove unmaintained Gazebo support (#4736)
1f1461e254 [wpilib] Add method to enable/disable LiveWindow in test mode (#4678)
eae68fc165 [wpimath] Add tolerance for Rotation3d rotation matrix special orthogonality (#4744)
4c4545fb4b [apriltag] Suppress warning (#4743)
16ffaa754d [docs] Generate docs for apriltag subproject (#4745)
5e74ff26d8 [apriltag, build] Update native utils, add apriltag impl and JNI (#4733)
53875419a1 [hal] Allow overriding stderr printing by HAL_SendError (#4742)
aa6499e920 [ntcore] Fix special topic multi-subscriber handling (#4740)
df70351107 [build] Fix cmake install of thirdparty includes (#4741)
e9bd50ff9b [glass] NT view: clear meta-topic info on disconnect (#4732)
9b319fd56b [ntcore] Add sub option for local vs remote changes (#4731)
18d28ec5e3 [ntcore] Remove duplicate value checking from ClientImpl
bdfb625211 [ntcore] Send duplicate values to network if necessary
21003e34eb [commands] Update Subsystem factories and example to return CommandBase (#4729)
70080457d5 [commands] Refactor ProxyScheduleCommand, SelectCommand into ProxyCommand (#4534)
e82cd5147b [wpilib] Tweak Color HSV formula and use in AddressableLED (#4724)
ec124bb662 [commands] Allow unsetting a subsystem's default command (#4621)
2b2aa8eef7 [examples] Update all examples to use NWU coordinate conventions (#4725)
cb38bacfe8 [commands] Revert to original Trigger implementation (#4673)
15561338d5 [commands] Remove one more default command isFinished check (#4727)
ca35a2e097 Add simgui files to .gitignore (#4726)
20dbae0cee [examples] Renovate command-based examples (#4409)
1a59737f40 [commands] Add convenience factories (#4460)
42b6d4e3f7 Use defaulted comparison operators in C++ (#4723)
135c13958f [wpigui] Add FontAwesome (#4713)
ffbfc61532 [ntcore] Add NetworkTable table-specific listeners (#4640)
8958b2a4da [commands] Add property tests for command compositions (#4715)
e4ac09077c [wpilib] Add link to MotorSafety article (#4720)
f40de0c120 [commands] Add C++ factory templates (#4686)
51fa3e851f [build] cmake: Use FetchContent instead of ExternalProject (#4714)
1da84b2255 [wpigui] Reload fonts to scale rather than preloading (#4712)
e43e2fbc84 [wpiutil] StringExtras: Add UnescapeCString (#4707)
5804d8fa84 [ntcore] Server: Properly handle multiple subscribers (#4717)
169ef5fabf [glass] Update NT view for topicsOnly and sendAll changes (#4718)
148759ef54 [examples] CANPDP: Expand properties shown (#4687)
58ed112b51 [commands] RepeatCommand: restart on following iteration (#4706)
dd1da77d20 [readme] Fix broken CI badge (#4710)
7cda85df20 [build] Check Gradle plugin repo last to fix CI (#4711)
7ed9b13277 [build] Bump version plugin to fix null tag (#4705)
6b4f26225d [apriltag] Fix pluralization of apriltag artifacts (#4671)
b2d2924b72 [cscore] Add Y16 image support (#4702)
34ec89c041 [wpilibc] Shuffleboard SimpleWidget: Return pointer instead of reference (#4703)
e15200068d [ci] Disable HW testbench runs (#4704)
d5200db6cd [wpimath] Rename HolonomicDriveController.calculate params (#4683)
2ee3d86de4 [wpimath] Clarify Rotation3d roll-pitch-yaw direction (#4699)
9f0a8b930f [cscore] Use MFVideoFormat_L8 for Gray on Windows (#4701)
2bca43779e [cscore] Add UYVY image support (#4700)
4307d0ee8b [glass] Plot: allow for more than 11 plots (#4685)
3fe8d355a1 [examples] StateSpaceDifferentialDriveSimulation: Use encoder reversed constants (#4682)
b44034dadc [ntcore] Allow duplicate client IDs on server (#4676)
52d2c53888 [commands] Rename Java factory wait() to waitSeconds() (#4684)
76e918f71e [build] Fix JNI artifacts linking to incorrect libraries (#4680)
0bee875aff [commands] Change C++ CommandPtr to use CommandBase (#4677)
98e922313b [glass] Don't check IsConnected for NT widgets (#4674)
9a36373b8f [apriltag] Switch 2022 apriltag layout length and width values (#4670)
cf8faa9e67 [wpilib] Update values on controllable sendables (#4667)
5ec067c1f8 [ntcore] Implement keep duplicates pub/sub flag (#4666)
e962fd2916 [ntcore] Allow numeric-compatible value sets (#4620)
88bd67e7de [ci] Update clang repositories to jammy (#4665)
902e8686d3 [wpimath] Rework odometry APIs to improve feature parity (#4645)
e2d49181da Update to native utils 2023.8.0 (#4664)
149bac55b1 [cscore] Add Arducam OV9281 exposure quirk (#4663)
88f7a3ccb9 [wpimath] Fix Pose relativeTo documentation (#4661)
8acce443f0 [examples] Fix swerve examples to use getDistance for turning encoder (#4652)
295a1f8f3b [ntcore] Fix WaitForListenerQueue (#4662)
388e7a4265 [ntcore] Provide mechanism to reset internals of NT instance (#4653)
13aceea8dc [apriltag] Fix FieldDimensions argument order (#4659)
c203f3f0a9 [apriltag] Fix documentation for AprilTagFieldLayout (#4657)
f54d495c90 Fix non initialized hal functionality during motor safety init (#4658)
e6392a1570 [cmd] Change factories return type to CommandBase (#4655)
53904e7cf4 [apriltag] Split AprilTag functionality to a separate library (#4578)
2e88a496c2 [wpimath] Add support for swerve joystick normalization (#4516)
ce4c45df13 [wpimath] Rework function signatures for Pose Estimation / Odometry (#4642)
0401597d3b [readme] Add wpinet to MavenArtifacts.md (#4651)
2e5f9e45bb [wpimath] Remove encoder reset comments on Swerve, Mecanum Odometry and Pose Estimation (#4643)
e4b5795fc7 [docs] Disable Doxygen for memory to fix search (#4636)
03d0ea188c [build] cmake: Add missing wpinet to installed config file (#4637)
3082bd236b [build] Move version file to its own source set (#4638)
b7ca860417 [build] Use build cache for sign step (#4635)
64838e6367 [commands] Remove unsafe default command isFinished check (#4411)
1269d2b901 [myRobot] Disable spotbugs (#4565)
14d8506b72 [wpimath] Fix units docs for LinearSystemId::IdentifyDrivetrainSystem() (#4600)
d1d458db2b [wpimath] Constrain Rotation2d range to -pi to pi (#4611)
f656e99245 [readme] Add links to development build documentation (#4481)
6dd937cef7 [commands] Fix Trigger API docs (NFC) (#4599)
49047c85b9 [commands] Report error on C++ CommandPtr use-after-move (#4575)
d07267fed1 [ci] Upgrade containers to Ubuntu 22.04 and remove libclang installation (#4633)
b53ce1d3f0 [build, wpiutil] Switch macos to universal binaries (#4628)
5a320c326b [upstream_util, wpiutil] Refactor python scripts (#4614)
c4e526d315 [glass] Fix NT Mechanism2D (#4626)
d122e4254f [ci] Run spotlessApply after wpiformat in comment command (#4623)
5a1e7ea036 [wpilibj] FieldObject2d: Add null check to close() (#4619)
179f569113 [ntcore] Notify locally on SetDefault (#4617)
b0f6dc199d [wpilibc] ShuffleboardComponent.WithProperties: Update type (#4615)
7836f661cd [wpimath] Add missing open curly brace to units/base.h (#4613)
dbcc1de37f [wpimath] Add DifferentialDriveFeedforward classes which wrap LinearPlantInversionFeedforward (#4598)
93890c528b [wpimath] Add additional angular acceleration units (#4610)
3d8d5936f9 [wpimath] Add macro for disabling units fmt support (#4609)
2b04159dec [wpimath] Update units/base.h license header (#4608)
2764004fad [wpinet] Fix incorrect jni definitions (#4605)
85f1bb8f2b [wpiutil] Reenable jni check task (#4606)
231ae2c353 [glass] Plot: Fix Y-axis not being saved (#4594)
e92b6dd5f9 [wpilib] Fix AprilTagFieldLayout JSON property name typos (#4597)
2a8e0e1cc8 Update all dependencies that use grgit (#4596)
7d06e517e9 [commands] Move SelectCommand factory impl to header (#4581)
323524fed6 [wpimath] Remove deprecated units/units.h header (#4572)
d426873ed1 [commands] Add missing PS4 triangle methods (#4576)
5be5869b2f [apriltags] Use map as internal data model (#4577)
b1b4c1e9e7 [wpimath] Fix Pose3d transformBy rotation type (#4545)
a4054d702f [commands] Allow composing two triggers directly (#4580)
0190301e09 [wpilibc] Explicitly mark EventLoop as non-copyable/non-movable (#4579)
9d1ce6a6d9 [ntcore] Catch file open error when saving preferences (#4571)
5005e2ca04 [ntcore] Change Java event mask to EnumSet (#4564)
fa44a07938 [upstream-utils][mpack] Add upstream util for mpack (#4500)
4ba16db645 [ntcore] Various fixes and cleanups (#4544)
837415abfd [hal] Fix joysticks either crashing or returning 0 (#4570)
2c20fd0d09 [wpilib] SingleJointedArmSim: Check angle equals limit on wouldHit (#4567)
64a7136e08 [wpimath] SwerveDrivePoseEstimator: Restore comment about encoder reset (#4569)
b2b473b24a [wpilib] Add AprilTag and AprilTagFieldLayout (#4421)
7aab8fa93a [build] Update to Native Utils 2023.6.0 (#4563)
12c2851856 [commands] WrapperCommand: inherit from CommandBase (#4561)
0da169dd84 [wpimath] Remove template argument from ElevatorFeedforward (#4554)
2416827c25 [wpimath] Fix docs for pose estimator local measurement models (#4558)
1177a3522e [wpilib] Fix Xbox/PS4 POV sim for port number constructors (#4548)
102344e27a [commands] HID classes: Add missing methods, tweak return types (#4557)
1831ef3e19 [wpilib] Fix Shuffleboard SuppliedValueWidget (#4559)
a9606ce870 [wpilib] Fix Xbox/PS4 POV sim (#4546)
6c80d5eab3 [wpimath] Remove unused SymbolExports.h include from units/base.h (#4541)
b114006543 [ntcore] Unify listeners (#4536)
32fbfb7da6 [build] cmake: Install ntcore generated include files (#4540)
02465920fb [build] Update native utils to 2023.4.0 (#4539)
3a5a376465 [wpimath] Increase constexpr support in geometry data types (#4231)
1c3c86e9f1 [ntcore] Cache GetEntry(name) values (#4531)
dcda09f90a [command] Rename trigger methods (#4210)
66157397c1 [wpilib] Make drive classes follow NWU axes convention (#4079)
9e22ffbebf [ntcore] Fix null deref in NT3 client (#4530)
648ab6115c [wpigui,dlt,glass,ov] Support arm in GUI tools (#4527)
8bc3b04f5b [wpimath] Make ComputerVisionUtil use 3D geometry classes (#4528)
cfb84a6083 [wpilibc] Don't hang waiting for NT server to start (#4524)
02c47726e1 [wpimath] Remove unused odometry instance from DifferentialDrivePoseEstimator test (#4522)
b2a0093294 [ci] Revert upgrade of github-pages-deploy-action (#4521)
2a98d6b5d7 [wpimath] PIDController: Add getters for position & velocity tolerances (#4458)
9f36301dc8 [ci] Write wpiformat patch to job summary (#4519)
901fc555f4 [wpimath] Position Delta Odometry for Mecanum (#4514)
4170ec6107 [wpimath] Position Delta Odometry for Swerve (#4493)
fe400f68c5 [docs] Add wpinet to docs build (#4517)
794669b346 [ntcore] Revamp listeners (#4511)
dcfa85a5d5 [ci] Build sanitizers with clang-14 (#4518)
15ad855f1d [ntcore] Add UnitTopic<T> (C++ only) (#4497)
11244a49d9 [wpilib] Add IsConnected function to all gyros (#4465)
1d2e8eb153 [build] Update myRobot deployment (#4515)
ad53fb19b4 [hal] Use new HMB api for addressable LED (#4479)
ba850bac3b [hal] Add more shutdown checks and motor safety shutdown (#4510)
023a5989f8 [ntcore] Fix typo in NetworkServer client connect message (#4512)
c970011ccc [docs] Add Doxygen aliases used by Foonathan memory (#4509)
07a43c3d9a [readme] Document clang-format version and /wpiformat (#4503)
a05b212b04 [ci] Revert changes to wpiformat task from #4501 (#4508)
09faf31b67 [commands] Replace Command HID inheritance with delegation (#4470)
9e1f9c1133 [commands] Add command factories (#4476)
f19d2b9b84 [ci] Add NUMBER environment variable to comment command commit script (#4507)
a28f93863c [ci] Push comment command commit directly to PR (#4506)
c9f61669b8 [ci] Fix comment command commit push (#4505)
dcce5ad3b3 [ci] Update github-script API usage (#4504)
6836e5923d [wpilibc] Restore get duty cycle scale factor (#4502)
335188c652 [dlt] Add deselect/select all buttons to download view (#4499)
60a29dcb99 [glass] Field2D: Add "hidden" option for objects (#4498)
b55d5b3034 [ci] Update deprecated github actions (#4501)
10ed4b3969 [ntcore] Various NT4 fixes (#4474)
4a401b89d7 [hal, wpilib] New DS thread model and implementation (#3787)
c195b4fc46 [wpimath] Clean up PoseEstimator nominal dt docs (#4496)
8f2e34c6a3 [build] Remove wpilib prefix from CMake flat install (#4492)
150d692df7 [wpimath] Remove unused private PoseEstimator function (#4495)
3e5bfff1b5 [wpimath] FromFieldRelativeSpeeds: Add ChassisSpeeds overload (#4494)
9c7e66a27d [commands] C++: Add CommandPtr overload for SetDefaultCommand (#4488)
0ca274866b [build] Fix CMake system library opt-ins (#4487)
dc037f8d41 [commands] Remove EndlessCommand (#4483)
16cdc741cf [wpimath] Add Pose3d(Pose2d) constructor (#4485)
9d5055176d [build] cmake: Allow disabling ntcore build (#4486)
d1e66e1296 [build] Compile all java code with inline string concatenation (#4490)
1fc098e696 Enable log macros to work with no args (#4475)
878cc8defb [wpilib] LiveWindow: Add enableAllTelemetry() (#4480)
8153911160 [build] Fix MSVC runtime archiver to grab default runtime (#4478)
fbdc810887 Upgrade to C++20 (#4239)
396143004c [ntcore] Add ntcoreffi binary (#4471)
1f45732700 [build] Update to 2023.2.4 native-utils and new dependencies (#4473)
574cb41c18 [ntcore] Various fixes (#4469)
d9d6c425e7 [build] Force Java 11 source compatibility (#4472)
58b6484dbe Switch away from NI interrupt manager to custom implementation (#3705)
ca43fe2798 [wpimath] Use Units conversions in ComputerVisionUtil docs (NFC) (#4464)
87a64ccedc [hal] Convert DutyCycle Raw output to be a high time measurement (#4466)
89a3d00297 [commands] Add FinallyDo and HandleInterrupt decorators (#4412)
1497665f96 [commands] Add C++ versions of Java-only decorators (#4457)
27b173374e [wpimath] Add minLinearAccel parameter to DifferentialDriveAccelerationLimiter (#4422)
2a13dba8ac [wpilib] TrajectoryUtil: Fix ambiguous documentation (NFC) (#4461)
77301b126c [ntcore] NetworkTables 4 (#3217)
90cfa00115 [build] cmake: Fix libssh include directory order (#4459)
5cf961edb9 [commands] Refactor lambda-based commands to inherit FunctionalCommand (#4451)
b2276e47de [wpimath] Enable continuous angle input for HolonomicDriveController (#4453)
893b46139a [fieldImages] Add utilities to simplify loading of fields (#4456)
60e29627c0 [commands] C++ unique_ptr migration (#4319)
3b81cf6c35 [wpilib] Improve Color.toString (#4450)
5c067d30a0 [wpinet] WebSocket: Add SendFrames() (#4445)
ceaf493811 [wpiutil] MakeJByteArray: Use span<uint8> instead of string_view (#4446)
10e04e2b13 [examples] FrisbeeBot: Fix reference capture (#4449)
726f67c64b [build] Add exeSplitSetup (#4444)
c7b7624c1c [wpiutil] Add MessagePack utility functions (#4448)
d600529ec0 [wpinet] uv::Async: Add UnsafeSend() (#4447)
b53b3526a2 [wpimath] Add CoordinateSystem conversion for Transform3d (#4443)
38bb23eb18 [wpimath] Add scalar multiply and divide operators to all geometry classes (#4438)
3937ff8221 [wpilib] Remove deprecated Controller class (#4440)
abbfe244b5 [wpilib] Improve Color FromHSV (#4439)
4ddb8aa0dd [sim] Provide function that resets all simulation data (#4016)
a791470de7 Clean up Java warning suppressions (#4433)
17f504f548 [hal,wpilib] Fix SPI Mode Setting (#4434)
773198537c [wpiutil] Add wpi::scope_exit (#4432)
5ac658c8f0 [wpiutil] Logger: Conditionalize around WPI_LOG (#4431)
8767e4a941 [wpiutil] DataLog: Fix SetMetadata output (#4430)
8c4af073f4 [wpiutil] Synchronization: shutdown race protection (#4429)
c79f38584a [build] Fix Java integration tests (#4428)
36c08dd97c [build] Fix cmake install of fmtlib (#4426)
69b7b3dd7d [ci] Remove the Windows cmake job (#4425)
738c75fed8 [readme] Fix formatting/linting link (#4423)
4eb1d03fb3 [wpimath] Document C++ LinearFilter exception (#4417)
ba4ec6c967 [build] Fix clang-tidy false positive on Linux (#4406)
97836f0e55 [commands] Fix ProfiledPIDSubsystem setGoal behavior (#4414)
fdfb85f695 [wpimath] Remove Java LQR constructor that takes a controller gain matrix (#4419)
ab1baf4832 [wpimath] Add rotation matrix constructor to Rotation3d (#4413)
9730032866 [wpimath] Document LQR and KalmanFilter exceptions (#4418)
5b656eecf6 [wpimath] Fix HTML5 entity (#4420)
9ae38eaa7c [commands] Add owning overload to ProxyScheduleCommand (#4405)
cb33bd71df [commands] deprecate withInterrupt decorator (#4407)
d9b4e7b8bf [commands] Revert "Change grouping decorator impl to flatten nested group structures (#3335)" (#4402)
0389bf5214 [hal] REVPH: Improve handling of disconnected CAN Bus (#4169)
4267fa08d1 [wpilibc] ADIS IMUs: Fix memory leak (#4170)
65c8fbd452 [wpilib] MotorControllerGroup: Override setVoltage (#4403)
f36162fddc [wpimath] Improve Discretization internal docs (#4400)
5149f7d894 [wpimath] Add two-vector Rotation3d constructor (#4398)
20b5bed1cb [wpimath] Clean up Java Quaternion class (#4399)
f18dd1905d [build] Include all thirdparty sources in distribution (#4397)
aa9d7f1cdc [wpiutil] Import foonathan memory (#4306)
2742662254 [ci] Remove a couple of obsolete clang-tidy checks (#4396)
a5df391166 [hal, wpilib] Fix up DIO pulse API (#4387)
59e6706b75 [glass] Turn on docking by default
8461bb1e03 [glass] Add support for saving docking info
b873e208b4 [wpigui] Add support for imgui config flags
873e72df8c [build] Update imgui to 1.88 docking branch
c8bd6fc5b4 [ci] Fix comment-command (take 2) (#4395)
fed68b83b4 [ci] Fix comment-command action not running runners (#4393)
0ef8a4e1df [wpimath] Support formatting more Eigen types (#4391)
c393b3b367 [build] Update to native utils 2023.1.0 and Gradle 7.5.1 (#4392)
b5a17f762c [wpimath] Add direction to slew rate limiter (#4377)
fafc81ed1a [wpiutil] Upgrade to fmt 9.1.0 (#4389)
cc56bdc787 [wpiutil] SafeThread: Add Synchronization object variant (#4382)
4254438d8d [commands] Mark command group lifecycle methods as final (#4385)
97c15af238 [wpimath] LinearSystemId: Fix docs, move C++ impls out of header (#4388)
d22ff8a158 [wpiutil] Add JNI access to C++ stderr (#4381)
fdb5a2791f [wpiutil] jni_util: Add Mac-friendly MakeJLongArray/JArrayRef (#4383)
c3a93fb995 [commands] Revamp Interruptible (#4192)
f2a8d38d2a [commands] Rename Command.repeat to repeatedly (#4379)
9e24c6eac0 [wpiutil] Logger: paren-protect instance usage in macro (#4384)
fe4d12ce22 [wpimath] Add LTV controller derivations and make enums private (#4380)
eb08486039 [build] Fix MacOS binary rpath generation (#4376)
ccf83c634a [build] Use native-utils platform names instead of raw strings (#4375)
3fd69749e7 [docs] Upgrade to doxygen 1.9.4 (#4370)
594df5fc08 [wpinet] uv/util.h: Pull in ws2_32.lib on Windows for ntohs (#4371)
539070820d [ci] Enable asan for wpinet and wpiutil (#4369)
564a56d99b [wpinet] Fix memory leak in WorkerThreadTest (#4368)
5adf50d93c [upstream_utils] Refactor upstream_utils scripts (#4367)
d80e8039d7 [wpiutil] Suppress fmtlib clang-tidy warning in C++20 consteval contexts (#4364)
0e6d67b23b [upstream_utils] Remove yapf format disable comment (#4366)
be5270697a [build] Suppress enum-enum deprecation warning in OpenCV (#4365)
8d28851263 Add Rosetta install command to build requirements (#4363)
3d2115c93e [wpinet] include-what-you-use in MulticastTest (#4360)
91002ae3cc [wpimath] Upgrade to Drake 1.6.0 (#4361)
148c18e658 [wpinet] Upgrade to libuv 1.44.2 (#4362)
a2a5c926b6 Fix clang-tidy warnings (#4359)
ea6b1d8449 [wpiutil] Remove unused ManagedStatic class (#4358)
ac9be78e27 Use stricter C++ type conversions (#4357)
151dabb2af [wpiutil] Upgrade to fmt 9.0.0 (#4337)
340465c929 [ci] Upgrade to clang-format and clang-tidy 14 (NFC) (#4347)
d45bcddd15 [examples] Add comments to StateSpaceDifferentialDrive (#4341)
0e0786331a Update LLVM libraries to 14.0.6 (#4350)
c5db23f296 [wpimath] Add Eigen sparse matrix and iterative solver support (#4349)
44abc8dfa6 [upstream_utils] Remove git version from upstream patches (#4351)
3fdb2f767d [wpimath] Add comments with Ramsete equations (#4348)
0485f05da9 [wpilibjExamples] Upgrade jacoco to match allwpilib (#4346)
0a5eb65231 [wpinet] Handle empty txt block for mdns announcer (#4072)
19ffebaf3e [wpilib] Add reference to I2C Lockup to API Docs (NFC) (#4340)
ce1a90d639 [hal] Replace SerialHelper "goto done" with continue (#4342)
d25af48797 [ci] Make upstream_utils CI fail on untracked files (#4339)
ebb836dacb [examples] Fix negations in event loop examples (#4334)
d83e202f00 [upstream_utils] Update paths in update_fmt.py (#4338)
3ccf806064 [wpimath] Remove redundant LinearFilter.finiteDifference() argument (#4335)
6f1e01f8bd [wpimath] Document example of online filtering for LinearFilter.finiteDifference() (#4336)
1023c34b1c [readme] Update location of ni-libraries (#4333)
faa29d596c [wpilib] Improve Notifier docs (NFC) (#4326)
add00a96ed [wpimath] Improve DifferentialDriveAccelerationLimiter docs (NFC) (#4323)
82fac41244 [wpimath] Better document trackwidth parameters (NFC) (#4324)
5eb44e22a9 Format Python scripts with black (NFC) (#4325)
2e09fa7325 [build] Fix mpack cmake (#4322)
fe3c24b1ee [command] Add ignoringDisable decorator (#4305)
aa221597bc [build] Add M1 builds, change arm name, update to 2023 deps (#4315)
579a8ee229 [ci] Use one worker for Windows release Gradle build (#4318)
5105c5eab6 [wpilibj] Change "final" to "exit" in the IterativeRobotBase JavaDoc (NFC) (#4317)
787fe6e7a5 [wpiutil] Separate third party libraries (#4190)
6671f8d099 [wpigui] Update portable file dialogs (#4316)
9ac9b69aa2 [command] Reorder Scheduler operations (#4261)
e61028cb18 [build] halsim_gui: Add wpinet dependency (#4313)
661d23eaf5 [glass] Add precision setting for NetworkTable view (#4311)
666040e3e5 [hal] Throw exceptions for invalid sizes in I2C and SPI JNI (#4312)
aebc272449 [build] Upgrade to spotbugs Gradle plugin 5.0.8 (#4310)
fd884581e4 [wpilib] Add BooleanEvent/Trigger factories on HID classes (#4247)
9b1bf5c7f1 [wpimath] Move Drake and Eigen to thirdparty folders (#4307)
c9e620a920 [wpilibc] Change EventLoop data structure to vector (#4304)
41d40dd62f [wpinet] Fix libuv unused variable warning on Mac (#4299)
30f5b68264 [wpinet] Fix JNI loading error (#4295)
f7b3f4b90e [examples] Getting Started: Change Joystick to XboxController (#4194)
a99c11c14c [wpimath] Replace UKF implementation with square root form (#4168)
45b7fc445b [wpilib] Add EventLoop (#4104)
16a4888c52 [wpilib] Default off LiveWindow telemetry (#4301)
17752f1337 [ci] Split debug and release Windows builds (#4277)
abb45a68db [commands] Remove custom test wrappers (#4296)
1280a54ef3 [upstream_utils]: Make work with Python 3.8 (#4298)
f2d243fa68 [build] Change defaults for Java lints (#4300)
a4787130f4 Update using development build to work with 2023 gradlerio (#4294)
af7985e46c [wpiutil] Use invoke_result_t instead of result_of in future.h (#4293)
e9d1b5c2d0 [hal] Remove deprecated SimDevice functions (#4209)
45b598d236 [wpilibj] Add toString() methods to Color and Color8Bit (#4286)
fc37265da5 [wpimath] Add angle measurement convention to ArmFeedforward docs (NFC) (#4285)
a4ec13eb0e [wpilibjexamples] Remove unnecessary voltage desaturation
2fa52007af [wpilibc] Use GetBatteryVoltage() in MotorController::SetVoltage
d9f9cd1140 [wpimath] Reset prev_time on pose estimator reset (#4283)
8b6df88783 [wpilibj] Tachometer.getFrequency(): Fix bug (#4281)
345cff08c0 [wpiutil] Make wpi::array constexpr (#4278)
57428112ac [wpimath] Upgrade to Drake v1.3.0 (#4279)
a18d4ff154 [build] Fix tools not being copied when built with -Ponly* (#4276)
d1cd07b9f3 [wpigui] Add OpenURL (#4273)
e67f8e917a [glass] Use glfwSetKeyCallback for Enter key remap (#4275)
be2fedfe50 [wpimath] Add stdexcept include for std::invalid_argument (IWYU) (#4274)
7ad2be172e [build] Update native-utils to 2023.0.1 (#4272)
abc605c9c9 [ci] Update workflows to 20.04 base image (#4271)
3e94805220 [wpiutil] Reduce llvm collections patches (#4268)
db2e1d170e [upstream_utils] Document how to update thirdparty libraries (#4253)
96ebdcaf16 [wpimath] Remove unused Eigen AutoDiff module (#4267)
553b2a3b12 [upstream_utils] Fix stackwalker (#4265)
3e13ef42eb [wpilibc] Add missing std::array #include (include-what-you-use) (#4266)
d651a1fcec Fix internal deprecation warnings (#4257)
b193b318c1 [commands] Add unless() decorator (#4244)
ef3714223b [commands] Remove docs reference to obsolete interrupted() method (NFC) (#4262)
3d8dbbbac3 [readme] Add quickstart (#4225)
013efdde25 [wpinet] Wrap a number of newer libuv features (#4260)
816aa4e465 [wpilib] Add Pneumatics sim classes (#4033)
046c2c8972 [wpilibc] Rename SpeedControllerGroupTest.cpp (#4258)
d80e9cdf64 [upstream_utils] Use shallow clones for thirdparty repos (#4255)
7576136b4a [upstream_utils] Make update_llvm.py executable (#4254)
c3b223ce60 [wpiutil] Vendor llvm and update to 13.0.0 (#4224)
5aa67f56e6 [wpimath] Clean up math comments (#4252)
fff4d1f44e [wpimath] Extend Eigen warning suppression to GCC 12 (#4251)
0d9956273c [wpimath] Add CoordinateSystem.convert() translation and rotation overloads (#4227)
3fada4e0b4 [wpinet] Update to libuv 1.44.1 (#4232)
65b23ac45e [wpilibc] Fix return value of DriverStation::GetJoystickAxisType() (#4230)
4ac34c0141 [upstream_utils] Cleanup update_libuv.py (#4249)
8bd614bb1e [upstream_utils] Use "git am" instead of "git apply" for patches (#4248)
4253d6d5f0 [upstream_utils] Apply "git am" patches individually (#4250)
6a4752dcdc Fix GCC 12.1 warning false positives (#4246)
5876b40f08 [wpimath] Memoize CoordinateSystem and CoordinateAxis statics (#4241)
5983434a70 [cameraserver] Replace IterativeRobot in comment sample code with TimedRobot (#4238)
a3d44a1e69 [wpimath] Add Translation2d.getAngle() (#4217)
d364bbd5a7 [upstream_utils] Give vendor update scripts execute permissions (#4226)
f341e1b2be [wpimath] Document standard coordinate systems better (NFC) (#4228)
9af389b200 [wpinet] AddrToName: Initialize name (#4229)
2ae4adf2d7 [ci] Add wpiformat command to PRs (#4223)
178b2a1e88 Contributing.md: Correct version of clang-format used (#4222)
18db343cdc [wpiutil, wpinet] Vendor libuv, stack walker (#4219)
f0c821282a [build] Use artifactory mirror (#4220)
d673ead481 [wpinet] Move network portions of wpiutil into new wpinet library (#4077)
b33715db15 [wpimath] Add CoordinateSystem class (#4214)
99424ad562 [sim] Allow creating a PWMSim object from a PWMMotorController (#4039)
dc6f641fd2 [wpimath] PIDController: Reset position and velocity error when reset() is called. (#4064)
f20a20f3f1 [wpimath] Add 3D geometry classes (#4175)
708a4bc3bc [wpimath] Conserve previously calculated swerve module angles when updating states for stationary ChassisSpeeds (#4208)
ef7ed21a9d [wpimath] Improve accuracy of ComputerVisionUtil.calculateDistanceToTarget() (#4215)
b1abf455c1 [wpimath] LTVUnicycleController: Use LUT, provide default hyperparameters (#4213)
d5456cf278 [wpimath] LTVDifferentialDriveController: Remove unused variable (#4212)
99343d40ba [command] Remove old command-based framework (#4211)
ee03a7ad3b Remove most 2022 deprecations (#4205)
ce1a7d698a [wpimath] Refactor WheelVoltages inner class to a separate file (#4203)
87bf70fa8e [wpimath] Add LTV controllers (#4094)
ebd2a303bf [wpimath] Remove deprecated MakeMatrix() function (#4202)
e28776d361 [wpimath] LinearSystemLoop: Add extern templates for common cases
dac1429aa9 [wpimath] LQR: Use extern template instead of Impl class
e767605e94 [wpimath] Add typedefs for common types
97c493241f [wpimath] UnscentedKalmanFilter: Move implementation out-of-line
8ea90d8bc9 [wpimath] ExtendedKalmanFilter: Move implementation out-of-line
ae7b1851ec [wpimath] KalmanFilter: Use extern template instead of Impl class
e3d62c22d3 [wpimath] Add extern templates for common cases
7200c4951d [wpiutil] SymbolExports: Add WPILIB_IMPORTS for dllimport
84056c9347 [wpiutil] SymbolExports: Add EXPORT_TEMPLATE_DECLARE/DEFINE
09cf6eeecb [wpimath] ApplyDeadband: add a scale param (#3865)
03230fc842 [build,ci] Enable artifactory build cache (#4200)
63cf3aaa3f [examples] Don't square ArcadeDrive inputs in auto (#4201)
18ff694f02 [wpimath] Add Rotation2d.fromRadians factory (#4178)
4f79ceedd9 [wpilibc] Add missing #include (#4198)
f7ca72fb41 [command] Rename PerpetualCommand to EndlessCommand (#4177)
a06b3f0307 [hal] Correct documentation on updateNotifierAlarm (#4156)
d926dd1610 [wpimath] Fix pose estimator performance (#4111)
51bc893bc5 [wpiutil] CircularBuffer: Change Java package-private methods to public (#4181)
fbe761f7f6 [build] Increase Gradle JVM heap size (#4172)
5ebe911933 [wpimath] Add DifferentialDriveAccelerationLimiter (#4091)
3919250da2 [wpilibj] Remove finalizers (#4158)
b3aee28388 [commands] Allow BooleanSupplier for Trigger operations (#4103)
9d20ab3024 [wpilib] Allow disabling ElevatorSim gravity (#4145)
aaa69f6717 [ci] Remove 32-bit Windows builds (#4078)
355a11a414 Update Java linters and fix new PMD errors (#4157)
ffc69d406c [examples] Reduce suggested acceleration in Ramsete example (#4171)
922d50079a [wpimath] Units: fix comment in degreesToRotations (NFC) (#4159)
dd163b62ae [wpimath] Rotation2d: Add factory method that uses rotations (#4166)
bd80e220b9 [ci] Upgrade CMake actions (#4161)
aef4b16d4c [wpimath] Remove unnecessary NOLINT in LinearPlantInversionFeedforward (NFC) (#4155)
975171609e [wpilib] Compressor: Rename enabled to isEnabled (#4147)
5bf46a9093 [wpimath] Add ComputerVisionUtil (#4124)
f27a1f9bfb [commands] Fix JoystickButton.getAsBoolean (#4131)
1b26e2d5da [commands] Add RepeatCommand (#4009)
88222daa3d [hal] Fix misspelling in AnalogInput/Output docs (NFC) (#4153)
81c5b41ce1 [wpilibj] Document MechanismLigament2d angle unit (NFC) (#4142)
9650e6733e [wpiutil] DataLog: Document finish and thread safety (NFC) (#4140)
c8905ec29a [wpimath] Remove ImplicitModelFollower dt argument (#4119)
b4620f01f9 [wpimath] Fix Rotation2d interpolation in Java (#4125)
2e462a19d3 [wpimath] Constexprify units unary operators (#4138)
069f932e59 [build] Fix gl3w cmake build (#4139)
126e3de91a [wpilibc] Remove unused SetPriority() call from Ultrasonic (#4123)
ba0dccaae4 [wpimath] Fix reference to Rotation2d.fromRadians() (#4118)
e1b6e5f212 [wpilib] Improve MotorSafety documentation (NFC) (#4120)
8d79dc8738 [wpimath] Add ImplicitModelFollower (#4056)
78108c2aba [wpimath] Fix PIDController having incorrect error after calling SetSetpoint() (#4070)
cdafc723fb [examples] Remove unused LinearPlantInversionFeedforward includes (#4069)
0d70884dce [wpimath] Add InterpolatedTreeMap (#4073)
765efa325e [wpimath] Remove redundant column index from vectors (#4116)
89ffcbbe41 [wpimath] Update TrapezoidProfile class name in comment (NFC) (#4107)
95ae23b0e7 [wpimath] Improve EKF numerical stability (#4093)
d5cb6fed67 [wpimath] Support zero cost entries in MakeCostMatrix() (#4100)
d0fef18378 [wpimath] Remove redundant `this.` from ExtendedKalmanFilter.java (#4115)
d640c0f41f [wpimath] Fix pose estimator local measurement standard deviation docs (NFC) (#4113)
a2fa5e3ff7 [wpilibc] BatterySim: Provide non-initializer list versions of Calculate (#4076)
a3eea9958e [hal] Add link to FRC CAN Spec (NFC) (#4086)
db27331d7b [wpilib] Update DifferentialDrive docs (NFC) (#4085)
fdfb31f164 [dlt] Export boolean[] values (#4082)
f93c3331b3 [wpigui] disable changing directory when initializing on MacOS (#4092)
ab7ac4fbb9 [build] Fix various warnings in cmake builds (#4081)
bc39a1a293 [wpilibc] Fix moved pneumatics objects not destructing properly (#4068)
2668130e70 [wpimath] Remove SwerveDrivePoseEstimator encoder reset warning (#4066)
d27ed3722b [ci] Set actions workflow concurrency (#4060)
dae18308c9 [wpimath] Minor fixes to Rotation2d docs (NFC) (#4055)
d66555e42f [datalogtool] Add datalogtool
9f52d8a3b1 [wpilib] DriverStation: Add DataLog support for modes and joystick data
757ea91932 [wpilib] Add DataLogManager
02a804f1c5 [ntcore] Add DataLog support
9b500df0d9 [wpiutil] Add high speed data logging
5a89575b3a [wpiutil] Import customized LLVM MemoryBuffer
b8c4d7527b [wpiutil] Add MappedFileRegion
ac5d46cfa7 [wpilibc] Fix ProfiledPID SetTolerance default velocity value (#4054)
bc9e96e86f [wpilib] Absolute Encoder API and behavior fixes (#4052)
f88c435dd0 [hal] Add mechanism to cancel all periodic callbacks (#4049)
Change-Id: I49aa5b08abbefc7a045e99e19d48ce2cd8fc4d1b
git-subtree-dir: third_party/allwpilib
git-subtree-split: 83f1860047c86aa3330fcb41caf3b2047e074804
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/upstream_utils/stack_walker_patches/0001-Apply-PR-35.patch b/upstream_utils/stack_walker_patches/0001-Apply-PR-35.patch
new file mode 100644
index 0000000..8fe466e
--- /dev/null
+++ b/upstream_utils/stack_walker_patches/0001-Apply-PR-35.patch
@@ -0,0 +1,1353 @@
+From 6e2f70b7bb7c59fe99b7469bf3e3a257876403dc Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Sun, 22 May 2022 23:58:57 -0400
+Subject: [PATCH 1/3] Apply PR #35
+
+---
+ .gitignore | 9 +
+ Main/StackWalker/StackWalker.cpp | 642 ++++++++++--------------
+ Main/StackWalker/StackWalker.h | 40 +-
+ Main/StackWalker/StackWalker_VC2017.sln | 16 +-
+ Main/StackWalker/main.cpp | 2 +-
+ 5 files changed, 306 insertions(+), 403 deletions(-)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..5d102c5
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,9 @@
++################################################################################
++# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
++################################################################################
++
++*.suo
++*.db
++*.sqlite
++/Main/StackWalker/_ReSharper.Caches/*
++/.vs/*
+diff --git a/Main/StackWalker/StackWalker.cpp b/Main/StackWalker/StackWalker.cpp
+index 7008ac6..48c7c57 100644
+--- a/Main/StackWalker/StackWalker.cpp
++++ b/Main/StackWalker/StackWalker.cpp
+@@ -1,4 +1,4 @@
+-/**********************************************************************
++/**********************************************************************
+ *
+ * StackWalker.cpp
+ * https://github.com/JochenKalmbach/StackWalker
+@@ -87,162 +87,36 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <tchar.h>
+-#include <windows.h>
+ #pragma comment(lib, "version.lib") // for "VerQueryValue"
+ #pragma warning(disable : 4826)
+
++#ifdef UNICODE
++ #define DBGHELP_TRANSLATE_TCHAR
+
+-// If VC7 and later, then use the shipped 'dbghelp.h'-file
++#endif
+ #pragma pack(push, 8)
+-#if _MSC_VER >= 1300
+ #include <dbghelp.h>
+-#else
+-// inline the important dbghelp.h-declarations...
+-typedef enum
+-{
+- SymNone = 0,
+- SymCoff,
+- SymCv,
+- SymPdb,
+- SymExport,
+- SymDeferred,
+- SymSym,
+- SymDia,
+- SymVirtual,
+- NumSymTypes
+-} SYM_TYPE;
+-typedef struct _IMAGEHLP_LINE64
+-{
+- DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_LINE64)
+- PVOID Key; // internal
+- DWORD LineNumber; // line number in file
+- PCHAR FileName; // full filename
+- DWORD64 Address; // first instruction of line
+-} IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
+-typedef struct _IMAGEHLP_MODULE64
+-{
+- DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_MODULE64)
+- DWORD64 BaseOfImage; // base load address of module
+- DWORD ImageSize; // virtual size of the loaded module
+- DWORD TimeDateStamp; // date/time stamp from pe header
+- DWORD CheckSum; // checksum from the pe header
+- DWORD NumSyms; // number of symbols in the symbol table
+- SYM_TYPE SymType; // type of symbols loaded
+- CHAR ModuleName[32]; // module name
+- CHAR ImageName[256]; // image name
+- CHAR LoadedImageName[256]; // symbol file name
+-} IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
+-typedef struct _IMAGEHLP_SYMBOL64
+-{
+- DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_SYMBOL64)
+- DWORD64 Address; // virtual address including dll base address
+- DWORD Size; // estimated size of symbol, can be zero
+- DWORD Flags; // info about the symbols, see the SYMF defines
+- DWORD MaxNameLength; // maximum size of symbol name in 'Name'
+- CHAR Name[1]; // symbol name (null terminated string)
+-} IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
+-typedef enum
+-{
+- AddrMode1616,
+- AddrMode1632,
+- AddrModeReal,
+- AddrModeFlat
+-} ADDRESS_MODE;
+-typedef struct _tagADDRESS64
+-{
+- DWORD64 Offset;
+- WORD Segment;
+- ADDRESS_MODE Mode;
+-} ADDRESS64, *LPADDRESS64;
+-typedef struct _KDHELP64
+-{
+- DWORD64 Thread;
+- DWORD ThCallbackStack;
+- DWORD ThCallbackBStore;
+- DWORD NextCallback;
+- DWORD FramePointer;
+- DWORD64 KiCallUserMode;
+- DWORD64 KeUserCallbackDispatcher;
+- DWORD64 SystemRangeStart;
+- DWORD64 Reserved[8];
+-} KDHELP64, *PKDHELP64;
+-typedef struct _tagSTACKFRAME64
+-{
+- ADDRESS64 AddrPC; // program counter
+- ADDRESS64 AddrReturn; // return address
+- ADDRESS64 AddrFrame; // frame pointer
+- ADDRESS64 AddrStack; // stack pointer
+- ADDRESS64 AddrBStore; // backing store pointer
+- PVOID FuncTableEntry; // pointer to pdata/fpo or NULL
+- DWORD64 Params[4]; // possible arguments to the function
+- BOOL Far; // WOW far call
+- BOOL Virtual; // is this a virtual frame?
+- DWORD64 Reserved[3];
+- KDHELP64 KdHelp;
+-} STACKFRAME64, *LPSTACKFRAME64;
+-typedef BOOL(__stdcall* PREAD_PROCESS_MEMORY_ROUTINE64)(HANDLE hProcess,
+- DWORD64 qwBaseAddress,
+- PVOID lpBuffer,
+- DWORD nSize,
+- LPDWORD lpNumberOfBytesRead);
+-typedef PVOID(__stdcall* PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE hProcess, DWORD64 AddrBase);
+-typedef DWORD64(__stdcall* PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess, DWORD64 Address);
+-typedef DWORD64(__stdcall* PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,
+- HANDLE hThread,
+- LPADDRESS64 lpaddr);
+-
+-// clang-format off
+-#define SYMOPT_CASE_INSENSITIVE 0x00000001
+-#define SYMOPT_UNDNAME 0x00000002
+-#define SYMOPT_DEFERRED_LOADS 0x00000004
+-#define SYMOPT_NO_CPP 0x00000008
+-#define SYMOPT_LOAD_LINES 0x00000010
+-#define SYMOPT_OMAP_FIND_NEAREST 0x00000020
+-#define SYMOPT_LOAD_ANYTHING 0x00000040
+-#define SYMOPT_IGNORE_CVREC 0x00000080
+-#define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100
+-#define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200
+-#define SYMOPT_EXACT_SYMBOLS 0x00000400
+-#define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800
+-#define SYMOPT_IGNORE_NT_SYMPATH 0x00001000
+-#define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000
+-#define SYMOPT_PUBLICS_ONLY 0x00004000
+-#define SYMOPT_NO_PUBLICS 0x00008000
+-#define SYMOPT_AUTO_PUBLICS 0x00010000
+-#define SYMOPT_NO_IMAGE_SEARCH 0x00020000
+-#define SYMOPT_SECURE 0x00040000
+-#define SYMOPT_DEBUG 0x80000000
+-#define UNDNAME_COMPLETE (0x0000) // Enable full undecoration
+-#define UNDNAME_NAME_ONLY (0x1000) // Crack only the name for primary declaration;
+-// clang-format on
+-
+-#endif // _MSC_VER < 1300
+ #pragma pack(pop)
+
+-// Some missing defines (for VC5/6):
+-#ifndef INVALID_FILE_ATTRIBUTES
+-#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+-#endif
+
+-// secure-CRT_functions are only available starting with VC8
+-#if _MSC_VER < 1400
+-#define strcpy_s(dst, len, src) strcpy(dst, src)
+-#define strncpy_s(dst, len, src, maxLen) strncpy(dst, len, src)
+-#define strcat_s(dst, len, src) strcat(dst, src)
+-#define _snprintf_s _snprintf
+-#define _tcscat_s _tcscat
+-#endif
+-
+-static void MyStrCpy(char* szDest, size_t nMaxDestSize, const char* szSrc)
++static void MyStrCpy(TCHAR* szDest, size_t nMaxDestSize, const TCHAR* szSrc)
+ {
+ if (nMaxDestSize <= 0)
+ return;
+- strncpy_s(szDest, nMaxDestSize, szSrc, _TRUNCATE);
++ _tcsncpy_s(szDest, nMaxDestSize, szSrc, _TRUNCATE);
+ // INFO: _TRUNCATE will ensure that it is null-terminated;
+ // but with older compilers (<1400) it uses "strncpy" and this does not!)
+ szDest[nMaxDestSize - 1] = 0;
+ } // MyStrCpy
+
++#ifdef _UNICODE
++ typedef SYMBOL_INFOW tSymbolInfo;
++ typedef IMAGEHLP_LINEW64 tImageHelperLine;
++#else
++ typedef SYMBOL_INFO tSymbolInfo;
++ typedef IMAGEHLP_LINE64 tImageHelperLine;
++#endif
++
+ // Normally it should be enough to use 'CONTEXT_FULL' (better would be 'CONTEXT_ALL')
+ #define USED_CONTEXT_FLAGS CONTEXT_FULL
+
+@@ -253,26 +127,26 @@ public:
+ {
+ m_parent = parent;
+ m_hDbhHelp = NULL;
+- pSC = NULL;
++ symCleanup = NULL;
+ m_hProcess = hProcess;
+ m_szSymPath = NULL;
+- pSFTA = NULL;
+- pSGLFA = NULL;
+- pSGMB = NULL;
+- pSGMI = NULL;
+- pSGO = NULL;
+- pSGSFA = NULL;
+- pSI = NULL;
+- pSLM = NULL;
+- pSSO = NULL;
+- pSW = NULL;
+- pUDSN = NULL;
+- pSGSP = NULL;
++ symFunctionTableAccess64 = NULL;
++ symGetLineFromAddr64 = NULL;
++ symGetModuleBase64 = NULL;
++ symGetModuleInfo64 = NULL;
++ symGetOptions = NULL;
++ symFromAddr = NULL;
++ symInitialize = NULL;
++ symLoadModuleEx = NULL;
++ symSetOptions = NULL;
++ stackWalk64 = NULL;
++ unDecorateSymbolName = NULL;
++ symGetSearchPath = NULL;
+ }
+ ~StackWalkerInternal()
+ {
+- if (pSC != NULL)
+- pSC(m_hProcess); // SymCleanup
++ if (symCleanup != NULL)
++ symCleanup(m_hProcess); // SymCleanup
+ if (m_hDbhHelp != NULL)
+ FreeLibrary(m_hDbhHelp);
+ m_hDbhHelp = NULL;
+@@ -281,7 +155,7 @@ public:
+ free(m_szSymPath);
+ m_szSymPath = NULL;
+ }
+- BOOL Init(LPCSTR szSymPath)
++ BOOL Init(LPCTSTR szSymPath)
+ {
+ if (m_parent == NULL)
+ return FALSE;
+@@ -354,54 +228,72 @@ public:
+ m_hDbhHelp = LoadLibrary(_T("dbghelp.dll"));
+ if (m_hDbhHelp == NULL)
+ return FALSE;
+- pSI = (tSI)GetProcAddress(m_hDbhHelp, "SymInitialize");
+- pSC = (tSC)GetProcAddress(m_hDbhHelp, "SymCleanup");
+-
+- pSW = (tSW)GetProcAddress(m_hDbhHelp, "StackWalk64");
+- pSGO = (tSGO)GetProcAddress(m_hDbhHelp, "SymGetOptions");
+- pSSO = (tSSO)GetProcAddress(m_hDbhHelp, "SymSetOptions");
+-
+- pSFTA = (tSFTA)GetProcAddress(m_hDbhHelp, "SymFunctionTableAccess64");
+- pSGLFA = (tSGLFA)GetProcAddress(m_hDbhHelp, "SymGetLineFromAddr64");
+- pSGMB = (tSGMB)GetProcAddress(m_hDbhHelp, "SymGetModuleBase64");
+- pSGMI = (tSGMI)GetProcAddress(m_hDbhHelp, "SymGetModuleInfo64");
+- pSGSFA = (tSGSFA)GetProcAddress(m_hDbhHelp, "SymGetSymFromAddr64");
+- pUDSN = (tUDSN)GetProcAddress(m_hDbhHelp, "UnDecorateSymbolName");
+- pSLM = (tSLM)GetProcAddress(m_hDbhHelp, "SymLoadModule64");
+- pSGSP = (tSGSP)GetProcAddress(m_hDbhHelp, "SymGetSearchPath");
+-
+- if (pSC == NULL || pSFTA == NULL || pSGMB == NULL || pSGMI == NULL || pSGO == NULL ||
+- pSGSFA == NULL || pSI == NULL || pSSO == NULL || pSW == NULL || pUDSN == NULL ||
+- pSLM == NULL)
++
++#ifdef _UNICODE
++ static const char strSymInitialize[] = "SymInitializeW";
++ static const char strUnDecorateSymbolName[] = "UnDecorateSymbolNameW";
++ static const char strSymGetSearchPath[] = "SymGetSearchPathW";
++ static const char strSymLoadModuleEx[] = "SymLoadModuleExW";
++ static const char strSymGetLineFromAddr64[] = "SymGetLineFromAddrW64";
++ static const char strSymGetModuleInfo64[] = "SymGetModuleInfoW64";
++ static const char strSymFromAddr[] = "SymFromAddrW";
++#else
++ static const char strSymInitialize[] = "SymInitialize";
++ static const char strUnDecorateSymbolName[] = "UnDecorateSymbolName";
++ static const char strSymGetSearchPath[] = "SymGetSearchPath";
++ static const char strSymLoadModuleEx[] = "SymLoadModuleEx";
++ static const char strSymGetLineFromAddr64[] = "SymGetLineFromAddr64";
++ static const char strSymGetModuleInfo64[] = "SymGetModuleInfo64";
++ static const char strSymFromAddr[] = "SymFromAddr";
++#endif
++ symInitialize = (tSI)GetProcAddress(m_hDbhHelp, strSymInitialize);
++ symCleanup = (tSC)GetProcAddress(m_hDbhHelp, "SymCleanup");
++
++ stackWalk64 = (tSW)GetProcAddress(m_hDbhHelp, "StackWalk64");
++ symGetOptions = (tSGO)GetProcAddress(m_hDbhHelp, "SymGetOptions");
++ symSetOptions = (tSSO)GetProcAddress(m_hDbhHelp, "SymSetOptions");
++
++ symFunctionTableAccess64 = (tSFTA)GetProcAddress(m_hDbhHelp, "SymFunctionTableAccess64");
++ symGetLineFromAddr64 = (tSGLFA)GetProcAddress(m_hDbhHelp, strSymGetLineFromAddr64);
++ symGetModuleBase64 = (tSGMB)GetProcAddress(m_hDbhHelp, "SymGetModuleBase64");
++ symGetModuleInfo64 = (tSGMI)GetProcAddress(m_hDbhHelp, strSymGetModuleInfo64);
++ symFromAddr = (tSFA)GetProcAddress(m_hDbhHelp, strSymFromAddr);
++ unDecorateSymbolName = (tUDSN)GetProcAddress(m_hDbhHelp, strUnDecorateSymbolName);
++ symLoadModuleEx = (tSLM)GetProcAddress(m_hDbhHelp, strSymLoadModuleEx);
++ symGetSearchPath = (tSGSP)GetProcAddress(m_hDbhHelp, strSymGetSearchPath);
++
++ if (symCleanup == NULL || symFunctionTableAccess64 == NULL || symGetModuleBase64 == NULL || symGetModuleInfo64 == NULL || symGetOptions == NULL ||
++ symFromAddr == NULL || symInitialize == NULL || symSetOptions == NULL || stackWalk64 == NULL || unDecorateSymbolName == NULL ||
++ symLoadModuleEx == NULL)
+ {
+ FreeLibrary(m_hDbhHelp);
+ m_hDbhHelp = NULL;
+- pSC = NULL;
++ symCleanup = NULL;
+ return FALSE;
+ }
+
+ // SymInitialize
+ if (szSymPath != NULL)
+- m_szSymPath = _strdup(szSymPath);
+- if (this->pSI(m_hProcess, m_szSymPath, FALSE) == FALSE)
+- this->m_parent->OnDbgHelpErr("SymInitialize", GetLastError(), 0);
++ m_szSymPath = _tcsdup(szSymPath);
++ if (this->symInitialize(m_hProcess, m_szSymPath, FALSE) == FALSE)
++ this->m_parent->OnDbgHelpErr(_T("SymInitialize"), GetLastError(), 0);
+
+- DWORD symOptions = this->pSGO(); // SymGetOptions
++ DWORD symOptions = this->symGetOptions(); // SymGetOptions
+ symOptions |= SYMOPT_LOAD_LINES;
+ symOptions |= SYMOPT_FAIL_CRITICAL_ERRORS;
+ //symOptions |= SYMOPT_NO_PROMPTS;
+ // SymSetOptions
+- symOptions = this->pSSO(symOptions);
++ symOptions = this->symSetOptions(symOptions);
+
+- char buf[StackWalker::STACKWALK_MAX_NAMELEN] = {0};
+- if (this->pSGSP != NULL)
++ TCHAR buf[StackWalker::STACKWALK_MAX_NAMELEN] = {0};
++ if (this->symGetSearchPath != NULL)
+ {
+- if (this->pSGSP(m_hProcess, buf, StackWalker::STACKWALK_MAX_NAMELEN) == FALSE)
+- this->m_parent->OnDbgHelpErr("SymGetSearchPath", GetLastError(), 0);
++ if (this->symGetSearchPath(m_hProcess, buf, StackWalker::STACKWALK_MAX_NAMELEN) == FALSE)
++ this->m_parent->OnDbgHelpErr(_T("SymGetSearchPath"), GetLastError(), 0);
+ }
+- char szUserName[1024] = {0};
++ TCHAR szUserName[1024] = {0};
+ DWORD dwSize = 1024;
+- GetUserNameA(szUserName, &dwSize);
++ GetUserName(szUserName, &dwSize);
+ this->m_parent->OnSymInit(buf, symOptions, szUserName);
+
+ return TRUE;
+@@ -411,7 +303,7 @@ public:
+
+ HMODULE m_hDbhHelp;
+ HANDLE m_hProcess;
+- LPSTR m_szSymPath;
++ LPTSTR m_szSymPath;
+
+ #pragma pack(push, 8)
+ typedef struct IMAGEHLP_MODULE64_V3
+@@ -423,13 +315,13 @@ public:
+ DWORD CheckSum; // checksum from the pe header
+ DWORD NumSyms; // number of symbols in the symbol table
+ SYM_TYPE SymType; // type of symbols loaded
+- CHAR ModuleName[32]; // module name
+- CHAR ImageName[256]; // image name
+- CHAR LoadedImageName[256]; // symbol file name
++ TCHAR ModuleName[32]; // module name
++ TCHAR ImageName[256]; // image name
++ TCHAR LoadedImageName[256]; // symbol file name
+ // new elements: 07-Jun-2002
+- CHAR LoadedPdbName[256]; // pdb file name
++ TCHAR LoadedPdbName[256]; // pdb file name
+ DWORD CVSig; // Signature of the CV record in the debug directories
+- CHAR CVData[MAX_PATH * 3]; // Contents of the CV record
++ TCHAR CVData[MAX_PATH * 3]; // Contents of the CV record
+ DWORD PdbSig; // Signature of PDB
+ GUID PdbSig70; // Signature of PDB (VC 7 and up)
+ DWORD PdbAge; // DBI age of pdb
+@@ -460,56 +352,59 @@ public:
+
+ // SymCleanup()
+ typedef BOOL(__stdcall* tSC)(IN HANDLE hProcess);
+- tSC pSC;
++ tSC symCleanup;
+
+ // SymFunctionTableAccess64()
+ typedef PVOID(__stdcall* tSFTA)(HANDLE hProcess, DWORD64 AddrBase);
+- tSFTA pSFTA;
++ tSFTA symFunctionTableAccess64;
+
+ // SymGetLineFromAddr64()
+ typedef BOOL(__stdcall* tSGLFA)(IN HANDLE hProcess,
+ IN DWORD64 dwAddr,
+ OUT PDWORD pdwDisplacement,
+- OUT PIMAGEHLP_LINE64 Line);
+- tSGLFA pSGLFA;
++ OUT tImageHelperLine* Line);
++ tSGLFA symGetLineFromAddr64;
+
+ // SymGetModuleBase64()
+ typedef DWORD64(__stdcall* tSGMB)(IN HANDLE hProcess, IN DWORD64 dwAddr);
+- tSGMB pSGMB;
++ tSGMB symGetModuleBase64;
+
+ // SymGetModuleInfo64()
+ typedef BOOL(__stdcall* tSGMI)(IN HANDLE hProcess,
+ IN DWORD64 dwAddr,
+ OUT IMAGEHLP_MODULE64_V3* ModuleInfo);
+- tSGMI pSGMI;
++ tSGMI symGetModuleInfo64;
+
+ // SymGetOptions()
+ typedef DWORD(__stdcall* tSGO)(VOID);
+- tSGO pSGO;
++ tSGO symGetOptions;
++
+
+ // SymGetSymFromAddr64()
+- typedef BOOL(__stdcall* tSGSFA)(IN HANDLE hProcess,
+- IN DWORD64 dwAddr,
++ typedef BOOL(__stdcall* tSFA)(IN HANDLE hProcess,
++ IN DWORD64 Address,
+ OUT PDWORD64 pdwDisplacement,
+- OUT PIMAGEHLP_SYMBOL64 Symbol);
+- tSGSFA pSGSFA;
++ OUT tSymbolInfo* Symbol);
++ tSFA symFromAddr;
+
+ // SymInitialize()
+- typedef BOOL(__stdcall* tSI)(IN HANDLE hProcess, IN PSTR UserSearchPath, IN BOOL fInvadeProcess);
+- tSI pSI;
++ typedef BOOL(__stdcall* tSI)(IN HANDLE hProcess, IN PTSTR UserSearchPath, IN BOOL fInvadeProcess);
++ tSI symInitialize;
+
+ // SymLoadModule64()
+ typedef DWORD64(__stdcall* tSLM)(IN HANDLE hProcess,
+ IN HANDLE hFile,
+- IN PSTR ImageName,
+- IN PSTR ModuleName,
++ IN PTSTR ImageName,
++ IN PTSTR ModuleName,
+ IN DWORD64 BaseOfDll,
+- IN DWORD SizeOfDll);
+- tSLM pSLM;
++ IN DWORD SizeOfDll,
++ IN PMODLOAD_DATA Data,
++ IN DWORD Flags);
++ tSLM symLoadModuleEx;
+
+ // SymSetOptions()
+ typedef DWORD(__stdcall* tSSO)(IN DWORD SymOptions);
+- tSSO pSSO;
++ tSSO symSetOptions;
+
+ // StackWalk64()
+ typedef BOOL(__stdcall* tSW)(DWORD MachineType,
+@@ -521,17 +416,17 @@ public:
+ PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
+ PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
+ PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
+- tSW pSW;
++ tSW stackWalk64;
+
+ // UnDecorateSymbolName()
+- typedef DWORD(__stdcall WINAPI* tUDSN)(PCSTR DecoratedName,
+- PSTR UnDecoratedName,
++ typedef DWORD(__stdcall WINAPI* tUDSN)(PCTSTR DecoratedName,
++ PTSTR UnDecoratedName,
+ DWORD UndecoratedLength,
+ DWORD Flags);
+- tUDSN pUDSN;
++ tUDSN unDecorateSymbolName;
+
+- typedef BOOL(__stdcall WINAPI* tSGSP)(HANDLE hProcess, PSTR SearchPath, DWORD SearchPathLength);
+- tSGSP pSGSP;
++ typedef BOOL(__stdcall WINAPI* tSGSP)(HANDLE hProcess, PTSTR SearchPath, DWORD SearchPathLength);
++ tSGSP symGetSearchPath;
+
+ private:
+ // **************************************** ToolHelp32 ************************
+@@ -548,8 +443,8 @@ private:
+ BYTE* modBaseAddr; // Base address of module in th32ProcessID's context
+ DWORD modBaseSize; // Size in bytes of module starting at modBaseAddr
+ HMODULE hModule; // The hModule of this module in th32ProcessID's context
+- char szModule[MAX_MODULE_NAME32 + 1];
+- char szExePath[MAX_PATH];
++ TCHAR szModule[MAX_MODULE_NAME32 + 1];
++ TCHAR szExePath[MAX_PATH];
+ } MODULEENTRY32;
+ typedef MODULEENTRY32* PMODULEENTRY32;
+ typedef MODULEENTRY32* LPMODULEENTRY32;
+@@ -567,25 +462,31 @@ private:
+ // try both dlls...
+ const TCHAR* dllname[] = {_T("kernel32.dll"), _T("tlhelp32.dll")};
+ HINSTANCE hToolhelp = NULL;
+- tCT32S pCT32S = NULL;
+- tM32F pM32F = NULL;
+- tM32N pM32N = NULL;
++ tCT32S createToolhelp32Snapshot = NULL;
++ tM32F module32First = NULL;
++ tM32N module32Next = NULL;
+
+ HANDLE hSnap;
+- MODULEENTRY32 me;
+- me.dwSize = sizeof(me);
++ MODULEENTRY32 moduleEntry32;
++ moduleEntry32.dwSize = sizeof(moduleEntry32);
+ BOOL keepGoing;
+- size_t i;
+
+- for (i = 0; i < (sizeof(dllname) / sizeof(dllname[0])); i++)
++#ifdef _UNICODE
++ static const char strModule32First[] = "Module32FirstW";
++ static const char strModule32Next[] = "Module32NextW";
++ #else
++ static const char strModule32First[] = "Module32First";
++ static const char strModule32Next[] = "Module32Next";
++#endif
++ for (size_t i = 0; i < (sizeof(dllname) / sizeof(dllname[0])); i++)
+ {
+ hToolhelp = LoadLibrary(dllname[i]);
+ if (hToolhelp == NULL)
+ continue;
+- pCT32S = (tCT32S)GetProcAddress(hToolhelp, "CreateToolhelp32Snapshot");
+- pM32F = (tM32F)GetProcAddress(hToolhelp, "Module32First");
+- pM32N = (tM32N)GetProcAddress(hToolhelp, "Module32Next");
+- if ((pCT32S != NULL) && (pM32F != NULL) && (pM32N != NULL))
++ createToolhelp32Snapshot = (tCT32S)GetProcAddress(hToolhelp, "CreateToolhelp32Snapshot");
++ module32First = (tM32F)GetProcAddress(hToolhelp, strModule32First);
++ module32Next = (tM32N)GetProcAddress(hToolhelp, strModule32Next);
++ if ((createToolhelp32Snapshot != NULL) && (module32First != NULL) && (module32Next != NULL))
+ break; // found the functions!
+ FreeLibrary(hToolhelp);
+ hToolhelp = NULL;
+@@ -594,21 +495,21 @@ private:
+ if (hToolhelp == NULL)
+ return FALSE;
+
+- hSnap = pCT32S(TH32CS_SNAPMODULE, pid);
++ hSnap = createToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
+ if (hSnap == (HANDLE)-1)
+ {
+ FreeLibrary(hToolhelp);
+ return FALSE;
+ }
+
+- keepGoing = !!pM32F(hSnap, &me);
++ keepGoing = !!module32First(hSnap, &moduleEntry32);
+ int cnt = 0;
+ while (keepGoing)
+ {
+- this->LoadModule(hProcess, me.szExePath, me.szModule, (DWORD64)me.modBaseAddr,
+- me.modBaseSize);
++ this->LoadModule(hProcess, moduleEntry32.szExePath, moduleEntry32.szModule, (DWORD64)moduleEntry32.modBaseAddr,
++ moduleEntry32.modBaseSize);
+ cnt++;
+- keepGoing = !!pM32N(hSnap, &me);
++ keepGoing = !!module32Next(hSnap, &moduleEntry32);
+ }
+ CloseHandle(hSnap);
+ FreeLibrary(hToolhelp);
+@@ -631,39 +532,41 @@ private:
+ typedef BOOL(__stdcall * tEPM)(HANDLE hProcess, HMODULE * lphModule, DWORD cb,
+ LPDWORD lpcbNeeded);
+ // GetModuleFileNameEx()
+- typedef DWORD(__stdcall * tGMFNE)(HANDLE hProcess, HMODULE hModule, LPSTR lpFilename,
++ typedef DWORD(__stdcall * tGMFNE)(HANDLE hProcess, HMODULE hModule, LPTSTR lpFilename,
+ DWORD nSize);
+ // GetModuleBaseName()
+- typedef DWORD(__stdcall * tGMBN)(HANDLE hProcess, HMODULE hModule, LPSTR lpFilename,
++ typedef DWORD(__stdcall * tGMBN)(HANDLE hProcess, HMODULE hModule, LPTSTR lpFilename,
+ DWORD nSize);
+ // GetModuleInformation()
+ typedef BOOL(__stdcall * tGMI)(HANDLE hProcess, HMODULE hModule, LPMODULEINFO pmi, DWORD nSize);
+
+- HINSTANCE hPsapi;
+- tEPM pEPM;
+- tGMFNE pGMFNE;
+- tGMBN pGMBN;
+- tGMI pGMI;
+-
+- DWORD i;
+- //ModuleEntry e;
++ //ModuleEntry e;
+ DWORD cbNeeded;
+ MODULEINFO mi;
+ HMODULE* hMods = 0;
+- char* tt = NULL;
+- char* tt2 = NULL;
++ TCHAR* tt = NULL;
++ TCHAR* tt2 = NULL;
+ const SIZE_T TTBUFLEN = 8096;
+ int cnt = 0;
+
+- hPsapi = LoadLibrary(_T("psapi.dll"));
++ HINSTANCE hPsapi = LoadLibrary(_T("psapi.dll"));
+ if (hPsapi == NULL)
+ return FALSE;
+
+- pEPM = (tEPM)GetProcAddress(hPsapi, "EnumProcessModules");
+- pGMFNE = (tGMFNE)GetProcAddress(hPsapi, "GetModuleFileNameExA");
+- pGMBN = (tGMFNE)GetProcAddress(hPsapi, "GetModuleBaseNameA");
+- pGMI = (tGMI)GetProcAddress(hPsapi, "GetModuleInformation");
+- if ((pEPM == NULL) || (pGMFNE == NULL) || (pGMBN == NULL) || (pGMI == NULL))
++#ifdef _UNICODE
++ static const char strGetModuleFileName[] = "GetModuleFileNameExW";
++ static const char strGetModuleBaseName[] = "GetModuleBaseNameW";
++#else
++ static const char strGetModuleFileName[] = "GetModulefileNameExA";
++ static const char strGetModuleBaseName[] = "GetModuleBaseNameA";
++#endif
++
++ tEPM enumProcessModules = (tEPM)GetProcAddress(hPsapi, "EnumProcessModules");
++ tGMFNE getModuleFileNameEx = (tGMFNE)GetProcAddress(hPsapi, strGetModuleFileName);
++ tGMBN getModuleBaseName = (tGMFNE)GetProcAddress(hPsapi, strGetModuleBaseName);
++ tGMI getModuleInformation = (tGMI)GetProcAddress(hPsapi, "GetModuleInformation");
++ if ((enumProcessModules == NULL) || (getModuleFileNameEx == NULL) ||
++ (getModuleBaseName == NULL) || (getModuleInformation == NULL))
+ {
+ // we couldn't find all functions
+ FreeLibrary(hPsapi);
+@@ -671,12 +574,12 @@ private:
+ }
+
+ hMods = (HMODULE*)malloc(sizeof(HMODULE) * (TTBUFLEN / sizeof(HMODULE)));
+- tt = (char*)malloc(sizeof(char) * TTBUFLEN);
+- tt2 = (char*)malloc(sizeof(char) * TTBUFLEN);
++ tt = (TCHAR*)malloc(sizeof(TCHAR) * TTBUFLEN);
++ tt2 = (TCHAR*)malloc(sizeof(TCHAR) * TTBUFLEN);
+ if ((hMods == NULL) || (tt == NULL) || (tt2 == NULL))
+ goto cleanup;
+
+- if (!pEPM(hProcess, hMods, TTBUFLEN, &cbNeeded))
++ if (!enumProcessModules(hProcess, hMods, TTBUFLEN, &cbNeeded))
+ {
+ //_ftprintf(fLogFile, _T("%lu: EPM failed, GetLastError = %lu\n"), g_dwShowCount, gle );
+ goto cleanup;
+@@ -688,20 +591,20 @@ private:
+ goto cleanup;
+ }
+
+- for (i = 0; i < cbNeeded / sizeof(hMods[0]); i++)
++ for (DWORD i = 0; i < cbNeeded / sizeof(hMods[0]); i++)
+ {
+ // base address, size
+- pGMI(hProcess, hMods[i], &mi, sizeof(mi));
++ getModuleInformation(hProcess, hMods[i], &mi, sizeof(mi));
+ // image file name
+ tt[0] = 0;
+- pGMFNE(hProcess, hMods[i], tt, TTBUFLEN);
++ getModuleFileNameEx(hProcess, hMods[i], tt, TTBUFLEN);
+ // module name
+ tt2[0] = 0;
+- pGMBN(hProcess, hMods[i], tt2, TTBUFLEN);
++ getModuleBaseName(hProcess, hMods[i], tt2, TTBUFLEN);
+
+ DWORD dwRes = this->LoadModule(hProcess, tt, tt2, (DWORD64)mi.lpBaseOfDll, mi.SizeOfImage);
+ if (dwRes != ERROR_SUCCESS)
+- this->m_parent->OnDbgHelpErr("LoadModule", dwRes, 0);
++ this->m_parent->OnDbgHelpErr(_T("LoadModule"), dwRes, 0);
+ cnt++;
+ }
+
+@@ -718,16 +621,16 @@ private:
+ return cnt != 0;
+ } // GetModuleListPSAPI
+
+- DWORD LoadModule(HANDLE hProcess, LPCSTR img, LPCSTR mod, DWORD64 baseAddr, DWORD size)
++ DWORD LoadModule(HANDLE hProcess, LPCTSTR img, LPCTSTR mod, DWORD64 baseAddr, DWORD size)
+ {
+- CHAR* szImg = _strdup(img);
+- CHAR* szMod = _strdup(mod);
++ TCHAR* szImg = _tcsdup(img);
++ TCHAR* szMod = _tcsdup(mod);
+ DWORD result = ERROR_SUCCESS;
+ if ((szImg == NULL) || (szMod == NULL))
+ result = ERROR_NOT_ENOUGH_MEMORY;
+ else
+ {
+- if (pSLM(hProcess, 0, szImg, szMod, baseAddr, size) == 0)
++ if (symLoadModuleEx(hProcess, 0, szImg, szMod, baseAddr, size, 0, 0) == 0)
+ result = GetLastError();
+ }
+ ULONGLONG fileVersion = 0;
+@@ -738,13 +641,13 @@ private:
+ {
+ VS_FIXEDFILEINFO* fInfo = NULL;
+ DWORD dwHandle;
+- DWORD dwSize = GetFileVersionInfoSizeA(szImg, &dwHandle);
++ DWORD dwSize = GetFileVersionInfoSize(szImg, &dwHandle);
+ if (dwSize > 0)
+ {
+ LPVOID vData = malloc(dwSize);
+ if (vData != NULL)
+ {
+- if (GetFileVersionInfoA(szImg, dwHandle, dwSize, vData) != 0)
++ if (GetFileVersionInfo(szImg, dwHandle, dwSize, vData) != 0)
+ {
+ UINT len;
+ TCHAR szSubBlock[] = _T("\\");
+@@ -763,41 +666,41 @@ private:
+
+ // Retrieve some additional-infos about the module
+ IMAGEHLP_MODULE64_V3 Module;
+- const char* szSymType = "-unknown-";
++ const TCHAR* szSymType = _T("-unknown-");
+ if (this->GetModuleInfo(hProcess, baseAddr, &Module) != FALSE)
+ {
+ switch (Module.SymType)
+ {
+ case SymNone:
+- szSymType = "-nosymbols-";
++ szSymType = _T("-nosymbols-");
+ break;
+ case SymCoff: // 1
+- szSymType = "COFF";
++ szSymType = _T("COFF");
+ break;
+ case SymCv: // 2
+- szSymType = "CV";
++ szSymType = _T("CV");
+ break;
+ case SymPdb: // 3
+- szSymType = "PDB";
++ szSymType = _T("PDB");
+ break;
+ case SymExport: // 4
+- szSymType = "-exported-";
++ szSymType = _T("-exported-");
+ break;
+ case SymDeferred: // 5
+- szSymType = "-deferred-";
++ szSymType = _T("-deferred-");
+ break;
+ case SymSym: // 6
+- szSymType = "SYM";
++ szSymType = _T("SYM");
+ break;
+ case 7: // SymDia:
+- szSymType = "DIA";
++ szSymType = _T("DIA");
+ break;
+ case 8: //SymVirtual:
+- szSymType = "Virtual";
++ szSymType = _T("Virtual");
+ break;
+ }
+ }
+- LPCSTR pdbName = Module.LoadedImageName;
++ LPCTSTR pdbName = Module.LoadedImageName;
+ if (Module.LoadedPdbName[0] != 0)
+ pdbName = Module.LoadedPdbName;
+ this->m_parent->OnLoadModule(img, mod, baseAddr, size, result, szSymType, pdbName,
+@@ -823,7 +726,7 @@ public:
+ BOOL GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V3* pModuleInfo)
+ {
+ memset(pModuleInfo, 0, sizeof(IMAGEHLP_MODULE64_V3));
+- if (this->pSGMI == NULL)
++ if (this->symGetModuleInfo64 == NULL)
+ {
+ SetLastError(ERROR_DLL_INIT_FAILED);
+ return FALSE;
+@@ -841,7 +744,7 @@ public:
+ static bool s_useV3Version = true;
+ if (s_useV3Version)
+ {
+- if (this->pSGMI(hProcess, baseAddr, (IMAGEHLP_MODULE64_V3*)pData) != FALSE)
++ if (this->symGetModuleInfo64(hProcess, baseAddr, (IMAGEHLP_MODULE64_V3*)pData) != FALSE)
+ {
+ // only copy as much memory as is reserved...
+ memcpy(pModuleInfo, pData, sizeof(IMAGEHLP_MODULE64_V3));
+@@ -855,7 +758,7 @@ public:
+ // could not retrieve the bigger structure, try with the smaller one (as defined in VC7.1)...
+ pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V2);
+ memcpy(pData, pModuleInfo, sizeof(IMAGEHLP_MODULE64_V2));
+- if (this->pSGMI(hProcess, baseAddr, (IMAGEHLP_MODULE64_V3*)pData) != FALSE)
++ if (this->symGetModuleInfo64(hProcess, baseAddr, (IMAGEHLP_MODULE64_V3*)pData) != FALSE)
+ {
+ // only copy as much memory as is reserved...
+ memcpy(pModuleInfo, pData, sizeof(IMAGEHLP_MODULE64_V2));
+@@ -880,7 +783,7 @@ StackWalker::StackWalker(DWORD dwProcessId, HANDLE hProcess)
+ this->m_szSymPath = NULL;
+ this->m_MaxRecursionCount = 1000;
+ }
+-StackWalker::StackWalker(int options, LPCSTR szSymPath, DWORD dwProcessId, HANDLE hProcess)
++StackWalker::StackWalker(int options, LPCTSTR szSymPath, DWORD dwProcessId, HANDLE hProcess)
+ {
+ this->m_options = options;
+ this->m_modulesLoaded = FALSE;
+@@ -889,7 +792,7 @@ StackWalker::StackWalker(int options, LPCSTR szSymPath, DWORD dwProcessId, HANDL
+ this->m_dwProcessId = dwProcessId;
+ if (szSymPath != NULL)
+ {
+- this->m_szSymPath = _strdup(szSymPath);
++ this->m_szSymPath = _tcsdup(szSymPath);
+ this->m_options |= SymBuildPath;
+ }
+ else
+@@ -918,11 +821,11 @@ BOOL StackWalker::LoadModules()
+ return TRUE;
+
+ // Build the sym-path:
+- char* szSymPath = NULL;
++ TCHAR* szSymPath = NULL;
+ if ((this->m_options & SymBuildPath) != 0)
+ {
+ const size_t nSymPathLen = 4096;
+- szSymPath = (char*)malloc(nSymPathLen);
++ szSymPath = (TCHAR*)malloc(nSymPathLen * sizeof(TCHAR));
+ if (szSymPath == NULL)
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+@@ -932,27 +835,27 @@ BOOL StackWalker::LoadModules()
+ // Now first add the (optional) provided sympath:
+ if (this->m_szSymPath != NULL)
+ {
+- strcat_s(szSymPath, nSymPathLen, this->m_szSymPath);
+- strcat_s(szSymPath, nSymPathLen, ";");
++ _tcscat_s(szSymPath, nSymPathLen, this->m_szSymPath);
++ _tcscat_s(szSymPath, nSymPathLen, _T(";"));
+ }
+
+- strcat_s(szSymPath, nSymPathLen, ".;");
++ _tcscat_s(szSymPath, nSymPathLen, _T(".;"));
+
+ const size_t nTempLen = 1024;
+- char szTemp[nTempLen];
++ TCHAR szTemp[nTempLen];
+ // Now add the current directory:
+- if (GetCurrentDirectoryA(nTempLen, szTemp) > 0)
++ if (GetCurrentDirectory(nTempLen, szTemp) > 0)
+ {
+ szTemp[nTempLen - 1] = 0;
+- strcat_s(szSymPath, nSymPathLen, szTemp);
+- strcat_s(szSymPath, nSymPathLen, ";");
++ _tcscat_s(szSymPath, nSymPathLen, szTemp);
++ _tcscat_s(szSymPath, nSymPathLen, _T(";"));
+ }
+
+ // Now add the path for the main-module:
+- if (GetModuleFileNameA(NULL, szTemp, nTempLen) > 0)
++ if (GetModuleFileName(NULL, szTemp, nTempLen) > 0)
+ {
+ szTemp[nTempLen - 1] = 0;
+- for (char* p = (szTemp + strlen(szTemp) - 1); p >= szTemp; --p)
++ for (TCHAR* p = (szTemp + _tcslen(szTemp) - 1); p >= szTemp; --p)
+ {
+ // locate the rightmost path separator
+ if ((*p == '\\') || (*p == '/') || (*p == ':'))
+@@ -961,48 +864,48 @@ BOOL StackWalker::LoadModules()
+ break;
+ }
+ } // for (search for path separator...)
+- if (strlen(szTemp) > 0)
++ if (_tcslen(szTemp) > 0)
+ {
+- strcat_s(szSymPath, nSymPathLen, szTemp);
+- strcat_s(szSymPath, nSymPathLen, ";");
++ _tcscat_s(szSymPath, nSymPathLen, szTemp);
++ _tcscat_s(szSymPath, nSymPathLen, _T(";"));
+ }
+ }
+- if (GetEnvironmentVariableA("_NT_SYMBOL_PATH", szTemp, nTempLen) > 0)
++ if (GetEnvironmentVariable(_T("_NT_SYMBOL_PATH"), szTemp, nTempLen) > 0)
+ {
+ szTemp[nTempLen - 1] = 0;
+- strcat_s(szSymPath, nSymPathLen, szTemp);
+- strcat_s(szSymPath, nSymPathLen, ";");
++ _tcscat_s(szSymPath, nSymPathLen, szTemp);
++ _tcscat_s(szSymPath, nSymPathLen, _T(";"));
+ }
+- if (GetEnvironmentVariableA("_NT_ALTERNATE_SYMBOL_PATH", szTemp, nTempLen) > 0)
++ if (GetEnvironmentVariable(_T("_NT_ALTERNATE_SYMBOL_PATH"), szTemp, nTempLen) > 0)
+ {
+ szTemp[nTempLen - 1] = 0;
+- strcat_s(szSymPath, nSymPathLen, szTemp);
+- strcat_s(szSymPath, nSymPathLen, ";");
++ _tcscat_s(szSymPath, nSymPathLen, szTemp);
++ _tcscat_s(szSymPath, nSymPathLen, _T(";"));
+ }
+- if (GetEnvironmentVariableA("SYSTEMROOT", szTemp, nTempLen) > 0)
++ if (GetEnvironmentVariable(_T("SYSTEMROOT"), szTemp, nTempLen) > 0)
+ {
+ szTemp[nTempLen - 1] = 0;
+- strcat_s(szSymPath, nSymPathLen, szTemp);
+- strcat_s(szSymPath, nSymPathLen, ";");
++ _tcscat_s(szSymPath, nSymPathLen, szTemp);
++ _tcscat_s(szSymPath, nSymPathLen, _T(";"));
+ // also add the "system32"-directory:
+- strcat_s(szTemp, nTempLen, "\\system32");
+- strcat_s(szSymPath, nSymPathLen, szTemp);
+- strcat_s(szSymPath, nSymPathLen, ";");
++ _tcscat_s(szTemp, nTempLen, _T("\\system32"));
++ _tcscat_s(szSymPath, nSymPathLen, szTemp);
++ _tcscat_s(szSymPath, nSymPathLen, _T(";"));
+ }
+
+ if ((this->m_options & SymUseSymSrv) != 0)
+ {
+- if (GetEnvironmentVariableA("SYSTEMDRIVE", szTemp, nTempLen) > 0)
++ if (GetEnvironmentVariable(_T("SYSTEMDRIVE"), szTemp, nTempLen) > 0)
+ {
+ szTemp[nTempLen - 1] = 0;
+- strcat_s(szSymPath, nSymPathLen, "SRV*");
+- strcat_s(szSymPath, nSymPathLen, szTemp);
+- strcat_s(szSymPath, nSymPathLen, "\\websymbols");
+- strcat_s(szSymPath, nSymPathLen, "*http://msdl.microsoft.com/download/symbols;");
++ _tcscat_s(szSymPath, nSymPathLen, _T("SRV*"));
++ _tcscat_s(szSymPath, nSymPathLen, szTemp);
++ _tcscat_s(szSymPath, nSymPathLen, _T("\\websymbols"));
++ _tcscat_s(szSymPath, nSymPathLen, _T("*http://msdl.microsoft.com/download/symbols;"));
+ }
+ else
+- strcat_s(szSymPath, nSymPathLen,
+- "SRV*c:\\websymbols*http://msdl.microsoft.com/download/symbols;");
++ _tcscat_s(szSymPath, nSymPathLen,
++ _T("SRV*c:\\websymbols*http://msdl.microsoft.com/download/symbols;"));
+ }
+ } // if SymBuildPath
+
+@@ -1013,7 +916,7 @@ BOOL StackWalker::LoadModules()
+ szSymPath = NULL;
+ if (bRet == FALSE)
+ {
+- this->OnDbgHelpErr("Error while initializing dbghelp.dll", 0, 0);
++ this->OnDbgHelpErr(_T("Error while initializing dbghelp.dll"), 0, 0);
+ SetLastError(ERROR_DLL_INIT_FAILED);
+ return FALSE;
+ }
+@@ -1038,9 +941,10 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
+ {
+ CONTEXT c;
+ CallstackEntry csEntry;
+- IMAGEHLP_SYMBOL64* pSym = NULL;
++
++ tSymbolInfo* pSym = NULL;
+ StackWalkerInternal::IMAGEHLP_MODULE64_V3 Module;
+- IMAGEHLP_LINE64 Line;
++ tImageHelperLine Line;
+ int frameNum;
+ bool bLastEntryCalled = true;
+ int curRecursionCount = 0;
+@@ -1125,12 +1029,12 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
+ #error "Platform not supported!"
+ #endif
+
+- pSym = (IMAGEHLP_SYMBOL64*)malloc(sizeof(IMAGEHLP_SYMBOL64) + STACKWALK_MAX_NAMELEN);
++ pSym = (tSymbolInfo*)malloc(sizeof(tSymbolInfo) + STACKWALK_MAX_NAMELEN*sizeof(TCHAR));
+ if (!pSym)
+ goto cleanup; // not enough memory...
+- memset(pSym, 0, sizeof(IMAGEHLP_SYMBOL64) + STACKWALK_MAX_NAMELEN);
+- pSym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
+- pSym->MaxNameLength = STACKWALK_MAX_NAMELEN;
++ memset(pSym, 0, sizeof(tSymbolInfo) + STACKWALK_MAX_NAMELEN*sizeof(TCHAR));
++ pSym->SizeOfStruct = sizeof(tSymbolInfo);
++ pSym->MaxNameLen = STACKWALK_MAX_NAMELEN;
+
+ memset(&Line, 0, sizeof(Line));
+ Line.SizeOfStruct = sizeof(Line);
+@@ -1145,11 +1049,11 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
+ // assume that either you are done, or that the stack is so hosed that the next
+ // deeper frame could not be found.
+ // CONTEXT need not to be supplied if imageTyp is IMAGE_FILE_MACHINE_I386!
+- if (!this->m_sw->pSW(imageType, this->m_hProcess, hThread, &s, &c, myReadProcMem,
+- this->m_sw->pSFTA, this->m_sw->pSGMB, NULL))
++ if (!this->m_sw->stackWalk64(imageType, this->m_hProcess, hThread, &s, &c, myReadProcMem,
++ this->m_sw->symFunctionTableAccess64, this->m_sw->symGetModuleBase64, NULL))
+ {
+ // INFO: "StackWalk64" does not set "GetLastError"...
+- this->OnDbgHelpErr("StackWalk64", 0, s.AddrPC.Offset);
++ this->OnDbgHelpErr(_T("StackWalk64"), 0, s.AddrPC.Offset);
+ break;
+ }
+
+@@ -1167,7 +1071,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
+ {
+ if ((this->m_MaxRecursionCount > 0) && (curRecursionCount > m_MaxRecursionCount))
+ {
+- this->OnDbgHelpErr("StackWalk64-Endless-Callstack!", 0, s.AddrPC.Offset);
++ this->OnDbgHelpErr(_T("StackWalk64-Endless-Callstack!"), 0, s.AddrPC.Offset);
+ break;
+ }
+ curRecursionCount++;
+@@ -1178,23 +1082,23 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
+ {
+ // we seem to have a valid PC
+ // show procedure info (SymGetSymFromAddr64())
+- if (this->m_sw->pSGSFA(this->m_hProcess, s.AddrPC.Offset, &(csEntry.offsetFromSmybol),
++ if (this->m_sw->symFromAddr(this->m_hProcess, s.AddrPC.Offset, &(csEntry.offsetFromSmybol),
+ pSym) != FALSE)
+ {
+ MyStrCpy(csEntry.name, STACKWALK_MAX_NAMELEN, pSym->Name);
+ // UnDecorateSymbolName()
+- this->m_sw->pUDSN(pSym->Name, csEntry.undName, STACKWALK_MAX_NAMELEN, UNDNAME_NAME_ONLY);
+- this->m_sw->pUDSN(pSym->Name, csEntry.undFullName, STACKWALK_MAX_NAMELEN, UNDNAME_COMPLETE);
++ DWORD res = this->m_sw->unDecorateSymbolName(pSym->Name, csEntry.undName, STACKWALK_MAX_NAMELEN, UNDNAME_NAME_ONLY);
++ res = this->m_sw->unDecorateSymbolName(pSym->Name, csEntry.undFullName, STACKWALK_MAX_NAMELEN, UNDNAME_COMPLETE);
+ }
+ else
+ {
+- this->OnDbgHelpErr("SymGetSymFromAddr64", GetLastError(), s.AddrPC.Offset);
++ this->OnDbgHelpErr(_T("SymGetSymFromAddr64"), GetLastError(), s.AddrPC.Offset);
+ }
+
+ // show line number info, NT5.0-method (SymGetLineFromAddr64())
+- if (this->m_sw->pSGLFA != NULL)
++ if (this->m_sw->symGetLineFromAddr64 != NULL)
+ { // yes, we have SymGetLineFromAddr64()
+- if (this->m_sw->pSGLFA(this->m_hProcess, s.AddrPC.Offset, &(csEntry.offsetFromLine),
++ if (this->m_sw->symGetLineFromAddr64(this->m_hProcess, s.AddrPC.Offset, &(csEntry.offsetFromLine),
+ &Line) != FALSE)
+ {
+ csEntry.lineNumber = Line.LineNumber;
+@@ -1202,7 +1106,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
+ }
+ else
+ {
+- this->OnDbgHelpErr("SymGetLineFromAddr64", GetLastError(), s.AddrPC.Offset);
++ this->OnDbgHelpErr(_T("SymGetLineFromAddr64"), GetLastError(), s.AddrPC.Offset);
+ }
+ } // yes, we have SymGetLineFromAddr64()
+
+@@ -1252,7 +1156,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
+ } // got module info OK
+ else
+ {
+- this->OnDbgHelpErr("SymGetModuleInfo64", GetLastError(), s.AddrPC.Offset);
++ this->OnDbgHelpErr(_T("SymGetModuleInfo64"), GetLastError(), s.AddrPC.Offset);
+ }
+ } // we seem to have a valid PC
+
+@@ -1298,20 +1202,20 @@ BOOL StackWalker::ShowObject(LPVOID pObject)
+ }
+
+ // SymGetSymFromAddr64() is required
+- if (this->m_sw->pSGSFA == NULL)
++ if (this->m_sw->symFromAddr == NULL)
+ return FALSE;
+
+ // Show object info (SymGetSymFromAddr64())
+ DWORD64 dwAddress = DWORD64(pObject);
+ DWORD64 dwDisplacement = 0;
+- IMAGEHLP_SYMBOL64* pSym =
+- (IMAGEHLP_SYMBOL64*)malloc(sizeof(IMAGEHLP_SYMBOL64) + STACKWALK_MAX_NAMELEN);
+- memset(pSym, 0, sizeof(IMAGEHLP_SYMBOL64) + STACKWALK_MAX_NAMELEN);
+- pSym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
+- pSym->MaxNameLength = STACKWALK_MAX_NAMELEN;
+- if (this->m_sw->pSGSFA(this->m_hProcess, dwAddress, &dwDisplacement, pSym) == FALSE)
++ tSymbolInfo* pSym =
++ (tSymbolInfo*)malloc(sizeof(tSymbolInfo) + STACKWALK_MAX_NAMELEN*sizeof(TCHAR));
++ memset(pSym, 0, sizeof(tSymbolInfo) + STACKWALK_MAX_NAMELEN*sizeof(TCHAR));
++ pSym->SizeOfStruct = sizeof(tSymbolInfo);
++ pSym->MaxNameLen = STACKWALK_MAX_NAMELEN;
++ if (this->m_sw->symFromAddr(this->m_hProcess, dwAddress, &dwDisplacement, pSym) == FALSE)
+ {
+- this->OnDbgHelpErr("SymGetSymFromAddr64", GetLastError(), dwAddress);
++ this->OnDbgHelpErr(_T("SymGetSymFromAddr64"), GetLastError(), dwAddress);
+ return FALSE;
+ }
+ // Object name output
+@@ -1342,22 +1246,22 @@ BOOL __stdcall StackWalker::myReadProcMem(HANDLE hProcess,
+ }
+ }
+
+-void StackWalker::OnLoadModule(LPCSTR img,
+- LPCSTR mod,
++void StackWalker::OnLoadModule(LPCTSTR img,
++ LPCTSTR mod,
+ DWORD64 baseAddr,
+ DWORD size,
+ DWORD result,
+- LPCSTR symType,
+- LPCSTR pdbName,
++ LPCTSTR symType,
++ LPCTSTR pdbName,
+ ULONGLONG fileVersion)
+ {
+- CHAR buffer[STACKWALK_MAX_NAMELEN];
++ TCHAR buffer[STACKWALK_MAX_NAMELEN];
+ size_t maxLen = STACKWALK_MAX_NAMELEN;
+ #if _MSC_VER >= 1400
+ maxLen = _TRUNCATE;
+ #endif
+ if (fileVersion == 0)
+- _snprintf_s(buffer, maxLen, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s'\n",
++ _sntprintf_s(buffer, maxLen, _T("%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s'\n"),
+ img, mod, (LPVOID)baseAddr, size, result, symType, pdbName);
+ else
+ {
+@@ -1365,9 +1269,9 @@ void StackWalker::OnLoadModule(LPCSTR img,
+ DWORD v3 = (DWORD)((fileVersion >> 16) & 0xFFFF);
+ DWORD v2 = (DWORD)((fileVersion >> 32) & 0xFFFF);
+ DWORD v1 = (DWORD)((fileVersion >> 48) & 0xFFFF);
+- _snprintf_s(
++ _sntprintf_s(
+ buffer, maxLen,
+- "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n",
++ _T("%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n"),
+ img, mod, (LPVOID)baseAddr, size, result, symType, pdbName, v1, v2, v3, v4);
+ }
+ buffer[STACKWALK_MAX_NAMELEN - 1] = 0; // be sure it is NULL terminated
+@@ -1376,7 +1280,7 @@ void StackWalker::OnLoadModule(LPCSTR img,
+
+ void StackWalker::OnCallstackEntry(CallstackEntryType eType, CallstackEntry& entry)
+ {
+- CHAR buffer[STACKWALK_MAX_NAMELEN];
++ TCHAR buffer[STACKWALK_MAX_NAMELEN];
+ size_t maxLen = STACKWALK_MAX_NAMELEN;
+ #if _MSC_VER >= 1400
+ maxLen = _TRUNCATE;
+@@ -1384,48 +1288,48 @@ void StackWalker::OnCallstackEntry(CallstackEntryType eType, CallstackEntry& ent
+ if ((eType != lastEntry) && (entry.offset != 0))
+ {
+ if (entry.name[0] == 0)
+- MyStrCpy(entry.name, STACKWALK_MAX_NAMELEN, "(function-name not available)");
++ MyStrCpy(entry.name, STACKWALK_MAX_NAMELEN, _T("(function-name not available)"));
+ if (entry.undName[0] != 0)
+ MyStrCpy(entry.name, STACKWALK_MAX_NAMELEN, entry.undName);
+ if (entry.undFullName[0] != 0)
+ MyStrCpy(entry.name, STACKWALK_MAX_NAMELEN, entry.undFullName);
+ if (entry.lineFileName[0] == 0)
+ {
+- MyStrCpy(entry.lineFileName, STACKWALK_MAX_NAMELEN, "(filename not available)");
++ MyStrCpy(entry.lineFileName, STACKWALK_MAX_NAMELEN, _T("(filename not available)"));
+ if (entry.moduleName[0] == 0)
+- MyStrCpy(entry.moduleName, STACKWALK_MAX_NAMELEN, "(module-name not available)");
+- _snprintf_s(buffer, maxLen, "%p (%s): %s: %s\n", (LPVOID)entry.offset, entry.moduleName,
++ MyStrCpy(entry.moduleName, STACKWALK_MAX_NAMELEN, _T("(module-name not available)"));
++ _sntprintf_s(buffer, maxLen, _T("%p (%s): %s: %s\n"), (LPVOID)entry.offset, entry.moduleName,
+ entry.lineFileName, entry.name);
+ }
+ else
+- _snprintf_s(buffer, maxLen, "%s (%d): %s\n", entry.lineFileName, entry.lineNumber,
++ _sntprintf_s(buffer, maxLen, _T("%s (%d): %s\n"), entry.lineFileName, entry.lineNumber,
+ entry.name);
+ buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
+ OnOutput(buffer);
+ }
+ }
+
+-void StackWalker::OnDbgHelpErr(LPCSTR szFuncName, DWORD gle, DWORD64 addr)
++void StackWalker::OnDbgHelpErr(LPCTSTR szFuncName, DWORD gle, DWORD64 addr)
+ {
+- CHAR buffer[STACKWALK_MAX_NAMELEN];
++ TCHAR buffer[STACKWALK_MAX_NAMELEN];
+ size_t maxLen = STACKWALK_MAX_NAMELEN;
+ #if _MSC_VER >= 1400
+ maxLen = _TRUNCATE;
+ #endif
+- _snprintf_s(buffer, maxLen, "ERROR: %s, GetLastError: %d (Address: %p)\n", szFuncName, gle,
++ _sntprintf_s(buffer, maxLen, _T("ERROR: %s, GetLastError: %d (Address: %p)\n"), szFuncName, gle,
+ (LPVOID)addr);
+ buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
+ OnOutput(buffer);
+ }
+
+-void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName)
++void StackWalker::OnSymInit(LPCTSTR szSearchPath, DWORD symOptions, LPCTSTR szUserName)
+ {
+- CHAR buffer[STACKWALK_MAX_NAMELEN];
++ TCHAR buffer[STACKWALK_MAX_NAMELEN];
+ size_t maxLen = STACKWALK_MAX_NAMELEN;
+ #if _MSC_VER >= 1400
+ maxLen = _TRUNCATE;
+ #endif
+- _snprintf_s(buffer, maxLen, "SymInit: Symbol-SearchPath: '%s', symOptions: %d, UserName: '%s'\n",
++ _sntprintf_s(buffer, maxLen, _T("SymInit: Symbol-SearchPath: '%s', symOptions: %d, UserName: '%s'\n"),
+ szSearchPath, symOptions, szUserName);
+ buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
+ OnOutput(buffer);
+@@ -1442,16 +1346,16 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
+ OnOutput(buffer);
+ }
+ #else
+- OSVERSIONINFOEXA ver;
+- ZeroMemory(&ver, sizeof(OSVERSIONINFOEXA));
++ OSVERSIONINFOEX ver;
++ ZeroMemory(&ver, sizeof(OSVERSIONINFOEX));
+ ver.dwOSVersionInfoSize = sizeof(ver);
+ #if _MSC_VER >= 1900
+ #pragma warning(push)
+ #pragma warning(disable : 4996)
+ #endif
+- if (GetVersionExA((OSVERSIONINFOA*)&ver) != FALSE)
++ if (GetVersionEx((OSVERSIONINFO*)&ver) != FALSE)
+ {
+- _snprintf_s(buffer, maxLen, "OS-Version: %d.%d.%d (%s) 0x%x-0x%x\n", ver.dwMajorVersion,
++ _sntprintf_s(buffer, maxLen, _T("OS-Version: %d.%d.%d (%s) 0x%x-0x%x\n"), ver.dwMajorVersion,
+ ver.dwMinorVersion, ver.dwBuildNumber, ver.szCSDVersion, ver.wSuiteMask,
+ ver.wProductType);
+ buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
+@@ -1463,7 +1367,7 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
+ #endif
+ }
+
+-void StackWalker::OnOutput(LPCSTR buffer)
++void StackWalker::OnOutput(LPCTSTR buffer)
+ {
+- OutputDebugStringA(buffer);
++ OutputDebugString(buffer);
+ }
+diff --git a/Main/StackWalker/StackWalker.h b/Main/StackWalker/StackWalker.h
+index 0a004d9..03efcec 100644
+--- a/Main/StackWalker/StackWalker.h
++++ b/Main/StackWalker/StackWalker.h
+@@ -47,16 +47,6 @@
+ #pragma warning(disable : 4091)
+ #endif
+
+-// special defines for VC5/6 (if no actual PSDK is installed):
+-#if _MSC_VER < 1300
+-typedef unsigned __int64 DWORD64, *PDWORD64;
+-#if defined(_WIN64)
+-typedef unsigned __int64 SIZE_T, *PSIZE_T;
+-#else
+-typedef unsigned long SIZE_T, *PSIZE_T;
+-#endif
+-#endif // _MSC_VER < 1300
+-
+ class StackWalkerInternal; // forward
+ class StackWalker
+ {
+@@ -96,7 +86,7 @@ public:
+ } StackWalkOptions;
+
+ StackWalker(int options = OptionsAll, // 'int' is by design, to combine the enum-flags
+- LPCSTR szSymPath = NULL,
++ LPCTSTR szSymPath = NULL,
+ DWORD dwProcessId = GetCurrentProcessId(),
+ HANDLE hProcess = GetCurrentProcess());
+ StackWalker(DWORD dwProcessId, HANDLE hProcess);
+@@ -137,18 +127,18 @@ protected:
+ typedef struct CallstackEntry
+ {
+ DWORD64 offset; // if 0, we have no valid entry
+- CHAR name[STACKWALK_MAX_NAMELEN];
+- CHAR undName[STACKWALK_MAX_NAMELEN];
+- CHAR undFullName[STACKWALK_MAX_NAMELEN];
++ TCHAR name[STACKWALK_MAX_NAMELEN];
++ TCHAR undName[STACKWALK_MAX_NAMELEN];
++ TCHAR undFullName[STACKWALK_MAX_NAMELEN];
+ DWORD64 offsetFromSmybol;
+ DWORD offsetFromLine;
+ DWORD lineNumber;
+- CHAR lineFileName[STACKWALK_MAX_NAMELEN];
++ TCHAR lineFileName[STACKWALK_MAX_NAMELEN];
+ DWORD symType;
+ LPCSTR symTypeString;
+- CHAR moduleName[STACKWALK_MAX_NAMELEN];
++ TCHAR moduleName[STACKWALK_MAX_NAMELEN];
+ DWORD64 baseOfImage;
+- CHAR loadedImageName[STACKWALK_MAX_NAMELEN];
++ TCHAR loadedImageName[STACKWALK_MAX_NAMELEN];
+ } CallstackEntry;
+
+ typedef enum CallstackEntryType
+@@ -158,24 +148,24 @@ protected:
+ lastEntry
+ } CallstackEntryType;
+
+- virtual void OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName);
+- virtual void OnLoadModule(LPCSTR img,
+- LPCSTR mod,
++ virtual void OnSymInit(LPCTSTR szSearchPath, DWORD symOptions, LPCTSTR szUserName);
++ virtual void OnLoadModule(LPCTSTR img,
++ LPCTSTR mod,
+ DWORD64 baseAddr,
+ DWORD size,
+ DWORD result,
+- LPCSTR symType,
+- LPCSTR pdbName,
++ LPCTSTR symType,
++ LPCTSTR pdbName,
+ ULONGLONG fileVersion);
+ virtual void OnCallstackEntry(CallstackEntryType eType, CallstackEntry& entry);
+- virtual void OnDbgHelpErr(LPCSTR szFuncName, DWORD gle, DWORD64 addr);
+- virtual void OnOutput(LPCSTR szText);
++ virtual void OnDbgHelpErr(LPCTSTR szFuncName, DWORD gle, DWORD64 addr);
++ virtual void OnOutput(LPCTSTR szText);
+
+ StackWalkerInternal* m_sw;
+ HANDLE m_hProcess;
+ DWORD m_dwProcessId;
+ BOOL m_modulesLoaded;
+- LPSTR m_szSymPath;
++ LPTSTR m_szSymPath;
+
+ int m_options;
+ int m_MaxRecursionCount;
+diff --git a/Main/StackWalker/StackWalker_VC2017.sln b/Main/StackWalker/StackWalker_VC2017.sln
+index 790d550..2209e23 100644
+--- a/Main/StackWalker/StackWalker_VC2017.sln
++++ b/Main/StackWalker/StackWalker_VC2017.sln
+@@ -16,18 +16,18 @@ Global
+ Release_VC2017-UNICODE|x64 = Release_VC2017-UNICODE|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|Win32.ActiveCfg = Debug_VC2017-UNICODE|Win32
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|Win32.Build.0 = Debug_VC2017-UNICODE|Win32
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|x64.ActiveCfg = Debug_VC2017-UNICODE|x64
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|x64.Build.0 = Debug_VC2017-UNICODE|x64
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|Win32.ActiveCfg = Debug_VC2017|Win32
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|Win32.Build.0 = Debug_VC2017|Win32
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|x64.ActiveCfg = Debug_VC2017|x64
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|x64.Build.0 = Debug_VC2017|x64
+ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|Win32.ActiveCfg = Debug_VC2017-UNICODE|Win32
+ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|Win32.Build.0 = Debug_VC2017-UNICODE|Win32
+ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|x64.ActiveCfg = Debug_VC2017-UNICODE|x64
+ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|x64.Build.0 = Debug_VC2017-UNICODE|x64
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|Win32.ActiveCfg = Release_VC2017-UNICODE|Win32
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|Win32.Build.0 = Release_VC2017-UNICODE|Win32
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|x64.ActiveCfg = Release_VC2017-UNICODE|x64
+- {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|x64.Build.0 = Release_VC2017-UNICODE|x64
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|Win32.ActiveCfg = Release_VC2017|Win32
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|Win32.Build.0 = Release_VC2017|Win32
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|x64.ActiveCfg = Release_VC2017|x64
++ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|x64.Build.0 = Release_VC2017|x64
+ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|Win32.ActiveCfg = Release_VC2017-UNICODE|Win32
+ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|Win32.Build.0 = Release_VC2017-UNICODE|Win32
+ {89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|x64.ActiveCfg = Release_VC2017-UNICODE|x64
+diff --git a/Main/StackWalker/main.cpp b/Main/StackWalker/main.cpp
+index 220c97b..496021e 100644
+--- a/Main/StackWalker/main.cpp
++++ b/Main/StackWalker/main.cpp
+@@ -33,7 +33,7 @@ void (*pGlobalFuncPtr)() = 0;
+ class StackWalkerToConsole : public StackWalker
+ {
+ protected:
+- virtual void OnOutput(LPCSTR szText) { printf("%s", szText); }
++ virtual void OnOutput(LPCTSTR szText) { _tprintf(_T("%s"), szText); }
+ };
+
+ void Func5()
diff --git a/upstream_utils/stack_walker_patches/0002-Remove-_M_IX86-checks.patch b/upstream_utils/stack_walker_patches/0002-Remove-_M_IX86-checks.patch
new file mode 100644
index 0000000..14d7bae
--- /dev/null
+++ b/upstream_utils/stack_walker_patches/0002-Remove-_M_IX86-checks.patch
@@ -0,0 +1,79 @@
+From 238eda525de70b57bade634447c967f4f92bc96d Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Mon, 23 May 2022 00:06:45 -0400
+Subject: [PATCH 2/3] Remove _M_IX86 checks
+
+---
+ Main/StackWalker/StackWalker.h | 52 ----------------------------------
+ 1 file changed, 52 deletions(-)
+
+diff --git a/Main/StackWalker/StackWalker.h b/Main/StackWalker/StackWalker.h
+index 03efcec..89be951 100644
+--- a/Main/StackWalker/StackWalker.h
++++ b/Main/StackWalker/StackWalker.h
+@@ -179,57 +179,6 @@ protected:
+ friend StackWalkerInternal;
+ }; // class StackWalker
+
+-// The "ugly" assembler-implementation is needed for systems before XP
+-// If you have a new PSDK and you only compile for XP and later, then you can use
+-// the "RtlCaptureContext"
+-// Currently there is no define which determines the PSDK-Version...
+-// So we just use the compiler-version (and assumes that the PSDK is
+-// the one which was installed by the VS-IDE)
+-
+-// INFO: If you want, you can use the RtlCaptureContext if you only target XP and later...
+-// But I currently use it in x64/IA64 environments...
+-//#if defined(_M_IX86) && (_WIN32_WINNT <= 0x0500) && (_MSC_VER < 1400)
+-
+-#if defined(_M_IX86)
+-#ifdef CURRENT_THREAD_VIA_EXCEPTION
+-// TODO: The following is not a "good" implementation,
+-// because the callstack is only valid in the "__except" block...
+-#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
+- do \
+- { \
+- memset(&c, 0, sizeof(CONTEXT)); \
+- EXCEPTION_POINTERS* pExp = NULL; \
+- __try \
+- { \
+- throw 0; \
+- } \
+- __except (((pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER \
+- : EXCEPTION_EXECUTE_HANDLER)) \
+- { \
+- } \
+- if (pExp != NULL) \
+- memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \
+- c.ContextFlags = contextFlags; \
+- } while (0);
+-#else
+-// clang-format off
+-// The following should be enough for walking the callstack...
+-#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
+- do \
+- { \
+- memset(&c, 0, sizeof(CONTEXT)); \
+- c.ContextFlags = contextFlags; \
+- __asm call x \
+- __asm x: pop eax \
+- __asm mov c.Eip, eax \
+- __asm mov c.Ebp, ebp \
+- __asm mov c.Esp, esp \
+- } while (0)
+-// clang-format on
+-#endif
+-
+-#else
+-
+ // The following is defined for x86 (XP and higher), x64 and IA64:
+ #define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
+ do \
+@@ -238,7 +187,6 @@ protected:
+ c.ContextFlags = contextFlags; \
+ RtlCaptureContext(&c); \
+ } while (0);
+-#endif
+
+ #endif //defined(_MSC_VER)
+
diff --git a/upstream_utils/stack_walker_patches/0003-Add-advapi-pragma.patch b/upstream_utils/stack_walker_patches/0003-Add-advapi-pragma.patch
new file mode 100644
index 0000000..f48ee4e
--- /dev/null
+++ b/upstream_utils/stack_walker_patches/0003-Add-advapi-pragma.patch
@@ -0,0 +1,21 @@
+From 61646f76602a77059c18298caa575b95b702c94c Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 24 May 2022 01:24:31 -0400
+Subject: [PATCH 3/3] Add advapi pragma
+
+---
+ Main/StackWalker/StackWalker.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Main/StackWalker/StackWalker.cpp b/Main/StackWalker/StackWalker.cpp
+index 48c7c57..6f0fbf2 100644
+--- a/Main/StackWalker/StackWalker.cpp
++++ b/Main/StackWalker/StackWalker.cpp
+@@ -88,6 +88,7 @@
+ #include <stdlib.h>
+ #include <tchar.h>
+ #pragma comment(lib, "version.lib") // for "VerQueryValue"
++#pragma comment(lib, "Advapi32.lib") // for "GetUserName"
+ #pragma warning(disable : 4826)
+
+ #ifdef UNICODE