Welcome Guest.   Make a donation to an author on the site April 24, 2014, 06:22:56 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2010! Download 24 custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: Prev 1 2 3 [4] 5 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Locate32 Plugin for FARR by Okke  (Read 60733 times)
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #75 on: December 28, 2007, 07:34:19 PM »

Yes, as PlatformSDK states, WriteConsole will fail when used with redirection... so that's no good. If you redirect file, GetStdHandle() returns a file handle, so things should work fine. I think/hope notepad fails because the file lacks a BOM marker, but I'll do some testing, also of the code from the blog...

At the plugin side, I guess it comes down to whether you want to parse utf-8 or use ucs-16 directly. For locate, it's probably some printf calls that need to be changed to more specific code.
Logged

- carpe noctem
jmj
Charter Member
***
Posts: 42


Author of Locate32

View Profile WWW Give some DonationCredits to this forum member
« Reply #76 on: December 29, 2007, 03:17:13 AM »

Ok, it seems that unicode characters do not work even in console. It worked when I tested before, but probable
used copepage was valid for those charactes (those was cyrillic or chinese alphapets, now I tested random characters).


So what all I should do to get it work like you want? Atm locate.exe uses wprintf
Logged
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #77 on: December 29, 2007, 04:51:09 AM »

Ok, it seems that unicode characters do not work even in console. It worked when I tested before, but probable
used copepage was valid for those charactes (those was cyrillic or chinese alphapets, now I tested random characters).
Hm, it did work for my test, but all I used was some russian text. I did have to choose a non-raster font for the console, though. My codepage is 850, I doubt cyrillic characters are valid in that codepage?

So what all I should do to get it work like you want? Atm locate.exe uses wprintf
I guess we should take a look at the CRT implementation of wprinf (source comes with visual studio) and see how they handle it... but it breaks down to using WriteConsoleW for consoles, and WriteFile (possibly with wide->multibyte translation) for redirected stdout. If VS CRT doesn't do it this way, it means writing your own little printf. But since it's only really necessary for printing out the file paths, you can do without formatting specifiers etc.

Perhaps I ought to access the repository and actually DO something smiley
Logged

- carpe noctem
jmj
Charter Member
***
Posts: 42


Author of Locate32

View Profile WWW Give some DonationCredits to this forum member
« Reply #78 on: December 29, 2007, 05:25:41 AM »

It's not necessary to use wsprintf, until it's something which works.

You can try to fix it if you wish. If you haven't noticed, new address for the repository is http://svn.locate32.net/locate32. The repository can be read by anyone and your old password should work for writing.
Logged
Armando
Charter Member
***
Posts: 2,666



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #79 on: December 29, 2007, 12:44:51 PM »

Armando: I'm using locate 3.0 build 7.12260, from the x64 build.

Thanks. so you in the x64 world...

So where does the cure for diacritics lies ?  smiley
Logged

"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #80 on: December 29, 2007, 12:54:53 PM »

It's not necessary to use wsprintf, until it's something which works.

You can try to fix it if you wish. If you haven't noticed, new address for the repository is http://svn.locate32.net/locate32. The repository can be read by anyone and your old password should work for writing.
Yeah, works, just checked out source from repo.

I'm having trouble building it though, but I guess building your foundation-class-thingy library and adding it to %INCLUDE and %LIBS will fix that smiley
Logged

- carpe noctem
jmj
Charter Member
***
Posts: 42


Author of Locate32

View Profile WWW Give some DonationCredits to this forum member
« Reply #81 on: December 29, 2007, 01:16:28 PM »

f0dder: I sent you an email.
Logged
Armando
Charter Member
***
Posts: 2,666



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #82 on: December 29, 2007, 01:25:30 PM »

I mentioned some problems with diacritics and farr in the past (and I think it's been added to the official bug list):

http://www.donationcoder....c=10505.msg82218#msg82218

concerning the locate32 plugin, I'm having other problems, like trying to find filenames when they include characters like _ +

Here are some screenshots (the ! in the farr entry field is just my locate 32 trigger... faster than to write "loc").

I was looking for a gtd diagram. So i typed : ! gtd
And this what I got.




But what I was really looking for is



I tried different combinations, and it seems like certain characters (_ + and others) just completely messes the search.

Also, if I write __ __ without the locate plugin here's what farr displays



And with the locate plugin :



note that my locate plug-in is set to display 39 results and not 26, so this is not the problem here. But there might be a syntax problem that I'm not getting... does someone know what's happening ?

Okke ?
« Last Edit: December 29, 2007, 01:30:03 PM by Armando » Logged

"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
losiek
Participant
*
Posts: 6

View Profile Give some DonationCredits to this forum member
« Reply #83 on: December 29, 2007, 04:07:48 PM »

I'm having trouble building it though, but I guess building your foundation-class-thingy library and adding it to %INCLUDE and %LIBS will fix that smiley
If you still have problems with compling this - download source from this page: http://locate32.net/content/view/20/33/. It has necessary 3rd party libs and headers needed for compilation.
I played a little with writing results to a file and I finally forced locate to write in full Unicode:) But I'm rather inexperienced programmer and I used some dirty tricks to achieve that.
Maybe someone in the future will write a plug-in that gets results directly from Locate database;) On the other hand - we *just* have to wait until FARR will have built-in indexing. That will make this plug-in unnecessary... to beautiful to be real. Wink

