Differences in Win32 API Implementations Among Windows Operating Systems

Noel Nyman

Created: October 10, 1996
Revised: December 12, 1996

Windows API Implementations

The Microsoft® Windows® platform continues to evolve, responding to new developments in hardware and software technologies. Microsoft offers two mainstream, modern 32-bit desktop operating systems: Windows NT® Workstation version 4.0 and Microsoft Windows 95.

Microsoft Windows 95 OEM Service Release 2 (OSR 2), an update to Microsoft Windows 95, adds support for new and emerging hardware. This release includes updates to Windows 95 that have previously been available separately. Most computer manufacturers who pre-installed Windows 95 on new PCs began using OSR 2 in the fourth quarter of 1996. Many components of OSR 2 are available for download from Microsoft at http://www.microsoft.com/windows/.

Windows 95, Windows 95 OSR 2, and Windows NT use the same Win32® application programming interface (API). However, Windows 95 and Windows NT are different operating systems with different capabilities. OSR 2 adds functionality to Windows 95. Each operating system uses technology that is not present in the other. As a result, some of the functions of the Win32 API may require different parameters or calling conventions on each platform. Other functions are not implemented on all platforms. This white paper describes Win32 API differences among the platforms, allowing developers to make appropriate design decisions and create applications that make effective use of the functionality available on Windows platforms.

Overview

Microsoft Windows 95, Windows 95 OSR 2, and Windows NT 4.0 are all 32-bit operating systems that use the same Win32 API. Although the API has changed and expanded to encompass new features, programs will, in most cases, work without modification on all three operating systems. For more information on the API, see "Introduction to the Win32 Application Programming Interface" (MSDN Library Archive, Backgrounders).

There are some differences between Windows 95, Windows 95 OSR 2, and Windows NT 4.0 that applications must accommodate to run successfully on two or more of those platforms. This white paper discusses several categories of those differences:

Windows 95–Specific APIs

Independent Color Matching

The following API functions are not supported in Windows NT 4.0:

CheckColorsInGamut ColorMatchToTarget
CreateColorSpace DeleteColorSpace
EnumICMProfiles FreeImageColorMatcher
GetColorSpace GetDeviceGammaRamp
GetICMProfile GetLogColorSpace
LoadImageColorMatcher SetColorSpace
SetDeviceGammaRamp SetICMMode
SetICMProfile UpdateICMRegKey

Plug and Play

Plug and Play is not supported on Windows NT 4.0. Microsoft has committed to providing this functionality with the next major release of Windows NT Workstation. The ICOPEN.dnDevNode structure is not supported in Windows NT 4.0.

RT_PLUGPLAY is not supported in Windows NT 4.0 as a resource type for these API functions.

EnumResLangProc EnumResNameProc
EnumResTypeProc EnumResourceLanguages
EnumResourceNames

Flat Thunks

Windows NT 4.0 and Windows 95 use different thunking models. Windows NT 4.0 supports generic thunks that allow 16-bit code to call functions implemented in 32-bit code. Although Windows 95 supports generic thunks, it does not support the underlying process model used by Windows NT 4.0. This means that generic thunking code might not work identically under Windows 95 and Windows NT 4.0. For more information on thunking and Windows 95, see "Thunk Compiler" (MSDN Library, Platform SDK).

Windows 95 implements its own thunking model, called flat thunks. Flat thunks allow 32-bit code to call functions implemented in 16-bit code. They also allow 16-bit code to call functions implemented in 32-bit code. However, applications that use flat thunks cannot run on Windows NT 4.0 unless the thunking code is isolated into platform-specific DLLs.

Pen API for Windows

The Pen API is not supported in Windows NT 4.0.

Windows 95 OSR 2–Specific APIs

FAT32 File System

Windows 95 OSR 2 incorporates the FAT32 file system. FAT32 is an enhancement of the file allocation table (FAT) file system. FAT32 supports large drives with improved disk space efficiency.

General-purpose applications are fully compatible with FAT32, and most Win32 applications do not need to be revised for FAT32. Only applications that use low-level disk structures, or in other ways depend on the on-disk format of data, will need revision. For more information, see "FAT32 File System" (MSDN Library, Platform SDK).

GetDiskFreeSpaceEx

