Subversion Repositories Kolibri OS

Rev

Rev 3799 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3799 Rev 3805
Line 172... Line 172...
172
                }
172
                }
173
                entry++;
173
                entry++;
174
            }
174
            }
175
            reloc = MakePtr(PIMAGE_BASE_RELOCATION, reloc,reloc->SizeOfBlock);
175
            reloc = MakePtr(PIMAGE_BASE_RELOCATION, reloc,reloc->SizeOfBlock);
176
        };
176
        };
177
        printf("unmap base %p offset %x %d page(s)\n",
177
//        printf("unmap base %p offset %x %d page(s)\n",
178
                img_base,
178
//                img_base,
179
                nt->OptionalHeader.DataDirectory[5].VirtualAddress,
179
//                nt->OptionalHeader.DataDirectory[5].VirtualAddress,
180
                (nt->OptionalHeader.DataDirectory[5].Size+4095)>>12);
180
//                (nt->OptionalHeader.DataDirectory[5].Size+4095)>>12);
Line 181... Line 181...
181
 
181
 
182
        user_unmap(img_base,nt->OptionalHeader.DataDirectory[5].VirtualAddress,
182
        user_unmap(img_base,nt->OptionalHeader.DataDirectory[5].VirtualAddress,
183
                   nt->OptionalHeader.DataDirectory[5].Size);
183
                   nt->OptionalHeader.DataDirectory[5].Size);
184
    };
184
    };
185
    return img_base;
185
    return img_base;
Line -... Line 186...
-
 
186
};
-
 
187
 
-
 
188
void* get_entry_point(void *raw)
-
 
189
{
-
 
190
    PIMAGE_DOS_HEADER     dos;
-
 
191
    PIMAGE_NT_HEADERS32   nt;
-
 
192
 
-
 
193
    dos = (PIMAGE_DOS_HEADER)raw;
-
 
194
    nt =  MakePtr( PIMAGE_NT_HEADERS32, dos, dos->e_lfanew);
-
 
195
 
Line 186... Line 196...
186
};
196
    return  MakePtr(void*, raw, nt->OptionalHeader.AddressOfEntryPoint);
187
 
197
};
188
 
198
 
189
 
199
 
190
void* load_libc()
200
void* load_libc()
191
{
201
{
Line 192... Line 202...
192
    void     *raw_img;
202
    void     *raw_img;
-
 
203
    size_t    raw_size;
193
    size_t    raw_size;
204
    void     *img_base = NULL;
194
    void     *img_base = NULL;
205
    ufile_t   uf;
Line -... Line 206...
-
 
206
 
195
    ufile_t   uf;
207
    uf = load_file("/kolibrios/lib/libc.dll");
196
 
208
 
Line 197... Line 209...
197
    uf = load_file("/kolibrios/lib/libc.dll");
209
    raw_img   = uf.data;
Line 198... Line 210...
198
    raw_img   = uf.data;
210
    raw_size  = uf.size;
199
    raw_size  = uf.size;
211
 
200
 
212
 
201
    if(raw_img == NULL)
213
    if(raw_img == NULL)
202
        return NULL;
214
        return NULL;
Line 203... Line 215...
203
 
215