340 Commits

Author SHA1 Message Date
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
6dead076a2 Add missing SAL
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-22 13:54:44 +02:00
0559794633 Add last_error_saver
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-15 18:10:02 +01:00
9da457ab2b WinHTTP: Add WinHttpQueryHeaders
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-11 21:41:51 +01:00
5be20dde23 COM: Add helpers for VBARRAY creation
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-16 08:46:01 +01:00
6ca4c28f9c Fix typo in documentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-16 08:25:09 +01:00
f5de1accad Remove __vsnprintf to declutter global namespace
It is usual for WinStd to have A and W versions of the same function.
Why would vsnprintf be different?

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-09 21:49:09 +01:00
cbb221fce4 Use correct exception in WlanReasonCodeToString
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-09 20:07:31 +01:00
9d4cac5131 Add mutex_locker
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-09 20:07:30 +01:00
abd7189ec4 Fix single-byte version of vsnprintf()
Not defining our own vsnprintf() for char* strings made code switch to
C99 stdlib vsnprintf(), which is behaving differently than vsprintf()
expects.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-09 19:45:24 +01:00
bce73bc2ea Bump Copyright year
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-06 10:54:53 +01:00
19e2dbbe72 Win: Revise string zero termination
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-06 10:48:54 +01:00
9f5a68e789 Write directly into std::string buffer
This removes extra memory allocation.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-05 23:35:19 +01:00
49542a5f64 Refactor
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-21 09:19:52 +01:00
e2a279f30f Simplify UnmapViewOfFile_delete
No need to have it as a template. And array version is not required
either.
2023-12-08 14:23:26 +01:00
f778e698c9 COM: Make com_initializer constructors throw on error
This aligns the class with other COM classes (see com_obj) and makes
client code simpler as it does not need to check for error explicitly.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-08 10:09:47 +01:00
06b656e2ce Fix to compile as C++17
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 20:26:52 +01:00
8e323efef9 Resolve code analysis warnings
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-07 09:37:07 +01:00
512451ec0e Support for C++17
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-07 08:53:06 +01:00
16df7b86a1 sanitizing_allocator: fix zeroing memory when sizeof(T)>1
std::allocator<>::deallocate() second parameter is number of elements,
not array size!

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-07 08:50:04 +01:00
b39aecb224 Fix FormatMessage helper functions
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-18 13:43:40 +02:00
f9090e02f4 Throw on 4G overflows
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-16 14:33:11 +02:00
ff8136f708 Add load_msg_from_res and fmt_msg_from_res helpers
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-13 11:56:58 +02:00
f9f9aade69 Add clipboard_opener
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-10 16:50:35 +02:00
f8f8e7e76e Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-10 16:50:20 +02:00
e0fc1ae56a Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-06 15:57:36 +02:00
2680cdb3fd Upgrade win_runtime_error and ws_runtime_error to include error message
Upper levels usually just catch std::exception and display what()
message to the user. Rather than requiring typed exception catching and
per-type user message synthesis, it's easier for upper levels if we
stuff the Windows/Winsock2 formatted error message at the end of the
string returned by what() and leave the catch (std::exception&) do the
magic.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-03 15:18:25 +02:00
d99aedecc1 Add winstd::http
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-01 22:49:05 +02:00
c1bd614597 Add GetThreadPreferredUILanguages
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-01 22:48:33 +02:00
7637d86c7d Add winstd::mutex
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-01 22:48:07 +02:00
ca4e9d069f Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-01 22:47:28 +02:00
40003c4054 COM: Improve bstr constructors
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-01 22:44:38 +02:00
0addbd825a icon: Add
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-03 13:54:46 +02:00
da8bd86d83 Add helpers for GlobalAlloc
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-08 11:14:03 +01:00
bf9ab7c4e2 Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-08 09:48:03 +01:00
3698ca011a COM: Introduce SAFEARRAY helpers
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-08 09:48:02 +01:00
31ebd9b08f Make duplicate_internal() and other allocation methods throw
An exception can be way more elaborate why duplication failed and it
doesn't require consistent checking for result.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-08 09:28:13 +01:00
1d206602e6 com_obj: Add CoCreateInstance constructor
When using winstd::com_obj<> as a member of another class and we want
to create an instance of the object in another class' constructor, this
comes convenient.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-08 09:28:13 +01:00