EDIT:
I'm soo lame :/ (or maybe Windows is?) In order to write wide characters correctly file need to be opened in binary mode. Then fwprintf works perfectly. No dirty hacks are needed.
« Last Edit: December 29, 2007, 04:55:32 PM by losiek » Logged
mouser
First Author
Administrator
*****
Posts: 32,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #84 on: December 29, 2007, 05:06:17 PM »

Quote
Maybe someone in the future will write a plug-in that gets results directly from Locate database;

i think that this would be a great idea.. since the locate source code is available, it could be done and would bring indexed searching directly into FARR. if the plugin is written in C++ i could even incorporate the code into the main FARR codebase.
Logged
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #85 on: December 29, 2007, 05:46:28 PM »

losiek: hm, perhaps fwprintf internally detects between console/redirect and chooses the appropriate WriteConsoleW/WriteFile API? Remember, for locate.exe, we ideally want to support unicode both when used from a command prompt and when redirected to a pipe (the FARR plugin).

Dunno if writing a separate plugin directly accessing the locate databases would be that much of an advantage over piping locate.exe, once the unicode issue is fixed...
Logged

- carpe noctem
mouser
First Author
Administrator
*****
Posts: 32,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #86 on: December 29, 2007, 05:52:27 PM »

Quote
Dunno if writing a separate plugin directly accessing the locate databases would be that much of an advantage over piping locate.exe

sure it would, and it would let you:
1) avoid the startup overhead each time you did a search
2) be able to search on the fly as you type
Logged
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #87 on: December 29, 2007, 05:59:54 PM »

startup overhead is very very very small for locate.exe. You know how I usually bitch a lot about those matters where other people don't care smiley, and I don't feel any problems with the current method, even though locate.exe weighs in at a whopping 333kb here.

Search on the fly as you type, that's already being done with the plugin right now, although it could perhaps run slightly more efficient with a "full" plugin.
Logged

- carpe noctem
Armando
Charter Member
***
Posts: 2,666



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #88 on: December 29, 2007, 07:11:27 PM »

