Skip to content
Discussion options

You must be logged in to vote

The string concatenation functions themselves may not be the problem here. Looking at the code snippet, I'd first verify that the types being passed around are what the Process Hacker string APIs expect.

A few observations:

1. PhConcatStrings2 returns a new string

Functions such as:

PPH_STRING PhConcatStrings2(
    _In_ PWSTR String1,
    _In_ PWSTR String2
);

don't append to an existing PPH_STRING; they allocate and return a new one.

For example:

PPH_STRING newString = PhConcatStrings2(
    jsonString->Buffer,
    hashString->Buffer
);

You would then need to manage the references correctly:

PhDereferenceObject(jsonString);
jsonString = newString;

If you ignore the returned value, nothing…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dmex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants