I understand PBYTE
is unsigned char*
from Windows Data Types.
I am calling a function which updates data
and dataSize
.
I print the data after I call the function, but once I print the vector that stores all the data, I am not getting the same value.
Is it possible that the data is getting corrupted?
This is a function written internally, not open-source.
SerializeEvent(__in_z PCWSTR EventName,
__out_bcount(DataSize) PBYTE & Data,
__out ULONG & DataSize){}
This function takes in a field and serializes it and data
is basically the buffer where the serialize event name is stored, and dataSize
is the size for the same.
PBYTE data=NULL;
ULONG dataSize=0;
int main(){
vector<PBYTE> dataVector;
vector<ULONG> dataSizeVector;
for(int i=0;i<10;i++){
serializeData(event,data,dataSize);
printf("%02x ",data); ///----->a
dataVector.push_back(data);
dataSizeVector.push_back(dataSize);
}
//just want to print the contents of this vector to verify
for(int i=0;i<dataVector.size();i++){
printf("%02x ",dataVector.at(i)); ----> b
}
}
The print from the first for
loop is not matching the print from the second for
loop. Am I missing something?
But doing the same for dataSizeVector is printing similar values...