Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free dynamically allocated BSTR. #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/inlineExecute-Assembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ void go(char* args, int length) {//Executes .NET assembly in memory
for (long i = 0; i < argumentCount; i++)
{
//Insert the string from argumentsArray[i] into the safearray
OLEAUT32$SafeArrayPutElement(vtPsa.parray, &i, OLEAUT32$SysAllocString(argumentsArray[i]));
OLEAUT32$SafeArrayPutElement(vtPsa.parray, &i, bstrArg);
OLEAUT32$SysFreeString( bstrArg );
BSTR bstrArg = OLEAUT32$SysAllocString(argumentsArray[i]);
}

//Break ETW
Expand Down
1 change: 1 addition & 0 deletions src/inlineExecute-Assembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ WINBASEAPI HRESULT WINAPI OLEAUT32$SafeArrayPutElement(SAFEARRAY* psa, LONG* rgI
WINBASEAPI HRESULT WINAPI OLEAUT32$SafeArrayDestroy(SAFEARRAY* psa);
WINBASEAPI HRESULT WINAPI OLEAUT32$VariantClear(VARIANTARG* pvarg);
WINBASEAPI BSTR WINAPI OLEAUT32$SysAllocString(const OLECHAR* psz);
WINBASEAPI VOID WINAPI OLEAUT32$SysFreeString(BSTR bstrString);

#define intZeroMemory(addr,size) memset((addr),0,size)
#define intAlloc(size) KERNEL32$HeapAlloc(KERNEL32$GetProcessHeap(), HEAP_ZERO_MEMORY, size)
Expand Down