What's the difference between OpenVirtualDisk() and CreateFile() function?
These both does the same work that is opening a vhd file... I want to ask the specific scenarios in which we use these two functions...please correct me if I'm wrong somewhere
See also questions close to this topic
GetUserPreferredUILanguages() never returns more than two languages
I'm trying to retrieve the complete list of the user's preferred languages from a C++/Qt application, as configured in the "Region & language" page in the user's preferences:
For that, I am trying with the WinAPI function GetUserPreferredUILanguages(), on an up-to-date Windows 10 Pro system.
However, the function always only returns the first entry (the main Windows display language), and "en-US". If English is configured as the main language, then only "en-US" is returned. E.g., if I have (German, French, English) configured, ["de-de", "en-US"] is returned, French is omitted. If I add more languages to the list, they are omitted as well. I also looked at User Interface Language Management, but to no avail. GetSystemPreferredUILanguages() for example only returns "en-US". GetUILanguageFallbackList() returns ["de-de", "de", "en-US", "en"].
The code I use:
// calling GetUserPreferredUILanguages() twice, once to get number of // languages and required buffer size, then to get the actual data ULONG numberOfLanguages = 0; DWORD bufferLength = 0; const auto result1 = GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numberOfLanguages, nullptr, &bufferLength); // result1 is true, numberOfLanguages=2 QVector<wchar_t> languagesBuffer(static_cast<int>(bufferLength)); const auto result2 = GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numberOfLanguages, languagesBuffer.data(), &bufferLength); // result2 is true, languageBuffer contains "de-de", "en-US"
Is this not the right function to use, or am I misunderstanding something about the language configuration in Windows 10? How can I get the complete list of preferred languages? I see UWP API that might do the job, but if possible, I'd like to use C API, as it integrated more easily with the C++ codebase at hand. (unmanaged C++, that is)
Invalid Directory error inside exeoutput but works fine in browser
I am trying to compile a PHP application using Exeoutput. The problem is with the following code:
$uniqueKey = shell_exec('wmic bios get serialnumber 2>&1'); $uniqueKey = str_replace('SerialNumber', '', $uniqueKey);
In browser (through XAMPP), output is perfect. It shows a serial key. But when I run this page under Exeoutput environment, I get the message:
The current directory is invalid.
Running into strange problems when processing loads of data and objects
I have an application which seems to have some kind of memory problem.
Depending on some input data it may happen this application allocates several thousands of objects which all have a total size of <1 Gbyte (using a computer running at 32 Gbyte RAM).
Nevertheless I experience some problems after processing some of these data, an opened progress bar becomes quite huge, the progress in this bar is no longer updated (while the application is still running), the Visual Studio Debugger becomes very unresponsive, other dialogues which should appear do not open any more although the relevant code is called.
I do not expect an answer which clearly points to the exact reason for my problems but asks this question to check some things:
memory fragmentation should not be the reason when a modern operating system with FPU and memory management is used, right?
also in case of a "stupid" memory leak, I should not see such problems when more than 10 GBytes of RAM are still available, right?
I create and destroy as many threads as objects in memory using CreateThread()/CloseHandle() - this should not be a problem also when called several thousands of times, right?
because the data processing is done in these threads and I do not want to start more threads at the same time than CPU-cores are available, I signal the end of processing of one piece of data by using SetEvent()/WaitForSingleObject()/ResetEvent() before the next thread is started. Using several thousands of SetEvent()-calls should be no problem, right?
Thanks, every hint, idea and suggestion is welcome :-)