381 Commits

Author SHA1 Message Date
5f28e39b03 Warn usage of (v)sprintf (v2)
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
Doxygen Action / build (push) Has been cancelled
Until all projects using this are reviewed, please keep this warning in
place.

Signed-off-by: Simon Rozman <simon.rozman@amebis.si>
2025-11-28 11:38:02 +01:00
359ba8b7ef Warn usage of (v)sprintf
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
Doxygen Action / build (push) Has been cancelled
Until all projects using this are reviewed, please keep this warning in
place.

Signed-off-by: Simon Rozman <simon.rozman@amebis.si>
2025-11-28 09:43:11 +01:00
Simon Rozman
acf2419ef0 Fix (v)sprintf
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
Doxygen Action / build (push) Has been cancelled
9f5a68e789 changed its behavior to append
rather than set the output string. Which is misleading. This reverts
(v)sprintf back to set the string.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-11-14 15:12:32 +01:00
Simon Rozman
9136c74309 Win: Add nspace, boundary_descriptor
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
Doxygen Action / build (push) Has been cancelled
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-08-04 11:20:56 +02:00
Simon Rozman
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
Simon Rozman
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
Simon Rozman
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
Simon Rozman
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
Simon Rozman
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
Simon Rozman
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
Simon Rozman
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
Simon Rozman
ca791f1663 Use native line endings 2025-05-26 14:49:17 +02:00
Simon Rozman
666d362075 WinHTTP: Add missing #include
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-04-22 16:41:50 +02:00
Simon Rozman
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
Simon Rozman
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
Simon Rozman
9921eb359d UnitTest: ShortProjectName is not available in VS2019
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 14:27:06 +01:00
Simon Rozman
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
Simon Rozman
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
Simon Rozman
0d024b97d1 AppVeyor: Reconfigure
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 12:05:05 +01:00
Simon Rozman
f0699d7f47 Silence C26451
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 10:13:00 +01:00
Simon Rozman
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
Simon Rozman
901b5af311 AppVeyor: Initial support
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 09:53:40 +01:00
Simon Rozman
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
Simon Rozman
59f5df1e4e UnitTests: Adapt to new default $(IntDir)
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-28 09:51:38 +01:00
Simon Rozman
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
Simon Rozman
3053b98ab8 WinHTTP: Add http_proxy_info
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-02-14 15:45:57 +01:00
Simon Rozman
e287d62fbc Win: Silence benign warning
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-02-03 20:47:52 +01:00
Simon Rozman
4655738add Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:49:03 +01:00
Simon Rozman
892d950f2b Win: Fix LoadStringA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:44:40 +01:00
Simon Rozman
9ce2e578bb Win: Test ExpandEnvironmentStringsA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:44:18 +01:00
Simon Rozman
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
Simon Rozman
bbe3da0303 Sec: Fix GetUserNameExA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:40:27 +01:00
Simon Rozman
034a0ce74f Win: Test GetModuleFileNameA
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-30 13:19:45 +01:00
Simon Rozman
b25f6de9e5 BCrypt: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-28 10:07:37 +01:00
Simon Rozman
acea29ac6d BCrypt: Fix bcrypt_keypair
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-28 10:07:24 +01:00
Simon Rozman
289aab2354 BCrypt: Add
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-24 15:07:14 +01:00
Simon Rozman
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
Simon Rozman
6874413b65 Win: Add ntstatus_error
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-24 15:04:35 +01:00
Simon Rozman
a0aa5f177d Update SAL of no longer optional exception text
This was overlooked in b7de081788 and
2d9e445e18.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-21 09:09:12 +01:00
Simon Rozman
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
Simon Rozman
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
Simon Rozman
34d5dc23df COM: Fix documentation external references
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-16 13:24:44 +01:00
Simon Rozman
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
Simon Rozman
e1d4e03831 COM: Allow SysAllocString(NULL)
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-16 13:22:57 +01:00
Simon Rozman
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
Simon Rozman
f33010e6b6 COM: Add helper for SAFEARRAY creation
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-15 15:03:14 +01:00
Simon Rozman
b0cf45a0f1 Bump Copyright year
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-08 12:36:14 +01:00
Simon Rozman
460ace5928 Trim trailing whitespace
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-01-07 15:04:42 +01:00
Simon Rozman
f415b194b5 Update URLs after migration to codeberg.org
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-12-03 10:11:08 +01:00
Simon Rozman
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