Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Iterating the Section Table errors

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Tue Jul 29, 2008 10:17 pm    Post subject: Iterating the Section Table errors Reply with quote

I'm trying to iterate the section table and I'm getting 5 errors that I can't seem to fix (I fixed the other 5 x_x), and I was wondering if you guys could help. And the only reason I'm only listing the name is because I can't figure out how to set items in different columns Confused Here's my code:

Code:

void IterateSections() {
   LPVOID lpSection = (LPVOID)(pImageNtHeaders->OptionalHeader.ImageBase+pImageNtHeaders->OptionalHeader.SizeOfHeaders);
   WORD wNumSections = pImageNtHeaders->FileHeader.NumberOfSections;
   PIMAGE_SECTION_HEADER pImageSectionHeader = (PIMAGE_SECTION_HEADER)calloc(wNumSections, sizeof(IMAGE_SECTION_HEADER));
   for(int i = 0; i<wNumSections; i++) {
      pImageSectionHeader[i] = (PIMAGE_SECTION_HEADER)lpSection;
      InsertItem(LVIF_TEXT, 0, 0, (LPSTR)pImageSectionHeader[i]->Name);
      lpSection += sizeof(IMAGE_SECTION_HEADER);
   }
}


Here are my errors:

Quote:

------ Build started: Project: PE Loader Emulator, Configuration: Debug Win32 ------
Compiling...
main.cpp
c:\documents and settings\oib\my documents\visual studio 2008\projects\pe loader emulator\pe loader emulator\main.cpp(23) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'PIMAGE_SECTION_HEADER' (or there is no acceptable conversion)
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(9637): could be '_IMAGE_SECTION_HEADER &_IMAGE_SECTION_HEADER::operator =(const _IMAGE_SECTION_HEADER &)'
while trying to match the argument list '(_IMAGE_SECTION_HEADER, PIMAGE_SECTION_HEADER)'
c:\documents and settings\oib\my documents\visual studio 2008\projects\pe loader emulator\pe loader emulator\main.cpp(24) : error C2819: type '_IMAGE_SECTION_HEADER' does not have an overloaded member 'operator ->'
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(9623) : see declaration of '_IMAGE_SECTION_HEADER'
did you intend to use '.' instead?
c:\documents and settings\oib\my documents\visual studio 2008\projects\pe loader emulator\pe loader emulator\main.cpp(24) : error C2232: '->_IMAGE_SECTION_HEADER::Name' : left operand has 'struct' type, use '.'
c:\documents and settings\oib\my documents\visual studio 2008\projects\pe loader emulator\pe loader emulator\main.cpp(24) : error C3861: 'InsertItem': identifier not found
c:\documents and settings\oib\my documents\visual studio 2008\projects\pe loader emulator\pe loader emulator\main.cpp(25) : error C2036: 'LPVOID' : unknown size
Build log was saved at "file://c:\Documents and Settings\OIB\My Documents\Visual Studio 2008\Projects\PE Loader Emulator\PE Loader Emulator\Debug\BuildLog.htm"
PE Loader Emulator - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Jul 29, 2008 10:26 pm    Post subject: Reply with quote

Code:
void IterateSections()
{
   DWORD dwSection = (DWORD)(pImageNtHeaders->OptionalHeader.ImageBase+pImageNtHeaders->OptionalHeader.SizeOfHeaders);
   WORD wNumSections = pImageNtHeaders->FileHeader.NumberOfSections;
   PIMAGE_SECTION_HEADER pImageSectionHeader = (PIMAGE_SECTION_HEADER)calloc(wNumSections, sizeof(IMAGE_SECTION_HEADER));
   for(int i = 0; i < wNumSections; i++)
   {
      pImageSectionHeader[i] = (PIMAGE_SECTION_HEADER)dwSection;
      InsertItem(LVIF_TEXT, 0, 0, (LPSTR)pImageSectionHeader[i].Name);
      dwSection += sizeof(IMAGE_SECTION_HEADER);
   }
}


Leaves 1 Error.
I'm still working on it. (pImageSectionHeader[i] = (PIMAGE_SECTION_HEADER)dwSection)

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Tue Jul 29, 2008 10:31 pm    Post subject: Reply with quote

Thanks. But just another question, since this one can be quickly answered, how do I add items to a specific column?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Jul 29, 2008 10:34 pm    Post subject: Reply with quote

LVM_SETITEM message (or the macro ListView_SetItem)

Edit:

Try replacing that line that causes the error with this and see if it works.
Code:
memcpy( &pImageSectionHeader[i], (void*)dwSection, sizeof(dwSection) );

or
Code:
memcpy( (void*)pImageSectionHeader[i], (void*)dwSection, sizeof(dwSection) );

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Tue Jul 29, 2008 10:56 pm    Post subject: Reply with quote

Thanks it compiles fine. But it's not listing anything. And LVM_SETITEM didn't help because that just sets an items attributes. I want to insert the item at a specific column.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Jul 29, 2008 10:59 pm    Post subject: Reply with quote

LVM_INSERTITEM : Inserts an item into the first column using a filled LVITEM struct. Once there is an item in the first column you must use LVM_SETITEM to place items in the column's to the right (ListView control must be created with the LVS_REPORT style).

LVM_SETITEM : Sets an item definition (LVITEM struct) to a specified column. (LVITEM - iSubItem = ColumnNumber)

Btw Make sure when you create your columns via LVCOLUMN struct that you set the mask to LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH. If you want to utilize sub items.

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Tue Jul 29, 2008 11:15 pm    Post subject: Reply with quote

Oh lol. Thanks. But still, it won't list anything.

Code:

for(int i = 0; i<wNumSections; i++) {
      memcpy(&pImageSectionHeader[i], (LPVOID)dwSection, sizeof(dwSection));
      InsertItem(LVIF_TEXT, i, 0, (LPSTR)pImageSectionHeader[i].Name, FALSE);
      dwSection += sizeof(IMAGE_SECTION_HEADER);
   }

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Wed Jul 30, 2008 12:49 am    Post subject: Reply with quote

Did you change the iSubItem value?
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Wed Jul 30, 2008 8:52 am    Post subject: Reply with quote

To what are you referring to?

And I can't get it to even list the names in the first column. And I can't get it to list anything in the second/third/fourth/fifth column. I set each column to LVCF_SUBITEM, I set their subitem 0-4 and tried assigning an item with iItem at 0 and iSubItem at the columns number.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites