OCX
application/octet-stream
Magic Bytes
Offset: 0
4D 5A
An OLE Custom Control (OCX) is a specialized software component format developed by Microsoft for the Windows operating system environment. These files function as reusable modules that provide specific graphical user interface elements or background processing logic for applications developed in Visual Basic or C++. Now considered a legacy technology superseded by the ActiveX standard, they are primarily encountered today while maintaining established enterprise software or historical systems.
Validation Code
How to validate .ocx files in Python
Python
def is_ocx(file_path: str) -> bool:
"""Check if file is a valid OCX by magic bytes."""
signature = bytes([0x4D, 0x5A])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .ocx files in Node.js
Node.js
function isOCX(buffer: Buffer): boolean {
const signature = Buffer.from([0x4D, 0x5A]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsOCX(data []byte) bool {
signature := []byte{0x4D, 0x5A}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/ocx
curl https://filesignature.org/api/v1/ocx