Still problem with a class and function
-
Hi im trying to return char with the function but it gives error, anhy help
struct random_class {
char \*crypto\_buf; void \_\_thiscall classfunction (void \*pParam);
};
random_class* pParam;void (__thiscall* classfunction)(void *pParam );
void __thiscall myclassfunction(void *pParam )
{
classfunction(pParam->crypto_buf);
}error C2227: left of '->crypto_buf' must point to class/struct/union/generic type 1> type is 'void *'
-
Hi im trying to return char with the function but it gives error, anhy help
struct random_class {
char \*crypto\_buf; void \_\_thiscall classfunction (void \*pParam);
};
random_class* pParam;void (__thiscall* classfunction)(void *pParam );
void __thiscall myclassfunction(void *pParam )
{
classfunction(pParam->crypto_buf);
}error C2227: left of '->crypto_buf' must point to class/struct/union/generic type 1> type is 'void *'
-
Hi im trying to return char with the function but it gives error, anhy help
struct random_class {
char \*crypto\_buf; void \_\_thiscall classfunction (void \*pParam);
};
random_class* pParam;void (__thiscall* classfunction)(void *pParam );
void __thiscall myclassfunction(void *pParam )
{
classfunction(pParam->crypto_buf);
}error C2227: left of '->crypto_buf' must point to class/struct/union/generic type 1> type is 'void *'
Why do you need to use explicitely
__thiscall
?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Why do you need to use explicitely
__thiscall
?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]because the function that i dissasembled does have void * pointer and it is also __thiscall Here is how the dissasembled func looks like:
void *__thiscall sub_402355(void *this)
{
void *v1; // ebx@1
signed int v2; // edi@1
void *v3; // esi@1v3 = this;
*(_BYTE *)this = 0;
v2 = 0;
v1 = this;
do
{
sub_401462(*((_BYTE *)v3 + v2++ + 188), v1);
v1 = (char *)v1 + 2;
}
while ( v2 < 16 );
return v3;
} -
because the function that i dissasembled does have void * pointer and it is also __thiscall Here is how the dissasembled func looks like:
void *__thiscall sub_402355(void *this)
{
void *v1; // ebx@1
signed int v2; // edi@1
void *v3; // esi@1v3 = this;
*(_BYTE *)this = 0;
v2 = 0;
v1 = this;
do
{
sub_401462(*((_BYTE *)v3 + v2++ + 188), v1);
v1 = (char *)v1 + 2;
}
while ( v2 < 16 );
return v3;
}What are you doing? Do you intend to reproduce the function behaviour in
C
? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
What are you doing? Do you intend to reproduce the function behaviour in
C
? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi im trying to return char with the function but it gives error, anhy help
struct random_class {
char \*crypto\_buf; void \_\_thiscall classfunction (void \*pParam);
};
random_class* pParam;void (__thiscall* classfunction)(void *pParam );
void __thiscall myclassfunction(void *pParam )
{
classfunction(pParam->crypto_buf);
}error C2227: left of '->crypto_buf' must point to class/struct/union/generic type 1> type is 'void *'
nah1337 wrote:
classfunction(pParam->crypto_buf);
Have you tried:
classfunction(((random_class *) pParam)->crypto_buf);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
Take a look at your manuals, you cannot access anything from a
void*
, you must cast it so that it points to some type, otherwise the compiler does not know how to access the data.txtspeak is the realm of 9 year old children, not developers. Christian Graus
-
nah1337 wrote:
classfunction(pParam->crypto_buf);
Have you tried:
classfunction(((random_class *) pParam)->crypto_buf);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius