The MASM Forum Archive 2004 to 2012

Specialised Projects => Custom Interface Components => Topic started by: ramguru on January 14, 2006, 06:33:09 PM

Title: ShineInHex - hex view/edit control
Post by: ramguru on January 14, 2006, 06:33:09 PM
Here is my hex view/edit control that I made for my bigger project. Source code and test-app are included in attachment...

(http://img519.imageshack.us/img519/106/sihbe3.png)

UPDATE:
[/color]
RECENT UPDATE:
[/color]
FAQ

New version 27/06/2010 +
ShineInHex documentation Offline is attached below
[/font]

[attachment deleted by admin]
Title: Re: ShineInHex - hex view/edit control
Post by: Mincho Georgiev on January 14, 2006, 07:42:24 PM
Hi, Ramguru, it's been a while. I like that. And regards for non-flickering surface :) I've say many times how mutch i hate flickering, welldone.
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 14, 2006, 09:43:57 PM
Thanks for feedback, shaka_zulu! I hate flicker more than you :) Thanks to James Brown (http://www.catch22.net/) we can all get rid of it...  :cheekygreen:
Title: Re: ShineInHex - hex view/edit control
Post by: zooba on January 14, 2006, 10:14:57 PM
Hey,

Just had a play with the test app. Seems like the hit-testing may be off by a little bit in the ASCII part, the selecting doesn't select the bits I'm clicking on.

Also, can you make it accept lowercase hex letters? It can convert them to uppercase, theres no issue there, but it's easier to type without having to go to the shift key every second character :wink

Good work :U
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 15, 2006, 03:07:33 PM
Thanks for reply, zooba.
1. Mouse selection for ASCII part wasn't implemented actually. But you mentioned it, so I've added this feature...
2. ..case with lowercase letters. I've moved input part from WM_KEYDOWN (no difference between lower/uppercase... ) to WM_CHAR and forgot to add some extra code lines...
  I have more code to add, so new upload will be a little later... :wink
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 16, 2006, 12:26:01 AM
New upload!
*What's new..
--now you can fill selection with whatever number
--new message that sets offset (instead of 00000000,00000008...)
--fixed lower/uppercase, mouse selection, caret position after resizing
--added VK_UP, VK_DOWN support
*TODO list:
--Figure out why copy to clipboard "works, works not, works, works not, works, works not"..and so on
--Add mouse scrolling (using WM_TIMER) support
--Add some tooltips
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on November 16, 2006, 10:37:47 PM
UPDATE (http://www.masm32.com/board/index.php?topic=3671.msg27404#msg27404)
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 14, 2007, 12:00:25 AM
hi ramguru
congratulations, very nice control!
I like it's automatic resizing, but some very useful functions are missing:
scrolling with mouse and correct data copy (dunno if it really works).

if you have any internal non-published version with fixes, pls share it.

TIA
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 14, 2007, 09:37:47 AM
Thanks Jupiter,
"Copy Hex" works OK for me, "Copy Text" is supposed to copy ANSI string (that you probably well know is zero terminated), so if you try to copy Unicode string, you'll only get first character. Regarding scrolling using mouse - I know it's a TODO thing. At the moment I'm working on other project, I will only post an update here, when there will be serious changes...yet I don't know when that's going to happen  :wink
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 14, 2007, 02:55:59 PM
hi ramguru

a bug(feature?) found:
* Window is not scrolled _properly_ when using keyboard to scroll selected block
1. Select block of symbols (some rows)
2. Hold arrow down key to move cursor (current selection) down and to scroll block selection
Result:
Block scrolls down and disappears from screen coz in your VK_DOWN handler you don't check selection block length.
I think that the whole selection block must be visible while scrolling, not only first byte.
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 14, 2007, 03:15:51 PM
Thanks again, I haven't noticed that :toothy Yep, VK_DOWN/UP/LEFT/RIGHT should make selection disappear. OK I will make new update as soon as I can (hope not too late), yet I'm thinking of remaking my control so that it can support any font (be patient and report bugs of course  :U new version is coming soon...)
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 14, 2007, 04:09:33 PM
thank you for answer
good luck in finding time for development ;)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 16, 2007, 10:01:19 PM
Update

Briefly (what's new):

Not going to release newer version very soon, unless new bugs would be discovered or new features implemented...
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 17, 2007, 06:43:58 AM
hi ramguru
thank you for update!

scrolling using mouse work ok. any plans to implement WM_MOUSEWHEEL ?

in this release when I scroll with VK_UP | VK_DOWN | VK_PGUP | VK_PGDN, current selection is lost.
what about keeping selection block while scrolling using keyboard?

P.S. you changed default colors, why? old colors scheme looks nice ;)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 17, 2007, 10:48:04 AM
Update:

Briefly (What's new):

Jupiter, page down, page up, up, down should change cursor's position, IMHO selection should disappear after any of those is pressed, that's how most of editors work.
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 17, 2007, 12:33:48 PM
great, you added mouse-weel support ;)
Quoteselection should disappear after any of those is pressed, that's how most of editors work.
WinHex doesn't unselect
UltaEdit[Studio] unselect

let me explain:
when I want to add some bytes to selection, I hold Shift and scroll cursor with keyboard
to implement selection with keyboard:
* check if Shift is pressed while scrolling with keyboard
* check scroll direction

suggestion: show just changed bytes with another color

a little optimization:
.elseif eax==WM_MOUSEWHEEL
mov eax, wParam
shr eax, 16
xor ecx,ecx ; SB_LINEUP
cmp ax,0
jge @F
inc ecx ; SB_LINEDOWN
@@:
invoke SendMessage,hWin,WM_VSCROLL,ecx,0

instead of
.elseif eax==WM_MOUSEWHEEL
mov    eax, wParam
shr    eax, 16
cmp    ax, 0
jl     @F
invoke SendMessage, hWin, WM_VSCROLL, SB_LINEUP,   0
jmp    @pos_set
  @@:
invoke SendMessage, hWin, WM_VSCROLL, SB_LINEDOWN, 0
  @pos_set:
Title: Re: ShineInHex - hex view/edit control
Post by: six_L on January 17, 2007, 01:49:18 PM
 
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 17, 2007, 03:05:58 PM
Quote from: Jupiter on January 17, 2007, 12:33:48 PM
let me explain:
when I want to add some bytes to selection, I hold Shift and scroll cursor with keyboard
to implement selection with keyboard:
* check if Shift is pressed while scrolling with keyboard
* check scroll direction
I know what you mean (selection using keyboard), this is easy to accomplish, I will definitely add that feature.

Quote from: Jupiter on January 17, 2007, 12:33:48 PM
suggestion: show just changed bytes with another color
This feature could cause a headache from one point of view, and be neatly implemented - from other. Let's say you opened 4Gb ISO file, changed all bytes - now what ?! Does the control should allocate 4Gb for tracing what bytes where changed  :dazzled: Now how I'm thinking about this problem is to have 8 DWORDS buffer to store only pointers of 8 recently changed bytes location. I also could have 32 DWORDS buffer for 32 BYTES, but with 4 color options: col1 - 8 most recenlty changed bytes, col2 - 8 recently changed bytes, 8 not so recently changed bytes etc. Of course this feature would decrease a little bit drawing performance...

And thanks for the hint regarding "optimization" (it will be changed in next version)


Quote from: six_L on January 17, 2007, 01:49:18 PM

  • new file edit.
  • in the Hex region edit, the data of ASCII region will change; in ASCII region edit, the data of the Hex region will change.
  • if the file changed, note to save while it will be exited.
  • auto-cteated a bak file.

Hello six_L,

You surely are able express your ideas in mysterious way  :bg
As I suspect these are features you wanna see in ShineInHex.

Let's think  :wink about them

Quote from: six_L on January 17, 2007, 01:49:18 PM

  • new file edit.

I don't want to disappoint you, but ShineInHex is supposed to be a control that could be used in other applications, and only those "other applications" are responsible for memory management, ShineInHex accepts only [pointer,size_of_data] combination. And I don't think I ever will implement insert capability.
I made Test_ShineInHex just so you know how to use my control and as title says it's just a test.

Quote from: six_L on January 17, 2007, 01:49:18 PM

  • in the Hex region edit, the data of ASCII region will change; in ASCII region edit, the data of the Hex region will change.

If I understand correctly you want to be able to edit not only from Hex part (entering 0..F), but also from ANSI part (entering ANSI characters). If so - this isn't easy, but possible, probably will add this features later.

Quote from: six_L on January 17, 2007, 01:49:18 PM

  • if the file changed, note to save while it will be exited.
  • auto-cteated a bak file.

Again I think this is responsibility of application that uses my control.
Title: Re: ShineInHex - hex view/edit control
Post by: six_L on January 17, 2007, 03:32:12 PM
hey,ramguru
thanks your response.

though i expressed some strange, but i think you entirely understood my meanings.
UltraEdit maybe powerful, but has a bit of complexity.
i like some efficacious tools as the ShineInHex.
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 17, 2007, 05:02:58 PM
QuoteI know what you mean (selection using keyboard), this is easy to accomplish, I will definitely add that feature.
I mean that selection must not be cleared when scrolling via keyboard!
another scenario:
I select a block, then scroll cursor down (selection is intact), then I select 'Block End here" via shortcut or menu.

about changed bytes:
I supposed that you just paint changed byte with different color and forget about w/o checking it later

now my contribution:

tester now supports drag-n-drop

ShineInHex:

Legend:
[!] Info
[*] Change
[+] Addition
[-] Removal/Fix

--------------------------------------
v1.0 January 17, 2007
--------------------------------------
[+] Dynamic hex table generation (Static table was ~1.2 KB)
[+] Display national characters (cyrillic support)
[*] Uninitialized variables are now located in correct segment
[!] File size: 12 800 bytes (Old: 14 848 bytes)
[+] WinAsm studio project added
[!] by Jupiter

[attachment deleted by admin]
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 17, 2007, 05:42:02 PM
Your thoughts and ideas are welcome  :U
Feel free to repost updates/modifications or spread the word "ShineInHex" in other boards
With my new version of ShineInHex I'll include all your proposes (if you permit me) except the one with cyrilic charset  :8)

I really would show better initiative (at this time) if I had not serious problem with mathematics in my university   :( ....
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 17, 2007, 06:03:49 PM
well feel free to use all modifications ;)
I started History.txt, add updates there.

why you don't want to extend displayed charset (to support non-english letters)?
may be create message in callback to set character ranges?
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 18, 2007, 09:09:06 PM
Quote from: Jupiter on January 17, 2007, 06:03:49 PM
why you don't want to extend displayed charset (to support non-english letters)?
may be create message in callback to set character ranges?
Jupiter, you know I'm not Russian (your native is Cyrillic charset, my - Baltic). It could be implemented, but it should be general-purpose, f.e. using Alt+Shift control could automatically switch among any charset you (this would be more like IT).

Regarding ShineInHex development:
I won't post new version today, may be tomorrow, but so you know I've made major changes:
Now ClearType fonts are appropriately  supported (I will add "Courier New", "Lucida Console")
Now there are two input modes: 0..F and ASCII (thanks to six_L)
I've "remastered" the drawing procedure: now theoretically any byte can be highlighted with different text, background color w/o big performance loss. (I have future ideas about special ShineInHex edition that will highlight separate PEcoff parts differently, so new drawing method will make that possible )
Fixed bug where control lost scroll pos after it was minimized
Now I'm only working on highlighting modified bytes...

Just wait for new version  :U (if any-one waits  :lol )
Title: Re: ShineInHex - hex view/edit control
Post by: Ehtyar on January 18, 2007, 09:31:15 PM
I will most certainly be waiting. You're doing an incredible job ramguru, the highlight modified bytes and PEcoff sections ideas sound great. Thank you for such an awesome control.

Ehtyar.
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 18, 2007, 10:25:39 PM
ok, whil you work on control, I'll improve test app.
I really like your ToDo list ;)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 19, 2007, 11:23:57 PM
Update (http://www.masm32.com/board/index.php?topic=3671.msg27404#msg27404) :) finally
I've changed list of supported messages, some constants changed...so don't stick to the old one
Made some improvements in properties dialog (in test.exe)
Of course all changes I've mentioned in my last post...apply to the current version, also made selection using keyboard possible...
Now if you allow me  :lol I'm going to sleep  :bg
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 19, 2007, 11:52:27 PM
oh damn... when changed characters become darker... I hope that wasn't my brain damage ;)
anyway nice idea ;)

