Code that reads:
//
// Set the trace file location
//
qputenv("Z_TRACEFILE", file.generic_string().c_str());
where file is a std::filesystem::path object results in a 0xc0000409 abend:
EXCEPTION_RECORD: (.exr -1)
ExceptionAdd
ress: 00007ffc83c64ace (ucrtbase!abort+0x000000000000004e)
ExceptionCode: c0000409 (Security check failure or stack buffer overrun)
ExceptionFlags: 00000001
NumberParameters: 1
Parameter[0]: 0000000000000007
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT
PROCESS_NAME: DeepSkyStacker.exe
ERROR_CODE: (NTSTATUS) 0xc0000409 - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
EXCEPTION_CODE_STR: c0000409
EXCEPTION_PARAMETER1: 0000000000000007
STACK_TEXT:
00000000`0014e7f0 00007ffc`83c819de : 00000000`00000003 00000001`00000003 00000001`40000000 01000000`00000080 : ucrtbase!abort+0x4e
00000000`0014e820 00000001`408c82ce : 00000000`00000000 00000000`ffffffff 00000000`0014eff0 00000000`00000000 : ucrtbase!terminate+0x1e
00000000`0014e850 00007ffc`834b6fd3 : 00000000`00000000 00000000`00000000 00000000`0014ff90 00000000`00000000 : DeepSkyStacker!__scrt_unhandled_exception_filter+0x62
00000000`0014e880 00007ffc`860aa723 : 00007ffc`860ee064 00007ffc`860ee070 00000000`00000000 00000000`00000000 : KERNELBASE!UnhandledExceptionFilter+0x1f3
00000000`0014e970 00007ffc`86061b73 : 00000000`0014ff90 00007ffc`8611c144 00000000`0014eaa0 00000000`00000000 : ntdll!RtlUserThreadStart$filt$0+0x3f
00000000`0014e9a0 00007ffc`860a640f : 00000000`0014fa10 00000000`0014efa0 00000000`00000000 00007ffc`85fcc53c : ntdll!_C_specific_handler+0x93
00000000`0014ea10 00007ffc`85f52327 : 00000000`0014fa10 00007ffc`85f40000 00007ffc`85fcc53c 00007ffc`8611c144 : ntdll!RtlpExecuteHandlerForException+0xf
00000000`0014ea40 00007ffc`85f4a961 : 00000000`00000000 00000000`0014f8c0 00000000`00000000 00000000`0014fa10 : ntdll!RtlDispatchException+0x437
00000000`0014f190 00007ffc`8346804a : 00000000`0014fec0 00000000`0014fb18 00000000`00000001 00000000`e06d7363 : ntdll!RtlRaiseException+0x221
00000000`0014f9f0 00007ffc`67c452c7 : 00000000`00000000 00000000`01c00000 00000000`08f84fb0 00000000`08f7af01 : KERNELBASE!RaiseException+0x8a
00000000`0014faf0 00000001`400953f8 : 00000000`00000000 00000001`4089b483 00000000`0014fde0 00000000`00000052 : VCRUNTIME140!_CxxThrowException+0x97
00000000`0014fb50 00000001`40125abf : 00000000`00000001 00000000`00000000 00000000`00000052 00000000`00000020 : DeepSkyStacker!std::_Throw_system_error_from_std_win_error+0x38
(Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : DeepSkyStacker!std::_Check_convert_result+0x6f
00000000`0014fbd0 00000001`401259b7 : 00000000`0014fde0 00000000`0014fcc0 00000000`0014fd50 00000000`00000000 : DeepSkyStacker!std::_Convert_wide_to_narrow<std::char_traits<char>,std::allocator<char> >+0xdf
00000000`0014fc30 00000001`4012a3d1 : 00000001`40deaa58 00000000`0014fde0 00000000`00000000 00000001`40deaa58 : DeepSkyStacker!std::filesystem::_Convert_wide_to<std::char_traits<char>,std::allocator<char>,char>+0x37
00000000`0014fc80 00000001`40266d6e : 00000000`00000000 00000000`00000000 00000000`08f47fe0 00000000`0014fe20 : DeepSkyStacker!std::filesystem::path::generic_string<char,std::char_traits<char>,std::allocator<char>,0>+0x131
(Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : DeepSkyStacker!std::filesystem::path::generic_string+0x11
00000000`0014fd20 00000001`4005eeb0 : 00000000`00000000 00000001`4094b420 00000001`4094b420 00000000`00000000 : DeepSkyStacker!DSS::TraceControl::TraceControl+0x5ae
00000000`0014fea0 00007ffc`83c2e716 : 00000001`4094b380 00000000`00000000 00000000`00000000 00000000`00000000 : DeepSkyStacker!`dynamic initializer for 'traceControl''+0x40
00000000`0014fef0 00000001`408c724c : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ucrtbase!initterm+0x36
00000000`0014ff20 00007ffc`859fe8d7 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : DeepSkyStacker!__scrt_common_main_seh+0x7c
00000000`0014ff60 00007ffc`85fcc53c : 00000000`00000000 00000000`00000000 000004f0`fffffb30 000004d0`fffffb30 : kernel32!BaseThreadInitThunk+0x17
00000000`0014ff90 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x2c
I think I need to change the above to read:
//
// Set the trace file location
//
qputenv("Z_TRACEFILE", file.generic_u8string().c_str());
I can't build my code at present (vcpkg issue) which is why I'm asking, rather than just trying it!
Thanks, David