A clean, modern reimplementation of Silkroad Online's GFXFileManager.dll — the
native file‑manager module the game client loads to read its PK2 archives — extended
with a full PK2 toolkit API for building, extracting, encrypting and patching
archives from your own tools.
Silkroad Online stores all of its game data (models, textures, maps, text tables, …)
inside encrypted PK2 archives. The retail client delegates all archive access to a
DLL named GFXFileManager.dll through a small COM‑style factory interface.
This project provides a from‑source, drop‑in compatible GFXFileManager.dll that:
- implements the classic client interface (
GFXDllCreateObject/GFXDllReleaseObject/GFXFMInfo); - bundles a self‑contained Blowfish + PK2 reader/writer engine (no external dependencies);
- exposes an additional wide‑char native API (
PK2Tools_*W) so external utilities can list, build, extract, (de)encrypt and inject content into PK2 archives, with progress callbacks.
It builds cleanly under the latest C and C++ language standards with full
conformance mode (/permissive-) and ships as a single, anonymous GFXFileManager.dll
(no debug symbols, no embedded build paths — see Privacy).
- ✅ Drop‑in client DLL — same exports and calling convention the retail client expects.
- ✅ Standalone PK2 engine — Blowfish encryption, reader and writer, no third‑party libs.
- ✅ Toolkit API — list / build / extract / crypt / import, all Unicode (
wchar_t). - ✅ Progress callbacks — per‑mille progress reporting for long operations.
- ✅ Modern build — C++/C latest,
/permissive-, MSVC preview toolset, Release/Win32. - ✅ Privacy‑clean output — no PDB, no usernames, no machine paths inside the DLL.
| Export | Convention | Description |
|---|---|---|
GFXDllCreateObject |
__stdcall |
Creates the file‑manager object the client talks to. |
GFXDllReleaseObject |
__stdcall |
Releases a previously created object. |
GFXFMInfo |
__stdcall |
Returns runtime information about open containers. |
All toolkit functions are extern "C" __stdcall, return 0 on success (non‑zero on error),
and write a human‑readable message into errorBuffer (up to errorChars wide chars) on failure.
// Progress callback: percent is 0..1000 (per-mille). Return non-zero to cancel.
typedef int (__stdcall *PK2ToolsProgressCallback)(int percent, const wchar_t *status, void *userdata);
int __stdcall PK2Tools_SetBlowfishKeyW(const wchar_t *key,
wchar_t *errorBuffer, int errorChars);
int __stdcall PK2Tools_ListPk2W(const wchar_t *pk2File, const wchar_t *listFile,
wchar_t *errorBuffer, int errorChars);
int __stdcall PK2Tools_BuildPk2W(const wchar_t *sourceFolder, const wchar_t *outputPk2,
int encryptEntries, int encryptPayloads,
PK2ToolsProgressCallback callback, void *userdata,
wchar_t *errorBuffer, int errorChars);
int __stdcall PK2Tools_CryptPk2W(const wchar_t *pk2File, int encryptPayloads,
PK2ToolsProgressCallback callback, void *userdata,
wchar_t *errorBuffer, int errorChars);
int __stdcall PK2Tools_ImportFolderW(const wchar_t *pk2File, const wchar_t *sourceFolder,
const wchar_t *internalFolder, int encryptPayloads,
PK2ToolsProgressCallback callback, void *userdata,
wchar_t *errorBuffer, int errorChars);
int __stdcall PK2Tools_ExtractPk2W(const wchar_t *pk2File, const wchar_t *outputFolder,
const wchar_t *selectionFile, int extractAll, int rawOutput,
PK2ToolsProgressCallback callback, void *userdata,
wchar_t *errorBuffer, int errorChars);| Export | Purpose |
|---|---|
PK2Tools_SetBlowfishKeyW |
Set the Blowfish key used to (de)crypt archive entries. |
PK2Tools_ListPk2W |
Write the full entry listing of a PK2 to a text file. |
PK2Tools_BuildPk2W |
Build a new PK2 archive from a source folder. |
PK2Tools_CryptPk2W |
Encrypt or decrypt the payloads of an existing PK2. |
PK2Tools_ImportFolderW |
Inject a folder into an existing PK2 at a given internal path. |
PK2Tools_ExtractPk2W |
Extract all (or a selection of) files from a PK2. |
- Windows 10 / 11
- Visual Studio 2026 (Professional/Community) with the Desktop development with C++ workload
- Platform toolset
v145and the Windows 11 SDK (10.0.x) - Target architecture: Win32 (x86) — Silkroad is a 32‑bit client
The project uses the C/C++ latest language standard and the MSVC preview toolset. Enable "Use the latest MSVC build tools preview" in Visual Studio if it is not already on.
Double‑click setup.bat. It locates MSBuild, builds Release | Win32, and reports the
result. Pass Debug to build the debug configuration instead:
setup.bat REM Release | Win32
setup.bat Debug REM Debug | Win32The compiled DLL is written to:
bin\Release\GFXFileManager.dll
- Open
GFXFileManager.sln. - Select the Release / Win32 configuration.
- Build → Build Solution (
Ctrl+Shift+B).
msbuild GFXFileManager.sln /t:Build /p:Configuration=Release /p:Platform=Win32 /m.
├─ GFXFileManager.sln Visual Studio 2026 solution
├─ GFXFileManager.vcxproj Project (v145, C/C++ latest, Release|Win32)
├─ export.def Exported symbol definitions
├─ setup.bat One‑click Release build script
├─ README.md
├─ LICENSE
└─ src/
├─ GFXDllCreateObject.cpp Client factory entry points
├─ GFXInfo.cpp / .h Open‑container info tracking (GFXFMInfo)
├─ IFileManager.* File‑manager interface implementation
├─ CPFileManager.* PK2 container file manager
├─ CWFileManager.* Writable container file manager
├─ EncryptedFiles.cpp Encrypted entry handling
├─ NonEncryptedFiles.cpp Plain entry handling
├─ PK2PayloadCrypto.* Payload (de)encryption
├─ PK2ToolsNativeApi.cpp PK2Tools_*W toolkit exports
└─ pk2/
├─ blowfish.* Blowfish cipher
├─ PK2Reader.* PK2 archive reader
├─ PK2Writer.* PK2 archive writer
└─ shared_io.* Low‑level I/O helpers
Drop the built GFXFileManager.dll next to the Silkroad client executable (replacing the
original module). The client resolves GFXDllCreateObject and drives archive access through it.
Load the DLL and resolve the PK2Tools_*W exports with GetProcAddress, or link against the
generated import library. Example — extracting an archive:
HMODULE dll = LoadLibraryW(L"GFXFileManager.dll");
auto SetKey = (int(__stdcall*)(const wchar_t*, wchar_t*, int))
GetProcAddress(dll, "PK2Tools_SetBlowfishKeyW");
auto Extract = (int(__stdcall*)(const wchar_t*, const wchar_t*, const wchar_t*,
int, int, void*, void*, wchar_t*, int))
GetProcAddress(dll, "PK2Tools_ExtractPk2W");
wchar_t err[512] = {0};
SetKey(L"169841", err, 512); // default Silkroad key
Extract(L"Media.pk2", L"out", nullptr, 1, 0, nullptr, nullptr, err, 512);The release build is produced with debug information disabled and a reproducible link
(/Brepro). The shipped GFXFileManager.dll contains no .pdb reference, no user name,
and no machine paths — the build output folder holds a single, anonymous DLL.
Released under the MIT License.
Disclaimer. Silkroad Online and PK2 are properties of their respective owners. This project is an independent, educational reimplementation for interoperability and private‑server / modding use. It ships no copyrighted game assets.