Autor Beitrag
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Di 01.03.05 18:41 
ich habe folgenden code:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
library opengl32;

uses windows;

var oldglGetString : function (name: cardinal): PChar; stdcall;
    oldglAlphaFunc : procedure(func: cardinal; ref: single); stdcall;
    oldglBegin : procedure(mode: cardinal); stdcall;
    oldglBlendFunc : procedure(sfactor, dfactor: cardinal); stdcall;
    oldglClear : procedure(mask: cardinal); stdcall;
    oldglClearColor : procedure(red, green, blue, alpha: single); stdcall;
    oldglColor3bv : procedure(v: pbyte); stdcall;
    oldglColor3f : procedure(red, green, blue: single); stdcall;
    oldglColor3fv : procedure(v: psingle); stdcall;
    oldglColor3ubv : procedure(v: pbyte); stdcall;
    oldglColor4f : procedure(red, green, blue, alpha: single); stdcall;
    oldglColor4ub : procedure(red, green, blue, alpha: pbyte); stdcall;
    oldglCullFace : procedure(mode: cardinal); stdcall;
    oldglDepthFunc : procedure(func: cardinal); stdcall;
    oldglDepthMask : procedure(flag: boolean); stdcall;
    oldglDepthRange : procedure(zNear, zFar: double); stdcall;
    oldglDisable : procedure(cap: cardinal); stdcall;
    oldglEnable : procedure(cap: cardinal); stdcall;
    oldglEnd : procedurestdcall;
    oldglFrustum : procedure(left, right, bottom, top, zNear, zFar: double); stdcall;
    oldglGetFloatv : procedure(pname: cardinal; params: psingle); stdcall;
    oldglLoadIdentity : procedurestdcall;
    oldglLoadMatrixf : procedure(m: psingle); stdcall;
    oldglMatrixMode : procedure(mode: cardinal); stdcall;
    oldglNormal3f : procedure(nx, ny, nz: single); stdcall;
    oldglOrtho : procedure(left, right, bottom, top, zNear, zFar: double); stdcall;
    oldglPolygonMode : procedure(face, mode: cardinal); stdcall;
    oldglPopMatrix : procedurestdcall;
    oldglPushMatrix : procedurestdcall;
    oldglReadPixels : procedure(x,y: integer; width, height: integer; format, _type: cardinal; pixels: Pointer); stdcall;
    oldglRotatef : procedure(anolde, x,y,z: single); stdcall;
    oldglShadeModel : procedure(mode: cardinal); stdcall;
    oldglTexCoord2f : procedure(s,t: single); stdcall;
    oldglTexEnvf : procedure(target, pname: cardinal; param: single); stdcall;
    oldglTexImage2D : procedure(target: cardinal; level, components: integer; width, height: integer; border: integer; format, _type: cardinal; pixels: Pointer); stdcall;
    oldglTexParameterf : procedure(target, pname: cardinal; param: single); stdcall;
    oldglTranslatef : procedure(x,y,z: single); stdcall;
    oldglVertex2f : procedure(x,y: single); stdcall;
    oldglVertex3f : procedure(x,y,z: single); stdcall;
    oldglVertex3fv : procedure(v: psingle); stdcall;
    oldglViewport : procedure(x,y: integer; width, height: integer); stdcall;
    oldglDeleteTextures : procedure(n: integer; textures: pinteger); stdcall;
    oldglPolygonOffset : procedure(factor, bias: single); stdcall;
    oldglTexSubImage2D : procedure(target: cardinal; level, xoffset, yoffset: integer; width, height: integer; format, Atype: cardinal; pixels: Pointer); stdcall;

    oldwglDescribePixelFormat : function(DC: HDC; p2: Integer; p3: UINT; PFD: PPixelFormatDescriptor): Integer; stdcall;
    oldwglChoosePixelFormat : function(DC: HDC; p2: PPixelFormatDescriptor): Integer; stdcall;
    oldwglGetProcAddress : function(ProcName: PChar): Pointer; stdcall;
    oldwglSwapBuffers : function(DC: HDC): BOOL; stdcall;
    oldwglMakeCurrent : function(DC: HDC; p2: HGLRC): BOOL; stdcall;
    oldwglSetPixelFormat : function(DC: HDC; p2: Integer; p3: PPixelFormatDescriptor): BOOL; stdcall;
    oldwglCreateContext : function(DC: HDC): HGLRC; stdcall;
    oldwglDeleteContext : function(p1: HGLRC): BOOL; stdcall;


function glGetString (name: cardinal): PChar; stdcall;
begin
  result := oldglGetString (name);
end;

procedure glAlphaFunc (func: cardinal; ref: single); stdcall;
begin
  oldglAlphaFunc (func, ref);