well... it seems that you can go sleep now ;)))))
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 20, 2007, 04:14:00 PM
It seems that selection is kinda slow  :( On my usual development environment (lenovo laptop) it looks OK, but screen update rate is only - 60Hz. Now if I test it with desktop box where update rate is 75Hz, I can fractionally see flicker, which is mother of evil. I can only imagine how badly control looks where screen update rate is 100Hz or more. I will have to work on selection update (probably combining regions and invalidating them). It would be nice to hear from all of you who use my control (or tried at least once) what features could make ShineInHex better tool, while I'm still on the wave of development...
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 20, 2007, 04:28:30 PM
on my laptop all looks ok, no flickering
about features:
moving/deleting and copy/paste
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 20, 2007, 04:43:31 PM
Jupiter,
Forget deleting, moving (sorry) ShineInHex is designed to accept a pointer, not handle file management.
Regarding Copy - the control already does Copy pretty well, I'm just thinking about adding "Copy Ansi", "Copy Unicode" commands
I'm also thinking of implementing a statusbar in non-client area, that will add faster search opportunity, various status information.
I'm also thinking of implementing folding, meaning you'll be able to collapse/expand a range of data...what do you think?
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 20, 2007, 05:23:29 PM
ok, no del/move, but 'Fill with...' can be easily implemented. may be useful to fill block with zeros or any other chars.

layout:
add horizontal bar at the top where position index will be placed, coz when I resize dialog, I must how many bytes are shown per line
like this:
Offset |  1 2 3 4 5 6 7 8 9 A B C D E F |

Quotecollapse/expand a range of data
for this we need +1 thin vertical pane just before address column, there will be:
colored parts with different colors for collapsed/expanded blocks and
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 20, 2007, 06:08:38 PM
Quote from: Jupiter on January 20, 2007, 05:23:29 PM
Quotestatusbar in non-client area, that will add faster search opportunity, various status information.
I think that callback for parent window will be better solution: in this case host application may handle status bar or any other window for output.
anyway at first time it can be implemented as built-in control feature.
I will tell ya a secret, I have no idea how to implement these callbacks  :toothy
However, I think less code left to user, more handled internally - better...

As soon as I know I'm totally screwed up with math in university, I'll be free to implement these things...
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 20, 2007, 07:28:11 PM
good luck and patience with math

about callbacks:
host sends message to control with msg code "set call back" (HEXM_SET_CALLBACK) with pointer to callback proc as param
like this:
call from host:
invoke SendMessage,hWndHexEd,HEXM_SET_CALLBACK,addr EditCallback,INIT_FLAGS
in your control:
you'll check (IsBadCodePtr) and store ptr to callback, then you can call it when you need to notify main window:
_call pHostCallBack,hWnd,Msg,wParam,lParam
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 23, 2007, 02:28:35 PM
New version will look similarly:

(http://img262.imageshack.us/img262/848/whichdirection0lt.png)

Now I'm working on smoother selection, later will implement folding. Don't know how much it can take 'cause folding can be tricky...
Title: Re: ShineInHex - hex view/edit control
Post by: six_L on January 23, 2007, 03:01:50 PM
 :U
it's becoming better and better.
Title: Re: ShineInHex - hex view/edit control
Post by: mnemonic on January 23, 2007, 03:50:43 PM
Just here to say that I like this tiny application - nice job.  :U

I don't know how it is handled at the moment, but it would be nice if the apllication doesn't load the whole file into memory but just a small part that actually is displayed plus some buffer for smooth scrolling.
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on January 23, 2007, 06:03:57 PM
@ mnemonic
ShineInHex control do not load file, it's a task of host application (checkout Test_... in .zip archive)

@ ramguru
shine ;)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 23, 2007, 06:21:25 PM
Thanks for good words guys,

Quote from: mnemonic on January 23, 2007, 03:50:43 PM
I don't know how it is handled at the moment, but it would be nice if the apllication doesn't load the whole file into memory but just a small part that actually is displayed plus some buffer for smooth scrolling.

The only reason for me not to use FileMapping was possibility to save modified file later. If I were using FileMapping all changes would be directly made. Since I've not implemented "Undo" this wouldn't be very correct from the point of casual user. Today when I take a look at CreateFileMapping I've noticed PAGE_WRITECOPY which may let to save changes later...
Title: Re: ShineInHex - hex view/edit control
Post by: mnemonic on January 24, 2007, 11:09:10 AM
Quote from: Jupiter on January 23, 2007, 06:03:57 PMShineInHex control do not load file, it's a task of host application (checkout Test_... in .zip archive)
That's why I talked from the "apllication" and not from the "control". :wink
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 31, 2007, 06:06:29 PM
Sorry guys for not posting an update, I'm seriously stuck with that folding. Hell knows what was in my mind when I'd decided to implement that feature, it involves so many things (too many). And now CPU consumption is very high when using ClearType fonts in fullscreen-mode, it makes me nervous and think that I'm doing a crap...
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on March 10, 2007, 06:28:40 PM
update (http://www.masm32.com/board/index.php?topic=3671.msg27404#msg27404)

New features:

Now I'm thinking about RP (http://www.masm32.com/board/index.php?topic=6271.0) project and I have lots of motion to accelerate its development ...
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on March 10, 2007, 09:44:20 PM
great update!
thank you.
I'll check Resource Puncher too.

Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on March 10, 2007, 09:56:06 PM
Thanks friend your feedback keeps me going!
Title: Re: ShineInHex - hex view/edit control
Post by: PBrennick on March 10, 2007, 11:07:41 PM
Very nice but is in dire need of an UNDO/REDO. or just an UNDO, al least. I do not think filemapping should be implemented without it.

Paul
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on March 11, 2007, 10:16:57 AM
Thanks, Paul you probably are right, these my warnings are no excuse for me not implementing Undo/Redo features. I'll see what I can do, it will take a while, but it will be implemented, if everything is going to be smoothly (now I'm thinking about unlimited undo/redo)...
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on March 11, 2007, 07:43:39 PM
hi, ramguru.
at first, relax, you did great work and you can't implement all features at once

a little bug: when you use keyboard to move cursor, current offset isn't updated (only when using mouse)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on March 12, 2007, 05:45:33 PM
Thanks, Jupiter
UPDATE (http://www.masm32.com/board/index.php?topic=3671.msg27404#msg27404)
What's new:

And yes Ctrl+Z - undo, Ctrl+Y - redo
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on March 12, 2007, 07:28:47 PM
great work, ramguru ;)
prety fast update ;)

