1. TridLoadDefsPack() creates a 0-byte TrIDDefs.trd if the file doesn't exist already in the proper folder. Why is this? Is it the fault of the library itself, or something to do with the script?
2) You've mentioned on the Wiki page for this script that "At the moment works only on ANSI filenames (non Unicode)." Why is this? I see that in Delphi we have Char, String (both ANSI), WideChar, WideString (both Unicode), PChar, PString (pointers to ANSI strings), PWideChar and PWideString (pointers to Unicode strings). But in PascalScript (according to the Types Wiki page) we only have Char, String, WideChar, WideString and PChar. Is the lack of Unicode support a fault of the library itself, or something to do with PascalScript not supporting PString, PWideChar and PWideString? Also, any reason why these are missing from PascalScript?
-----
{ TrID Script v6 }
// v1 - Original script by Denis
// v2 - Modified by Andrew to output lowercase extensions and detect presence of TrIDLib.dll and TrIDDefs.trd
// v3 - Modified by Andrew to keep existing extensions if not identified properly
// v4 - Modified by Andrew to display multiple possible extensions
// v5 - Modified by Andrew to display multiple possible extensions with cutoff of 20%
// v6 - Modified by Andrew to fix a path-related issue
// Important: Download http://mark0.net/download/tridlib-free.zip and http://mark0.net/download/triddefs.zip,
// then extract TrIDLib.dll and TrIDDefs.trd to ReNamer.exe's folder/directory or else the script will fail
// TrID DLL exported functions
function TridLoadDefsPack(szPath: PChar): Integer;
external 'TrID_LoadDefsPack@TrIDLib.dll stdcall';
function TridSubmitFileA(szFileName: PChar): Integer;
external 'TrID_SubmitFileA@TrIDLib.dll stdcall';
function TridAnalyze: Integer;
external 'TrID_Analyze@TrIDLib.dll stdcall';
function TridGetInfo(lInfoType: Integer; lInfoIdx: Integer; sBuf: PChar): Integer;
external 'TrID_GetInfo@TrIDLib.dll stdcall';
// Constants for TrID_GetInfo etc.
const
TRID_GET_RES_NUM = 1; // Get the number of results
TRID_GET_RES_FILEEXT = 3; // Filetype extension
TRID_GET_RES_POINTS = 4; // Matching points
TRID_GET_RES_CUTOFF = 20; // Cutoff percentage for results
function GetExtensions(): WideString;
var
Str1, Str2: String;
I, NumRes, NumPts, TotPts: Integer;
begin
Result := '';
SetLength(Str1, 100);
NumRes := TridGetInfo(TRID_GET_RES_NUM, 0, PChar(Str1));
if (NumRes > 0) then
begin
for I := 1 to NumRes do
TotPts := TotPts + TridGetInfo(TRID_GET_RES_POINTS, I, PChar(Str1));
for I := 1 to NumRes do
begin
NumPts := TridGetInfo(TRID_GET_RES_POINTS, I, PChar(Str1));
if ((NumPts*100/TotPts) > TRID_GET_RES_CUTOFF) then
begin
TridGetInfo(TRID_GET_RES_FILEEXT, I, PChar(Str1));
Str2 := LowerCase(String(PChar(Str1)));
if (Length(Str2)>0) And (Pos(Str2, Result)=0) then
begin
if (I > 1) then Result := Result + '/';
Result := Result + Str2;
end;
end;
end;
end;
end;
var
Initialized: Boolean;
AppPath, FileExts: WideString;
begin
if (not Initialized) then
begin
Initialized := True;
AppPath := WideExtractFilePath(GetApplicationPath());
if (TridLoadDefsPack(AppPath) = 0) then
begin
WideDeleteFile(AppPath + 'TrIDDefs.trd');
if (DialogYesNo('Error! TrIDDefs.trd not found in the program directory (' + AppPath + ')!'
+ #13#10#13#10 + 'Do you want to download the latest version from the TrID website now?')) then
ShellOpenFile('http://mark0.net/soft-trid-e.html');
Exit;
end;
end;
if (TridSubmitFileA(PChar(FilePath)) <> 0) then
begin
if (TridAnalyze <> 0) then
begin
FileExts := GetExtensions();
if (Length(FileExts) > 0) then
FileName := WideStripExtension(FileName) + '.' + FileExts;
end;
end;
end.
-----
EDIT: Changed the function used for stripping the extension to WideStripExtension. Also, published on the wiki: wiki/ReNamer:Scripts:TrID
]]>1) I would suggest you to use:
Path := WideExtractFilePath(GetApplicationPath());
Instead of:
Path := WideReplaceText(GetApplicationPath(), 'ReNamer.exe', '');
2) Also, that line should go into the initialization section instead of being called for every processed files, unless it is used anywhere else.
3) You can also remove any checking against "TrIDLib.dll" library (redundant). Your script will never actually execute if the DLL is not found.
]]>[Script deleted, see below for latest version.]
Denis' earlier script was displaying only the top-most extension, i.e. the 1st one returned with max. probability attached. Since you requested that all possible extensions should be shown and the user given a choice, I modified the script accordingly. Of course, now it shows all extensions even down to absurd ones with very low probability.
.
.
...but for you with the next script I can provide a single line of code that will solve your problem.
.
.
P.S. Additional fix for eR@SeR :
Nice work around. For now, everything seems OK. If I notice something unclear or have any questions I'll get you notice. Thanks for mpg script line
Last but not least, let me say that when we improve TrID's library, then the highest probabilities will rise to the top and override the others. So that's the reason why I plan to keep submitting new definitions. Also, the more files we run it on, the better a definition will be naturally.
Once again thank you for your effort and persistence in creating these scripts. Keep going to achieve better detectons for TrID database and scripts too if possible off course!
]]>{ TrID Script v5 }
// v1 - Original script by Denis
// v2 - Modified by Andrew to output lowercase extensions and detect presence of TrIDLib.dll and TrIDDefs.trd
// v3 - Modified by Andrew to keep existing extensions if not identified properly
// v4 - Modified by Andrew to display multiple possible extensions
// v5 - Modified by Andrew to display multiple possible extensions with cutoff of 20%
// TrID DLL exported functions
function TridAnalyze: Integer;
external 'TrID_Analyze@TrIDLib.dll stdcall';
function TridSubmitFileA(szFileName: PChar): Integer;
external 'TrID_SubmitFileA@TrIDLib.dll stdcall';
function TridLoadDefsPack(szPath: PChar): Integer;
external 'TrID_LoadDefsPack@TrIDLib.dll stdcall';
function TridGetInfo(lInfoType: Integer; lInfoIdx: Integer; sBuf: PChar): Integer;
external 'TrID_GetInfo@TrIDLib.dll stdcall';
// Constants for TrID_GetInfo
const
TRID_GET_RES_NUM = 1; // Get the number of results available
TRID_GET_RES_FILEEXT = 3; // Filetype extension
TRID_GET_RES_POINTS = 4; // Matching points
function GetExtensions(): String;
var
Str1, Str2: String;
I, NumRes, NumPts, TotPts: Integer;
begin
Result := '';
SetLength(Str1, 100);
NumRes := TridGetInfo(TRID_GET_RES_NUM, 0, PChar(Str1));
if (NumRes > 0) then
begin
for I := 1 to NumRes do
TotPts := TotPts + TridGetInfo(TRID_GET_RES_POINTS, I, PChar(Str1));
for I := 1 to NumRes do
begin
NumPts := TridGetInfo(TRID_GET_RES_POINTS, I, PChar(Str1));
if ((NumPts*100/TotPts) > 20) then
begin
TridGetInfo(TRID_GET_RES_FILEEXT, I, PChar(Str1));
Str2 := LowerCase(String(PChar(Str1)));
if (Length(Str2)>0) And (Pos(Str2, Result)=0) then
begin
if (I > 1) then Result := Result + '/';
Result := Result + Str2;
end;
end;
end;
end;
end;
var
Exts: String;
Initialized, FileErr: Boolean;
begin
if (not Initialized) then
begin
if (not WideFileExists('TrIDLib.dll')) Or (WideFileSize('TrIDLib.dll')=0)
Or (not WideFileExists('TrIDDefs.trd')) Or (WideFileSize('TrIDDefs.trd')=0) then
begin
if (DialogYesNo('Error! TrIDLib.dll and/or TrIDDefs.trd not found in the program directory!'
+ #13#10#13#10 + 'Do you want to download the latest versions from the TrID website now?')) then
ShellOpenFile('http://mark0.net/soft-trid-e.html');
FileErr := True;
end;
TridLoadDefsPack('');
Initialized := True;
end;
if (FileErr) then Exit;
TridSubmitFileA(PChar(FilePath));
if (TridAnalyze <> 0) then
begin
Exts := GetExtensions();
if (Length(Exts) > 0) then FileName := WideExtractBaseName(FileName) + '.' + Exts;
end;
end.
The cutoff is kept at 20%, but it's extremely easy to change.
P.S. Additional fix for eR@SeR :
Change this:
begin
if (I > 1) then Result := Result + '/';
Result := Result + Str2;
end;
to this:
begin
if (I > 1) then Result := Result + '/';
if (Str2 = 'mpg/mpeg') then Str2 := 'mpg'; // Add this line!
Result := Result + Str2;
end;
36.5% (.M4V) MPEG-4 Video (70005/3/23)
32.8% (.M4R) iPhone Ringtone (63004/2/19)
25.3% (.3G2) 3GPP2 multimedia audio/video (48504/2/20)
2.6% (.MOV) QuickTime Movie (5000/1/2)
1.5% (.MP4) Generic MP4 container (3004/2)
0.5% (.) MacBinary 2 header (1002/3)
0.5% (.ABR) Adobe PhotoShop Brush (1002/3)
As you can see, it ranks extensions in decreasing order of probability, according to the amount of matches it gets for magic bytes, strings etc. Denis' earlier script was displaying only the top-most extension, i.e. the 1st one returned with max. probability attached. Since you requested that all possible extensions should be shown and the user given a choice, I modified the script accordingly. Of course, now it shows all extensions even down to absurd ones with very low probability.
I had already pondered this issue and as a compromise between the two extreme approaches (show only 1 vs show all), I thought that I should keep a cut-off, say 10 or 15%. So in that case I would display only extensions with probability >= 10 or 15%. But I faced some issues with that code and have asked for Marco's help. Meanwhile I released the previous script with no cut-off defined. As soon as Marco replies, I will release the next version.
The "mpg/mpeg" issue can be solved in 2 ways. The better/official way will be to:
1) Edit the XML for that file type (video-mpeg.trid.xml) and change the contents of the <Ext>MPG/MPEG</Ext> tag
2) Create a new TrIDDefs.trd file for personal use using TrIDDefsPack.exe, or send the updated XML to Marco so he can include it in the definitions library
The quick-fix (and IMO wrong) way will be to create a special exception in the script. I believe that the official definition should remain "mpg/mpeg" (allow the user to decide), but for you with the next script I can provide a single line of code that will solve your problem.
Last but not least, let me say that when we improve TrID's library, then the highest probabilities will rise to the top and override the others. So that's the reason why I plan to keep submitting new definitions. Also, the more files we run it on, the better a definition will be naturally. For example, not all AVIs or MP4s are exactly alike, since AVI and MP4 are just containers and the internal contents can vary greatly depending on codecs etc. Thus the more AVIs or MP4s we scan with TrIDScan.exe, the better the resulting definitions will be for those file types.
]]>...TrID will show only those extensions that it identifies as being possibly correct, with the greatest advantage being that it will moreover display them from left to right in decreasing order of probability! Cool, eh?
COOL but there is something wrong with your script I think. I tested with mine eminent 82 video files and get:
avi ---> avi/, wmv ---> wmv/cat or wmv ---> wma/wmv/cat, flv ---> cel.
Also xls ---> xls/, jpg ---> jpg/mp3, mp3 ---> (too much variable detections).
Seems when you added slash as separator, displays / at the end of already correct extensions (not all) and adds some non existing detections that TrID Script v3 don't have (like cat, cel...). Check it yourself, correct it and your script will be masterpiece
Btw can you make (with corrected script) mpg/mpeg to be only mpg so we don't have to manually edit the detection?
Like I said... I cannot run tridscan.exe. Right after I run, it immediately shutdowns. I don't know the reason.
Weird. What OS do you have? Vista? I'm sure the author would like to know of any possible incompatibility.
Well, Dubs gives you an alternatives but TrID gives you only one detection which is wrong in case dll ---> exe and in less cases of wmv ---> wma. So better solution will be as Denis did, to give you a choice to pick one of two or more extensions. Better this than wrong extension to be result. I hope you agree with me?
Yes, I do! So here, for your pleasure (and for others, of course ), is the next version of the script, which displays multiple extensions and allows the user to decide. Please note that unlike Dubs which always shows exe|com|dll|drv|sys|ocx|cpl|scr|vxd in the same order, TrID will show only those extensions that it identifies as being possibly correct, with the greatest advantage being that it will moreover display them from left to right in decreasing order of probability! Cool, eh?
{ TrID Script v4 (Originally by Denis; modified by Andrew to display multiple possible extensions) }
// TrID DLL exported functions
function TridAnalyze: integer;
external 'TrID_Analyze@TrIDLib.dll stdcall';
function TridSubmitFileA(szFileName: pchar): integer;
external 'TrID_SubmitFileA@tridlib.dll stdcall';
function TridLoadDefsPack(szPath: pchar): integer;
external 'TrID_LoadDefsPack@tridlib.dll stdcall';
function TridGetInfo(lInfoType: integer; lInfoIdx: integer; sBuf: pchar): integer;
external 'TrID_GetInfo@tridlib.dll stdcall';
// Constants for TrID_GetInfo
const
TRID_GET_RES_NUM = 1; // Get the number of results available
TRID_GET_RES_FILEEXT = 3; // Filetype extension
function GetExtensions(): String;
var
Str: String;
I, NumRes: Integer;
begin
Result := '';
SetLength(Str, 100);
NumRes := TridGetInfo(TRID_GET_RES_NUM, 0, PChar(Str));
if (NumRes > 0) then
begin
for I := 1 to NumRes do
begin
TridGetInfo(TRID_GET_RES_FILEEXT, I, PChar(Str));
if (Pos(LowerCase(String(PChar(Str))), Result) = 0) then
begin
if (I > 1) then Result := Result + '/';
Result := Result + LowerCase(String(PChar(Str)));
end;
end;
end;
end;
var
Initialized, FileErr: Boolean;
begin
if (not Initialized) then
begin
if (not WideFileExists('TrIDLib.dll')) Or (WideFileSize('TrIDLib.dll')=0)
Or (not WideFileExists('TrIDDefs.trd')) Or (WideFileSize('TrIDDefs.trd')=0) then
begin
ShowMessage('Error! Either TrIDLib.dll or TrIDDefs.trd do not exist in the program directory!');
FileErr := True;
end;
TridLoadDefsPack('');
Initialized := True;
end;
if (FileErr) then
Exit;
TridSubmitFileA(PChar(FilePath));
if (TridAnalyze<>0) And (GetExtensions()<>'') then
FileName := WideExtractBaseName(FileName) + '.' + GetExtensions();
end.
Here's the result:
As you can see, TrID's signatures need to be updated a bit (like for SYS files, which I'll do and send in when time permits), but it is without doubt better than Dubs. BTW, I feel "dll/drv" is better than "dll|drv" (confusing depending on system font), so I used "/" instead of "|". I feel Dubs should also be modified accordingly by Denis.
...but it is actually a mp3 file in great amount. Winamp displays 9:34 but plays (wow) from 7:58... Those 1:36 at beginning could be an exe.
Well I would argue that purely in terms of the binary content, the EXE data in that file outweighs the MP3 data. The duration of the MP3 is irrelevant here as it could be of extremely low bitrate, or a very simple tone, which would imply less data. Anyway, the important thing to note here is that the file begins with EXE data, and both Dubs and TrID match from the beginning of the file and hence IMO correctly identify it as an EXE. No tool in the world will be prepared to identify such a weird file as EXE+MP3, right?
P.S. Let's stop discussing about that file now BTW.
]]>Did you read the instructions on the following page...
Yes, of course... Like I said
...I cannot run tridscan.exe.
Right after I run, it immediately shutdowns. I don't know the reason. In fact doesn't matter. Most common extensions are detectable and that is the point. I will not submit and that's it. Thank you for offering help and quotation of author also
That's why Dubs also says exe|com|dll|drv|sys|ocx|cpl|scr|vxd (though TrID is a bit better here!), 'cos internally they're all very similar or even the same and just for application purposes have been given different extensions.
Well, Dubs gives you an alternatives but TrID gives you only one detection which is wrong in case dll ---> exe and in less cases of wmv ---> wma. So better solution will be as Denis did, to give you a choice to pick one of two or more extensions. Better this than wrong extension to be result. I hope you agree with me?
I used used this program to see that that code. Free Hex Editor XVI32...
.
(By the way, the txt files do not have that special start code)
Now I know how to get those 'magic bytes' and submit more extensions. Thank you
Yes I noticed that when I experimented with txt and with diz, nfo files too, probably because of that Denis didn't add that detection(s)...
So clearly, Dubs and TrID are meant to identify Binary files and not Text files. Hope that clears up any doubts you have.
Yes it's clear now. How can I even know that txt files don't have magic bytes when I didn't try by myself i.e. didn't know how to "see" those paired digits? Right?
...so here's the next version of the script, which will not delete the existing extension if it cannot identify it properly.
Nice one and I hope that it will be next releases (yet even better) of scripts too
Interestingly, if you rename the file to EXE, you'll see that it's the setup file for a cracked version of Ulead GIF Animator 5!
Yes, I renamed immediately to exe when I saw that something is wrong with it and noted that. I run it and result was error. I don't know how he appended that exe part or what so ever to mp3 or why, but that "joker" succeeded in his intention
So actually, since the file starts with EXE data, both Dubs and TrID identify it as EXE, which is correct! Mystery solved!
...but it is actually a mp3 file in great amount. Winamp displays 9:34 but plays (wow) from 7:58... Those 1:36 at beginning could be an exe.
P.S. Where did you get this file? It is so weird... Maybe someone used this technique to hide the EXE and give it to someone? Who knows...
I think I downloaded via Limewire and on Gnutella you can find everything even these craps as well Wrong way to hide cracked application obviously
At the other hand he is a genius. He appended an exe and mp3. Remarkable no doubt
I'm still for submitting extensions to Denis to enrich its database which is modest, but I will use TrID only when Dubs fails to detect or get cases like exe|com|dll|drv|sys|ocx|cpl|scr|vxd or wma|wmv|asf... This option is rarely used for most of users, like you said, but I use almost every day, mostly for downloaded video and archive files. It happens that you have downloaded some file that have wrong extension. Here is mp3 song which is generated as exe etc. Almost unbelievable :S I cannot even convert it
Hmm... Cannot download the file for some reason. Never happened with MediaFire before. I would have liked to analyse the file myself to see why TrID misidentifies it as .EXE (that's very funny!) BTW, what does Dubs identify it as? MP3?
Also, let me tell you about this wonderful little portable utility I use to correctly identify the codecs required to play my downloaded videos. It's called GSpot (which is a funny name no doubt ), but it is amazing! Get it from here and try it out. I guarantee you won't be disappointed. You can also check out AVIcodec (not just for AVIs) and VideoInspector.
- if Dubs remains and still be developed mine suggestion will be to add only missing "frequent" extensions (like SafetyCar's one for example) to fill the database and ReNamer's size will not be dramatically changed.
No problem with this, since Denis will surely ensure that ReNamer doesn't become too bloated with unnecessary stuff (that's why he rightly rejects many otherwise good ideas, because they're not part of ReNamer's core functionality).
I'm for it that users decides which one will use?
Yes, Dubs might be for the casual/occasional user whereas TrID would be for the more advanced user, especially since it is written in PascalScript.
I just hope that Denis will add your modified pascal script into next release - that would be great. I guess that those two files (TrIDLib.dll, TrIDDefs.trd) will not be added due to their size But better anything than nothing...
Actually the TrID author will first have to be asked whether it is ok to redistribute his files. Plus it also raises questions about keeping the ReNamer package updated with the latest TrID files. At first I too thought that those files should be packaged, but then I changed my mind because it's unnecessary work for Denis to keep track of TrID changes and update the ReNamer package accordingly. Anyway for those advanced users who want it, the ReNamer manual should contain the URLs to the files and a note on how to use them, plus the actual script should be part of the package as well. That should be sufficient and those who're interested can then download the latest DLL and TRD versions and use them.
Still exist wrong detections (like wmv --> wma, dll --> exe). I read on Marco's site how to submit/update extensions but I cannot run tridscan.exe. Maybe I do something wrong?
Did you read the instructions on the following page - http://mark0.net/soft-tridscan-e.html? It's very nicely written with screenshots etc. If you're getting stuck somewhere, let me know and we can investigate further. I just followed the instructions and it was very easy. My new signatures are already part of the latest TRD package released in 2009!
Also re. the DLL/EXE issue (and other similar 'misidentification' issues with very similar file types), read what TrID's author wrote to me in response to my mail:
But when the filetype are so similar (they are all EXE, in the end, with a very similar structure), things are not always black or white.
Due to the nature of these files, don't expect always the topscore / perfect id.
At the moment, the results are to be taken just like best guesses: they will help in most of occasions, but it's not a 100% perfect system.
That's why Dubs also says exe|com|dll|drv|sys|ocx|cpl|scr|vxd (though TrID is a bit better here!), 'cos internally they're all very similar or even the same and just for application purposes have been given different extensions.
About txt detection:
...
Just I don't know how to get those magic bytes like SafetyCar did? Any help would be appreciated
Well, let me quote SafetyCar here in response to your query:
Those are the first numbers from the file red as hexadecimal, each file kind of extension use to have a diferent start.
(By the way, the txt files do not have that special start code)
Like SafetyCar has pointed out, the so-called "magic bytes" are nothing but a common string of bytes shared by all files of a particular type. For example, suppose all MS Word Documents internally start with the string "MSWORDDOC". This may be for identification purposes, so that the program recognises which are its own files, and which are falsely named DOC files (since those probably will not have the string in the beginning). So what Dubs and TrID both do is look for that string "MSWORDDOC", which are the magic bytes for MS Word Documents. If it finds them, it says the extension is DOC, else it's not. Understood?
Now the problem with text files of any type (DIZ, NFO are also just renamed ASCII text files) is that they have no magic bytes! All text files may be different, so there is no common identification string. Actually, you've assumed wrongly what dubs is used for. Dubs = "Detect Using Binary Signature". So clearly, Dubs and TrID are meant to identify Binary files and not Text files. Hope that clears up any doubts you have.
That goes without saying. Excellent, logical, detailed rebuttal Andrew
Heh. Thanks for understanding!
I think this is the most problematic thing of using it TrID, I think that when it doesn't know the extension, removes it...
You're absolutely right, that is indeed irritating. But this once again perfectly proves just how great the PascalScript approach to call TrID used by Denis is! With PascalScript we can always change it to suit our needs, so here's the next version of the script, which will not delete the existing extension if it cannot identify it properly. Note that multiple identifications like MPG/MPEG will still be presented as before, since I feel the user should decide.
{ TrID Script v3 (Originally by Denis with minor changes by Andrew) }
// TrID DLL exported functions
function TridAnalyze: integer;
external 'TrID_Analyze@TrIDLib.dll stdcall';
function TridSubmitFileA(szFileName: pchar): integer;
external 'TrID_SubmitFileA@tridlib.dll stdcall';
function TridLoadDefsPack(szPath: pchar): integer;
external 'TrID_LoadDefsPack@tridlib.dll stdcall';
function TridGetInfo(lInfoType: integer; lInfoIdx: integer; sBuf: pchar): integer;
external 'TrID_GetInfo@tridlib.dll stdcall';
// Constants for TrID_GetInfo
const
TRID_GET_RES_NUM = 1; // Get the number of results available
TRID_GET_RES_FILETYPE = 2; // Filetype descriptions
TRID_GET_RES_FILEEXT = 3; // Filetype extension
TRID_GET_RES_POINTS = 4; // Matching points
TRID_GET_VER = 1001; // TrIDLib version (major * 100 + minor)
TRID_GET_DEFSNUM = 1004; // Number of filetypes definitions loaded
function GetTopExtensions(Max: Integer): String;
var
S: String;
Num, I: Integer;
begin
Result := '';
SetLength(S, 100);
Num := TridGetInfo(TRID_GET_RES_NUM, 0, PChar(S));
if Num > 0 then
begin
if Num > Max then
Num := Max;
for I := 1 to Num do
begin
TridGetInfo(TRID_GET_RES_FILEEXT, I, PChar(S));
if I > 1 then Result := Result + '|';
Result := Result + WideLowerCase(String(PChar(S)));
end;
end;
end;
var
Initialized, FileErr: Boolean;
begin
if not Initialized then
begin
if (not WideFileExists('TrIDLib.dll')) Or (WideFileSize('TrIDLib.dll')=0)
Or (not WideFileExists('TrIDDefs.trd')) Or (WideFileSize('TrIDDefs.trd')=0) then
begin
WideShowMessage('Error! Either TrIDLib.dll or TrIDDefs.trd do not exist in the program directory!');
FileErr := True;
end;
TridLoadDefsPack('');
Initialized := True;
end;
if FileErr then
Exit;
TridSubmitFileA(PChar(FilePath));
if (TridAnalyze<>0) And (GetTopExtensions(1)<>'') then
FileName := WideExtractBaseName(FileName) + '.' + GetTopExtensions(1);
end.
Best wishes in New Year
Wish Denis and all of you and your families a very Happy New Year!
__________________________________________________________________________
Edit: Ok, I was able to finally download that 'MP3' file and check it out with a hex editor. What a joke it turned out to be!
The file starts with "MZ", which implies an EXE file, but contains a "LAME3.93" tag towards the end, which implies an MP3! Seems some joker/idiot has appended an MP3 to an EXE, then renamed the resulting combined EXE+MP3 file to MP3. It is a little known fact that MP3 players like Winamp etc. are quite tolerant of corrupted data (since lots of MP3 get corrupted to some extent while downloading). So Winamp just skips the initial EXE part of the file and starts playing the MP3 data.
Interestingly, if you rename the file to EXE, you'll see that it's the setup file for a cracked version of Ulead GIF Animator 5! But since the EXE file format is not fault tolerant (one bad bit here and there will corrupt it), the setup doesn't run completely till the end. If all the EXE data is there without truncation, then it should be possible to separate the 2 files to get one working EXE and one proper MP3.
So actually, since the file starts with EXE data, both Dubs and TrID identify it as EXE, which is correct! Mystery solved!
P.S. Where did you get this file? It is so weird... Maybe someone used this technique to hide the EXE and give it to someone? Who knows...
]]>About txt detection:
- open Notepad, type any characters just non unicode ones, File/Save As "somename", under Encoding select ANSI, click Save button, rename or remove txt extension, add into ReNamer, use { TrID script } and you'll get "somename." Reproduced? Also occured with nfo and diz extensions (crack notes).
I think this is the most problematic thing of using it TrID, I think that when it doesn't know the extension, removes it...
Just I don't know how to get those magic bytes like SafetyCar did? Any help would be appreciated
Those are the first numbers from the file red as hexadecimal, each file kind of extension use to have a diferent start.
I used used this program to see that that code. Free Hex Editor XVI32, here: http://www.chmaas.handshake.de/
I think there are much more of programs like this.
(By the way, the txt files do not have that special start code)
]]>No doubt that TrID is great tool with so much detectable extensions etc. I just noticed some flaws not only for TrID's as you noticed and that's it. It's awesome and saves Denis's precious time and energy. I agree with that, now:
When I said:
We should "invest" in Dubs because of these issues.
I meant especially about these two (others are solvable):
- all generated extensions are un UPPER CASE even for not changed one
- added 82 video files (asf, avi, mpg, wmv)...
But, when you modified Denis's script to make extensions in lower case, one great problem for me has gone. I thought that TrID generates like that, obviously it's not the case
I'm still for submitting extensions to Denis to enrich its database which is modest, but I will use TrID only when Dubs fails to detect or get cases like exe|com|dll|drv|sys|ocx|cpl|scr|vxd or wma|wmv|asf... This option is rarely used for most of users, like you said, but I use almost every day, mostly for downloaded video and archive files. It happens that you have downloaded some file that have wrong extension. Here is mp3 song which is generated as exe etc. Almost unbelievable :S I cannot even convert it
- will Denis remove or even still develop Dubs or not, we don't know yet
- if Dubs remains and still be developed mine suggestion will be to add only missing "frequent" extensions (like SafetyCar's one for example) to fill the database and ReNamer's size will not be dramatically changed.
- if only Dubs could detect doc(x), xls(x) ppt(x) then wma, wmv, asf...separately that would be great achievement, until then TrID is solution
I'm for it that users decides which one will use?
Some (?) will use Dubs because of:
- part of ReNamer
- check it and forget it (easy setting)
- fast enough
- basic detection...
Many (?) will use TrID because of:
- its great advantages which you already mentioned
- troubles that have connected to Dubs...
And everyone will be satisfied
I just hope that Denis will add your modified pascal script into next release - that would be great. I guess that those two files (TrIDLib.dll, TrIDDefs.trd) will not be added due to their size But better anything than nothing...
Still exist wrong detections (like wmv --> wma, dll --> exe). I read on Marco's site how to submit/update extensions but I cannot run tridscan.exe. Maybe I do something wrong?
Btw I found what was problem about xlsx detection - it was password protected. I oversighted that fact, so it is ok now
About txt detection:
- open Notepad, type any characters just non unicode ones, File/Save As "somename", under Encoding select ANSI, click Save button, rename or remove txt extension, add into ReNamer, use { TrID script } and you'll get "somename." Reproduced? Also occured with nfo and diz extensions (crack notes).
Just I don't know how to get those magic bytes like SafetyCar did? Any help would be appreciated
4) I was also trying that instead of a plain error message, the script can direct the user to the web page from where the .DLL file is available...
That would be great
Let me end by saying that I'm not supporting TrID out of some false sense of attachment, just because I happened to bring it to Denis' attention.
That goes without saying. Excellent, logical, detailed rebuttal Andrew
Best wishes in New Year
]]>