Bug 1358552: Fix incorrect ABI specification in js-ctypes declarations in toolkit; r?froydnj
MozReview-Commit-ID: JuNNtbNC5pe
--- a/toolkit/modules/UpdateUtils.jsm
+++ b/toolkit/modules/UpdateUtils.jsm
@@ -216,17 +216,17 @@ XPCOMUtils.defineLazyGetter(this, "gWinC
kernel32 = ctypes.open("Kernel32");
} catch (e) {
Cu.reportError("Unable to open kernel32! Exception: " + e);
}
if (kernel32) {
try {
let GetNativeSystemInfo = kernel32.declare("GetNativeSystemInfo",
- ctypes.default_abi,
+ ctypes.winapi_abi,
ctypes.void_t,
SYSTEM_INFO.ptr);
let winSystemInfo = SYSTEM_INFO();
// Default to unknown
winSystemInfo.wProcessorArchitecture = 0xffff;
GetNativeSystemInfo(winSystemInfo.address());
switch (winSystemInfo.wProcessorArchitecture) {
@@ -318,17 +318,17 @@ XPCOMUtils.defineLazyGetter(UpdateUtils,
osVersion += ".unknown (unknown)";
}
if (kernel32) {
try {
// Get Service pack info
try {
let GetVersionEx = kernel32.declare("GetVersionExW",
- ctypes.default_abi,
+ ctypes.winapi_abi,
BOOL,
OSVERSIONINFOEXW.ptr);
let winVer = OSVERSIONINFOEXW();
winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
if (0 !== GetVersionEx(winVer.address())) {
osVersion += "." + winVer.wServicePackMajor +
"." + winVer.wServicePackMinor;
--- a/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js
+++ b/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js
@@ -55,17 +55,17 @@ function getServicePack() {
{wSuiteMask: WORD},
{wProductType: BYTE},
{wReserved: BYTE}
]);
let kernel32 = ctypes.open("kernel32");
try {
let GetVersionEx = kernel32.declare("GetVersionExW",
- ctypes.default_abi,
+ ctypes.winapi_abi,
BOOL,
OSVERSIONINFOEXW.ptr);
let winVer = OSVERSIONINFOEXW();
winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
if (0 === GetVersionEx(winVer.address())) {
// Using "throw" instead of "do_throw" (see NOTE above)
throw ("Failure in GetVersionEx (returned 0)");
@@ -100,17 +100,17 @@ function getProcArchitecture() {
{dwAllocationGranularity: DWORD},
{wProcessorLevel: WORD},
{wProcessorRevision: WORD}
]);
let kernel32 = ctypes.open("kernel32");
try {
let GetNativeSystemInfo = kernel32.declare("GetNativeSystemInfo",
- ctypes.default_abi,
+ ctypes.winapi_abi,
ctypes.void_t,
SYSTEM_INFO.ptr);
let sysInfo = SYSTEM_INFO();
// Default to unknown
sysInfo.wProcessorArchitecture = 0xffff;
GetNativeSystemInfo(sysInfo.address());
switch (sysInfo.wProcessorArchitecture) {
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -2414,17 +2414,17 @@ function lockDirectory(aDirPath) {
const LPVOID = ctypes.voidptr_t;
const GENERIC_READ = 0x80000000;
const FILE_SHARE_READ = 1;
const FILE_SHARE_WRITE = 2;
const OPEN_EXISTING = 3;
const FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
const INVALID_HANDLE_VALUE = LPVOID(0xffffffff);
let kernel32 = ctypes.open("kernel32");
- let CreateFile = kernel32.declare("CreateFileW", ctypes.default_abi,
+ let CreateFile = kernel32.declare("CreateFileW", ctypes.winapi_abi,
LPVOID, LPCWSTR, DWORD, DWORD,
LPVOID, DWORD, DWORD, LPVOID);
gHandle = CreateFile(aDirPath, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, LPVOID(0),
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, LPVOID(0));
Assert.notEqual(gHandle.toString(), INVALID_HANDLE_VALUE.toString(),
"the handle should not equal INVALID_HANDLE_VALUE");
kernel32.close();
@@ -3735,17 +3735,17 @@ function adjustGeneralPaths() {
gProcess = null;
debugDump("finish - kill process");
}
if (gHandle) {
try {
debugDump("start - closing handle");
let kernel32 = ctypes.open("kernel32");
- let CloseHandle = kernel32.declare("CloseHandle", ctypes.default_abi,
+ let CloseHandle = kernel32.declare("CloseHandle", ctypes.winapi_abi,
ctypes.bool, /* return*/
ctypes.voidptr_t /* handle*/);
if (!CloseHandle(gHandle)) {
debugDump("call to CloseHandle failed");
}
kernel32.close();
gHandle = null;
debugDump("finish - closing handle");
--- a/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
@@ -191,17 +191,17 @@ function getServicePack() {
{wSuiteMask: WORD},
{wProductType: BYTE},
{wReserved: BYTE}
]);
let kernel32 = ctypes.open("kernel32");
try {
let GetVersionEx = kernel32.declare("GetVersionExW",
- ctypes.default_abi,
+ ctypes.winapi_abi,
BOOL,
OSVERSIONINFOEXW.ptr);
let winVer = OSVERSIONINFOEXW();
winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
if (0 === GetVersionEx(winVer.address())) {
// Using "throw" instead of "do_throw" (see NOTE above)
throw ("Failure in GetVersionEx (returned 0)");
@@ -236,17 +236,17 @@ function getProcArchitecture() {
{dwAllocationGranularity: DWORD},
{wProcessorLevel: WORD},
{wProcessorRevision: WORD}
]);
let kernel32 = ctypes.open("kernel32");
try {
let GetNativeSystemInfo = kernel32.declare("GetNativeSystemInfo",
- ctypes.default_abi,
+ ctypes.winapi_abi,
ctypes.void_t,
SYSTEM_INFO.ptr);
let sysInfo = SYSTEM_INFO();
// Default to unknown
sysInfo.wProcessorArchitecture = 0xffff;
GetNativeSystemInfo(sysInfo.address());
switch (sysInfo.wProcessorArchitecture) {