I attached... just a color scheme ;)
put in Test_ShineInHex.exe folder

[attachment deleted by admin]
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on March 12, 2007, 07:39:05 PM
Really nice, maybe next release will contain a folder with suggested set of color schemes. Hmm, if I will release it to some kind of download site, it will require an installer (to build me a solid website), I guess, but usual installer adds 100Kb additional raw data, sad.
Title: Re: ShineInHex - hex view/edit control
Post by: PBrennick on March 12, 2007, 10:36:17 PM
That would be great. This is an excellent piece of work so I thought I would help by giving you a nudge. When I speak up like that, it means I feel it is well worth improving.  :U

Paul
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on March 13, 2007, 10:09:44 AM
in case of NSIS installer, overhead is 30 KB only
http://nsis.sf.net

anyway you can always create own tiny installer ;)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on March 14, 2007, 09:04:52 PM
cool my soft finally got published after a long wait
interesting, do they say this to everyone:
Quote
Hello,

Your product "ShineInHex 1.0f" has been tested by the Softpedia labs and found to be
completely clean of adware/spyware components.

We are impressed with the quality of your product and encourage you to keep
this high standards in the future.

To assure our visitors that "ShineInHex 1.0f" is clean, we have granted it with the
"100% FREE" Softpedia award. Moreover, to let your users know about this
certification, you may display this award on your website, on software boxes
or inside your product.

