IRC Log Viewer » #firebreath » 2011-04-01

IRC Nick Time (GMT-7) Message
neilg_ 08:04 Morning all!
zEh- 08:04 !
kylehuff 08:04 good morning
(I hope)
zEh- 08:04 can't get a function that's been called from different threads to be executed FCFS
(windows)
critical section freezes
and mutex doesnt work
anyone?
waitforsingleobject "WAIT_TIMEOUTS"
no matter what
as long as it's not infinite, it'll time out
neilg_ 09:04 zEh-: I'm confused. What do you mean by you can't get a function that's been called from different threads to be executed?
zEh- 09:04 i need it to be like
the first call must be finished before the second one starts
neilg_ 09:04 Where is the function? Is it in C/C++ or JS?
zEh- 09:04 with waitforsingleobject
for exmaple
C++ win32
and the function is attached via detours
i have like
lock(); log << "a" << parameter << "b"; unlock();
in the middle of the logging the other thread function call happens
because i cant get it locked properly
with lock() i waitforsingleobject
neilg_ 09:04 Okay, sure. I now know what you want to do. I'm not sure if you can do that with detours - I know what detours is but not exactly how it works. Is there a mutex already existing that you can call? You'd need to initialise it outside of that fuction for it to work
zEh- 09:04 i can make an mutex, np
i had one, that didnt work either
ill put smth together
neilg_ 09:04 Sure... but is it initialized when you're using detours?
zEh- 09:04 to be sure how u mean that
neilg_ 09:04 That's my question :)
zEh- 09:04 i have an place for that, just before "attaching"/hooking
(it's done in dllmain proc_attach)
neilg_ 09:04 Huh. Okay, so it should be in the same process then... Hmm. Okay, I just wanted to be sure it wasn't something obvious like that. :) As I say, I've not used detours - I only know what it is!
zEh- 09:04 ye
u know what my prob could be?
so, what would u do? init a mutex before attaching, and waitforsingleobject(); stuff(); resetevent(); ?
neilg_ 09:04 Well, I think you might have to use a named mutex
zEh- 09:04 didnt do that
why?
neilg_ 09:04 Because I don't know whether the mutexes get initalized properly when using detours. But if you init a named mutex then it's system-wide and so you know it's going to exist.
It might not be that, it could be fine using detours - I just don't know
zEh- 09:04 but good idea
ill try that
zEh- 09:04 same problem.. it's like i have problems accessing const wchar* parameters
weird
sabotaged|wk 10:04 what do you use detours for?
zEh- 10:04 detouring createwindowexw to get it drawing to my plugin
sabotaged|wk 10:04 cross process drawing?
zEh- 10:04 plugin createprocesses that process
sabotaged|wk 10:04 ??
zEh- 10:04 plugin starts a process with dll, dll detours
want the process to draw to plugin window
instead of his own
its
sabotaged|wk 10:04 oh
why dont you just draw right to the plugin's hwnd from your new process
zEh- 10:04 it's a binary
sabotaged|wk 10:04 oh
so your detour createwindowex that the new process calls and return the plugin window?
zEh- 10:04 i want to do that
but i either have problems with handling multihreading or using LPCWSTR paramters
i dont get it, im not into debugging
xD
when i use waitforsingleobject+releasemutex the process freezes
taxilian 10:04 wait…
zEh- where are you using waitforsingleobject? is DllMain still in the stack?
zEh- 10:04 the detoured function uses it
i want the detourned function to do one call after the other
cross threaded
taxilian 10:04 I know nothing about detoured functions, but I do know that if you try to use mutexes in dllmain it will hang like that
zEh- 11:04 i create a mutex on dllmain on a global handle with a name, and open that mutex name in the detoured function
the global thingy didnt work
that's why im using a named mutex now
well but im not sure about the paramters the mutex creation needs
security attributes and params are strange
taxilian 11:04 well, I have never heard of a detoured function before today
but if your mutex is locking, then either you have a deadlock or you're trying to use it in a place where it's already serializing everything
maybe you don't need the mutex
sabotaged|wk 11:04 http://blogs.msdn.com/b/oleglv/archive/2003/10/24/56141.aspx
zEh- 11:04 ok, when i dont have it it kinda makes strange things with a log
i know the docu
sabotaged|wk 11:04 "things that should never, ever be done in DllMain"
zEh- 11:04 but still have probs
sabotaged|wk 11:04 "Locking of any kind. If you are trying to acquire a lock that is currently help by a thread that needs OS loader lock (which you may be holding), you'll deadlock. "
zEh- 11:04 i dont wait in the dllmain
i just create the mutex there
as an init point
i just have this place due to dll loading
sabotaged|wk 11:04 d
d
oops
zEh- 11:04 ?
god, i need that to be fixed
doing that for a few days now
sabotaged|wk 11:04 named mutex doesnt work?
zEh- 11:04 sec
well ok seems like i misenterpreted a crash that made me think i have probs with multithreading
actually i crash by using the LPCWSTR
neilg_ 11:04 How are you using it?
zEh- 11:04 even crash when i try this or wstring X; if(lpClassName != NULL) X = lpClassName;
-or
i dont access anything else after that.. still crashes
if i remove the if and the definition it doesnt
am i really too stupid to access a const wchar*?
sabotaged|wk 11:04 maybe its something to do with detours? accessing memory from the other process improperly? i have no idea how that works with detours
zEh- 11:04 actually the detoured function, even the whole dll is in the address space of that process
sabotaged|wk 11:04 i thought you said you called createprocess?
zEh- 11:04 yes, suspended, and then i inject an dll and resume
sabotaged|wk 11:04 oh
neilg_ 11:04 My guess is that the DLL is compiled with a different character set to yours
That could totally explain why the wchar stuff isn't working for you
zEh- 11:04 i try that
neilg_ 11:04 You're going to try it - or you have tried it?
zEh- 11:04 going
neilg_ 11:04 Then good luck!
zEh- 11:04 well
the data is get is wstring for sure
i know that from logging now
the data i get
..
zEh- 13:04 (windows) how to retreive the pluginwindowwin from outside via findwindow or smth?
windowclass doesnt seem to be the same on different browsers
sabotaged|wk 13:04 from a different process you can get the plugin's hwnd by using findWindow, after calling SetWindowText on the window with some identifier to look for
zEh- 13:04 ah good idea
thx
sabotaged|wk 13:04 or you could probably do it with SetWindowLong too
sabotaged|wk 14:04 anyone know if i can use CGLayer to draw for cocoa+coregraphics?
taxilian 14:04 sabotaged|wk: Nope
sure can't
you could draw offscreen and then blit, though
sabotaged|wk 15:04 for performance i guess?
taxilian 15:04 wait
sorry, I misread that
CGLayer; I'm not sure
I read GLLayer =]
you get a CGContext
and that's what you have to draw to
neilg_ 15:04 Hey Richard, quick question...
In common.sh - what does FB_ROOT_REL=${0%/*} do?
taxilian 15:04 neilg_: it gets the path to common.sh
relative to CWD
neilg_ 15:04 Oh. Then I have a much better way
taxilian 15:04 are you fixing our prep scripts??
neilg_ 15:04 Because that doesn't work in directories with spaces in them. Or, apparently, parentheses
Apparently so ;)
taxilian 15:04 huzzah! =]
hmm.. don't know why it wouldn't
strange
what do you guys think? http://forum.firebreath.org/
neilg_ 15:04 Apart from the German language it looks pretty good!
taxilian 15:04 lol., the german language would have to be your fault, my friend
it's in English on mine
neilg_ 15:04 I don't see how... I'm in the US running in US English in Chrome. Odd.
taxilian 15:04 very odd
neilg_ 15:04 Sure that's not because you're logged in and I'm not?
taxilian 15:04 oh, wait… no, at the bottom I have German too
wonder why
a few minutes ago it wasn't doing that...
neilg_: try now?
neilg_ 16:04 Sure
Ja, das ist gut!
;)
zEh-DC 16:04 xD
neilg_ 16:04 Looks good now
taxilian 16:04 neilg_: can you log in? (with your firebreath.org login)
neilg_ 16:04 Yes
I'd forgotten the password I'd used - but it works
taxilian 16:04 excelent
I like this shared authentication thing =]
I had to hack the forum a bit to no longer let you use it's password management stuff, but it seems to work okay
zEh- 16:04 u mean autocomplete?
xD
ah u mean it's own user database
:\
taxilian 16:04 yeah
registration, "forgot my password", etc
zEh- 16:04 xD
taxilian 16:04 I'm still not sure if this will be a good idea or not
but there are enough users on the mailing list that I think it makes sense to set up a forum
since this supports RSS feeds I can probably keep up with it that way
zEh- 17:04 does fb have some sort of fullscreen itself?
sabotaged|wk 17:04 pretty sure it doesnt
taxilian 17:04 zEh-: no
zEh- 17:04 and the pluginwindow cant be resized and topmosted?
taxilian 17:04 no
zEh- 17:04 k
taxilian 17:04 but you can make a new one
and draw in that
zEh- 17:04 yeye fine
taxilian 17:04 that's what we do for fullscreen
taxilian 17:04 stuartmorgan: are you around?
stuartmorgan 17:04 For a bit, yes
taxilian 17:04 in your understanding, should I or should I not do a retain on a NPObject before returning it as a result from NPN_Invoke?
stuartmorgan 17:04 No idea
I know almost nothing about JS/NPAPI bridging
taxilian 17:04 hmm. darn. so I'm trying to figure out FIREBREATH-3
FireBreathBot 17:04 FIREBREATH-3: Summary: Significant memory leak associated with javascript-mapped plugin function calls that return objects or arrays
FIREBREATH-3: Assigned To: richard
FIREBREATH-3: Priority: Major, Status: Open, http://jira.firebreath.org/browse/FIREBREATH-3
taxilian 17:04 as far as I can tell, we're doing everything we're supposed to
but it's leaking in all browsers
I do a retain before I pass objects back to the browser; if I don't, it crashes
very annoying =]
guess I'll have to start pulling down source code and see if I can figure out what the browser is doing
sabotaged|wk 17:04 sounds like fun
taxilian 17:04 oh, you know it
particularly the part where I wait for hours for the code to download
taxilian 17:04 huh. Firefox tells us not to call NPN_ methods from the wrong thread, but they still do atomic operations for the refcounts? weird
sabotaged|wk 18:04 sweet, valgrind for os x
wonder if this will be a pita to get working for plugin container processes
taxilian 20:04 sabotaged|wk: if you get it working, please let me know; I haven't been able to get valgrind working on OS X at all