In Windows 95, the existing Win32 function GetDiskFreeSpace may obtain incorrect values for volumes that are larger than 2 gigabytes (GB). In OSR 2, the function GetDiskFreeSpace has been modified to cap the value returned and never reports volume sizes greater than 2 GB. On very large empty volumes, existing applications will see only 2 GB free. If less than 2 GB are free, the correct amount will be returned. For more information, see "GetDiskFreeSpace" (MSDN Library, Platform SDK).

Windows 95 OSR 2 and Windows NT 4.0 support the GetDiskFreeSpaceEx function. GetDiskFreeSpaceEx obtains correct values on all platforms for all volumes, including those that are larger than 2 GB. New applications should use the GetDiskFreeSpaceEx function instead of the GetDiskFreeSpace function.

Applications that need to maintain backward compatibility with earlier Win32 implementations should be prepared to fall back to the GetDiskFreeSpace function.

Windows 95 OSR 2– and Windows NT 4.0–Specific APIs

Detecting OSR 2

You can use the GetVersionEx function (available on all Win32 platforms) to determine that a system is running Windows 95 OSR 2 or a later release of the Windows 95 operating system.

The GetVersionEx function fills in the members of an OSVERSIONINFO data structure. If the dwPlatformId member of that structure is VER_PLATFORM_WIN32_WINDOWS, and the low word of the dwBuildNumber member is “1111,” the system is Windows 95 OSR 2. For Windows 95 and Windows 95 OSR 2, the dwMajorVersion element returns "4" and dwMinorVersion returns "0." Future versions or OSRs of Windows 95 will have higher build numbers. They may also have higher major/minor version numbers.

MS-DOS applications can check for an MS-DOS version number of 7.1 or higher to determine whether a system is running either Windows 95 OSR 2 or a later release of Windows 95.

Using Windows 95 OSR 2 Functionality

Some Windows 95 OSR 2 functions can be called directly. For others, you need to call the LoadLibrary or LoadLibraryEx function to load the appropriate .dll file and then call the GetProcAddress function to obtain an address for the function.

Applications that attempt to use Windows 95 OSR 2 functionality should be prepared to fall back to earlier Windows 95 functionality.

Redistributable APIs with Windows 95

Imagehlp

Imagehlp API functions provide access to portable executable (PE) images. Imagehlp is a built-in component of the Windows NT 4.0 operating system. Imagehlp is supported on Windows 95 by shipping Imagehlp.dll as a redistributable file. For more information, see "Portable Executable File Manipulation" and other articles by querying on “Imagehlp” in the Platform SDK documentation located in the MSDN Library.

OpenGL

OpenGL is a built-in component of Windows NT 4.0 and Windows 95 OSR 2. OpenGL is supported on Windows 95 by shipping it as a redistributable component.

Direct3D

DirectDraw®, DirectPlay®, DirectSound®, DirectInput™, and Direct3D™ are provided as redistributable dynamic-link libraries (DLLs) for Windows 95. DirectDraw, DirectPlay, DirectSound, and DirectInput are built-in components of OSR 2 and Windows NT 4.0. Direct 3D is not available for Windows NT 4.0.

Applications may prefer to use the redistributable components on all platforms to guarantee compatibility.

Functionality Windows 95 and OSR 2 Windows 95 OSR 2 Windows NT 4.0
DirectDraw Provided as redistributable Built into operating system Built into operating system
DirectPlay Provided as redistributable Built into operating system Built into operating system
DirectSound Provided as redistributable Built into operating system Built into operating system, runs in emulation mode only
DirectInput Provided as redistributable Built into operating system Built into operating system
Direct3D Provided as redistributable Built into operating system Not available

Cryptographic API

Windows 95 OSR 2 and Windows NT 4.0 support the Cryptographic Application Programming Interface (CryptoAPI), a set of functions allowing applications to encrypt or digitally sign data in a flexible manner, while providing protection for the user's sensitive private key data. The CryptoAPI is also available on Windows 95 if Internet Explorer 3.0 is installed. An application can provide the CryptoAPI on Windows 95 by installing Internet Explorer 3.0 as an add-on.

APIs with Different Implementations on Windows 95 and Windows NT 4.0

Unicode

On Windows NT 4.0, all functions that accept strings as parameters have both an American National Standards Institute (ANSI) and a wide-character version. The functions are postfixed by "A" and "W." For example, TextOutA accepts an ANSI string and TextOutW accepts a Unicode (wide) string. The wide-character versions of most Win32 API functions are generally not supported on Windows 95.

The following functions are exceptions that are supported on both Windows NT 4.0 and Windows 95:

MultiByteToWideChar WideCharToMultiByte
EnumResourceLanguages EnumResourceNames
EnumResourceTypes ExtTextOut
FindResource FindResourceEx
GetCharWidth GetCommandLine
GetTextExtentExPoint GetTextExtentPoint32
GetTextExtentPoint lstrlen
MessageBoxEx MessageBox
TextOut

Security Attributes

Some API functions require a pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. Calls from Windows NT 4.0 use the lpSecurityDescriptor member of the structure to specify a security descriptor. Windows 95 ignores the lpSecurityDescriptor member of the structure. The following functions take a SECURITY_ATTRIBUTES structure pointer:

CreateConsoleScreenBuffer CreateDirectory
CreateDirectoryEx CreateEvent
CreateFile CreateFileMapping
CreateMailslot CreateMutex
CreatePipe CreateProcess
CreateSemaphore CreateThread

TAPI

The Telephony API (TAPI) version 1.4 is supported on Windows 95 and Windows 95 OSR 2. TAPI version 2.0 is a built-in component of Windows NT 4.0 and will be available soon as an add-on for Windows 95. See "What's New for TAPI Version 2.0" (MSDN Library, Platform SDK) for information on TAPI features new to version 2.0.

Different Parameters

The following functions either require different parameters when called on Windows 95 and Windows NT 4.0, return different information, or return similar information in different ways. A few functions ignore parameters on one platform that are required on the other. Developers should review the Platform SDK descriptions for any functions on this list that they use in Windows 95 or Windows NT 4.0 applications.

ActivateKeyboardLayout AddPrinter Arc
Beep BeginPath BroadcastSystemMessage
ChangeMenu CharLower CharLowerBuff
CharUpper CharUpperBuff CreateDC
CreateDialogIndirect CreateDialogIndirectParam CreateFont
DebugActiveProcess DialogBoxIndirect DlgDirListComboBox
DrawIcon EditWordBreakProc EndPage
EnumFontFamExProc EnumPrinters ExitWindows
ExitWindowsEx ExtCreatePen FindFirstFile
FlushFileBuffers GetAsyncKeyState GetAsyncKeyState
GetClipboardData GetConsoleCP GetConsoleOutputCP
GetCurrentHwProfile GetDIBits GetFileAttributes
GetGraphicsMode GetGraphicsMode GetPrinter
GetPrivateProfileSection GetPrivateProfileString GetProcessAffinityMask
GetProfileSection GetProfileString GetStockObject
LoadImage LoadKeyboardLayout LoadLibrary
LoadLibraryEx LoadModule MapViewOfFile
MapViewOfFileEx MessageBoxIndirect mouse_event
MoveFileEx NetServerEnum OpenFile
OpenFileMapping RasCreatePhonebookEntry RasDial
RasEditPhonebookEntry RasEnumEntries RasGetEntryDialParams
RasGetProjectionInfo RasSetEntryDialParams ReadFile
ReadFileEx RegCreateKeyEx RegDeleteKey
RegisterClassEx RegLoadKey RegQueryInfoKey
RegReplaceKey RegSaveKey RegSaveKey
SearchPath SetBrushOrgEx SetClipboardData
SetComputerName SetFileAttributes SetGraphicsMode
SetJob SetLocalTime SetPrinter
SetSystemTime SetThreadAffinityMask ShellProc
StartDocPrinter StartPage SystemParametersInfo
SystemTimeToTzSpecificLocalTime UnloadKeyboardLayout UnmapViewOfFile
WriteFile WriteFileEx

Windows NT 4.0–Specific APIs

Unicode

On Windows NT 4.0, all functions that accept strings as parameters have both an ANSI and a wide-character version. The functions are postfixed by "A" and "W." For example, TextOutA accepts an ANSI string and TextOutW accepts a Unicode (wide) string. The wide-character versions of most Win32 API functions are generally not supported on Windows 95. For a list of API string functions that are supported in the same way on both Windows NT 4.0 and Windows 95, see the preceding "Unicode" section under "APIs with Different Implementations on Windows 95 and Windows NT 4.0."

Security

The following Windows NT 4.0 security API functions are not supported on Windows 95 nor on Windows 95 OSR 2:

AccessCheck AccessCheckAndAuditAlarm AddAccessAllowedAce
AddAccessDeniedAce AddAce AddAuditAccessAce
AdjustTokenGroups AdjustTokenPrivileges AllocateAndInitializeSid
AllocateLocallyUniqueId AreAllAccessesGranted AreAnyAccessesGranted
CopySid CreatePrivateObjectSecurity DdeImpersonateClient
DeleteAce DestroyPrivateObjectSecurity DuplicateToken
EqualPrefixSid EqualSid FindFirstFreeAce
FreeSid GetAce GetAclInformation
GetFileSecurity GetKernelObjectSecurity GetLengthSid
GetPrivateObjectSecurity GetProcessWindowStation GetSecurityDescriptorControl
GetSecurityDescriptorDacl GetSecurityDescriptorGroup GetSecurityDescriptorLength
GetSecurityDescriptorOwner GetSecurityDescriptorSacl GetSidIdentifierAuthority
GetSidLengthRequired GetSidSubAuthority GetSidSubAuthorityCount
GetTokenInformation GetUserObjectSecurity ImpersonateNamedPipeClient
ImpersonateSelf InitializeAcl InitializeSecurityDescriptor
InitializeSid IsValidAcl IsValidSecurityDescriptor
IsValidSid LookupAccountName LookupAccountSid
LookupPrivilegeDisplayName LookupPrivilegeName LookupPrivilegeValue
MakeAbsoluteSD MakeSelfRelativeSD MapGenericMask
ObjectCloseAuditAlarm ObjectOpenAuditAlarm ObjectPrivilegeAuditAlarm
OpenProcessToken OpenThreadToken PrivilegeCheck
PrivilegedServiceAuditAlarm RevertToSelf SetAclInformation
SetFileSecurity SetKernelObjectSecurity SetPrivateObjectSecurity
SetSecurityDescriptorDacl SetSecurityDescriptorGroup SetSecurityDescriptorOwner
SetSecurityDescriptorSacl SetThreadToken SetTokenInformation
SetUserObjectSecurity

Event Logging

The following event logging API functions are not supported on Windows 95 nor on Windows 95 OSR 2:

BackupEventLog ClearEventLog
CloseEventLog DeregisterEventSource
GetNumberOfEventLogRecords GetOldestEventLogRecord
NotifyChangeEventLog OpenBackupEventLog
OpenEventLog ReadEventLog
RegisterEventSource ReportEvent

Service Control Manager

The following service control manager API functions are not supported on Windows 95 nor on Windows 95 OSR 2:

ChangeServiceConfig CloseServiceHandle
ControlService CreateService
DeleteService EnumDependentServices
EnumServicesStatus GetServiceDisplayName
GetServiceKeyName LockServiceDatabase
NotifyBootConfigStatus OpenSCManager
OpenService QueryServiceConfig
QueryServiceLockStatus QueryServiceObjectSecurity
QueryServiceStatus RegisterServiceCtrlHandler
ServiceMain SetServiceBits
SetServiceObjectSecurity SetServiceStatus
StartService StartServiceCtrlDispatcher
UnlockServiceDatabase

Multiple Desktops

The following multiple desktops API functions are not supported on Windows 95 nor on Windows 95 OSR 2:

CloseDesktop CreateDesktop
Create WindowStation EnumDesktops
EnumDesktopWindows OpenDesktop
OpenInputDesktop SwitchDesktop
GetDesktopWindow GetThreadDesktop
SetThreadDesktop

Server-Side Named Pipes

Server-side named pipes are not supported on Windows 95 nor on Windows 95 OSR 2. Client-side named pipes are supported on Windows 95, Windows 95 OSR 2, and Windows NT 4.0.

Server-Oriented Sockets

Server-oriented socket calls are not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

AcceptEx
GetAcceptExSockaddrs
TransmitFile

Dynamic PE Updating

Dynamic updating of the resources in portable executable (PE) files is not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

BeginUpdateResource
EndUpdateResource
UpdateResource

I/O Completion Ports

I/O completion ports are not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

CreateIoCompletionPort
GetQueuedCompletionStatus
PostQueuedCompletionStatus

World Transforms

Certain world-transform functions are not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

CombineTransform
GetWorldTransform
ModifyWorldTransform
SetWorldTransform

Advanced Blt Functions