More information about your product's certification and the award is available
on this page: http://www.softpedia.com/progClean/ShineInHex-Clean-69262.html

Your product review page is located at:
http://www.softpedia.com/get/Programming/File-Editors/ShineInHex.shtml

Please feel free to link to us using the URL above.
If you choose to link to the award page for your product, you may use the
award graphic or a text link such as: "100% FREE award granted by Softpedia"

Don't hesitate to contact us for more information.

Sincerely,

I must admit, I'm impressed with these fox, they wrote program's description for me, and screen-shots are made by them...they are nice
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on April 12, 2007, 07:20:42 PM
UPDATE (http://www.masm32.com/board/index.php?topic=3671.msg27404#msg27404)
What's new, fixed:
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on April 12, 2007, 09:43:50 PM
thank you for update!

BUG:
.if eax==13000 || eax==13001
invoke OpenClipboard, HM.hWnd[ebx]
invoke EmptyClipboard
mov    edx, HM.sel_start[ebx]
mov    ecx, HM.sel_end[ebx]
.if edx > ecx
sub    edx, ecx
mov    ecx, edx
.else
sub    ecx, edx
.endif
shl    ecx, 1
inc    ecx
invoke GlobalAlloc, GMEM_MOVEABLE, ecx
mov    hex_clip_copy, eax
invoke GlobalLock, hex_clip_copy
mov    hex_clip_point, eax
cmp    eax, 0
je     @exit
mov    esi, HM.pointer[ebx]
mov    edi, hex_clip_point[ebx]
mov    ecx, HM.sel_start[ebx]
mov    edx, HM.sel_end[ebx]

check registers usage
(try to hex copy selected text)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on April 13, 2007, 04:13:32 AM
Thanks, I see my mistake  :bg , ebx is supposed to be used with HM structure, I've posted an update.

.if eax==13000 || eax==13001
invoke OpenClipboard, HM.hWnd[ebx]
invoke EmptyClipboard
mov    edx, HM.sel_start[ebx]
mov    ecx, HM.sel_end[ebx]
.if edx > ecx
sub    edx, ecx
mov    ecx, edx
.else
sub    ecx, edx
.endif
shl    ecx, 1
inc    ecx
invoke GlobalAlloc, GMEM_MOVEABLE, ecx
mov    hex_clip_copy, eax
invoke GlobalLock, hex_clip_copy
mov    hex_clip_point, eax
cmp    eax, 0
je     @exit
mov    esi, HM.pointer[ebx]
mov    edi, hex_clip_point ;[ebx] !!!!!!!!!!!!!!!
mov    ecx, HM.sel_start[ebx]
mov    edx, HM.sel_end[ebx]


Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on July 16, 2007, 11:21:23 PM
New Update (http://www.masm32.com/board/index.php?topic=3671.msg27404#msg27404)

This one includes features such as:
bytecode copying in masm or C format, including selection or excluding selection.
Title: Re: ShineInHex - hex view/edit control
Post by: six_L on July 17, 2007, 11:50:45 AM
 :U
:clap:
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on July 17, 2007, 12:17:45 PM
The last update (http://www.masm32.com/board/index.php?topic=3671.msg27404#msg27404) this week  :toothy
...fixed bytecode copying algos, when last char was stripped;
...fixed selection by keyboard, when last char could not be selected.
Title: Re: ShineInHex - hex view/edit control
Post by: Howard on August 03, 2007, 03:36:15 AM
Hi Ramguru

I've just downloaded your latest release to have my first look. I've managed to figure most things in its use (it wont open a file marked read-only, or an .exe - threw me for a while, but easily gotten around). However, I can't figure what is the use of the Copy command - once I copy a block I can't seem to do anything with it - is this for outside use or something (perhaps I need to look through the source). Is there a facility for pasting a block?
The other thing happening I noticed is that it is not saving the screen width (i.e. number of columns) in the ini file.
I'm commenting on these things because it is looking very nice, especially being set up as a control - I've done this sort of thing for my own use as a control, but not as nice as this - thinking of changing to it.

Thanks
Howard
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on August 03, 2007, 06:14:14 AM
Thanks for your thorough response, Howard

Quote from: Howard on August 03, 2007, 03:36:15 AM
(it wont open a file marked read-only,
In latest release I added HEXM_SETREADONLY , but didn't make a use of it. I think in following release test_application will be able to open read-only files and HEXM_SETREADONLY will make sure editing mode is turned off.

Quote from: Howard on August 03, 2007, 03:36:15 AM
However, I can't figure what is the use of the Copy command - once I copy a block I can't seem to do anything with it - is this for outside use or something
Of course it's for outside use, invoke your imagination :lol . Let's say you copied bare hex block, then you can check in other program if that block corresponds to opcode or something, examine it, you can paste it in find dialog (and search for reversed data) whatever.

Quote from: Howard on August 03, 2007, 03:36:15 AM
Is there a facility for pasting a block?
No, there isn't yet. It would be difficult, pasting sometimes means inserting, but this can't be implemented  :naughty: For pasting-overwriting case there is a good chance in the future.

Quote from: Howard on August 03, 2007, 03:36:15 AM
The other thing happening I noticed is that it is not saving the screen width (i.e. number of columns) in the ini file.
That can & will be implemented in the following release. But generally it's parent's responsibility to save that data, not control's.


I was using a lot this control myself lately while examining mnu,dlg formats and i have something more in mind, ways to improve it: like tabs; command line support; double view; structure viewer/editor...Will be working on some of these features after I'm finished with rc2dlg converter.
Title: Re: ShineInHex - hex view/edit control
Post by: Howard on August 07, 2007, 04:20:48 AM
Hi Ramguru

I've basically been comparing your control from a stand-alone pont of view with James Brown's HexEdit which I've used for several years - best I've ever found - stepped up from MadEdit in MSDOS. I think you mentioned his name earlier in this thread. His is the only hexeditor I've come across that can genuinely copy & paste (has 1 or 2 bugs in Search, but fixes coming I think). I use that facility quite often. I've tried dozens of hexeditors - none compare to James' - but yours seems to be shaping up well, especially with the control thing in mind. The copy-paste-overwrite would pretty well finish it off.
For me I don't currently see a use for pasting outside the control.
We load stuff into the control to view it, monitor changes instigated by the parent, and manually manipulate it if necessary.

I couldn't paste into the Find dialog either.

I agree with your comment about paste-insert - really a no-no in hex editing, because most of the time we are dealing with fixed length files - eproms etc. That would be scarey!

You mention 'double-view' - if that means two concurrent windows into a hex block, that sounds real good - and triple-view... :bg

I haven't seen mention of rc2dlg converter - I'll search for it -sounds like you're having lots of fun :clap:

Howard
Title: Re: ShineInHex - hex view/edit control
Post by: wskjuf on August 16, 2007, 09:42:43 AM
Hi Ramguru,

It's very good. and i suppose if it could give a better support for  diplay  of 64 bits length files in future, then i can deal with 4g bytes over files easier. sorry for my poor english.
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on August 20, 2007, 10:47:57 AM
Thanks for your all feedback...
wanted to reply and post update at the same time, but that's not easy thing to do, 'caz I'm working on multiple projects, one fails everything pend :) . ATM having some issues with tab control also it doesn't  very well fit with ShineInHex design so I'm experimenting with "FireWorks CS3" well I'm not very good at graphics  :wink

Quote from: Howard on August 07, 2007, 04:20:48 AM
I've basically been comparing your control from a stand-alone pont of view with James Brown's HexEdit which I've used for several years - best I've ever found
Well I'm not very self-confident at this point James brown is MVP, he has worked in M$ - what am I compared with him  :red (And yet HexEdit 2 is coming soon, I will be planted in the right-invisible place)
But I agree his HexEdit had some impact on this project, wanted to make something similar, better, what I would love  :toothy

Quote from: Howard on August 07, 2007, 04:20:48 AM
For me I don't currently see a use for pasting outside the control.
We load stuff into the control to view it, monitor changes instigated by the parent, and manually manipulate it if necessary.

I couldn't paste into the Find dialog either.
So from your comment I assume you find some copy commands useless, could you be more precise and name them  ::)

I don't understand why you couldn't paste copied data into Find Dialog. Let's say I select "14-06" then execute "Copy->Hex" then run "Dialogs->Find" check "HEX" radio button & paste data into edit field, I would be able to look for that data then "1406" or reversed data "0614" by pressing "Find" button as many times as this data occur.

Quote from: Howard on August 07, 2007, 04:20:48 AM
You mention 'double-view' - if that means two concurrent windows into a hex block, that sounds real good - and triple-view... :bg

I imagine this feature as parent-dependent, meaning in one-side there will be one instance of ShineInHex on other side the second instance, it will help to see differences in both files. Or maybe you have something else in mind, please share...

Quote from: wskjuf on August 16, 2007, 09:42:43 AM
Hi Ramguru,

It's very good. and i suppose if it could give a better support for  diplay  of 64 bits length files in future, then i can deal with 4g bytes over files easier. sorry for my poor english.
Hi, wskjuf
I doubt about 64-bit support, you see it would be  10 times wiser to create two versions of hex-editor one for 32-bits one for 64-bits (I mean different OSes). 64-bit programming supports 64 bit registers - so it would be no big problem converting. However I have no 64-bit CPU...and cannot start digging into 64-bit world  :'(
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on August 26, 2007, 12:26:00 AM
This is a preview of upcoming feature - structure viewer (later editor too)
You can give some suggestions at this stage  :wink
Now it exists as separate project (not yet integrated in ShineInHex) you can download and test it.
It does something serious at this moment:
1) reads structs.txt file that contains all the user-defined structures, as an example:
>BITMAPFILEHEADER
bfType      dw ?
bfSize      dd ?
bfReserved1 dw ?
bfReserved2 dw ?
bfOffBits   dd ?
<

supported keywords "db dw dd df dq dt dup"
you can see ">" indicates beginning of a structure, "<" indicates its end (btw 1-st structure in structs.txt should begin after newline separator). The toughest thing here was to create dynamical memory allocation model...you know  - app allocates memory, then allocates more memory and places a pointer to that block in previous allocated block, then allocates even more memory and does the same thing, so you understand freeing was just same painfull.
2) determines if struct member is an array and of course all data sizes
3) it shows values in big-endian form

