PMWINX.LIB
PMWINX.LIB is the import library for the OS/2 Presentation Manager Win32 Extensions (PMWINX), distributed with the IBM OS/2 Developer's Toolkit. It provides the linker stubs for a comprehensive Win32 API compatibility layer that maps Win32 GDI, USER, KERNEL, and common-dialog functions onto the native OS/2 PM, GPI, and Dos subsystems.
File size in the OS/2 Warp 4.52 Toolkit 4.5: 61,440 bytes (2001-10-02). Source DLL: PMWINX.DLL.
PMWINX is IBM's PM-native Win32 compatibility layer for OS/2 Warp 4. It allows Win32 applications to be ported to OS/2 by providing over 600 Win32 API functions implemented on top of OS/2 system services — without requiring Windows binary compatibility; source code must be recompiled.
Architecture
PMWINX.DLL translates Win32 API calls to their OS/2 equivalents at runtime:
| Win32 source | OS/2 target |
|---|---|
| GDI32.DLL (drawing, bitmaps, fonts, regions) | GPI (Graphics Programming Interface) in PMGPI.DLL |
| USER32.DLL (windows, messages, dialogs, menus) | Presentation Manager windowing in PMWIN.DLL |
| KERNEL32.DLL (files, memory, threads, sync, registry) | Dos* and DosQuery* APIs in OS2386.LIB / DOSCALLS.DLL |
| COMDLG32.DLL (common dialogs) | PM standard dialogs |
| SHELL32.DLL (drag and drop) | WPS/PM shell integration |
In addition, PMWINX provides several OS/2-specific extension functions (prefixed Win or Awe) for bridging PM and Win32 concepts.
API Coverage
PMWINX.LIB exports over 600 public symbols organized into the functional groups below.
GDI — Drawing
Path drawing
The Win32 path model is fully implemented via GPI path objects:
BeginPath, EndPath, AbortPath, CloseFigure, FlattenPath, WidenPath, FillPath, StrokePath, StrokeAndFillPath, PathToRegion, GetPath
Geometric primitives
LineTo, MoveToEx, Arc, ArcTo, AngleArc, Chord, Ellipse, Rectangle, RoundRect, Polygon, Polyline, PolylineTo, PolyBezier, PolyBezierTo, PolyDraw, PolyPolygon, PolyPolyline, LineDDA, FloodFill, ExtFloodFill, FillRect, FrameRect, InvertRect
Regions
CombineRgn, CreateEllipticRgn, CreateEllipticRgnIndirect, CreatePolygonRgn, CreatePolyPolygonRgn, CreateRectRgn, CreateRectRgnIndirect, CreateRoundRectRgn, EqualRgn, FillRgn, FrameRgn, InvertRgn, PaintRgn, PtInRegion, RectInRegion, GetRegionData, GetRgnBox, OffsetRgn, ExtCreateRegion, SelectClipRgn, ExtSelectClipRgn, ExcludeClipRect, IntersectClipRect, OffsetClipRgn, GetClipRgn, GetClipBox
Bitmaps and pixels
BitBlt, StretchBlt, MaskBlt, PatBlt, StretchDIBits, SetDIBitsToDevice, CreateBitmap, CreateCompatibleBitmap, CreateDIBitmap, SetBitmapBits, GetBitmapBits, SetBitmapDimensionEx, GetBitmapDimensionEx, SetDIBits, GetDIBits, SetDIBColorTable, GetDIBColorTable, SetPixel, GetPixel, SetBoundsRect, GetBoundsRect
Device contexts
CreateCompatibleDC, CreateDC, CreateIC, DeleteDC, GetDC, GetDCEx, ReleaseDC, GetWindowDC, GetDCOrgEx, SaveDC, RestoreDC, ResetDC, GetCurrentObject, GetObjectType, GetObject, DeleteObject, SelectObject, UnrealizeObject, GetCurrentPositionEx, GetDeviceCaps, DeviceCapabilities
Pens and brushes
CreatePen, CreatePenIndirect, ExtCreatePen, CreateSolidBrush, CreateHatchBrush, CreatePatternBrush, CreateBrushIndirect, CreateDIBPatternBrushPt, GetBrushOrgEx, SetBrushOrgEx, GetStockObject
Fonts and text
CreateFont, CreateFontIndirect, AddFontResource, RemoveFontResource, EnumFonts, EnumFontFamilies, GetTextMetrics, GetOutlineTextMetrics, GetTextFace, GetTextExtentPoint, GetTextExtentPoint32, GetTabbedTextExtent, GetCharABCWidths, GetCharWidth, GetKerningPairs, GetRasterizerCaps, TextOut, ExtTextOut, TabbedTextOut, DrawText, GetTextAlign, SetTextAlign, GetTextColor, SetTextColor, GetBkColor, SetBkColor, GetBkMode, SetBkMode, GetTextCharacterExtra, SetTextCharacterExtra, SetTextJustification
Color and palettes
CreatePalette, SelectPalette, RealizePalette, ResizePalette, AnimatePalette, SetPaletteEntries, GetPaletteEntries, GetSystemPaletteEntries, GetNearestColor, GetNearestPaletteIndex, GetPriorityClipboardFormat, GetSysColor, SetSysColors
Mapping, transforms, and viewport
SetMapMode, GetMapMode, SetViewportExtEx, GetViewportExtEx, SetViewportOrgEx, GetViewportOrgEx, OffsetViewportOrgEx, ScaleViewportExtEx, SetWindowExtEx, GetWindowExtEx, SetWindowOrgEx, GetWindowOrgEx, OffsetWindowOrgEx, ScaleWindowExtEx, DPtoLP, LPtoDP, MapWindowPoints, GetWorldTransform, SetWorldTransform, ModifyWorldTransform, GetGraphicsMode, SetGraphicsMode
Metafiles
Enhanced metafile (EMF) and legacy WMF:
CreateEnhMetaFile, CloseEnhMetaFile, DeleteEnhMetaFile, CopyEnhMetaFile, PlayEnhMetaFile, PlayEnhMetaFileRecord, EnumEnhMetaFile, GetEnhMetaFile, GetEnhMetaFileBits, GetEnhMetaFileHeader, GetEnhMetaFilePaletteEntries, SetEnhMetaFileBits, GetWinMetaFileBits, SetWinMetaFileBits, CreateMetaFile, CloseMetaFile, DeleteMetaFile, CopyMetaFile, PlayMetaFile, PlayMetaFileRecord, EnumMetaFile, GetMetaFile, GetMetaFileBitsEx, SetMetaFileBitsEx
Miscellaneous GDI
GetAspectRatioFilterEx, GetArcDirection, SetArcDirection, GetMiterLimit, SetMiterLimit, GetPolyFillMode, SetPolyFillMode, GetROP2, SetROP2, GetStretchBltMode, SetStretchBltMode, GetMapperFlags, SetMapperFlags, EnumObjects, Escape, PtVisible, RectVisible
GDI — Printing
StartDoc, EndDoc, StartPage, EndPage, AbortDoc, SetAbortProc (via Escape), PrintDlg, EnumPrinters
USER32 — Windows
Window lifecycle
CreateWindowEx, DestroyWindow, ShowWindow, UpdateWindow, CloseWindow, MoveWindow, SetWindowPos, BeginDeferWindowPos, DeferWindowPos, EndDeferWindowPos, GetWindowRect, GetClientRect, AdjustWindowRect, AdjustWindowRectEx, GetWindowLong, SetWindowLong, GetWindowWord, SetWindowWord, GetWindowText, SetWindowText, GetWindowTextLength, GetWindowPlacement, SetWindowPlacement, GetWindowThreadProcessId, WindowFromDC, WindowFromPoint
Window state
EnableWindow, IsWindowEnabled, IsWindowVisible, IsIconic, IsZoomed, IsWindow, IsChild, BringWindowToTop, SetForegroundWindow, GetForegroundWindow, SetActiveWindow, GetActiveWindow, SetFocus, GetFocus, GetTopWindow, GetWindow, GetNextWindow, GetParent, SetParent, ChildWindowFromPoint, ArrangeIconicWindows, FlashWindow
Painting and invalidation
BeginPaint, EndPaint, InvalidateRect, InvalidateRgn, ValidateRect, ValidateRgn, RedrawWindow, GetUpdateRect, GetUpdateRgn, ExcludeUpdateRgn, LockWindowUpdate, DrawFocusRect, DrawIcon
Class registration
RegisterClass, UnregisterClass, GetClassInfo, GetClassName, GetClassLong, SetClassLong, GetClassWord, SetClassWord
Messages
GetMessage, PeekMessage, PostMessage, PostQuitMessage, PostThreadMessage, SendMessage, SendDlgItemMessage, DispatchMessage, TranslateMessage, ReplyMessage, WaitMessage, MsgWaitForMultipleObjects, GetMessagePos, GetMessageTime, GetMessageExtraInfo, GetQueueStatus, CallMsgFilter, CallWindowProc, DefWindowProc, InSendMessage
Dialogs
DialogBox, DialogBoxParam, CreateDialog, CreateDialogParam, EndDialog, DefDlgProc, IsDialogMessage, GetDlgItem, GetDlgCtrlID, GetDlgItemText, SetDlgItemText, GetDlgItemInt, SetDlgItemInt, GetDialogBaseUnits, MapDialogRect, CheckDlgButton, CheckRadioButton, IsDlgButtonChecked, GetNextDlgGroupItem, GetNextDlgTabItem, DlgDirList, DlgDirSelectEx, DlgDirListComboBox, DlgDirSelectComboBoxEx
Menus
CreateMenu, CreatePopupMenu, DestroyMenu, AppendMenu, InsertMenu, ModifyMenu, RemoveMenu, DeleteMenu, EnableMenuItem, CheckMenuItem, CheckRadioButton, HiliteMenuItem, SetMenuItemBitmaps, TrackPopupMenu, GetMenu, GetSubMenu, GetSystemMenu, GetMenuItemID, GetMenuItemCount, GetMenuString, GetMenuState, GetMenuCheckMarkDimensions, DrawMenuBar, SetMenu, IsMenu
Scrollbars
GetScrollPos, SetScrollPos, GetScrollRange, SetScrollRange, ShowScrollBar, EnableScrollBar, ScrollWindow, ScrollWindowEx, ScrollDC
Clipboard
OpenClipboard, CloseClipboard, EmptyClipboard, GetClipboardData, SetClipboardData, IsClipboardFormatAvailable, CountClipboardFormats, EnumClipboardFormats, GetClipboardFormatName, RegisterClipboardFormat, GetClipboardOwner, GetClipboardViewer, SetClipboardViewer, ChangeClipboardChain, OpenClipboardWindow (GetOpenClipboardWindow)
Caret
CreateCaret, DestroyCaret, ShowCaret, HideCaret, SetCaretPos, GetCaretPos, SetCaretBlinkTime, GetCaretBlinkTime
Cursor and mouse
LoadCursor, CreateCursor, DestroyCursor, CopyCursor, SetCursor, GetCursor, GetCursorPos, SetCursorPos, ClipCursor, GetClipCursor, ShowCursor, SwapMouseButton, GetDoubleClickTime, SetDoubleClickTime, GetCapture, SetCapture, ReleaseCapture
Keyboard and input
GetKeyState, GetKeyboardType, GetKeyNameText, MapVirtualKey, VkKeyScan, LoadAccelerators, CreateAcceleratorTable, DestroyAcceleratorTable, TranslateAccelerator, TranslateMDISysAccel, IsCharAlpha, IsCharAlphaNumeric, IsCharLower, IsCharUpper, CharUpper, CharUpperBuff, CharLower, CharLowerBuff, CharNext, CharPrev, CharToOem, OemToChar
Hooks
SetWindowsHookEx, UnhookWindowsHookEx, CallNextHookEx
Timers
SetTimer, KillTimer
Properties
GetProp, SetProp, RemoveProp, EnumProps, EnumPropsEx
MDI
CreateMDIWindow, DefMDIChildProc, DefFrameProc, TranslateMDISysAccel
Enumeration
EnumWindows, EnumChildWindows, EnumThreadWindows
Icons
LoadIcon, CreateIcon, CreateIconFromResource, DestroyIcon, CopyIcon, DrawIcon, GetIconInfo
Misc USER32
MessageBox, MessageBeep, Beep, SystemParametersInfo, GetSystemMetrics, GetDesktopWindow, GetLastActivePopup, ShowOwnedPopups, FindWindow, SetWindowsHookEx, RegisterWindowMessage, OutputDebugString, WinExec, WinHelp, GetWindowsDirectory, GetSystemDirectory
DDE — Dynamic Data Exchange
Complete DDEML (DDE Management Library) implementation:
DdeInitialize, DdeUninitialize, DdeConnect, DdeConnectList, DdeDisconnect, DdeDisconnectList, DdeReconnect, DdeCreateStringHandle, DdeFreeStringHandle, DdeKeepStringHandle, DdeQueryString, DdeCmpStringHandles, DdeCreateDataHandle, DdeAddData, DdeAccessData, DdeUnaccessData, DdeFreeDataHandle, DdeGetData, DdeClientTransaction, DdePostAdvise, DdeNameService, DdeGetLastError, DdeQueryConvInfo, DdeQueryNextServer, DdeSetUserHandle, DdeEnableCallback, PackDDElParam, UnpackDDElParam, FreeDDElParam, ReuseDDElParam
Common Dialogs (COMDLG32)
ChooseColor, ChooseFont, GetOpenFileName, GetSaveFileName, PrintDlg, FindText, ReplaceText, GetFileTitle, CommDlgExtendedError
Shell — Drag and Drop
DragAcceptFiles, DragFinish, DragQueryFile, DragQueryPoint
KERNEL32 — File I/O
CreateFile, DeleteFile, CopyFile, MoveFile, OpenFile, ReadFile, WriteFile, CloseHandle, SetFilePointer, SetEndOfFile, GetFileSize, GetFileTime, SetFileTime, GetFileType, GetFileAttributes, SetFileAttributes, GetFileInformationByHandle, LockFile, UnlockFile, FlushFileBuffers, SetStdHandle, GetStdHandle, FindFirstFile, FindNextFile, FindClose, GetFullPathName, GetTempFileName, GetTempPath, SearchPath, CreateDirectory, RemoveDirectory, GetCurrentDirectory, SetCurrentDirectory, GetDriveType, GetLogicalDrives, GetLogicalDriveStrings, GetDiskFreeSpace, GetVolumeInformation, SetVolumeLabel
KERNEL32 — Memory
HeapCreate, HeapDestroy, HeapAlloc, HeapFree, HeapReAlloc, GlobalAlloc, GlobalFree, GlobalLock, GlobalUnlock, GlobalReAlloc, GlobalSize, GlobalFlags, GlobalHandle, GlobalDiscard, GlobalMemoryStatus, LocalAlloc, LocalFree, LocalLock, LocalUnlock, LocalReAlloc, LocalSize, LocalFlags, LocalHandle, LocalDiscard, LocalFileTimeToFileTime, ZeroMemory, IsBadReadPtr, IsBadWritePtr, IsBadCodePtr, IsBadStringPtr, IsBadHugeReadPtr, IsBadHugeWritePtr, VirtualAlloc / VirtualFree (via AweHeapSize / heap), SizeofResource, FindResource, LoadResource, LockResource
KERNEL32 — Processes and Threads
CreateProcess, TerminateProcess, ExitProcess, GetCurrentProcess, GetCurrentProcessId, GetCommandLine, OpenProcess, DuplicateHandle, GetExitCodeProcess, GetPriorityClass, SetPriorityClass, GetModuleFileName, GetModuleHandle, LoadLibrary, FreeLibrary, LoadModule, GetProcAddress, CreateThread, TerminateThread, ExitThread, SuspendThread, ResumeThread, GetCurrentThread, GetCurrentThreadId, GetThreadPriority, SetThreadPriority, GetExitCodeThread, TlsAlloc, TlsFree, TlsGetValue, TlsSetValue, Sleep
KERNEL32 — Synchronization
CreateEvent, OpenEvent, SetEvent, ResetEvent, PulseEvent, CreateMutex, OpenMutex, ReleaseMutex, CreateSemaphore, OpenSemaphore, ReleaseSemaphore, WaitForSingleObject, WaitForMultipleObjects, MsgWaitForMultipleObjects, InitializeCriticalSection, DeleteCriticalSection, EnterCriticalSection, LeaveCriticalSection, InterlockedIncrement, InterlockedDecrement, InterlockedExchange
KERNEL32 — Time
GetSystemTime, SetSystemTime, GetLocalTime, SetLocalTime, GetTickCount, GetCurrentTime, SystemTimeToFileTime, FileTimeToSystemTime, FileTimeToDosDateTime, DosDateTimeToFileTime, LocalFileTimeToFileTime, FileTimeToLocalFileTime, CompareFileTime, SystemTimeToTzSpecificLocalTime, GetTimeZoneInformation, SetTimeZoneInformation, timeGetTime, timeGetSystemTime
KERNEL32 — Environment and System
GetEnvironmentStrings, GetEnvironmentVariable, SetEnvironmentVariable, GetACP, GetOEMCP, IsDBCSLeadByte, SetHandleCount, GetLastError, SetLastError, FatalAppExit, FatalExit, GetOverlappedResult, MulDiv, lstrcat, lstrcmp, lstrcmpi, lstrcpy, lstrlen, wsprintf, wvsprintf, OutputDebugString, WritePrivateProfileString, WriteProfileString, GetPrivateProfileInt, GetPrivateProfileString, GetProfileInt, GetProfileString
Registry (ADVAPI32)
RegCreateKey, RegCreateKeyEx, RegOpenKey, RegOpenKeyEx, RegCloseKey, RegDeleteKey, RegDeleteValue, RegQueryValue, RegQueryValueEx, RegSetValue, RegSetValueEx, RegEnumKey, RegEnumKeyEx, RegEnumValue, RegQueryInfoKey
The registry is mapped to OS/2's PrfQuery* / PrfWrite* profile (INI file) system.
Atoms
AddAtom, DeleteAtom, FindAtom, GetAtomName, InitAtomTable, GlobalAddAtom, GlobalDeleteAtom, GlobalFindAtom, GlobalGetAtomName
OS/2-Specific Extensions
PMWINX adds several OS/2-specific functions not present in the Windows Win32 API:
WinCallWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow)- Calls the application's
WinMainentry point from within the PMWINX message loop context. Replaces the standard C runtime startup for PMWINX-hosted applications.
WinQueryTranslateMode(hwnd)- Returns the current coordinate translation mode for a PMWINX window. Translation modes control how Win32 screen coordinates (top-left origin, Y downward) are mapped to PM coordinates (bottom-left origin, Y upward).
WinSetTranslateMode(hwnd, ulMode)- Sets the coordinate translation mode for a window.
WinTranslateDevicePoints(hwnd, pPoints, cPoints)- Translates an array of Win32 device-space points to OS/2 PM screen coordinates.
WinTranslateDeviceRects(hwnd, pRects, cRects)- Translates an array of Win32 RECT structures to OS/2 PM coordinates.
WinTranslateGraphicsObjectHandle(hwnd, hObj)- Converts a PMWINX GDI object handle (e.g. HPEN, HFONT) to the corresponding OS/2 GPI handle, allowing mixed Win32/GPI rendering in the same window.
WinTranslateMnemonicString(puniStr, pszOut)- Converts a Win32 menu string with
&accelerator markers (e.g."&File") to an OS/2 PM mnemonic string with~markers (e.g."~File").
AweHeapSize(ulSize)- Queries or sets the maximum heap size for the PMWINX address-window extension (AWE) heap allocator.
Usage
IBM VisualAge C++ / ILINK
icc -O2 -Gm -c myapp.c ilink /PM:PM myapp.obj os2386.lib pmwinx.lib
OpenWatcom (wlink)
wcl386 -bt=os2 -mf -c myapp.c wlink system os2_pm file myapp.obj library os2386.lib library pmwinx.lib
EMX/GCC
gcc -Zomf -c myapp.c gcc -Zomf -o myapp.exe myapp.o os2386.lib pmwinx.lib
Include files
| Header | Contents |
|---|---|
pmwinx.h |
Master PMWINX header: all Win32 API prototypes mapped to OS/2 calling convention; Win32 type definitions (HWND, HDC, HFONT, RECT, POINT, MSG, WNDCLASS, PAINTSTRUCT, etc.) as OS/2 typedefs; Win32 constant definitions (WM_*, WS_*, CS_*, IDC_*, IDI_*, MB_*, etc.).
|
windows.h |
Thin compatibility header including pmwinx.h. Allows Win32 source code that includes <windows.h> to compile with PMWINX with minimal changes.
|
Minimal PMWINX window
#include <windows.h> /* maps to pmwinx.h on OS/2 */
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
WPARAM wp, LPARAM lp)
{
switch (msg) {
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
TextOut(hdc, 10, 10, "Hello PMWINX", 12);
EndPaint(hwnd, &ps);
return 0;
}
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, msg, wp, lp);
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev,
LPSTR lpCmd, int nShow)
{
WNDCLASS wc = {0};
wc.lpfnWndProc = WndProc;
wc.hInstance = hInst;
wc.lpszClassName = "MyWin";
RegisterClass(&wc);
HWND hwnd = CreateWindowEx(0, "MyWin", "PMWINX Demo",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
400, 300,
NULL, NULL, hInst, NULL);
ShowWindow(hwnd, nShow);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}
Relationship to Other Compatibility Layers
| Product | Type | Source | Scope |
|---|---|---|---|
| PMWINX (this library) | Source-level porting aid | IBM OS/2 Toolkit | GDI32, USER32, KERNEL32, COMDLG32, DDE, SHELL32 (partial), ADVAPI32 (registry) |
| Odin | Binary Win32 compatibility | Open Source (OS2World) | Full PE binary execution; thunks real Windows DLLs; broader Win32 coverage including COM |
| Win-OS/2 (WinOS2) | 16-bit Windows 3.1 emulation | IBM (closed) | 16-bit Win16 API only; runs inside a VDM |
PMWINX is designed for source-level porting of Win32 applications to OS/2, not binary compatibility. Developers recompile their Win32 source code targeting OS/2 and link against PMWINX.LIB.
Version History
| Version | OS/2 release | Date | Notes |
|---|---|---|---|
| 1.0 | OS/2 Warp 4 | 1996 | Initial release. Core GDI, USER32 window/message/dialog/menu/clipboard, basic KERNEL32 file and memory, COMDLG32. Delivered as part of the Warp 4 Toolkit. |
| 2.0 | OS/2 Warp 4.x | 1997–1999 | Added DDE (complete DDEML), registry (ADVAPI32), world transforms, enhanced metafile (EMF), MDI, path drawing, drag and drop. |
| 2.x | OS/2 Warp 4.52 Developer's Toolkit 4.5 | 2001 | Final IBM release. Added WinTranslate* OS/2 extension functions, AweHeapSize, time zone support, additional thread and sync functions. File size: 61,440 bytes (2001-10-02).
|