|
|
Browse by Tags
All Tags » Code
Showing page 1 of 22 (218 total posts)
-
Many of the normal interlocked operations
come with variants called
InterlockedXxxAcquire and InterlockedXxxRelease.
What do the terms Acquire and
Release mean here?
They have to do with the memory model and how aggressively
the CPU can reorder operations around it.
An operation with acquire semantics is one which does not
permit subsequent ...
-
Each component that uses ACLs to control access
has its own idea of what
GENERIC_READ,
GENERIC_WRITE, and
GENERIC_EXECUTE mean.
It's not like
there's a master list
that somebody can make that lists them all,
because I can make up a new one right here.
Watch me:
#define GIZMO_QUERY_STATUS 0x0001
#define GIZMO_QUERY_MEMBERS 0x0002
#define ...
-
The command interpreter cmd.exe has a concept
known as the error level,
which is the exit code of the program most recently run.
You can test the error level with the
IF ERRORLEVEL command:
IF ERRORLEVEL 1 ECHO error level is 1 or more
<sidebar>
The IF ERRORLEVEL n test succeeds
if the error level is n or more.
This was presumably ...
-
Now, it may very well be true that many people who
use
GetForegroundWindow()
as the owner for a dialog box
because they don't know any better,
but I'm not convinced that everyone who does so did it out of ignorance;
I'm sure there's some malice in there, too.
Here's how it may have gone down:
Bug: I start the product setup, and then I go ...
-
Last time, we looked at a customer who wanted to know how to tell
whether a given folder was a Recycle Bin folder or not.
We answered the question as stated,
but made the mistake of not looking
at the problem the customer was trying to solve.
I need to know which folders are Recycle Bin folders so I can
skip over them when searching the drive ...
-
Here's a question inspired by an actual customer question:
I need a function that, given a path, tells me whether it is
a Recycle Bin folder.
I tried using functions like SHGetSpecialFolderPath
with CSIDL_BITBUCKET, but that doesn't work because
the Recycle Bin is a virtual folder that is the union of the
Recycle Bins of all drives.
The ...
-
The WM_SETFONT message tells a control which font
you would like the control to use for its text.
This message is a convention, not a rule.
For example, our
scratch program
doesn't pay attention to the
WM_SETFONT message.
If somebody sends it a WM_SETFONT,
nothing happens.
The scratch program just ignores the caller and
uses whatever font it ...
-
For the same reason that
not all error codes are defined in
winerror.h,
not all error strings are defined in the system message table.
If you've ever played with the message compiler,
you'd quickly have recognized the winerror.h file
as the header file associated with a message resource.
In other words,
there's a .mc file that gets processed
by ...
-
Last time, we saw how
those extra bits can be used to multiplex HANDLE
with other values.
That was a specific case of a more general scenario:
Expanding the handle namespace to include things that aren't handles.
(You can also view today's example as a generalization of the
sentinel value problem,
where we need to generate an arbitrary number ...
-
Last time, we saw how
those extra bits can be used to develop safe sentinel values.
That is a special case of a more general problem:
How do you pack 33 bits of information into
a 32-bit value?
Whereas last time, we weren't forced into the use of a sentinel value
because we could develop a (cumbersome) helper class and switch
people over to ...
1 ...
|
|
|