Structures won't be constrained by any offset (meaning IMAGE_DOS_HEADER can only begin at 0 offset). Structure-viewer data will be changing in real-time according to selection. Also at any time user will be able to switch to other structure.

My current unknowns are:
how to show (draw) big arrays, say "x db 512 dup (?)" not filling all the screen with numbers :)
is it worth to show numb. in decimal ?
is it worth to deal with floats ?????

(http://img528.imageshack.us/img528/5250/seew6.png)

[attachment deleted by admin]
Title: Re: StructEd
Post by: Jupiter on August 26, 2007, 12:46:42 PM
Hi ramguru!
Great work, really!

Nice idea with Structs.txt

Well... let's talk about bugs found ;)

1. TAB instead of many spaces in Structs.txt is not supported - app crashes!
2. Extra symbols after structure's title (see screenshot)

Keep this good work!
If you need any help - contact me via e-mail.

(http://img71.imageshack.us/img71/7600/structedbugtitle001jr4.png)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on August 26, 2007, 01:02:45 PM
Big thanks, Jupiter
I'll try to fix everything you've mentioned ASAP.
Also decided to add decimal preview for struct_members <= sizeof(DWORD) (not for arrays)
Keep posting suggestions  :U
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on August 26, 2007, 01:44:19 PM
Quote from: ramguru on August 26, 2007, 01:02:45 PM
Keep posting suggestions

Some options for single click:
Struct Title - Roll / Unroll struct
Struct Field (member) - highlight line

Some options for double click:
Struct Title - copy entire structure (formated as MASM struct syntax)
Struct Field (member) - copy value and name (e_lfanew<TAB>80h)
Struct Value - copy value only (80h)

Display options:
"Zebroid" list style: light/dark row for better visual distinguish
Additional column(s) for decimal and string representation of field value (5A4Dh / 'MZ' / 23117)
Different colours for db/dw/dd etc (very nice feature I think)
Additional field description (for some fields): e_lfanew - PE header offset

Structs database (Structs.txt):
Allow TAB characters in file
Redesign displaying of fields: format string using TAB stops and string length instead of aligning using spaces (as it currently realized)


Implementation:
Define RECT for drawing place (if we need to draw structs somewhere else in the dialog)
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on August 26, 2007, 02:04:52 PM
These are some serious suggestions  :U thanks
It will take some time to implement them  :wink
Title: Re: ShineInHex - hex view/edit control
Post by: Howard on August 27, 2007, 10:02:38 PM
G'day Ramguru

Picking up on some of your points:
QuoteThanks for your all feedback...
Quote from: Howard on August 08, 2007, 02:20:48 am
For me I don't currently see a use for pasting outside the control.
We load stuff into the control to view it, monitor changes instigated by the parent, and manually manipulate it if necessary.

I couldn't paste into the Find dialog either.

So from your comment I assume you find some copy commands useless, could you be more precise and name them 

I don't understand why you couldn't paste copied data into Find Dialog. Let's say I select "14-06" then execute "Copy->Hex" then run "Dialogs->Find" check "HEX" radio button & paste data into edit field, I would be able to look for that data then "1406" or reversed data "0614" by pressing "Find" button as many times as this data occur.
Thanks, you have enlightened me - I normally highlight the chtrs and press Control-C to copy. On reflection, you obviously haven't implemented that because you highlight both the hex and the Ascii simultaneously, which makes it impossible to decide, for a direct paste into the Find dialog.
A couple of comments here - could you make the Find box non-modal so that it's possible to edit on the fly; and secondly if you load a file, open the Find dialog and accidentally press the Find button with blank search string an error is generated.

For the Copy Commands, well so far I haven't required a facility to copy a section to outside the control (although use copy to clipboard many times a day in general file use - but that's already catered for by HexEdit), but I wouldn't presume to say that nobody else would use it. For me just being able to select maybe 40 bytes and use that to overcopy another section, sometimes once, sometimes many copies, is an essential use, and would save a lot of outside maniplutation.

QuoteQuote from: Howard on August 08, 2007, 02:20:48 am
You mention 'double-view' - if that means two concurrent windows into a hex block, that sounds real good - and triple-view...

I imagine this feature as parent-dependent, meaning in one-side there will be one instance of ShineInHex on other side the second instance, it will help to see differences in both files. Or maybe you have something else in mind, please share...

Yes, I had that partially in mind, but there are other ways of using this:
-  sometimes I want two views of a section of memory, one static (a snap-shot), the other dynamically updated, to watch for changes, and be able to compare with the snapshot without having to try to remember what it was
-  some occasions I'd like to view several sections of memory simultaneously as say in debugging, so more than two windows can be useful at times. In Visual Studio I often use up to 4, but VS only suits 80x86.

Thanks
(dreamy) Howard
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on August 27, 2007, 10:21:07 PM
Quote from: Howard on August 27, 2007, 10:02:38 PM
A couple of comments here - could you make the Find box non-modal so that it's possible to edit on the fly; and secondly if you load a file, open the Find dialog and accidentally press the Find button with blank search string an error is generated.
G'day Howard :) nice to meet ya

Yeah no problem, will include it in todo list
And I have just recently noticed that error (will be fixed of course).

Quote from: Howard on August 27, 2007, 10:02:38 PM
but that's already catered for by HexEdit), but I wouldn't presume to say that nobody else would use it.
I'll do my best redirecting users from HexEdit to my control  :toothy

Quote from: Howard on August 27, 2007, 10:02:38 PM
Yes, I had that partially in mind, but there are other ways of using this:
-  sometimes I want two views of a section of memory, one static (a snap-shot), the other dynamically updated, to watch for changes, and be able to compare with the snapshot without having to try to remember what it was
-  some occasions I'd like to view several sections of memory simultaneously as say in debugging, so more than two windows can be useful at times. In Visual Studio I often use up to 4, but VS only suits 80x86.
I doubt about one-static-one-dynamic-view-thing, 'caz at the moment I'm using memory mapped files, I'm dealing with direct changes, I don't know how it would turn if few instances opened the same file, may end in crash or in no read access. Regarding number of view I can make more than 2 but prefer even number :)



