377 Commits

Author SHA1 Message Date
75c5630dbc Common: Require explicit handle validation
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
Doxygen Action / build (push) Has been cancelled
Using operator bool() hid ambiguity when handle was polymorfic with
bool. Using operator!() reqired !! to test for validity which results in
awkward code.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-07-08 11:15:54 +02:00
9e992db24e Obsolete unnecessary function wrappers
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
Doxygen Action / build (push) Has been cancelled
Let's keep our codebase minimal.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-07-08 10:39:40 +02:00
23b856f2e6 Common: Enforce explicit handle validation
Some invalid handle values are -1 or INVALID_HANDLE_VALUE, hence our
handle template has a specific invalid handle value parameter we should
always test against. Time and again, I find my code simply comparing
handle against zero.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-07-08 10:38:40 +02:00
3d53fb7b9b Move public Git repos to Amebis
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
Doxygen Action / build (push) Has been cancelled
2025-07-07 08:50:41 +02:00
2147ed71ef Common: Require explicit handle validation
Using operator bool() hid ambiguity when handle was polymorfic with
bool. Using operator!() reqired !! to test for validity which results in
awkward code.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-06-12 14:04:17 +02:00
b04df162ae Common: Require explicit handle validation
Using operator bool() hid ambiguity when handle was polymorfic with
bool. Using operator!() reqired !! to test for validity which results in
awkward code.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-06-12 13:36:16 +02:00
d9a719ddb8 Common: Require explicit handle validation
Using operator bool() hid ambiguity when handle was polymorfic with
bool. Using operator!() reqired !! to test for validity which results in
awkward code.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-06-09 22:39:06 +02:00
ca791f1663 Use native line endings 2025-05-26 14:49:17 +02:00
666d362075 WinHTTP: Add missing #include
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-04-22 16:41:50 +02:00
2e03659948 Clear warning suppression
Code analysis got quite good and we'd better keep warnings on our radar.

Either:
1. Research and resolve the reason for the warning.
2. Remove silencing and let code analysis complain.
3. Comment why some warning silencing is there.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-04-03 14:09:53 +02:00
6607f20873 UnitTest: Switch to Assert::IsTrue for primitive datatypes
Visual Studio 2019 has issues compiling Assert::AreEqual for some
integral datatypes.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 15:33:57 +01:00
9921eb359d UnitTest: ShortProjectName is not available in VS2019
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 14:27:06 +01:00
ca9245770b UnitTest: Sync intermediate and output folders with sibling projects
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 13:33:18 +01:00
875b0581f7 UnitTests: Fix VS Win32 output folder anomaly
Visual Studio is using different output folder convention for Win32
builds. This makes it a royal-pain-in-the-ass to automate artifact
paths.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 12:33:40 +01:00
0d024b97d1 AppVeyor: Reconfigure
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 12:05:05 +01:00
f0699d7f47 Silence C26451
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 10:13:00 +01:00
0f412d5c38 COM: Fix filling arrays with more than 4G cells
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 10:08:36 +01:00
901b5af311 AppVeyor: Initial support
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 09:53:40 +01:00
42ed65c7b9 UnitTests: Rename Win32 solution platform to x86
This has been the new default for a while. AppVeyor seems to use this.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 09:53:16 +01:00
59f5df1e4e UnitTests: Adapt to new default $(IntDir)
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 09:51:38 +01:00
d1bfd1abed WinHTTP: Add http_error
WinHTTP errors don't get resolved by FormatMessage by default. We need
to format them using WINHTTP.DLL resources.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-02-20 14:12:14 +01:00
3053b98ab8 WinHTTP: Add http_proxy_info
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-02-14 15:45:57 +01:00
e287d62fbc Win: Silence benign warning
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-02-03 20:47:52 +01:00
4655738add Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:49:03 +01:00
892d950f2b Win: Fix LoadStringA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:44:40 +01:00
9ce2e578bb Win: Test ExpandEnvironmentStringsA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:44:18 +01:00
d3f8439118 Win: Trim trailing zeros in LoadStringW
When resources are compiled with /n (default), all strings are zero
terminated and LoadStringW returns number of characters including this
terminator.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:43:26 +01:00
bbe3da0303 Sec: Fix GetUserNameExA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:40:27 +01:00
034a0ce74f Win: Test GetModuleFileNameA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:19:45 +01:00
b25f6de9e5 BCrypt: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-28 10:07:37 +01:00
acea29ac6d BCrypt: Fix bcrypt_keypair
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-28 10:07:24 +01:00
289aab2354 BCrypt: Add
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-24 15:07:14 +01:00
ba13a57897 Remove excessive WINAPI
No need to have non-default calling convention for our API.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-24 15:06:54 +01:00
6874413b65 Win: Add ntstatus_error
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-24 15:04:35 +01:00
a0aa5f177d Update SAL of no longer optional exception text
This was overlooked in b7de0817889088bc524d0e6a9d9eff3e412aec49 and
2d9e445e1838d67ff642af06fb9417920e36ca7a.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-21 09:09:12 +01:00
2d9e445e18 Require all exceptions to provide some text
Otherwise what() returns nullptr and it makes catch handlers somewhat
inconvenient if they need to test for this too.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-20 16:24:00 +01:00
b7de081788 COM: Use FormatMessage when no msg provided for com_runtime_error
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-20 16:22:02 +01:00
34d5dc23df COM: Fix documentation external references
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-16 13:24:44 +01:00
01adb60ded COM: Allow safearray_accessor with NULL SAFEARRAY
This allows accessor to be used in the parent scope before checking
SAFEARRAY for NULL.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-16 13:23:43 +01:00
e1d4e03831 COM: Allow SysAllocString(NULL)
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-16 13:22:57 +01:00
e432882d3b Declare handle::detach()
It's trivial and used at the point from which no C++ exceptions are
expected, as the handle is no longer a subject to RAAI.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-15 15:03:14 +01:00
f33010e6b6 COM: Add helper for SAFEARRAY creation
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-15 15:03:14 +01:00
b0cf45a0f1 Bump Copyright year
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-08 12:36:14 +01:00
460ace5928 Trim trailing whitespace
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-07 15:04:42 +01:00
f415b194b5 Update URLs after migration to codeberg.org
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-12-03 10:11:08 +01:00
f85047dab9 COM: Test rather than assert
We generally don't care when our functions are called with invalid
arguments (validation should be performed on arguments input, not every
use). However, we do use asserts to validate arguments in Debug builds.
Unfortunately, this makes Code Analysis unhappy in the Release builds.
Let's make an exception on this one, since the check is not expensive
compared to the rest of the function.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-11-19 10:44:14 +01:00
e553485d33 Add missing UTF-8 BOM
We want to ensure non-UTF8 configured Windows machines interpret our
source code correctly.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-11-11 12:24:22 +01:00
d807e150ba Stop using get_ptr after moved to stdex
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-10-01 16:38:14 +02:00
5b023215f5 Move get_ptr to stdex
This was migrated to stdex being platform independent.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-09-30 09:41:09 +02:00
8cca09a567 Mark GetUserNameExW as tested
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-09-23 14:55:29 +02:00