end;

procedure glBegin (mode: cardinal); stdcall;
begin
  oldglBegin (mode);
end;

procedure glBlendFunc (sfactor, dfactor: cardinal); stdcall;
begin
  oldglBlendFunc (sfactor, dfactor);
end;

procedure glClear (mask: cardinal); stdcall;
begin
  oldglClear (mask);
end;

procedure glClearColor (red, green, blue, alpha: single); stdcall;
begin
  oldglClearColor (red, green, blue, alpha);
end;

procedure glColor3bv (v: pbyte); stdcall;
begin
  oldglColor3bv (v);
end;

procedure glColor3f (red, green, blue: single); stdcall;
begin
  oldglColor3f (red, green, blue);
end;

procedure glColor3fv (v: psingle); stdcall;
begin
  oldglColor3fv (v);
end;

procedure glColor3ubv (v: pbyte); stdcall;
begin
  oldglColor3ubv (v);
end;

procedure glColor4f (red, green, blue, alpha: single); stdcall;
begin
  oldglColor4f (red, green, blue, alpha);
end;

procedure glColor4ub (red, green, blue, alpha: pbyte); stdcall;
begin
  oldglColor4ub (red, green, blue, alpha);
end;

procedure glCullFace (mode: cardinal); stdcall;
begin
  oldglCullFace (mode);
end;

procedure glDepthFunc (func: cardinal); stdcall;
begin
  oldglDepthFunc (func);
end;

procedure glDepthMask (flag: boolean); stdcall;
begin
  oldglDepthMask (flag);
end;

procedure glDepthRange (zNear, zFar: double); stdcall;
begin
  oldglDepthRange (zNear, zFar);
end;

procedure glDisable (cap: cardinal); stdcall;
begin
  oldglDisable (cap);
end;

procedure glEnable (cap: cardinal); stdcall;
begin
  oldglEnable (cap);
end;

procedure glEnd; stdcall;
begin
  oldglEnd;
end;

procedure glFrustum (left, right, bottom, top, zNear, zFar: double); stdcall;
begin
  oldglFrustum(left, right, bottom, top, zNear, zFar);
end;

procedure glGetFloatv (pname: cardinal; params: psingle); stdcall;
begin
  oldglGetFloatv (pname, params);
end;

procedure glLoadIdentity; stdcall;
begin
  oldglLoadIdentity;
end;

procedure glLoadMatrixf (m: psingle); stdcall;
begin
  oldglLoadMatrixf (m);
end;

procedure glMatrixMode (mode: cardinal); stdcall;
begin
  oldglMatrixMode (mode);
end;

procedure glNormal3f (nx, ny, nz: single); stdcall;
begin
  oldglNormal3f (nx, ny, nz);
end;

procedure glOrtho (left, right, bottom, top, zNear, zFar: double); stdcall;
begin
  oldglOrtho (left, right, bottom, top, zNear, zFar);
end;

procedure glPolygonMode (face, mode: cardinal); stdcall;
begin
  oldglPolygonMode (face, mode);
end;

procedure glPopMatrix; stdcall;
begin
  oldglPopMatrix;
end;

procedure glPushMatrix; stdcall;
begin
  oldglPushMatrix;
end;

procedure glReadPixels (x,y: integer; width, height: integer; format, _type: cardinal; pixels: Pointer); stdcall;
begin
  oldglReadPixels (x, y, width, height, format, _type, pixels);
end;

procedure glRotatef (angle, x,y,z: single); stdcall;
begin
  oldglRotatef (angle, x,y,z);
end;

procedure glShadeModel (mode: cardinal); stdcall;
begin
  oldglShadeModel (mode);
end;

procedure glTexCoord2f (s,t: single); stdcall;
begin
  oldglTexCoord2f (s,t);
end;

procedure glTexEnvf (target, pname: cardinal; param: single); stdcall;
begin
  oldglTexEnvf (target, pname, param);
end;

procedure glTexImage2D (target: cardinal; level, components: integer; width, height: integer; border: integer; format, _type: cardinal; pixels: Pointer); stdcall;
begin
  oldglTexImage2D (target, level, components, width, height, border, format, _type, pixels);
end;

procedure glTexParameterf (target, pname: cardinal; param: single); stdcall;
begin
  oldglTexParameterf (target, pname, param);
end;

procedure glTranslatef (x,y,z: single); stdcall;
begin
  oldglTranslatef (x,y,z);
end;

procedure glVertex2f (x,y: single); stdcall;
begin
  oldglVertex2f (x,y);
end;

procedure glVertex3f (x,y,z: single); stdcall;
begin
  oldglVertex3f (x,y,z);
end;

procedure glVertex3fv (v: psingle); stdcall;
begin
  oldglVertex3fv (v);