Title: Re: ShineInHex - hex view/edit control
Post by: Howard on August 27, 2007, 10:50:57 PM
Hi Ramguru

QuoteI doubt about one-static-one-dynamic-view-thing, 'caz at the moment I'm using memory mapped files, I'm dealing with direct changes, I don't know how it would turn if few instances opened the same file, may end in crash or in no read access. Regarding number of view I can make more than 2 but prefer even number :)


You're thinking from the point of view of memory-mapped files. I'm thinking from the point of view of one file loaded to a block of memory by the parent and that same memory block being simultaneously accessed by one or more instances - which I'd deduced (hoped) should be possible for the control? I follow your concerns about more than one instance opening the same file - although in a slightly different context both Notepad & Wordpad don't have any qualms. And while on the subject, that's one of my few gripes with HexEdit - once it has got hold of a file nothing else can get at it. From a developer's point of view, (mostly) we know what we are doing and don't need to be protected from ourselves :wink

Oh... and even numbers is a lot better than no numbers.

Regards
Howard
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on September 21, 2007, 08:54:42 PM
New version in first post:
...implemented multi_tab interface (using GDTabs);
...now read-only files can be opened with disabled input;
...fixed crash bug in find_dialog
...find_dialog now is modeless dialog-box with alpha feature

Sorry, Howard, no multiple views support (it doesn't fit in current design)
This update was more regarding test application...update regarding the control is coming soon
Title: Re: ShineInHex - hex view/edit control
Post by: Sameer on September 22, 2007, 08:59:44 AM
excellent stuff mate

keep going ;)
Title: Re: ShineInHex - hex view/edit control
Post by: Draakie on January 18, 2008, 07:45:44 AM
Hi RamGuru,

