This commit is contained in:
DavidXanatos 2023-07-03 21:10:54 +02:00
parent 2c46c273d2
commit 1b906088ad
10 changed files with 33 additions and 124 deletions

View File

@ -1220,8 +1220,8 @@ int Program_Start(void)
WCHAR *parms = Eat_String(cmdline);
if (parms && *parms) {
WCHAR *cmd2 = MyHeapAlloc(cmdline_len * sizeof(WCHAR));
WCHAR *arg2 = MyHeapAlloc(cmdline_len * sizeof(WCHAR));
WCHAR *cmd2 = MyHeapAlloc((cmdline_len + 1) * sizeof(WCHAR));
WCHAR *arg2 = MyHeapAlloc((cmdline_len + 1) * sizeof(WCHAR));
wcsncpy(cmd2, cmdline, parms - cmdline);
cmd2[parms - cmdline] = L'\0';

View File

@ -1197,12 +1197,12 @@ _FX HRESULT Com_CoUnmarshalInterface_Common(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, NULL, riid, 0, hr);
if (hr == RPC_S_SERVER_UNAVAILABLE) {
IStream_Seek(pStream, *seekpos, STREAM_SEEK_SET, &posu);
@ -1278,11 +1278,11 @@ static HRESULT Com_CoMarshalInterface(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, NULL, riid, 0, hr);
Com_RpcRaiseException(hr);
return E_ABORT;
@ -2106,7 +2106,7 @@ _FX void Com_IUnknown_Add_Ref_Release(COM_IUNKNOWN *This, UCHAR op)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr)
if (hr != S_OK)
Com_RpcRaiseException(hr);
}
@ -2244,12 +2244,12 @@ _FX HRESULT Com_IClassFactory_CreateInstance(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, &This->Guid, riid, 0, hr);
Com_RpcRaiseException(hr);
return E_ABORT;
@ -2313,7 +2313,7 @@ _FX HRESULT Com_IClassFactory_New(
if (rpl) {
hr = rpl->h.status;
if (hr) {
if (hr != S_OK) {
Com_Free(rpl);
if (hr == ERROR_ELEVATION_REQUIRED && StringGUID) {
SbieApi_Log(2214, StringGUID);
@ -2323,7 +2323,7 @@ _FX HRESULT Com_IClassFactory_New(
}
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_RpcRaiseException(hr);
return E_ABORT;
}
@ -2417,11 +2417,11 @@ _FX HRESULT Com_OuterIUnknown_QueryInterface(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, &This->Guid, riid, 0, hr);
#ifndef REGHIVE_ALWAYS_MOUNT_NEVER_UNMOUNT // if not sbox build
Com_RpcRaiseException(hr);
@ -2588,13 +2588,13 @@ _FX HRESULT Com_IRpcChannelBuffer_SendReceive(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (pStatus)
*pStatus = hr;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, NULL, &This->Guid, ProcNum, hr);
return E_ABORT;
}
@ -2731,11 +2731,11 @@ _FX HRESULT Com_IMarshal_MarshalInterface(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, NULL, &This->Guid, 0, hr);
Com_RpcRaiseException(hr);
return E_ABORT;
@ -2873,11 +2873,11 @@ _FX HRESULT Com_IClientSecurity_QueryBlanket(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, NULL, &This->Guid, 0, hr);
Com_RpcRaiseException(hr);
return E_ABORT;
@ -2958,11 +2958,11 @@ _FX HRESULT Com_IClientSecurity_SetBlanket(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, NULL, &This->Guid, 0, hr);
Com_RpcRaiseException(hr);
return E_ABORT;
@ -2996,11 +2996,11 @@ _FX HRESULT Com_IClientSecurity_CopyProxy(
if (rpl) {
hr = rpl->h.status;
if (hr)
if (hr != S_OK)
Com_Free(rpl);
} else
hr = RPC_S_SERVER_UNAVAILABLE;
if (hr) {
if (hr != S_OK) {
Com_Trace(TraceType, NULL, &This->Guid, 0, hr);
Com_RpcRaiseException(hr);
return E_ABORT;
@ -3608,4 +3608,4 @@ _FX HRESULT Com_IClassFactoryEx_New(
}
return hr;
}
*/
*/

View File

@ -1066,7 +1066,7 @@ _FX HGLOBAL XDataObject::InitFormatIdList(HGLOBAL hData)
if (! pIdList)
return NULL;
HRESULT hr;
BOOL ok;
HANDLE hFile;
WCHAR *path = (WCHAR *)Dll_AllocTemp(8192);
@ -1083,8 +1083,8 @@ _FX HGLOBAL XDataObject::InitFormatIdList(HGLOBAL hData)
LPCITEMIDLIST pidl = pILCombine(GetPidl(0), GetPidl(count));
if (pidl) {
hr = pSHGetPathFromIDList(pidl, path);
if (SUCCEEDED(hr)) {
ok = pSHGetPathFromIDList(pidl, path);
if (ok) {
hFile = CreateFileW(path,
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
@ -1128,8 +1128,8 @@ _FX HGLOBAL XDataObject::InitFormatIdList(HGLOBAL hData)
// get the pidl for the parent folder in the sandbox
//
hr = pSHGetPathFromIDList(GetPidl(0), path);
if (! SUCCEEDED(hr))
ok = pSHGetPathFromIDList(GetPidl(0), path);
if (!ok)
goto finish;
hFile = CreateFileW(path,
@ -1153,8 +1153,8 @@ _FX HGLOBAL XDataObject::InitFormatIdList(HGLOBAL hData)
LPCITEMIDLIST pidl = pILCombine(GetPidl(0), GetPidl(1));
if (pidl) {
hr = pSHGetPathFromIDList(pidl, path);
if (SUCCEEDED(hr)) {
ok = pSHGetPathFromIDList(pidl, path);
if (ok) {
hFile = CreateFileW(path,
GENERIC_WRITE, FILE_SHARE_VALID_FLAGS, NULL,
@ -1188,6 +1188,7 @@ _FX HGLOBAL XDataObject::InitFormatIdList(HGLOBAL hData)
SbieDll_TranslateNtToDosPath(path);
HRESULT hr;
LPITEMIDLIST pidl;
ULONG flags = 0;
hr = pSHILCreateFromPath(path, &pidl, &flags);

View File

@ -1,63 +0,0 @@
#include "stdafx.h"
#include "qRC4.h"
#include <QByteArray>
void
rc4_swap(unsigned char &a, unsigned char &b)
{
unsigned char c = a;
a = b;
b = c;
}
void
rc4_init(rc4_sbox_t *rc4_sbox, const unsigned char *key_ptr, unsigned int key_len)
{
rc4_sbox->x = 0;
rc4_sbox->y = 0;
// Initialisation of the permutation
unsigned int i;
for (i = 0; i < 256; i++)
rc4_sbox->state[i] = (char)i;
// Mixing permutation
unsigned int j = 0;
unsigned int k;
for (i = 0; i < 256; i++)
{
k = i % key_len;
j = (key_ptr[k] + rc4_sbox->state[i] + j) & 0xff;
rc4_swap(rc4_sbox->state[i], rc4_sbox->state[j]);
}
}
void
rc4_transform(rc4_sbox_t *rc4_sbox, unsigned char *buffer_ptr, unsigned int buffer_len)
{
unsigned int i;
for (i = 0; i < buffer_len; i++)
{
// The pseudo-random generation algorithm
rc4_sbox->x = (rc4_sbox->x + 1) & 0xff;
rc4_sbox->y = (rc4_sbox->y + rc4_sbox->state[rc4_sbox->x]) & 0xff;
rc4_swap(rc4_sbox->state[rc4_sbox->x], rc4_sbox->state[rc4_sbox->y]);
unsigned char keyChar = rc4_sbox->state[(rc4_sbox->state[rc4_sbox->x] + rc4_sbox->state[rc4_sbox->y]) & 0xff];
if (buffer_ptr) // NULL when seeking
buffer_ptr[i] ^= keyChar;
}
}
void MISCHELPERS_EXPORT rc4_init(rc4_sbox_t *rc4_sbox, const QByteArray& Key)
{
rc4_init(rc4_sbox, (unsigned char*)Key.data(), Key.size());
}
QByteArray MISCHELPERS_EXPORT rc4_transform(rc4_sbox_t *rc4_sbox, const QByteArray& Data)
{
QByteArray Temp = Data;
rc4_transform(rc4_sbox, (unsigned char*)Temp.data(), Temp.size());
return Temp;
}

View File

@ -1,18 +0,0 @@
#pragma once
#include "../mischelpers_global.h"
typedef struct MISCHELPERS_EXPORT rc4_sbox_s
{
unsigned char state[256];
unsigned int x;
unsigned int y;
} rc4_sbox_t;
void MISCHELPERS_EXPORT rc4_init(rc4_sbox_t *rc4_sbox, const unsigned char *key_ptr, unsigned int key_len);
void MISCHELPERS_EXPORT rc4_transform(rc4_sbox_t *rc4_sbox, unsigned char *buffer_ptr, unsigned int buffer_len);
void MISCHELPERS_EXPORT rc4_init(rc4_sbox_t *rc4_sbox, const QByteArray& Key);
QByteArray MISCHELPERS_EXPORT rc4_transform(rc4_sbox_t *rc4_sbox, const QByteArray& Data);

View File

@ -12,7 +12,6 @@ HEADERS += ./MiscHelpers.h \
./Common/FlexError.h \
./Common/FlowLayout.h \
./Common/HistoryGraph.h \
./Common/qRC4.h \
./Common/Xml.h \
./Common/CheckableMessageBox.h \
./Common/ComboInputDialog.h \
@ -62,7 +61,6 @@ SOURCES += ./MiscHelpers.cpp \
./Common/ListItemModel.cpp \
./Common/MultiLineInputDialog.cpp \
./Common/PanelView.cpp \
./Common/qRC4.cpp \
./Common/NetworkAccessManager.cpp \
./Common/Settings.cpp \
./Common/SettingsWidgets.cpp \

View File

@ -212,7 +212,6 @@
<ClCompile Include="Common\MultiLineInputDialog.cpp" />
<ClCompile Include="Common\OtherFunctions.cpp" />
<ClCompile Include="Common\PanelView.cpp" />
<ClCompile Include="Common\qRC4.cpp" />
<ClCompile Include="Common\NetworkAccessManager.cpp" />
<ClCompile Include="Common\Settings.cpp" />
<ClCompile Include="Common\SettingsWidgets.cpp" />
@ -270,7 +269,6 @@
<QtMoc Include="Common\NeonEffect.h" />
<ClInclude Include="Common\OtherFunctions.h" />
<ClInclude Include="Common\PoolAllocator.h" />
<ClInclude Include="Common\qRC4.h" />
<QtMoc Include="Common\NetworkAccessManager.h" />
<ClInclude Include="Common\Xml.h" />
<ClInclude Include="MiscHelpers.h" />

View File

@ -90,9 +90,6 @@
<ClCompile Include="Common\Xml.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="Common\qRC4.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="Common\NetworkAccessManager.cpp">
<Filter>Common</Filter>
</ClCompile>
@ -161,9 +158,6 @@
<ClInclude Include="Common\Xml.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="Common\qRC4.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="Common\OtherFunctions.h">
<Filter>Common</Filter>
</ClInclude>

View File

@ -175,7 +175,7 @@ int openShellContextMenu(const QStringList& Files, void* parentWindow, const CSa
//details.aKeys = NULL;
SHCreateDefaultContextMenu(&details, IID_IContextMenu, reinterpret_cast<LPVOID*>(&pContextMenu));
}
if (!SUCCEEDED(!pContextMenu))
if (!pContextMenu)
return 0;
HMENU hMenu = CreatePopupMenu();

View File

@ -4,7 +4,6 @@
#include "../QSbieAPI/SbieAPI.h"
#include "../QtSingleApp/src/qtsingleapplication.h"
#include "../QSbieAPI/SbieUtils.h"
//#include "../MiscHelpers/Common/qRC4.h"
#include "../MiscHelpers/Common/Common.h"
#include <windows.h>
#include "./Windows/SettingsWindow.h"