Windows API's CreateFile with CFile gives invalid path error if used drives created with SUBST
A drive is created for a folder using SUBST command. We have a Windows application which reads contents of the and performs some operations. Application does not give any error when read the file path is from actual drive. But when try to read from drive…
Mitigation for Dll hijacking
Hello Team, I found dll injection in c#, .net and c++thick client applications. But to perform dll here I needed admin access. in this case I had admin access. So what will be the standard mitigation to prevent dll injection after even get the admin…
How to Detect Initial DPI changes in a WPF Application while Scaling according to Per Monitor Aware in Variable Dynamic Screen Resolution?
In daily life we have to deal with a lot of different types of display size it may be mobile or may be a 4k monitor. The screen resolution vary from display to display. Here another important factor is DPI (Display per inch) which is mainly a scaling…
How do I display a transparent custom bitmap on a toolbar button in a Win32 C++ app?
I'm trying to add a button with a custom transparent bitmap to a toolbar in my Win32 C++ app. I'm using the following code to create and populate the toolbar. toolBar = CreateWindowEx(0, TOOLBARCLASSNAME, nullptr, WS_CHILD, 0, 0, 0, 0, hwnd,…
Application crash even on a try catch block
When i comment out the line GetViewsByZOrder i get the following exception: Exception thrown at 0x00007FF96E36EE19 (rpcrt4.dll) in : 0xC0000005: Access violation reading location 0x00000000094F0122. On the line if (collection->GetViewForHwnd(hwnd,…
Porting SetTransform function in DirectX 9 to DirectX 11 or 12
Iam porting an existing project with DirectX 9 to DirectX 11 or 12, I am trying to port the function SetTransform from DirectX 9, there is no reference found in DirectX 11 or 12, please kindly suggest where to find the above function and how to define…
GDI+ PrivateFontCollection::AddMemoryFont failed to load fonts
GDI+ PrivateFontCollection::AddMemoryFont fails to load fonts and returns a status of InvalidParameter = 2. I made sure that my resources were correct as I also saved them locally, but the ttf fonts are correct. What is the problem please? My code and…
Disable windows shortcuts for high contrast and mouse keys
I need to block keyboard shortcuts "alt + shift + prtscr" and "alt + shift + numlk". How to do it with LL Keyboard hook? Help much appreciated !
Expected behavior of an application launched through SSH in two different scenarios
Hi, I have a C++ application which can also runs as a Service. I am trying to launch my application on a remote machine from a client machine. For this, I am using the 'Open SSH' software. Want to understand what is the expected behaviour from the OS…
Program output is correct, but VS reports an error during step-by-step debugging
The C++ code snippet is: class A { public: A(const std::string& ss, const std::string& tt) : s(ss), t(tt) {} void func1() const { std::cout << s; } void func2() const { std::cout << t; } using Action = void (A::*)()…
How does Windows' 'Game Controllers' properties connect to a joystick?
The situation: We need to use a new game controller (with a joystick only) hardware on Windows 10 IoT. In the properties of "Game Controllers", moving the joystick is visible in the displayed rectangle with the '+'. Our software using DirectX8…
How to get Code Coverage in Visual Studio 2022 with CMake Cpp Projects with a Windows Compiler
I have a Cpp project that is being built with the MSVC compiler and using CMake. I need a code coverage solution, preferably one that either provides detailed reports or in Visual Studio code highlighting that is possible using CMake. So far I have tried…
winrt::Windows::Devices::Usb::UsbDevice::FromIdAsync throws exception on get
code sample: #include <guiddef.h> #include <windows.h> #include <ppltasks.h> #include <winrt/Windows.Foundation.Collections.h> #include <winrt/Windows.Foundation.h> #include…
How to access registry items under driver service registry key path of Win11 24H2 in a WDF driver?
I am currently utilizing a Kernel Mode Driver Framework (KMDF) driver, employing the RtlQueryRegistryValues function with parameters (RTL_REGISTRY_ABSOLUTE, L"\Registry\Machine\System\CurrentControlSet\Services...") to access specific registry…
How to resolve debug assertion error when calling dialog create function in mfc extension dll
I have code like below: m_pPreviewDlg.Create(IDD_DIALOG_PREVIEW); The error below occurs in this code. What is the solution? I am using visual studio 2022
MFC Debug Assertion Failed (DLL Dialog Create Error)
I am trying to CREATE a dialog as MODALESS in a DLL. When DEBUGING is attempted, DEBUG ASSERTION FAILED LINE24 is output. What should I do? Code Example : extern "C" __declspec(dllexport) int CreateDlg() { CTestDlg *pDlg = new…
Visual Studio 2022- Couldn't install Microsoft.VisualCpp.Redist.14
I'm trying to install Desktop development with C++ for Visual Studio 2022. Attempting to install this using the Visual Studio Installer returns an error stating: Couldn't install Microsoft.VisualCpp.Redist.14 The log file mentions another log file that…
Count logical liines in a text control
Hi, ALL, There is a EM_GETLINECOUNT, but it will count the number of text lines. I'm looking for to count the displayed lines (or wrapped lines) in a text control. Either using WinAPI or C++. Thank you.
.net8 windows form design view problem.
I am developing Revit addin in Vidual Studio in c++/cli as class library. Before moving to .net platform everyhing was working fine. But in .net Windows form design views doesnt work. Though when I add form element by code. It compiles and works. The…
How to get list of all programs on system PATH that countain some characters in powershell/batch
So, i want to make a builder file for my C code, i use Clang compiler and wanted to link the Windows SDK's headers and make it multiplatform, so even VS 2015 is supported. I thought the easiest and best way will be to just find the programs that…