windows

Forcing windows to wait for a service to stop when it is shutting down

I'm having an issue that I can't figure out regarding a Windows Service I have written in C#. What I am trying to do is wait for a specified period for a child process to terminate before I am forced to kill it and stop the service. I have set my timeout for anywhere from 5 to 15 seconds and my service waits the appropriate amount of t...

How to get current country name on Windows 95, NT 3.51

I want to get current country code for oldest Windows systems. I was using GetLocaleInfo() with LOCALE_ICOUNTRY flag, but then I've realized it returns wrong results (the same values for different countries), so I've tried LOCALE_SISO3166CTRYNAME which returns country code in ISO3166 standard 2 letters code (eg. 'US') http://www.iso.or...

What are the minimum user permissions required to install a Windows service?

What are the minimum user permissions required to install a Windows service? ...

How can I tell if another process has the active foreground window? (Win32 API vb.net)

The user32.dll provides functions to get the process id from a process executable name, and I can also obtain the active or foreground window that the user is working. Can I determine what windows the targeted process has opened? Otherwise, can I find out what details about the process that opened the foreground/active window? My code ...

How do i get the true path to a reg key?

If you are running a 32 bit app on a 64 bit machine (I am using windows 7) and you write this code RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\XXX") it will actually get the key from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\XXX and not HKEY_LOCAL_MACHINE\SOFTWARE\XXX Progromatically given a RegistryKey how do...

Best API for low-level audio in Windows?

I'm working on an audio application, written in C. I need to provide live audio playback under Windows. I need to decide which audio API to use. I'm planning to use the basic waveOut API, but I wanted to check to see what the community here recommends. I want code that will Just Work on any recent version of Windows, with no need to ...

if change a file attribute to hidden when it is running, will it affected the process?

if change a file attribute to hidden when it is running, will it affected the process? ...

CryptDeriveKey (OID) is unknown whit SHA256 under Windows 7 64 bits

I'm testing some components i build with vs2008 SP1 targeting .net framework 3.5 SP1. I'm getting the exception "(OID) is unknown" in the method PasswordDeriveBytes.CryptDeriveKey passing "SHA256" as the parameter of the hashing algorithm (I also tried with "SHA256Managed" and "SHA256Cng" as mentioned here), this method works OK under X...

How to improve the performance of write data into registry?

Hi, I am working on performance optimizing for our legacy application. It use VC++ 2008, OS is WindowsXP or above. In installation, it will parse a file and write some information about the file into registry. With the files count increasing, the installation need very long time. I try to comment the code that write to registry, and i...

Identify a reboot

Is there any "Boot session ID" or (reliable) "Boot timestamp"? For an installation I need to detect that a scheduled reboot took place indeed. I guess I could do a dummy MoveFileEx() with MOVEFILE_DELAY_UNTIL_REBOOT, but i did hope for something easier. (We have to install a 3rd party package that sometimes behaves erratically after ...

Windows Service Installation Folder .Net

Hello there, I have a windows service that is hosting a WCF Service Library. Corresponding to this windows service, I have a setup project. I want to change the default installation folder of the service. It's fine that I can change while running through the installation wizard. But what settings I need to change at the project level? ...

blocking website via hosts file not working?

Hi, I'm trying to block a website using the hosts file using this tutorial : http://hackspc.com/how-to-block-a-website/ but It doesn't work, the website I'v blocked In this case facebook still shows up, please can anyone help me out here? Thanks, parastar ...

emacs windows spell check aspell or hunspell

I use emacs 23.1.50 version on Windows XP operation system. I could not setup hunspell or aspell as part of emacs with the example provided by the emacs wiki. Anyone has working confiugration for windows xp and please help me out. ...

Should the caller initialize "out" parameters?

Many Win32 API functions have parameters specified to be "out". For example, GetIconInfo() description says about the second parameter that The function fills in the structure's members. This implies that the function doesn't ever read the original values stored in the "out" parameter - only changes them - and therefore the caller is fr...

process termination C++

I have the following problem: I have an application (server that never ends) written in C++ running as a service containing inside the main thread also 3 threads (mainly doing IO). In the main loop I CATCH all possible exceptions. The process terminated and nothing was printed either by the main loop or by the threads themselves. I saw...

Any reason to use SecureZeroMemory() instead of memset() or ZeroMemory() when security is not an issue?

This MSND article says SecureZeroMemory() is good for cases when sensitive data stored in memory for a while should be for sure overwritten as soon as possible when no longer needed. Answers to this SO question explain why this can make a difference. Now is there any sence in using SecureZeroMemory() for initializing just every memory b...

How do I create a COM (and other device) emulator in C#?

Hi. We have several legacy components that interact with COM ports, USB etc. I would like to create a .NET program that would emulate a COM port and log the traffic, relaying it to a WCF service endpoint somewhere or directly into a database. Maybe also wrapping a real COM port kind of like the decorator pattern. I have looked around...

Free install system with GUI

Hello. Is there any free install system with a GUI interface? I found one - Advanced Installer, but free edition is too limited, I even can't show EULA. Other free tools like NSIS, WiX... are scripting only. I got no extra time to dig into new scripting language, or whatever time consuming activities. Currently I'm using default Visual...

Shortcut to a shortcut in Windows

I have a script that regularly creates a new folder on the network and saves files to a folder. When this script is run, it creates a shortcut to the folder just created. What I really want is for all my users to be able to have a shortcut on each of their desktops that points to the most recent folder. I'd thought I'd be able to prov...

How does one detect when the wallpaper has changed (Windows XP or greater)?

I have figured out how to change the desktop wallpaper (there are dozens of examples on the Internet.) One thing that still eludes me: how do I detect when the wallpaper has changed? (Say via the Display control panel or another program changing it.) ...