Tuesday, February 28, 2012
Changing Drives on the Windows Command Prompt is Easier Now Apparently
Found out a new method of current-drive switching on the Windows Command Prompt today, just type the the drive letter and semicolon into the prompt. For example "X:" or "C:" etc. rather than using the "cd" command. This makes things a little easier especially when changing current-drive to a 'fake' drive as I sometimes forget to add the "/D" switch. (For those that don't know: "cd /D X:" is required to change drives the long-winded way).
Friday, January 13, 2012
Creating Virtual Drives on Windows
1. DOS subst Command (note: not persistent)
subst X: "C:\some_target_folder"
2. API-Call: DefineDosDevice (note: not persistent)
3. Through the Registry (note: persistent)
"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Dos Devices"
Add a String Value "X:" where X is the new virtual drive and set the value to: "\DosDevices\C:\some_target_folder"
Monday, August 1, 2011
Personal Programming Diversions/Digressions
1. Feature-itis: I keep dreaming up interesting features to add and get side-tracked from the important functional code I should be writing.
2. Semantics/Perfectionism: I get obsessed with finding the perfect names for my classes/functions/variables. I take style-guides to be almighty laws.
Friday, March 18, 2011
Simple Alert Function for Win32 System Error
#pragma comment(lib, "Kernel32.lib")
#pragma comment(lib, "User32.lib")
extern "C" __declspec(dllimport) unsigned long __stdcall GetLastError();
extern "C" __declspec(dllimport) void* __stdcall LocalFree(void*);
extern "C" __declspec(dllimport) unsigned long __stdcall FormatMessageA(unsigned long, void*, unsigned long, unsigned long, char**, unsigned long, void*);
extern "C" __declspec(dllimport) signed long __stdcall MessageBoxA(void*, char*, char*, signed long);
inline void alert(char* s) { MessageBoxA(0, s, "Alert", 0); }
inline void alertSystemError() {
unsigned long e = GetLastError();
if(e) {
enum {
FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200
};
char* s;
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
0,
e,
0,
&s,
0,
0);
LocalFree(s);
alert(s);
}
else { alert("No system error"); }
}
Simple Alert Function (Win32)
#pragma comment(lib, "User32.lib")
extern "C" __declspec(dllimport) int __stdcall MessageBoxA(void*, char*, char*, int);
inline void alert(char* s) { MessageBoxA(0, s, 0, 0); }
Displaing the £ sign on the DOS command line
DOS (Western Europe):
Which in UTF-8 is:
#9C // 0x9CWhich in UTF-8 is:
#A3 // 0xA3
Sunday, January 23, 2011
Windows 7 Starter edition comes with one desktop background, which can't be changed or customized.
http://windows.microsoft.com/en-US/windows7/Personalize-your-computer
One word: wow. MS doesn't want users to be able to change the background?!?
Saturday, January 2, 2010
format PE GUI
entry main
section '.code' code readable executable
_main:
push 0
push _message
push _caption
push 0
call [MessageBoxA]
push 0
call [ExitProcess]
ret
section '.data' data readable writeable
_caption db 'Simple Hello World Demo',0
_message db 'Hello World!',0
section '.idata' import data readable writeable
dd 0,0,0,RVA kernel_name,RVA kernel_table
dd 0,0,0,RVA user_name,RVA user_table
dd 0,0,0,0,0
kernel_table:
ExitProcess dd RVA _ExitProcess
dd 0
user_table:
MessageBoxA dd RVA _MessageBoxA
dd 0
kernel_name db 'Kernel32.dll',0
user_name db 'User32.dll',0
_ExitProcess dw 0
db 'ExitProcess',0
_MessageBoxA dw 0
db 'MessageBoxA',0
section '.reloc' fixups data readable discardable
Friday, January 1, 2010
Hello World!
Hello World!
Bonjour Monde!
Hallo Welt!
¡Hola Mundo!
Ciao Mondo!
Здравствулте! мир!
First post!
Bonjour Monde!
Hallo Welt!
¡Hola Mundo!
Ciao Mondo!
Здравствулте! мир!
First post!
Subscribe to:
Posts (Atom)
