char *str = SvPV(sv, len);
UINT cp = SvUTF8(sv) ? CP_UTF8 : CP_ACP;
- wlen = MultiByteToWideChar(cp, 0, str, len+1, NULL, 0);
+ wlen = MultiByteToWideChar(cp, 0, str, (int)(len+1), NULL, 0);
New(0, wstr, wlen, WCHAR);
- MultiByteToWideChar(cp, 0, str, len+1, wstr, wlen);
+ MultiByteToWideChar(cp, 0, str, (int)(len+1), wstr, wlen);
return wstr;
}
SV *
wstr_to_sv(pTHX_ WCHAR *wstr)
{
- size_t wlen = wcslen(wstr)+1;
+ int wlen = (int)wcslen(wstr)+1;
BOOL use_default = FALSE;
int len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wstr, wlen, NULL, 0, NULL, NULL);
SV *sv = sv_2mortal(newSV(len));
{
char *name;
BOOL use_default = FALSE;
- size_t widelen = wcslen(widename)+1;
+ int widelen = (int)wcslen(widename)+1;
int len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, widename, widelen,
NULL, 0, NULL, NULL);
New(0, name, len, char);
}
message = SvPV_nolen(ST(1));
- bRet = InitiateSystemShutdownA(machineName, message,
- SvIV(ST(2)), SvIV(ST(3)), SvIV(ST(4)));
+ bRet = InitiateSystemShutdownA(machineName, message, (DWORD)SvIV(ST(2)),
+ (BOOL)SvIV(ST(3)), (BOOL)SvIV(ST(4)));
/* Disable shutdown privilege. */
tkp.Privileges[0].Attributes = 0;
croak("usage: Win32::MsgBox($message [, $flags [, $title]]);\n");
if (items > 1)
- flags = SvIV(ST(1));
+ flags = (DWORD)SvIV(ST(1));
if (IsWin2000()) {
WCHAR *title = NULL;
if (items != 1)
croak("usage: Win32::LoadLibrary($libname)\n");
hHandle = LoadLibraryA(SvPV_nolen(ST(0)));
- XSRETURN_IV((long)hHandle);
+#ifdef _WIN64
+ XSRETURN_IV((DWORD_PTR)hHandle);
+#else
+ XSRETURN_IV((DWORD)hHandle);
+#endif
}
XS(w32_FreeLibrary)
if (SUCCEEDED(hr)) {
LPOLESTR pStr = NULL;
if (SUCCEEDED(StringFromCLSID(&guid, &pStr))) {
- WideCharToMultiByte(CP_ACP, 0, pStr, wcslen(pStr), szGUID,
+ WideCharToMultiByte(CP_ACP, 0, pStr, (int)wcslen(pStr), szGUID,
sizeof(szGUID), NULL, NULL);
CoTaskMemFree(pStr);
XSRETURN_PV(szGUID);
if (items != 1 && items != 2)
croak("usage: Win32::GetFolderPath($csidl [, $create])\n");
- folder = SvIV(ST(0));
+ folder = (int)SvIV(ST(0));
if (items == 2)
create = SvTRUE(ST(1)) ? CSIDL_FLAG_CREATE : 0;
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "usage: Win32::SetLastError($error)");
- SetLastError(SvIV(ST(0)));
+ SetLastError((DWORD)SvIV(ST(0)));
XSRETURN_EMPTY;
}
Perl_croak(aTHX_ "usage: Win32::FormatMessage($errno)");
if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
- &source, SvIV(ST(0)), 0,
+ &source, (DWORD)SvIV(ST(0)), 0,
msgbuf, sizeof(msgbuf)-1, NULL))
{
XSRETURN_PV(msgbuf);
do {
len = GetShortPathName(SvPVX(shortpath),
SvPVX(shortpath),
- SvLEN(shortpath));
+ (DWORD)SvLEN(shortpath));
} while (len >= SvLEN(shortpath) && sv_grow(shortpath,len+1));
if (len) {
SvCUR_set(shortpath,len);
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "usage: Win32::Sleep($milliseconds)");
- Sleep(SvIV(ST(0)));
+ Sleep((DWORD)SvIV(ST(0)));
XSRETURN_YES;
}