BTW, anybody can help me with the issue mentioned in reply 82 (http://www.donationcoder....c=10501.msg93405#msg93405)
Logged

"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
losiek
Participant
*
Posts: 6

View Profile Give some DonationCredits to this forum member
« Reply #89 on: December 29, 2007, 08:15:55 PM »

f0dder:
OK, so everything I know at the moment:
1. Console in Windows XP can produce full Unicode output but only for displaying. Piping and redirecting is unsupported so it's useless for us.
2. Standard printing functions like wprintf (used in locate.exe) uses built-in WideCharToMultibyte conversion (to DOS codepage in my case), so polish letters have wrong hexcodes in normal windows.
3. I'm able to write raw Unicode to console (swprintf+WriteFile, without widechar->codepage conversion) - when displaying it look like there are spaces between all letters, but after redirecting to a file it works like a charm (even without BOM smiley ).

So everything we need now is widechar implementation of Locate plug-in. I don't have Delphi so I can't play with that Sad Anybody have seen Okke recently? Maybe you have enough time to make plug-in with integrated Locate smiley

Armando:
I think it's unresolvable at the moment. We have to wait for fixes or full Unicode version of this plug-in.
« Last Edit: December 29, 2007, 08:17:51 PM by losiek » Logged
Armando
Charter Member
***
Posts: 2,666



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #90 on: December 29, 2007, 09:06:13 PM »

So you think that characters like "_" or "+" affect the search because of incomplete Unicode compatibility ?
Logged

"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
jmj
Charter Member
***
Posts: 42


Author of Locate32

View Profile WWW Give some DonationCredits to this forum member
« Reply #91 on: December 30, 2007, 01:08:27 AM »

f0dder:
OK, so everything I know at the moment:
1. Console in Windows XP can produce full Unicode output but only for displaying. Piping and redirecting is unsupported so it's useless for us.
2. Standard printing functions like wprintf (used in locate.exe) uses built-in WideCharToMultibyte conversion (to DOS codepage in my case), so polish letters have wrong hexcodes in normal windows.
3. I'm able to write raw Unicode to console (swprintf+WriteFile, without widechar->codepage conversion) - when displaying it look like there are spaces between all letters, but after redirecting to a file it works like a charm (even without BOM smiley ).

So locate.exe could be changed to use WriteConsole (if not redirected) and add e.g. '-w' command line argument to use WriteFile and Unicode character set. Then plugin could use that.

But does f0dder want to work with this or do I make required changes?
Logged
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #92 on: December 30, 2007, 06:09:43 AM »

jmj: I want to play around with it a bit, as soon as I get the thing fully building Wink. Is the filename output done exclusively from the two callback functions?

losiek: things are a bit different than that smiley. WriteConsole can write unicode characters because internally there's two versions of it: *A and *W, one for ansi and one for wide/unicode. WriteFile doesn't have ansi/unicode versions, and simply writes to the target device. There's no way for the console device to know what format it receives from WriteFile, so it opts to only support MultiByte...

There shouldn't be any problem using raw WriteFile when you detect output has been redirected. Or well, THE problem is that you're not outputting a BOM marker, which will confuse e.g. notepad, and that some apps might not be prepared to handle unicode text. The best is probably to convert to UTF-8 when output is redirected...
Logged

- carpe noctem
jmj
Charter Member
***
Posts: 42


Author of Locate32

View Profile WWW Give some DonationCredits to this forum member
« Reply #93 on: December 30, 2007, 06:50:49 AM »

jmj: I want to play around with it a bit, as soon as I get the thing fully building Wink. Is the filename output done exclusively from the two callback functions?

Yes. The another is for filenames using ANSI, so you don't need to change that (unless you wish it).
Logged
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #94 on: December 30, 2007, 06:59:45 AM »

ANSI output should probably be left as-is; I dunno if WriteConsole has any advantage over WriteFile except for being able to output unicode properly to the console. Sure, probably less conversion layers to go through than WriteFile, but I doubt it's anything measurable.

Need to do some final pre-newyear shopping now, will look at code when I get home.
Logged

- carpe noctem
losiek
Participant
*
Posts: 6

View Profile Give some DonationCredits to this forum member
« Reply #95 on: December 30, 2007, 02:19:22 PM »

Armando:
No, I don't think that yours bugs are caused directly by lack of Unicode support, but I think that they're related. It seems that your bug work very similar to my ' (accent) bug. Can you check Location column in "loc +" results? Are there two (or more) paths for one file?

f0dder:
OK, so everybody is waiting now for your Unicode plug-in. Let's hope it will resolve other bugs also smiley Good luck.
Logged
Armando
Charter Member
***
Posts: 2,666



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #96 on: December 30, 2007, 04:46:43 PM »

Thanks losiek. I'll try that latter.
BTW... Where's Okke ?
Logged

"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #97 on: December 30, 2007, 04:54:25 PM »

Okay, with a bunch of help from jmj, I managed to build locate... took a bit of effort, it's a semi-large and semi-complex project, also regarding library dependencies and such smiley

Hacking up locate.exe to user either WriteConsoleW or WriteFile was easy, and I now have a version that does proper unicode output on console, and UTF-8 output when redirected, seems to work fine. The following screenshot shows what standard locate.exe outputs, and then what my quick hack outputs. Note that you need to set your console to use a non-raster font for this to work!



Note that there's no reason for me to release this new executable before Okke implements UTF-8 support, since you'll get pretty garbled output with the current plugin version smiley



In case anyone is wondering what the text is, it's just snippets from a russian article I found about fSekrit, seemed fitting to use when I was testing unicode support in fSekrit, and it's the best unicode test snippet I have at all, since I know none of those characters are available in my own codepage smiley
« Last Edit: December 30, 2007, 04:57:20 PM by f0dder » Logged

- carpe noctem
Armando
Charter Member
***
Posts: 2,666



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #98 on: December 30, 2007, 06:25:27 PM »

Nice work f0dder.
Any news from Okke?
Logged

"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #99 on: December 30, 2007, 07:28:35 PM »

I guess I could reverse-engineer Okke's DLL and make it support the utf-8/unicode locate hack, I've already located the "spawn child process and grab output", which is referenced three times, but Delphi code is so naaaasty to deal with smiley

EDIT: downloaded the FARR SDK, and realized the locate32 plugin source code is there, woo-hoo smiley. The plugin will need some updating (should be simple though), but it seems that FARR itself needs a bunch of updates to handle unicode. Working with mouser on the issue right now.
« Last Edit: December 30, 2007, 09:54:37 PM by f0dder » Logged

- carpe noctem
Pages: Prev 1 2 3 [4] 5 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.042s | Server load: 0.11 ]