flat assembler
Message board for the users of flat assembler.

Index > Main > Redefine Structure's address by code

Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 19 May 2021, 15:20
Hi
Why I can define my structure address by external functions but can't just mov it to structures variable?
Code:
.data
struct PROPVARIANT
  ...
ends
VarName PROPVARIANT

.code
;this code works fine 
cominvk pProps,GetValue,PKEY_AudioEngine_DeviceFormat,VarName

;example of use new address
movs_b  engineCapture,[VarName.blob.pBlobData],140


;can't compile:
mov VarName, Some address
    

After the IPropertyStore::GetValue method returns successfully, this parameter points to a PROPVARIANT structure that contains data about the property.
So that means it changes my struct address. Why I cannot to do the same way to redirect structure to new place?
Post 19 May 2021, 15:20
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 19 May 2021, 15:43
Не понятно.
Что ты подразумеваешь ?
Post 19 May 2021, 15:43
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 19 May 2021, 15:55
Quote:

Не понятно.
Что ты подразумеваешь ?

Подразумеваю, что если есть некая объявленная структура, с присвоенным уже в Дата адресом, то внешние функции могут менять этот адрес, например на тот, что винда сама определяет, как затребованную структуру. А вот самостоятельно переназначить адрес Структуры я не могу, компилятор ругается.
Post 19 May 2021, 15:55
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 19 May 2021, 16:19
Может как указатель ?
ptrVarName dd VarName1
VarName1 PROPVARIANT
VarName2 PROPVARIANT
Post 19 May 2021, 16:19
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 19 May 2021, 16:31
Так я могу и не париться совсем, а обращаться к адресу с топологией структуры
[rsi+PROPVARIANT.blob.pBlobData]
Вопрос был именно о переназначении внутреннего указателя самой структуры, как это работает при вызове внешних функций.
Post 19 May 2021, 16:31
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 19 May 2021, 16:36
Если ты можешь делать [rsi+PROPVARIANT.blob.pBlobData]
То не пойму что ты хочешь ?!

Твоя функция cominvk pProps,GetValue,PKEY_AudioEngine_DeviceFormat,VarName
тоже пишет в структуру VarName.
Post 19 May 2021, 16:36
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 19 May 2021, 16:45
Не хочу усложнять себе жизнь. Правда так и не понял, почему переадресация вообще работает? Ведь адреса заменяются на этапе компиляции, и первым элементом по данному адресу структуры, уже расположен первый элемент самой структуры. Но путем эксперимента, оно заработало, причем на разных функциях и интерфейсах, то есть вместо того, чтоб поместить адрес некой структуры в первые байты самой структуры, переадресовывается вся структура целиком и это очень удобно.
Post 19 May 2021, 16:45
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 19 May 2021, 16:46
Quote:

Твоя функция cominvk pProps,GetValue,PKEY_AudioEngine_DeviceFormat,VarName
тоже пишет в структуру VarName.

After the IPropertyStore::GetValue method returns successfully, this parameter points to a PROPVARIANT structure that contains data about the property.

Ну может я что-то и натупил конечно, сейчас пойду смотреть другие примеры
Post 19 May 2021, 16:46
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 19 May 2021, 16:53
Да, похоже на то, это не pointer to pointer variable Smile
Post 19 May 2021, 16:53
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20457
Location: In your JS exploiting you and your system
revolution 19 May 2021, 17:28
VarName is just a number.
Code:
VarName: ;this is just anumber
mov VarName, 0 ;fails
mov 6, 0 ;same thing without the name hiding the contents    
Post 19 May 2021, 17:28
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 19 May 2021, 17:30
Quote:
Да, похоже на то, это не pointer to pointer variable Smile

Of course.
Post 19 May 2021, 17:30
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.