So i made some hobby project in eagle only to find out that in 2016 i cannot print it in negative(for photoresist dry film). Well i do not have Adobe Post script editor, or gerber viewer. But i have more than 20years of windows programming experience...
How hard can it be to modify a program without source code for some feature that exist in all other similar apps. Well, its pretty simple - microsoft did everething to make it so.
I made a Detours dll wich hack inside eagle process and get things right.
How to use it,
1) we need withdll.exe its a part of microsoft detours (express version is free and limited to x86 u can get it there
https://www.microsoft.com/en-us/research/project/detours/ )
2) eaglecad_helper.dll with all the magic
3) we need to use withdll.exe to load that dll into eagle process. i doing that with shortcut like that
withdll.exe -d:eaglecad_helper.dll
"e:\elec\EAGLE-7.2.0\bin\eagle2.exe"where bold part is path to your eagle executable.
withdll.exe will run a new copy of eagle with dll injected and then if u print somethin it will come out in negative colors. If u need normal printing just restart eagle normaly.
Work good on my laser jet 1018 and canon ink printer mg5340, and some other. Should work with any eagle version but only 32bit build.
**********
Here is source code, so complicated that thay can not do it without my help:
__declspec(dllexport) int WINAPI MyEndPage(__in HDC hdc)
{
printInAction = 0;
PatBlt ( hdc, 0, 0, GetDeviceCaps ( hdc, HORZRES ), GetDeviceCaps ( hdc, VERTRES ), DSTINVERT );
return TrueEndPage(hdc);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)TrueEndPage, MyEndPage);
DetourTransactionCommit();
}
else if (ul_reason_for_call == DLL_PROCESS_DETACH)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)TrueEndPage, MyEndPage);
DetourTransactionCommit();
}
return TRUE;
}
PatBlt ( hdc, 0, 0, GetDeviceCaps ( hdc, HORZRES ), GetDeviceCaps ( hdc, VERTRES ), DSTINVERT );that part is doing actual work, 1 line of code. everething else is just detour hack sturtup code...
I attached compiled version and sources, u can build it with visual studio express.