A fellow South African came up with a very novel idea of allowing grouping - during the edit.

http://www.nitrogen.za.org/junk/Elucidator.zip

Might make for an interesting feature...... :dance:

Draakie
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on January 18, 2008, 10:26:13 AM
Thanks for the link Draakie
Was hoping to see those gradients in action  :lol but ...
So I had a play with that app to get the idea. And yes it's a novel feature. But if we sum things up. This Elucidator works only with decimal numbers which is good for users, but bad when it comes to editing, because direct editing is only possible with hex numbers. Also I'm working on similar feature: structure editor, which will order current selection into structure members. Next to hex representation there will be decimal one. Of course I agree it's not that convenient, 'cause it's not in-place change. But anyway I could make another feature like number grouping into BYTE (which is default), WORD, DWORD, so it would loook like:
99 88 77 66 55 44 33 22 [BYTE]
88 99 66 77 44 55 22 33 [WORD]
66 77 88 99 22 33 44 55 [DWORD]
Yet still thinking if it would make any sense ('cause structure editor does similar thing, and this would be applied to whole file)
Also I'm curious about that app, there is a messy column next to the scrollbar, is that a bug, or some kind of density/distribution indicator  :lol.
(http://img444.imageshack.us/img444/4177/pixelsun2.png)
Title: Re: ShineInHex - hex view/edit control
Post by: Draakie on January 28, 2008, 07:26:57 AM
Hi again Ramguru,

:bdg - I think the author wanted to create a file position indicator and got it way wrong - :bdg
        - and yes - essentially this is a viewer only.....sorry for the misconception.....

Anyway - about your comments...hmmmm it would be nice to pre-load say 5 different Structs -
highlight a certain area in the source and then view that area as that particular struct - or something like that.
Applying a single struct to an entire file is just not that "Nice" IMHO.

Yah - decimal is'nt really of that much use... :U - but how about support for REAL formats ?

In the end - it's up to you - you've put in the looong hours - blood -sweat - coffee etc.  :clap:

Draakie
Title: Re: ShineInHex - hex view/edit control
Post by: ramguru on June 27, 2010, 02:02:39 PM
update in 1st post :}
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on June 28, 2010, 12:48:43 PM
Wow :))
Nice update!
Thank you!
Title: Re: ShineInHex - hex view/edit control
Post by: six_L on June 29, 2010, 01:57:48 AM
perfect!!!
Title: Re: ShineInHex - hex view/edit control
Post by: Mincho Georgiev on July 07, 2010, 06:24:36 PM
I'm glad to see that you are still working on this project!

Best Regards!
Mincho.
Title: Re: ShineInHex - hex view/edit control
Post by: Jupiter on July 08, 2010, 11:11:39 AM
A little bit updated test app


[*] Relative path to includes and libs to build in portable environment
[+] Build.bat to build outside IDE
[*] Updated manifest built-in with app
[+] WinAsm project