Figure 1 Windows NT 4.0 Cryptography Functions
Context Functions
CryptAcquireContextA/W
CryptReleaseContext
CryptSetProvParam
CryptGetProvParam
CryptSetProviderA/W
Key Generation Functions
CryptGenKey
CryptDeriveKey
Data Encryption Functions
CryptEncrypt
CryptDecrypt
Key Exchange Functions
CryptDestroyKey
CryptSetKeyParam
CryptGetKeyParam
CryptExportKey
CryptImportKey
CryptGenRandom
CryptGetUserKey
Hashing and Signature Functions
CryptSetHashParam
CryptGetHashParam
CryptCreateHash
CryptHashData
CryptHashSessionKey
CryptGetHashValue
CryptDestroyHash
CryptSignHashA/W
CryptVerifySignatureA/W
Figure 2 New Windows NT 4.0 Shell Interfaces
IExtractIconA/W | ICommDlgBrowser |
IShellLinkA/W | IContextMenu2 |
ICopyHookA/W | IPersistFolder |
IFileViewerA/W | IShellIcon |
IShellView | IShellExecuteHookA/W |
IShellView2 | INewShortcutHookA/W |
IShellBrowser |
Figure 3 WSOCK32.DLL Forwarded Routines
Forwarded to WS2_32.DLL
accept
bind
closesocket
getpeername
getsockname
htonl
htons
ioctlsocket
listen
ntohl
ntohs
recv
recvfrom
select
send
sendto
shutdown
WSAAsyncSelect
WSAGetLastError
WSASetLastError
__WSAFDIsSet
Forwarded to MSWSOCK32.DLL
TransmitFile
AcceptEx
GetAcceptExSockaddrs
Figure 4 WinInet Functions
General-purpose WinInet Functions
InternetOpen
InternetConnect
InternetOpenUrl
InternetReadFile
InternetCloseHandle
InternetSetStatusCallback
InternetQueryOption
InternetSetOption
InternetFindNextFile (FTP and Gopher)
WinInet HTTP Functions
HttpOpenRequest
HttpAddRequestHeaders
HttpSendRequest
HttpQueryInfo
WinInet FTP Functions
FtpFindFirstFile
FtpGetFile
FtpPutFile
FtpDeleteFile
FtpRenameFile
FtpOpenFile
InternetWriteFile
FtpCreateDirectory
FtpRemoveDirectory
FtpSetCurrentDirectory
FtpGetCurrentDirectory
FtpCommand
InternetGetLastResponseInfo
WinInet Gopher Functions
GopherFindFirstFile
GopherOpenFile
GopherCreateLocator
GopherGetAttribute
Figure 5 HINTERNET Subtypes
INTERNET_HANDLE_TYPE_INTERNET | 1 |
INTERNET_HANDLE_TYPE_CONNECT_FTP | 2 |
INTERNET_HANDLE_TYPE_CONNECT_GOPHER | 3 |
INTERNET_HANDLE_TYPE_CONNECT_HTTP | 4 |
INTERNET_HANDLE_TYPE_FTP_FIND | 5 |
INTERNET_HANDLE_TYPE_FTP_FIND_HTML | 6 |
INTERNET_HANDLE_TYPE_FTP_FILE | 7 |
INTERNET_HANDLE_TYPE_FTP_FILE_HTML | 8 |
INTERNET_HANDLE_TYPE_GOPHER_FIND | 9 |
INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML | 10 |
INTERNET_HANDLE_TYPE_GOPHER_FILE | 11 |
INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML | 12 |
INTERNET_HANDLE_TYPE_HTTP_REQUEST | 13 |
Figure 6 IMAGEHLP Functions
Image integrity functions
ImageGetDigestStream
ImageAddCertificate
ImageRemoveCertificate
ImageEnumerateCertificates
ImageGetCertificateData
ImageGetCertificateHeader
Image modification functions
BindImage
BindImageEx
CheckSumMappedFile
MapFileAndCheckSum
ReBaseImage
RemovePrivateCvSymbolic
RemoveRelocations
SplitSymbols
UpdateDebugInfoFile
UpdateDebugInfoFileEx
TouchFileTimes
Image access functions
ImageLoad
ImageUnload
ImageNtHeader
ImageDirectoryEntryToData
ImageRvaToSection
ImageRvaToVa
MapAndLoad
GetImageConfigInformation
GetImageUnusedHeaderBytes
SetImageConfigInformation
UnMapAndLoad
FindExecutableImage
GetTimestampForLoadedLibrary
Symbol table functions
SymSetOptions
SymGetOptions
SymCleanup
SymEnumerateModules
SymEnumerateSymbols
EnumerateLoadedModules
SymFunctionTableAccess
SymGetModuleInfo
SymGetModuleBase
SymGetSymFromAddr
SymGetSymFromName
SymGetSymNext
SymGetSymPrev
SymInitialize
SymGetSearchPath
SymSetSearchPath
SymLoadModule
SymUnloadModule
SymUnDName
SymRegisterCallback
Debugger helper functions
StackWalk
FindDebugInfoFile
FindExecutableImage
MapDebugInformation
UnmapDebugInformation
UnDecorateSymbolName
Miscellaneous functions
ImagehlpApiVersion
ImagehlpApiVersionEx
SearchTreeForFile
MakeSureDirectoryPathExists
Figure A SETCURS.CPP
//======================================================
// SETCURS.EXE - Matt Pietrek 1996
// Microsoft Systems Journal, August 1996
// FILE: SETCURS.CPP
// To compile: CL SETCURS.CPP USER32.LIB
//======================================================
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#define ITERATIONS 5000
int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance,
PSTR lpszCmdLine, int nCmdShow )
{
HCURSOR hCursor;
hCursor = GetCursor();
// Bump up the thread's priority temporarily so that we don't get
// randomly interrupted.
SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
// We're going to cheat here, and use the support of 64 bit integers.
// With some typecasting, we can fool the compiler into believe that
// they're really LARGE_INTEGER structs.
unsigned __int64 beginTime64, endTime64, ticksPerSecond;
// Get the initial tick count
QueryPerformanceCounter( (LARGE_INTEGER *)&beginTime64 );
// The purpose of this program...
for ( unsigned i = 0; i < ITERATIONS; i++ )
{
SetCursor( hCursor );
}
// Get the final tick count
QueryPerformanceCounter( (LARGE_INTEGER *)&endTime64 );
// Be a good Win32 citizen and put the priority back.
SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_NORMAL );
DWORD ticks = (DWORD)(endTime64 - beginTime64) ;
// Find out how many ticks occur per second
QueryPerformanceFrequency( (LARGE_INTEGER *)&ticksPerSecond );
char szOutText[128];
// Spit out how many calls would be made in one second
wsprintf( szOutText, "%u calls/sec\n",
(DWORD)((ticksPerSecond / ticks) * ITERATIONS) );
MessageBox( 0, szOutText, "SETCURS", MB_OK );
return 0;
Figure B FIBER.CPP
//======================================================
// FIBER.EXE - Matt Pietrek 1996
// Microsoft Systems Journal, August 1996
// FILE: FIBER.CPP
// To compile: CL FIBER.CPP (must have NT 4.0 Win32 SDK)
//======================================================
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <stdio.h>
LPVOID lpFiber1; // Addresses of each fiber that's created
LPVOID lpFiber2;
LPVOID lpFiber3;
LPVOID lpFiberMain;
void WINAPI FiberRoutine( LPVOID param )
{
printf( "In fiber %u\n", param ); // Tell the world who we are
if ( 1 == (DWORD)param )
SwitchToFiber( lpFiber2 ); // fiber1 -> fiber2
else if ( 2 == (DWORD)param )
SwitchToFiber( lpFiber3 ); // fiber2 -> fiber3
else if ( 3 == (DWORD)param )
SwitchToFiber( lpFiberMain ); // fiber3->main fiber (original
// thread)
}
int main()
{
// Create 3 fibers, with starting addresses of the above routine
lpFiber1 = CreateFiber( 16384, FiberRoutine, (PVOID)1 );
lpFiber2 = CreateFiber( 16384, FiberRoutine, (PVOID)2 );
lpFiber3 = CreateFiber( 16384, FiberRoutine, (PVOID)3 );
if ( !lpFiber1 || !lpFiber2 || !lpFiber3 ) // Make sure the fibers were
return 0; // created
// Make this thread a fiber, so that it can force the other fibers to run
lpFiberMain = ConvertThreadToFiber( 0 );
// Sleep for 1 second, just to prove that the other
printf( "Sleeping for 1 second\n" );
Sleep( 1000 );
printf( "Switching to first fiber\n" );
SwitchToFiber( lpFiber1 ); // Switch to fiber1
printf( "Returning from SwitchToFiber\n" );
DeleteFiber( lpFiber1 ); // Clean up the 3 fibers we created earlier
DeleteFiber( lpFiber2 );
DeleteFiber( lpFiber3 );
return 0;
}