I have created a DLL in C++ VS2010.
It seems to me that 2 programs can not access it at the same time.
First program 1 has to complete the calls to the DLL, only then the DLL will process the calls from the other program.
I would like to know if there is a certain switch in the project settings that I need to set to make the DLL "multi-threaded".
The DLL is used by Windows SAPI. A program (in my case two programs) can reference the SAPI and make a computer voice (the computer voice is the DLL) speak something. I expected both programs to speak at the same time, but since they don't (they wait for each other), I expected my DLL to be single-threaded.
Thank you.
The speech API serializes speech from multiple sources so they don't play at the same time. One will play first, then the next, and so on until there is no more pending speech to be played. You can disable this via the registry as described here:
http://msdn.microsoft.com/en-us/library/ee431801(v=vs.85).aspx#_Toc494873956
Particularly the NoSerializeAccess value in HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Speech\AudioOutput\<AudioOutput1>\Attributes where <AudioOutput1> is the name of your audio output device.
This information can be found at http://msdn.microsoft.com/en-us/library/speechplatform_ispaudio.aspx
In order to prevent multiple TTS voices or engines from speaking simultaneously, the Speech Platform serializes output to objects which implement the ISpAudio interface. To disable serialization of outputs to an ISpAudio object, place an attribute called "NoSerializeAccess" in the Attributes folder of its object token.
Related
I'm trying to use QSharedMemory and QClipboard to share data between a SYSTEM process (running on the WinSta0\\Winlogon desktop) and a normal user process, but both fail to share data with others non-SYSTEM processes running on the normal desktop. I belive this is because the WinSta0\\Winlogon desktop is a isolated desktop.
My app is a program that takes shots of the Windows Secure Desktop and send it to clipboard.
The question is: Is there any way to share memory data between that process and non-SYSTEM processes? (Actually I'm using a file to do the job).
On Windows Vista and later, system services run in an isolated session ("session 0"). This is the most likely cause of your problem. (Note that all system services run in session 0, regardless of whether they are running in the SYSTEM security context or not. Similarly, it is possible to launch processes as SYSTEM in an arbitrary session.)
Each session has a separate WinSta0 workstation, and hence a separate clipboard. So clipboard functionality is not going to work here.
It is possible for file mapping objects (shared memory) to work across session boundaries. However, I don't know whether it is possible to do this with Qt. The best bet would appear to be to use setNativeKey which presumably determines the name of the file mapping; to make a file mapping cross session boundaries, use a name that begins with Global\ as described in the MSDN article on CreateFileMapping. If possible, consider using the Win32 API directly rather than Qt.
I've got a project going on, far away from complete, a stand alone audio mixer/effects processor. I plan to eventually, have all of my effects in stand alone program as VST, AU, and maybe TDM plugins.
I would like to be able to batch convert all the files in a project using an external sample rate converter. If not your choice of external converter, then just a specific program, R8 "brain free", or "R8 brain" pro, by Voxengo.
The second thing I would like to be able to do, is launch "Reaper", from within a project in my program, and have the files in a project, opened in reaper, and all of my effects plugins added with specific settings.
Is this even possible to do?
It depends on what level of automation interface the other programs offer. This could range from taking command line parameters to perform certain actions, to offering a sophisticated automation interface through a mechanism such as COM or OLE automation. It's a matter of checking what is offered by the software you plan to run from your own program.
The reaper documentation suggests it has quite a good API for automation purposes.
I have created a set of multi-platform C++ components to load and manage various types of digitally signed shared libraries. This handles all aspects of loading and initialziation including mapping them into the calling process, applying branch fix-ups, binding any imports and calling the initialization entry point. The components cannot use LoadLibrary() as it is platform specific and not all of the shared libraries are in PE format.
One of the few remaining issues I am faced with is providing appropriate debugger support for targeted platforms and development environments. In MS Windows environments this includes getting the debuggers to load symbol information generated by the compiler and linker (or converted from other source). Because the loading and initialization of the libraries occurs outside of the kernel, the debugger never receives LOAD_DLL_DEBUG_EVENT and UNLOAD_DLL_DEBUG_EVENT events. This leads to the following questions:
Is there an API or system call that allows events such as LOAD_DLL_DEBUG_EVENT to be sent directly to the debugger?
Is there a documented way to communicate directly with the program or session debug managers or with the machine debug manager service?
Is there an API or system call available to notify the kernel and subsequently the debugger that a DLL has been loaded? Since PE files are one of the primary supported formats this is the most desirable option. It also has the potential benefit of allowing the library to appear in the module list of the process.
Does the WinDBG SDK apply to debugging on Windows as a whole and can WinDBG extensions be used to instruct the debugger to load the symbol information?
I have search extensively for information on the above mentioned topics but have come up short. I have located a bit of information about the data structures used by the Windows debugger but nothing relevant to my specific situation.
I am open to API/system calls and approaches that are documented or undocumented and those requiring elevated privileges to function.
I don't think that there is a way to directly send the kind of events that you want (like LOAD_DLL_DEBUG_EVENT) to a process, at least not easily.
Why don't you simply wrap your libraries inside normal DLLs in Windows? Maybe you embed your custom module loading mechanism inside each "proxy" DLL, in this way you would not need to replicate so much functionality that the OS already provides for you.
If I understood the problem, you may see:
Writing a basic Windows Debuggers
Writing Windows Debugger (Detailed)
The Nikon SDK allows for a request/response system from PC to camera through USB through the C programming language. When creating two camera objects in two seperate threads, it is not possible to send two commands simultaneously to two seperate cameras. One camera will get its command, and send back the response, and then the second camera will get its command and send back a response. I think it has to do with the fact the DLL the Nikon SDK accesses uses global variables. The DLL is not open-source, so I cannot change or verify this. I did make two seperate copies of the DLL and each thread acesses a seperate copy. Is it possible to send two commands and get responses back at the same time?
Even though you made two copies of the DLL, they are both being loaded into the same address space / process, so any conflicts will still overlap.
The first thing I would try is two separate EXEs, each loading the original DLL, so that they are running in different processes. If this allows the two cameras to be controlled independently and simultaneously, you will just need to build some kind of process isolation system :-)
The only way I know to do this (and it's not easy) is to build a COM wrapper around the Nikon DLLs and use IIS to isolate the two instances into their own processes. A slightly easier approach might be to build your own "server" for each camera, running in an EXE process, and send messages to it (maybe just Windows messages) from a third master process.
A brute force solution would be to run each process in its own virtual machine using VMWare Workstation or a similar virtual PC architecture. Of course, now you've got the problem of communicating between two virtual PCs...
Those md3 files are not thread safe and contain static functions. I got this working on the Nikon SDK by dynamically creating a new copy of the md3 file each time a camera is connected. I had one main md3 for detecting the cameras and then would create a new md3 each time I connected.
Finally, make sure your class is thread safe and contains no global or static functions. I recommend encasing the base Nikon code into a class. If your writing a 3rd party dll that requires static functions use a pointer to the Nikon class, for each static call pass the void* object that is created by your constructor.
First think I would try is spawning 2 instances of your application. One for each camera.
Not sure exactly what you're trying to accomplish. Does the answer take too long, so that you want to get the answers at the same time? Why not simply just create a wrapper and make sure the question/answer are simply synchronous, so that you can access the SDK from any thread (and in case thread X is waiting for a response and thread Y makes a request, thread Y will wait until thread X is getting the response, and then make a request).
I was having a discussion with a colleague about whether or not the following is possible:
Install an MFC application from a USB drive in Windows XP (this installation would be initiated manually by a user with sufficient privileges to install software).
After rebooting, this application should start instead of the default Windows XP shell (explorer.exe).
Does anyone know how I might accomplish this?
You won't be able to run an MFC application before windows starts up because by definition MFC runs off of windows DLLs that are not loaded until windows itself is. Not to mention that Windows is what is responsible for loading a PE in the first place, so you won't even be able to load a compiled EXE or DLL without a custom bootstrapper.
In order to do what you want to do you have a few options. There are (easy) ways for windows to be set to load an application on startup. If that is what you want, then this is entirely possible.
However, if you wish to execute code before and while windows is starting up, then you must first overwrite the bootstrapper (with something like GRUB), execute your code (again, you will not have access to any standard library - you will have to operate directly on the buffers made available to you by the CPU if you wish to do any sort of I/O), then start up windows by launching its bootstrapper. I have no idea how to do this; but that is the general overview of what must happen.
You mentioned DLL injection, which is another possibility. I am not familiar with what DLLs, and in what order, are loaded during windows startup. That will be an exercise for you. What you will have to take into consideration, is that the higher level you want to exist in (i.e. what libraries are available for you to do File/Console I/O) the higher up you need to execute your code in the windows startup process.
My suggestion to you is simply write a program that executes as a service that is started up during windows initialization. Its easy to do, and you will have the entire HAL loaded and ready to actually perform tasks - rather then you having to write device-specific drivers in order to manipulate hardware before window's loads the HAL.
Modify HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit registry value with full path to your application. This key specifies what program should be launched right after a user logs into Windows. The default program for this key is C:\windows\system32\userinit.exe. Userinit.exe is a program that restores your profile, fonts, colors, etc for your username. It is possible to add further programs that will launch from this key by separating the programs with a comma