end;

procedure glViewport (x,y: integer; width, height: integer); stdcall;
begin
  oldglViewport (x,y, width, height);
end;

procedure glDeleteTextures (n: integer; textures: pinteger); stdcall;
begin
  oldglDeleteTextures (n, textures);
end;

procedure glPolygonOffset (factor, bias: single); stdcall;
begin
  oldglPolygonOffset (factor, bias);
end;

procedure glTexSubImage2D (target: cardinal; level, xoffset, yoffset: integer; width, height: integer; format, Atype: cardinal; pixels: Pointer); stdcall;
begin
  oldglTexSubImage2D (target, level, xoffset, yoffset, width, height, format, Atype, pixels);
end;


function wglDescribePixelFormat (DC: HDC; p2: Integer; p3: UINT; PFD: PPixelFormatDescriptor): Integer; stdcall;
begin
  result := oldwglDescribePixelFormat (DC, p2, p3, PFD);
end;

function wglChoosePixelFormat (DC: HDC; p2: PPixelFormatDescriptor): Integer; stdcall;
begin
  result := oldwglChoosePixelFormat (DC, p2);
end;

function wglGetProcAddress (ProcName: PChar): Pointer; stdcall;
begin
  result := oldwglGetProcAddress (ProcName);
end;

function wglSwapBuffers (DC: HDC): BOOL; stdcall;
begin
  result := oldwglSwapBuffers (DC);
end;

function wglMakeCurrent (DC: HDC; p2: HGLRC): BOOL; stdcall;
begin
  result := oldwglMakeCurrent (DC, p2);
end;

function wglSetPixelFormat (DC: HDC; p2: Integer; p3: PPixelFormatDescriptor): BOOL; stdcall;
begin
  result := oldwglSetPixelFormat (DC, p2, p3);
end;

function wglCreateContext (DC: HDC): HGLRC; stdcall;
begin
  result := oldwglCreateContext (DC);
end;

function wglDeleteContext(p1: HGLRC): BOOL; stdcall;
begin
  result := oldwglDeleteContext(p1);
end;


exports
    glGetString,
    glAlphaFunc,
    glBegin,
    glBlendFunc,
    glClear,
    glClearColor,
    glColor3bv,
    glColor3f,
    glColor3fv,
    glColor3ubv,
    glColor4f,
    glColor4ub,
    glCullFace,
    glDepthFunc,
    glDepthMask,
    glDepthRange,
    glDisable,
    glEnable,
    glEnd,
    glFrustum,
    glGetFloatv,
    glLoadIdentity,
    glLoadMatrixf,
    glMatrixMode,
    glNormal3f,
    glOrtho,
    glPolygonMode,
    glPopMatrix,
    glPushMatrix,
    glReadPixels,
    glRotatef,
    glShadeModel,
    glTexCoord2f,
    glTexEnvf,
    glTexImage2D,
    glTexParameterf,
    glTranslatef,
    glVertex2f,
    glVertex3f,
    glVertex3fv,
    glViewport,
    glDeleteTextures,
    glPolygonOffset,
    glTexSubImage2D,

    wglDescribePixelFormat,
    wglChoosePixelFormat,
    wglGetProcAddress,
    wglSwapBuffers,
    wglMakeCurrent,
    wglSetPixelFormat,
    wglCreateContext,
    wglDeleteContext;

procedure DLLMain(dwReason: cardinal);
var oglh: integer;
begin
  case dwReason of
    DLL_PROCESS_ATTACH:
    begin
      Set8087CW($133F);
      oglh := LoadLibraryA('C:\windows\system32\opengl32.dll');

      @oldglGetString := GetProcAddress(oglh,'glGetString');
      @oldglAlphaFunc := GetProcAddress(oglh,'glAlphaFunc');
      @oldglBegin := GetProcAddress(oglh,'glBegin');
      @oldglBlendFunc := GetProcAddress(oglh,'glBlendFunc');
      @oldglClear := GetProcAddress(oglh,'glClear');
      @oldglClearColor := GetProcAddress(oglh,'glClearColor');
      @oldglColor3bv := GetProcAddress(oglh,'glColor3bv');
      @oldglColor3f := GetProcAddress(oglh,'glColor3f');
      @oldglColor3fv := GetProcAddress(oglh,'glColor3fv');
      @oldglColor3ubv := GetProcAddress(oglh,'glColor3ubv');
      @oldglColor4f := GetProcAddress(oglh,'glColor4f');
      @oldglColor4ub := GetProcAddress(oglh,'glColor4ub');
      @oldglCullFace := GetProcAddress(oglh,'glCullFace');
      @oldglDepthFunc := GetProcAddress(oglh,'glDepthFunc');
      @oldglDepthMask := GetProcAddress(oglh,'glDepthMask');
      @oldglDepthRange := GetProcAddress(oglh,'glDepthRange');
      @oldglDisable := GetProcAddress(oglh,'glDisable');
      @oldglEnable := GetProcAddress(oglh,'glEnable');
      @oldglEnd := GetProcAddress(oglh,'glEnd');
      @oldglFrustum := GetProcAddress(oglh,'glFrustum');
      @oldglGetFloatv := GetProcAddress(oglh,'glGetFloatv');
      @oldglLoadIdentity := GetProcAddress(oglh,'glLoadIdentity');
      @oldglLoadMatrixf := GetProcAddress(oglh,'glLoadMatrixf');
      @oldglMatrixMode := GetProcAddress(oglh,'glMatrixMode');
      @oldglNormal3f := GetProcAddress(oglh,'glNormal3f');
      @oldglOrtho := GetProcAddress(oglh,'glOrtho');
      @oldglPolygonMode := GetProcAddress(oglh,'glPolygonMode');
      @oldglPopMatrix := GetProcAddress(oglh,'glPopMatrix');
      @oldglPushMatrix := GetProcAddress(oglh,'glPushMatrix');
      @oldglReadPixels := GetProcAddress(oglh,'glReadPixels');
      @oldglRotatef := GetProcAddress(oglh,'glRotatef');
      @oldglShadeModel := GetProcAddress(oglh,'glShadeModel');
      @oldglTexCoord2f := GetProcAddress(oglh,'glTexCoord2f');
      @oldglTexEnvf := GetProcAddress(oglh,'glTexEnvf');
      @oldglTexImage2D := GetProcAddress(oglh,'glTexImage2D');
      @oldglTexParameterf := GetProcAddress(oglh,'glTexParameterf');
      @oldglTranslatef := GetProcAddress(oglh,'glTranslatef');
      @oldglVertex2f := GetProcAddress(oglh,'glVertex2f');
      @oldglVertex3f := GetProcAddress(oglh,'glVertex3f');
      @oldglVertex3fv := GetProcAddress(oglh,'glVertex3fv');
      @oldglViewport := GetProcAddress(oglh,'glViewport');
      @oldglDeleteTextures := GetProcAddress(oglh,'glDeleteTextures');
      @oldglPolygonOffset := GetProcAddress(oglh,'glPolygonOffset');
      @oldglTexSubImage2D := GetProcAddress(oglh,'glTexSubImage2D');

      @oldwglDescribePixelFormat := GetProcAddress(oglh,'wglDescribePixelFormat');
      @oldwglChoosePixelFormat := GetProcAddress(oglh,'wglChoosePixelFormat');
      @oldwglGetProcAddress := GetProcAddress(oglh,'wglGetProcAddress');
      @oldwglSwapBuffers := GetProcAddress(oglh,'wglSwapBuffers');
      @oldwglMakeCurrent := GetProcAddress(oglh,'wglMakeCurrent');
      @oldwglSetPixelFormat := GetProcAddress(oglh,'wglSetPixelFormat');
      @oldwglCreateContext := GetProcAddress(oglh,'wglCreateContext');
      @oldwglDeleteContext := GetProcAddress(oglh,'wglDeleteContext');
    end;

    DLL_PROCESS_DETACH:
    begin
    end;

    DLL_THREAD_ATTACH:
    begin
    end;

    DLL_THREAD_DETACH:
    begin
    end;
  end;
end;

begin
  DllProc := @DllMain;
  DllMain(DLL_PROCESS_ATTACH);
end.


meine DLL heißt 'opengl32.dll' und ist in nem ordner von einem Spiel wo auch die EXE des spiels liegt
das spiel ruft meine dll mit LoadLibrary('opengl32.dll') auf

meine dll lädt nun bei DLL_PROCESS_ATTACH

die originale dll mit LoadLibrary('C:\windows\system32\opengl32.dll'); doch da crashed es

ntdll.LdrLoadDll lädt ja die dll, und es kommt der fehler das eine export funktion nicht vorhanden ist
glEvalMesh1, die ist JEDOCH in der opengl32.dll im systemorder vorhanden NICHT aber in meiner dll

die ntdll SOLL die opengl32.dll ausm systemornder laden (macht das auch halb, bis es die exports prüft) die werden aber in meiner
dll gesucht (wo sie nicht vorhanden sind, in der vom system32 order aber schon)

sieht für mich wie ein bug aus ;>
vill kennt jemand nen fix
uall@ogc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mi 02.03.05 16:47 
habs gelöst musste ne neue funktion schreiben:

www.arschvoll.net/fo...adlibraryworking.JPG

es wird eine DLL geladen egal ob sie schon im speicher ist :)