windows

strptime in windows?

I wrote this really nice app that works just fine in Linux. It uses strptime(). Windows doesn't have this. Is there a Windows alternative for this? My coworker needs to use this app. (I tried googling it already to no avail) ...

How do I run programs with Strawberry Perl?

A coworker is trying to use ack (a Perl program) on his Windows machine, having tried it under Linux and decided he definitely wants to use it. He managed to get Strawberry Perl installed on his machine, but can't seem to figure out what to do to make ack run with it from a command prompt. He tried editing the #! line, but I knew that ...

Simulating a BlueScreen

I am trying to make a program that records a whole bunch of things periodically. The specific reason is that if it bluescreens, a developer can go back and check a lot of the environment and see what was going on around that time. My problem, is their a way to cause a bluescreen? Maybe with a windowsAPI call (ZeroMemory maybe?). Anywho...

Cast to LPCWSTR???

I'm trying to create a (very) simple Win32 GUI program, but for some reason the compiler (I'm using VC++ 2008 Express) wants me to manually typecast every string or char* to LPCWSTR: I get this compiler error every time I do this, for example I get this error for the "Hello" and "Note": error C2664: 'MessageBoxW' : cannot convert param...

What is the most reliable way of using GNUMake with filenames containing spaces?

I want to use GNUMake to run a rule-based makefile which builds a set of C files in a directory structure (on a Windows file system). The root directory, some sub-directories and some files contain spaces. Example file: "C:\Documents and Settings\<username>\My Documents\Test Dir\Build Me.c" GNUMake doesn't really work when the file pa...

windows equivalent of .netrc on unix?

Hi, On unix, we can specify the ftp username/password in ~/.netrc file and next time onwards,there is no need to specify username/password while ftping to any machine provided the credentials for that machine exists in ~/.netrc file. Its very helpful especially if you need to login to multiple machines may times lets say for monitoring...

Add or extend file system support under windows

I've seen that Mac Drive 7 adds HFS+ and HFS support to windows for both hard-drives and CDs, which includes handling problems like the mac partition format. Clearly that must mean that file system support in windows is extensible somehow, even if it is slow. So where could someone start to write a simple (or not) file system driver for ...

Calling MsiEnumRelatedProducts from C# is crashing

I'm having no end of trouble calling MsiEnumRelatedProducts from C#. I've tried a couple of variations on the p/invoke definition but no luck (out and ref). I think the problem is the last parameter, which is an LPTSTR that is supposed to point to a string 39 characters long. Here's the pinvoke and call: public static string EnumRelat...

The ideal background filesystem backup

I am thinking about a script/program that can run in background, and attempt to backup or synchronize a given filesystem path to a mirror location (probably located on an external/separate storage device). This should apply to Windows but it could as well be used under Linux. Differential/incremental backups are a bonus. Windows Syste...

COM method call returns Catastrophic Failure

Note: Pass BSTR variable to COM method, HRESULT return is 8000FFFF Previous calls with interface pointer, was successful: HRESULT is 0 Execution, inside Visual Studio succeeds, outside fails - release and debug Illustration: const char *simFile; simFile = new char; //omitted _bstr_t simFileToOpen(simFile); BSTR raw_sim_Open = simFil...

COM method call returns Catastrophic Failure when BSTR is passed

Revised from previous question Note: Pass BSTR variable to COM method, HRESULT return is 8000FFFF Previous calls with interface pointer, was successful: HRESULT is 0 Execution, inside Visual Studio succeeds, outside fails - release and debug Illustration: BSTR raw_sim_Open = SysAllocString (L"c:\\example.S8"); hresult = pis8->raw_...

How can I extract a full path from the PATH environment variable?

I want to extract a full path from the PATH environment variable with native cmd tools. Consider the following PATH content: C:\Program Files\Windows Resource Kits\Tools\;C:\Perl\site\bin;C:\Perl\bin;C:\WI NDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Program Files\Microsoft SQ L Server\90\Tools\binn\;C:\WINDOWS\system32\...

Path.Combine absolute with relative path strings

I'm trying to join a windows path with a relative path using Path.Combine However, Path.Combine(@"C:\blah\",@"..\bling") return "C:\blah..\bling" instead of "C:\bling\" Does anyone know how to accomplish this without writing my own relative path resolver (which shouldn't be too hard)? I know it seems stupid to ask for code to simple t...

Creating next/back windows in Visual C++

Hi all, What's the best way to create a set of windows like in installers where you can click next/back and move between screens. My idea is to define a class which holdes all the necessary 'current window' information, such as buttons, dialogue boxes and all that. And basically have the next/previous increment between displaying these...

Library for drawing musical notes

I'm looking for a Windows library that can draw musical notes on the screen in some way. I'm going to use it to write an app in C#, but a pure Win32-based solution is good enough. Does anybody know of any such library? Edit: I'm going to update the notes in real-time, and they need not look incredibly fancy. ...

Securely invoking commands with admin rights under Windows

I need to punctually invoque commands (net share, netsh...) requiring admin rights from a software launched by a user account. Under a Unix variant, I would install alongside my user mode software a small, cautiously written script bearing a suid bit and which would invoke the needed command(s). What is the equivalent best practice und...

What's a good way to uniquely identify a computer?

I'm developing some desktop software for a client to resell. The client wants to restrict the software so that the registration code will be specific to one and only one computer. Besides using the MAC from the network card, does anyone have any other techniques (that work on both Windows and Mac OS X) for uniquely identifying a comput...

Is there a way I can tell a process before it starts up or after it starts up which IP address to use on Windows?

I can program in C# so if there are any .NET classes available to reassigning IP addresses or if there is a command line operation for changing the IP address of a given process, that is what I think I'm looking for. I'm doing some automated browser testing and I want to have requests coming to my site from different IP addresses. My we...

Networking with C/C++ in a Windows enviroment

What is the best way to use sockets on the Windows platform? Basic sockets I guess, TCP/IP. Maybe for a chat client, or just for learning. Could someone give me an example of WININET usage? maybe ftpgetfile() ...

Where to store preferences under Windows in a networked application?

Where should I store preferences and setting if my goal is that my app should be runnable from a network share and the user's settings should persist regardless of the exact machine he is logged in on at the time? Similarly, where should I store application wide settings? The development environment in use is not .Net but can compile a...