Certain advanced Blt functions are not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

MaskBlt
PlgBlt

Printer Forms

Printer forms print-spooler functions are not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

AddForm
DeleteForm
EnumForms
GetForm
SetForm

Printer Change Notification

Printer change notification print-spooler functions are not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

FindClosePrinterChangeNotification
FindFirstPrinterChangeNotification
FindNextPrinterChangeNotification
WaitForPrinterChange

WinSpool Functions

The following WinSpool functions are not supported on Windows 95 nor on Windows 95 OSR 2.

PrinterMessageBox
ResetPrinter

Fibers

Fiber functions are not supported on Windows 95 nor on Windows 95 OSR 2. The following functions are not supported:

ConvertThreadToFiber
CreateFiber
DeleteFiber
GetCurrentFiber
GetFiberData
SwitchToFiber

32-Bit LAN Manager

The Windows NT 32-bit LAN Manager Unicode functions exported from Netapi32.dll are not supported on Windows 95 nor on Windows 95 OSR 2. Windows 95 supports a subset of LAN Manager ANSI string functions exported from Svrapi.dll. For more information, see Knowledge Base article number Q125700, titled "Windows 95 Support for Net Function Calls” (MSDN Library).

The following functions are not supported (the bold functions have ANSI string Windows 95 equivalents exported from Svrapi.dll):

MultinetGetConnectionPerformance NetAlertRaise NetAlertRaiseEx
NetApiBufferAllocate NetApiBufferFree NetApiBufferReallocate
NetApiBufferSize NetFileEnum NetFileGetInfo
NetGetAnyDCName NetGetDCName NetGetDisplayInformationIndex
NetQueryDisplayInformation NetGroupAdd NetGroupAddUser
NetGroupDel NetGroupDelUser NetGroupEnum
NetGroupGetInfo NetGroupGetUsers NetGroupSetInfo
NetGroupSetUsers NetHandleGetInfo NetHandleSetInfo
NetLocalGroupAdd NetLocalGroupAddMembers NetLocalGroupDel
NetLocalGroupDelMembers NetLocalGroupEnum NetLocalGroupGetInfo
NetLocalGroupGetMembers NetLocalGroupSetInfo NetLocalGroupSetMembers
NetMessageBufferSend NetMessageNameAdd NetMessageNameDel
NetMessageNameEnum NetMessageNameGetInfo NetRemoteTOD
NetReplExportDirAdd NetReplExportDirDel NetReplExportDirEnum
NetReplExportDirGetInfo NetReplExportDirLock NetReplExportDirSetInfo
NetReplExportDirUnlock NetReplGetInfo NetReplImportDirAdd
NetReplImportDirDel NetReplImportDirEnum NetReplImportDirGetInfo
NetReplImportDirLock NetReplImportDirUnlock NetReplSetInfo
NetScheduleJobAdd NetScheduleJobDel NetScheduleJobEnum
NetScheduleJobGetInfo NetServerDiskEnum NetServerEnum
NetServerGetInfo NetServerSetInfo NetServerTransportAdd
NetServerTransportDel NetServerTransportEnum NetSessionDel
NetSessionEnum NetSessionGetInfo NetShareAdd
NetShareCheck NetShareDel NetShareGetInfo
NetShareSetInfo NetStatisticsGet2 NetUserAdd
NetUserChangePassword NetUserDel NetUserEnum
NetUserGetGroups NetUserGetInfo NetUserGetLocalGroups
NetUserSetGroups NetUserSetInfo NetUserModalsGet
NetUserModalsSet NetWkstaGetInfo NetWkstaSetInfo
NetWkstaTransportAdd NetWkstaTransportDel NetWkstaTransportEnum
NetWkstaUserGetInfo NetWkstaUserSetInfo NetWkstaUserEnum

GDI

The following GDI functions are not supported on Windows 95 nor on Windows 95 OSR 2:

AngleArc
ArcTo

CancelDC

The CancelDC function is not supported on Windows 95 nor on Windows 95 OSR 2.

Summary

This white paper has discussed some of the API differences between the three Windows 32-bit operating systems. Microsoft continues to publish additional information to help application developers take advantage of the latest functionality provided by the Windows family of operating systems. Updated information is made available through MSDN and on the Internet at http://www.microsoft.com/.

Additional Resources

Related information can be found in the following resources: