Showing results for November 2004 - Page 2 of 3 - The Old New Thing

Nov 17, 2004
0
0

Poking at diploma mills: Kennedy-Western University

Raymond Chen
Raymond Chen

I enjoy poking around diploma mills. Especially the ones that spam my inbox. Like Kennedy-Western University, which describes itself like so: Since 1984 Kennedy-Western University (KWU) has provided distance and online degree programs to over 30,000 students. KWU is one of the largest non-accredited online universities in the United States. ... ...

Non-Computer
Nov 17, 2004
0
0

How do I break an integer into its component bytes?

Raymond Chen
Raymond Chen

Warning: .NET content ahead. For some reason, this gets asked a lot. To break an integer into its component bytes, you can use the BitConverter.GetBytes method: int i = 123456; byte[] bytes = BitConverter.GetBytes(i); After this code fragment, the byte array contains { 0x40, 0xE2, 0x01, 0x00 }. Update 11am: The endian-ness of th...

Code
Nov 16, 2004
0
0

Exploiting the inattentive

Raymond Chen
Raymond Chen

The makers of a certain major brand of detergent which I will not name (but which for the purposes of this discussion will be called "Snide") appears to take every step to exploit inattentive customers. A box of Snide detergent powder comes with instructions indicating that for a normal-sized load, you should use 3/8 cup of detergent; for a large...

Non-ComputerExploiting the inattentive
Nov 16, 2004
0
0

What is this Xerox directory doing in Program Files?

Raymond Chen
Raymond Chen

If you go snooping around, you may find an empty directory. What's that for? This directory is being watched by Windows File Protection, because it needs to protect the file should it ever show up. (Why does the directory have to exist in order for Windows File Protection to be able to watch it? I'm told it's a limitation of the Windows File Pr...

Tips/Support
Nov 15, 2004
0
0

Asking questions where the answer is unreliable anyway

Raymond Chen
Raymond Chen

Here are some questions and then explanations why you can't do anything meaningful with the answer anyway even if you could get an answer in the first place. "How can I find out how many outstanding references there are to a shared memory object?" Even if there were a way to find out, the answer you get would be instantly wrong anyway because th...

Other
Nov 12, 2004
0
0

Will dragging a file result in a move or a copy?

Raymond Chen
Raymond Chen

Some people are confused by the seemingly random behavior when you drag a file. Do you get a move or a copy? And you're right to be confused because it's not obvious until you learn the secret. Mind you, this secret hasn't changed since 1989, but an old secret is still a secret just the same. (Worse: An old secret is a compatibility constraint.)...

Tips/Support
Nov 11, 2004
0
0

Advantages of knowing your x86 machine code

Raymond Chen
Raymond Chen

Next time you find yourself debugging in assembly language (which for some of us is the only way we debug), here are some machine code tricks you may wish to try out: 90 This is the single-byte NOP opcode. If you want to patch out code and don't want to think about it, just whack some 90's over it. To undo it, you have to patch the or...

Code
Nov 9, 2004
0
0

A history of GlobalLock, part 4: A peek at the implementation

Raymond Chen
Raymond Chen

On one of our internal discussion mailing lists, someone posted the following question: We have some code that was using DragQueryFile to extract file paths. The prototype for DragQueryFile appears as follows: UINT DragQueryFile( HDROP hDrop, UINT iFile, LPTSTR lpszFile, UINT cch ); In the code we have, instead of passing an ...

History
Nov 8, 2004
0
0

A history of GlobalLock, part 3: Transitioning to Win32

Raymond Chen
Raymond Chen

Now that you know how the 16-bit memory manager handled the global heap, it's time to see how this got transitioned to the new 32-bit world. The function continued to emulate all its previous moveability rules, but the return value of was no longer a selector since Win32 used the processor in "flat mode". This means that the old trick of ca...

History