The MASM Forum

64 bit assembler => Mikl__'s ml64 examples => Topic started by: Mikl__ on May 26, 2017, 08:43:47 PM

Title: Uncle Remus Tales
Post by: Mikl__ on May 26, 2017, 08:43:47 PM
Uncle Remus Tales
(http://wasm.in/forum/attachments/skazki-dyaduschki-rimusa4-jpg.198/?temp_hash=cceddd42436bb47e6949cf2c3d9ce12b)
Consider this cycle a parody that Joel Chandler Harris wrote on the "Iczelion Lessons" rewritten under Win x64
Drawings from the movie "Songs of the South" (1946) are kindly provided (http://wasm.in/forum/attachments/twdc_logo-svg-png.274/?temp_hash=2da92c7ab6bbb6ea43dbd55893f45158)
Uncle Remus tales:#37i gif-animation
Code: [Select]
; GUI #
include win64a.inc
include gdiplus.inc
includelib gdiplus.lib

PropertyTagFrameDelay  equ 5100h
cdXPos          equ 127
cdYPos          equ 127
cdXSize         equ 200
cdYSize         equ 100
cdVBarTipo      equ 0
cdMainIcon      equ 100
cdIdTimer       equ 1
.code
WinMain proc
local msg:MSG
local ptDiff:POINT
local rctWnd:RECT
local rctClient:RECT
local nSize:qword
local pDimensionIDs:qword
local count:qword

;инициализация библиотеки GDIPLUS
mov ecx,offset gdiplusToken
mov edx,offset gsi
invoke GdiplusStartup,,,0

xor ebx,ebx
mov edi,offset ClassName
mov ecx,offset FileName
invoke LoadCursorFromFile

push rax ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT ;hbrBackground
push 10003h ;hCursor
push rax ;hIcon
push IMAGE_BASE ;hInstance
push rbx ;cbClsExtra & cbWndExtra
pushaddr WndProc  ;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
invoke RegisterClassEx,esp ;addr WNDCLASSEX

        mov ecx,offset szfilename
mov edx,offset g_image
invoke GdipLoadImageFromFile
;TestForAnimatedGIF-------------------------------
lea edx,count
mov [rdx],ebx;count=0
mov ecx,g_image
invoke GdipImageGetFrameDimensionsCount
mov ecx,dword ptr count
test ecx,ecx
jz @f
shl ecx,4
invoke GdipAlloc

mov dword ptr pDimensionIDs,eax
mov ecx,g_image
invoke GdipImageGetFrameDimensionsList,,eax,count
or eax,eax
jnz @f
mov r8d,offset nFrameCount
mov ecx,g_image
invoke GdipImageGetFrameCount,,pDimensionIDs
or eax,eax
jnz @f
lea r8d,nSize
mov ecx,g_image
invoke GdipGetPropertyItemSize,,PropertyTagFrameDelay
or eax,eax
jnz @f
mov ecx,dword ptr nSize
shl ecx,2
invoke GdipAlloc
mov pPropertyItem,eax
mov ecx,g_image
invoke GdipGetPropertyItem,,PropertyTagFrameDelay,nSize,eax
or eax,eax
jnz @f
mov ecx,dword ptr pDimensionIDs
        invoke GdipFree
@@:;------------------------------------
mov edx,offset nWidth
mov ecx,g_image
call GdipGetImageWidth
mov edx,offset nHeight
mov ecx,g_image
call GdipGetImageHeight

push rbx
push IMAGE_BASE
push rbx
  push rbx
push cdYSize ; nHeight
push cdXSize ; nWidth
push cdYPos ; Y
push cdXPos ; X
sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
        mov hMainWnd,eax
        lea edx,rctClient ;lpRect
invoke GetClientRect,eax
lea edx,rctWnd ;lpRect
mov ecx,hMainWnd
invoke GetWindowRect
mov eax,rctWnd.right
sub eax,rctWnd.left
sub eax,rctClient.right
mov ptDiff.x,eax
mov eax,rctWnd.bottom
sub eax,rctWnd.top
sub eax,rctClient.bottom
mov ptDiff.y,eax
mov qword ptr [rsp+28h],TRUE ; bRepaint
        mov ecx,nHeight
add ecx,ptDiff.y
mov [rsp+20h],rcx ;nHeight
mov eax,nWidth
add eax,ptDiff.x
mov ecx,hMainWnd
invoke MoveWindow,,cdXPos,cdYPos,rax
lea edi,msg
@@: invoke GetMessage,edi,NULL,0,0
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
invoke DispatchMessage,edi
jmp @b
WinMain endp
WndProc proc hWnd:qword,umsg:qword,wParam:qword,lParam:qword
local ps:PAINTSTRUCT
local graphics:qword

mov hWnd,rcx
mov wParam,r8
mov lParam,r9

cmp edx,WM_DESTROY
je wmDESTROY
cmp edx,WM_CREATE
je wmCREATE
cmp edx,WM_SIZE
je wmSIZE
cmp edx,WM_PAINT
je wmPAINT
cmp edx,WM_TIMER
je wmTIMER
leave
        jmp DefWindowProc
wmDESTROY::invoke KillTimer,,cdIdTimer
cmp g_image,0
jz @f
mov ecx,g_image
invoke GdipDisposeImage
@@: cmp pPropertyItem,0
jz @f
mov ecx,pPropertyItem
invoke GdipFree
@@: invoke ExitProcess,NULL
wmPAINT:lea edx,ps
invoke BeginPaint
;DrawFrameGIF---------------------
mov edx,offset nWidth
mov ecx,g_image
invoke GdipGetImageWidth
or eax,eax
jnz @f
mov edx,offset nHeight
mov ecx,g_image
invoke GdipGetImageHeight
or eax,eax
jnz @f
lea edx,graphics
invoke GdipCreateFromHDC,ps.hdc
mov eax,dword ptr vdyClient
mov [rsp+28h],rax
mov eax,dword ptr vdxClient
mov [rsp+20h],rax
mov edx,g_image
invoke GdipDrawImageRectI,graphics,,0,0
invoke GdipDeleteGraphics,graphics
mov r8d,nFramePosition
inc nFramePosition
mov edx,offset pageGuid
mov ecx,g_image
invoke GdipImageSelectActiveFrame
mov eax,nFramePosition
sub eax,nFrameCount
jnz @f
mov nFramePosition,eax
;-------------------------------
@@: lea edx,ps
invoke EndPaint,hWnd
jmp wmBYE
wmTIMER:invoke InvalidateRect,,0,0
jmp wmBYE
wmCREATE:invoke SetTimer,,cdIdTimer,100,0
jmp wmBYE
wmSIZE: mov rax,r9;lParam
mov vdxClient,ax
shr eax,10h
mov vdyClient,ax
jmp wmBYE
wmBYE: leave
retn
WndProc endp
;-----------------------------------
ClassName db "Uncle Remus tales:#37i gif animation",0
FileName db "br_Rabbit3.cur",0
gsi GdiplusStartupInput <1,0,0,0,0>
pageGuid GUID <6AEDBD6Dh,3FB5h,418Ah,<83h,0A6h,7Fh,45h,22h,9Dh,0C8h,72h>>
szfilename: du <movie.gif>
gdiplusToken dd ?
nWidth dd ?
nHeight dd ?
vdxClient dw 0,0
vdyClient dw 0,0
nFrameCount dd ?
nFramePosition dd 0
pPropertyItem dd ?
g_image dd ?
hMainWnd dd ?
end
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 26, 2017, 08:49:03 PM
rename files movie.01.zip, movie.02.zip, movie.03.zip, movie.04.zip to movie.zip.001, movie.zip.002, movie.zip.003, movie.zip.004 and unzip they
to be continued
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 26, 2017, 08:50:14 PM
to be continued
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 26, 2017, 08:52:07 PM
completion
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 26, 2017, 08:55:03 PM
completion
Title: Re: Uncle Remus Tales
Post by: Siekmanski on May 27, 2017, 12:41:26 AM
I renamed the files, but couldn't unzip the movie. (unknown format or corrupt file)
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 27, 2017, 01:01:10 AM
Hi, Siekmanski!
I used 7-zip (www.7-zip.org) compression level=Maximum, compression method=default, dictionary size=32 KB, word size=64
Result is "movie.zip" folder with "movie.gif" file, size is 1730254 bytes. I just checked. File movie.gif downloaded and unpacked without errors
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 27, 2017, 06:07:19 PM
Uncle Remus tales:#37j simple animation
Code: [Select]
; GUI #
include win64a.inc
include gdiplus.inc
includelib gdiplus.lib
ILD_NORMAL equ 0
.code
WinMain proc
local msg:MSG
local hwnd:qword

;inizialisation GDIPLUS
mov ecx,offset gdiplusToken
mov edx,offset gsi
invoke GdiplusStartup,,,0

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
mov ecx,offset FileName
invoke LoadCursorFromFile
push rax ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT;hbrBackground
push 10003h ;hCursor
push rax    ;hIcon
push rsi ;hInstance
push rbx    ;cbClsExtra & cbWndExtra
pushaddr WndProc  ;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
invoke RegisterClassEx,esp ;addr WNDCLASSEX

push rbx
push rsi ;rsi=400000h
shl esi,9 ;rsi=CW_USEDEFAULT
push rbx
  push rbx
push 180;rsi
push 170;
push rsi
push rsi
sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
    mov hwnd,rax
        and  qword ptr [rsp+20h],0
invoke ImageList_Create,153,147,ILC_COLOR24,1
mov hList,eax

        mov ecx,offset FilenameW
mov edx,offset pImage
  invoke GdipCreateBitmapFromFile
mov edx,offset hBmp
  invoke  GdipCreateHBITMAPFromBitmap,pImage,,0
  invoke  GdipDisposeImage,pImage

  mov edx,hBmp
mov ecx,hList
invoke ImageList_Add,,,0
  mov ecx,hBmp
invoke DeleteObject
        invoke GetDC,hwnd
        mov hDC,eax
        mov r9d,offset Draw
        invoke SetTimer,hwnd,1,40;1000/25=40
lea edi,msg
@@: invoke GetMessage,edi,NULL,0,0
invoke DispatchMessage,edi
jmp @b
WinMain endp
WndProc:
cmp edx,WM_DESTROY
je wmDESTROY
        jmp DefWindowProc
wmDESTROY:invoke ExitProcess,NULL
;-------------------------------------
Draw proc
        enter 30h,0
and qword ptr [rbp-8],ILD_NORMAL; drawing style
and qword ptr [rbp-10h],0;y-coordinate to draw at
mov edx,count
mov r8d,hDC
mov ecx,hList
invoke ImageList_Draw,,,,0
inc count
cmp count,210
jb @f
and count,0
@@: leave
ret
Draw endp
;-----------------------------------
align 2
FilenameW: du <all3.jpg>
ClassName db "Uncle Remus tales:#37j Simple animation",0
gsi GdiplusStartupInput <1,0,0,0,0>
FileName db "br_Rabbit3.cur",0
gdiplusToken dd ?
hBmp dd ?
count dd ?
hList dd ?
hDC dd ?
pImage dq ?
end
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 27, 2017, 06:10:07 PM
rename files 37j.001.zip, 37j.002.zip, 37j.003.zip, 37j.004.zip to 37j.zip.001, 37j.zip.002, 37j.zip.003, 37j.zip.004 and unzip they
to be continued
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 27, 2017, 06:13:08 PM
to be continued
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 27, 2017, 06:14:24 PM
completion
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 29, 2017, 11:47:20 PM
Uncle Remus tales:#37a Animation
We are writing a player based on the SysAnimate32 class. We create a window, on this window we upload a child window with the class SysAnimate32 indicating the file that we want to play.
Create a child window using the CreateWindowEx function. We do not need to register the window class, since it was already registered by Windows. When creating the screen, specify "SysAnimate32" as the class name for CreateWindowsEx. Other parameters that we must specify are the handle of the parent window and the ID of the control. The control ID should be unique if we used several controls to distinguish this control from others. But since the control we have is the only one set ID = 0. We also need to specify the screen sizes and the coordinates of its upper left corner. Normally, the child window is created during the processing of the WM_CREATE message of the main window. We will create a child window before processing the message loop. After creating the animation management tool, we send the ACM_OPEN message via the SendMessage function to open the AVI clip and load it into memory. The message specifies the path to the AVI file.
Code: [Select]
LRESULT WINAPI SendMessage(
  _In_ HWND   hWndControl, //A handle to the window whose window procedure will receive the message
  _In_ UINT ACM_OPEN, //The message to be sent
  _In_ WPARAM hinst, //Additional message-specific information
  _In_ LPARAM lpszName      //Additional message-specific information
);
Parameters
Code: [Select]
; GUI #
include win64a.inc
ACM_OPEN = WM_USER + 100
ACS_AUTOPLAY = 4
ID_ANIMATE = 101
.code
WinMain proc
local msg:MSG
local hwnd:QWORD

xor ebx,ebx
mov esi,IMAGE_BASE
mov ecx,offset FileNameCur
invoke LoadCursorFromFile
mov edi,offset ClassName
push rax ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOW;hbrBackground
push 10005h ;hCursor
push rax        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
pushaddr WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
    invoke RegisterClassEx,esp ;addr WNDCLASSEX

push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push 440
push 510
push 10
push 10
sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_CAPTION or WS_SYSMENU or WS_VISIBLE
mov hwnd,rax

push rbx
push rsi;IMAGE_BASE
push ID_ANIMATE
push rax;hwnd
push rbx;The width and height of the frame will be adjusted automatically
push rbx
push 20
push 20
sub esp,20h
mov r8d,offset NoText
mov edx,offset Animate32
invoke CreateWindowEx,WS_EX_STATICEDGE+WS_EX_CLIENTEDGE,,,WS_CHILD+WS_VISIBLE+WS_TABSTOP+ACS_AUTOPLAY

movr qword ptr [rsp+20h],AviFile
    invoke SendDlgItemMessage,hwnd,ID_ANIMATE,ACM_OPEN,IMAGE_BASE

    lea edi,msg
@@:     invoke GetMessage,edi,0,0,0
        invoke DispatchMessage,edi
        jmp @b
WinMain endp
WndProc: cmp edx,WM_DESTROY
je wmDESTROY
        jmp DefWindowProc
wmDESTROY:invoke ExitProcess,0
;---------------------------------------
ClassName db 'Uncle Remus tales:#37a Animation',0
FileNameCur db "br_Rabbit3.cur",0
AviFile db 'output.avi',0
Animate32 db "SysAnimate32"
NoText db 0
end
There is link for output.avi (https://yadi.sk/i/J4bVuX4H3JdByJ) file. To play via "SysAnimate32", the avi-file should not be compressed (therefore it has such a large size) and can not contain audio data
Title: Re: Uncle Remus Tales
Post by: Mikl__ on May 30, 2017, 10:23:20 PM
Read 129 times, downloaded 1 times
Is my english so terrible? Or the topic is completely uninteresting?
Title: Re: Uncle Remus Tales
Post by: jj2007 on May 30, 2017, 10:30:54 PM
No, your English is good, your code is excellent, as usual :t

I even quoted you here (http://masm32.com/board/index.php?topic=94.msg67229#msg67229) ;-)

Code: [Select]
push rbx ; ширина и высота кадра настроятся автоматически
push rbx ; The width and height of the frame will be adjusted automatically

But I had to write a little converter to see your cyrillic comments:

include \masm32\MasmBasic\MasmBasic.inc      ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  Let esi=Cat$(Utf8Bom+ConvertCp$(FileRead$("tut_37a.asm"), 1251, CP_UTF8))
  FileWrite "tut_37aUtf8.asc", esi
  ShEx "tut_37aUtf8.asc"
EndOfCode
Title: Re: Uncle Remus Tales
Post by: nidud on May 31, 2017, 12:03:41 AM
But I had to write a little converter to see your cyrillic comments:

 :biggrin:

Why?
Title: Re: Uncle Remus Tales
Post by: jj2007 on May 31, 2017, 12:24:08 AM
But I had to write a little converter to see your cyrillic comments:

 :biggrin:

Why?

Oops, I forgot that everybody should read sources only in their own codepages (http://masm32.com/board/index.php?topic=6221.msg66429#msg66429). So, having an Italian OS, I am not allowed to see cyrillic comments, even if Google would be able to translate it for me, as demonstrated above. Sorry, Sir Nidud, I won't do it again 8)
Title: Re: Uncle Remus Tales
Post by: hutch-- on May 31, 2017, 12:33:46 AM
I downloaded and test it last night but gave up due to exhaustion as I had been awake too long. I could get it to run with VLC but the file was very large and the resolution very low.
Title: Re: Uncle Remus Tales
Post by: jj2007 on May 31, 2017, 01:06:38 AM
VLS runs it, FLV runs it but in distorted black & white.

The file output.avi is 156 MB, no sound, otherwise it wouldn't play with sysanimate32.

The control is very easy to use, just create it and then
Code: [Select]
invoke SendMessage, hAvi, ACM_OPEN, 0, pFileName
invoke SendMessage, hAvi, ACM_PLAY, -1, 0FFFF0000h

But its usage is really very limited, without sound, and working only with avi files that do not contain sound info.
Attached my dual 64/32-bit version; expects output.avi in the same folder.
Title: Re: Uncle Remus Tales
Post by: nidud on May 31, 2017, 01:35:54 AM
Oops, I forgot that everybody should read sources only in their own codepages (http://masm32.com/board/index.php?topic=6221.msg66429#msg66429).

The question here is if you intentionally try to prohibit or give the impression that the Russians and Norwegians can't use SendMessageA and all the ASCII API functions, and we have to use Microsoft Word or WordPad to write our code.

Quote
So, having an Italian OS, I am not allowed to see cyrillic comments

The copyright holder of the text is the writer.

Quote
even if Google would be able to translate it for me, as demonstrated above.

If he copy and paste the text in this (English) forum the text is converted to Unicode for other members who use this language to read or others to translate, as demonstrated above.

Quote
Sorry, Sir Nidud, I won't do it again 8)

Good :t
Title: Re: Uncle Remus Tales
Post by: hutch-- on June 02, 2017, 12:09:21 AM
See if this helps.

Tutorial: Encoding an MP4 File

https://msdn.microsoft.com/en-us/library/windows/desktop/ff819476(v=vs.85).aspx
Title: Re: Uncle Remus Tales
Post by: jj2007 on June 02, 2017, 02:11:29 AM
Almost unrelated:

Code: [Select]
uselib vfw32
...
invoke MCIWndCreate, hWnd, hInstance, 0, Chr$("chimes.wav")

Can't launch the program because vfw32.dll is not present.

But these files are present:
C:\Windows\SysWOW64\msvfw32.dll
C:\Windows\System32\msvfw32.dll
 ::)
Title: Re: Uncle Remus Tales
Post by: TWell on June 02, 2017, 02:48:40 AM
check that vfw.lib again.
SDK version of vfw.lib and msvfw.lib use MSVFW32.dll.
MCIWndCreate are in both of those libraries and it is a cdecl type ?

Title: Re: Uncle Remus Tales
Post by: jj2007 on June 02, 2017, 03:12:26 AM
There is no \Masm32\lib\msvfw32.lib, only \Masm32\lib\vfw32.lib
And the latter produces that error message...
Title: Re: Uncle Remus Tales
Post by: TWell on June 02, 2017, 03:18:44 AM
So it is a broken library, make a bug report about it ;)

Correct vfw.lib have references to MSVFW32.DLL AVIFIL32.DLL AVICAP32.DLL
since 1994 ?
Title: Re: Uncle Remus Tales
Post by: jj2007 on June 02, 2017, 05:12:10 AM
make a bug report about it ;)

Like this one (http://www.masmforum.com/board/index.php?topic=4314.0)?  ;)
Title: Re: Uncle Remus Tales
Post by: Siekmanski on June 02, 2017, 05:18:42 AM
try this one.
Title: Re: Uncle Remus Tales
Post by: jj2007 on June 02, 2017, 08:57:57 AM
Nice. I wanted to extract the two files to my "Marinus" folder, and guess what? They were already there :P

Thanks anyway. In the meantime, I tested Pelle's vfw32.lib, it works, too.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 05, 2017, 09:42:17 AM
https://wasm.in/threads/skazki-djadjushki-rimusa.31832/
Title: Re: Uncle Remus Tales
Post by: jj2007 on June 05, 2017, 10:08:53 AM
Thank you, Mikl - this is nicely written, and even in English ;) (https://translate.google.it/translate?sl=ru&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=https%3A%2F%2Fwasm.in%2Fthreads%2Fskazki-djadjushki-rimusa.31832%2F&edit-text=)
(https://wasm.in/data/avatars/m/7/7954.jpg?1480491213)

Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 20, 2017, 12:47:29 PM
Uncle Remus tales:#14 Process
asm-file
Code: [Select]
; GUI #
include win64a.inc
include advapi32.inc
includelib advapi32.lib

MI_PROCESS_CREATE equ 0
MI_PROCESS_TERMINATE equ 1
MI_EXIT equ 2
IDR_MAINMENU equ 30
WM_FINISH equ WM_USER+100h
MAX_KEY_LENGTH equ 255
MAX_VALUE_NAME equ 16383
.code
WinMain proc
local msg:MSG

      xor ebx,ebx
mov edi,offset ClassName
mov esi,IMAGE_BASE
mov ecx,offset FileName
invoke LoadCursorFromFile
push rax ;hIconSm
push rdi ;lpszClassName
push IDR_MAINMENU;lpszMenuName
push COLOR_WINDOW;hbrBackground
push 10003h ;hCursor
push rax ;hIcon
push rsi ;hInstance
push rbx ;cbClsExtra & cbWndExtra
pushaddr WndProc;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
invoke RegisterClassEx,esp ;addr WNDCLASSEX
push rbx
push rsi ;rsi=400000h
shl esi,9 ;rsi=CW_USEDEFAULT
push rbx
push rbx
push 200
push 300
push rsi
push rsi
sub esp,20h
    invoke CreateWindowEx,WS_EX_CLIENTEDGE,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
invoke GetMenu,eax
mov hMenu,rax
    lea edi,msg
@@:    invoke GetMessage,edi,0,0,0
invoke DispatchMessage,edi
      jmp @b
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local progStartInfo:STARTUPINFO
local hKey:qword
local lpcbData:dword
local hFile:qword
local szBuff[MAX_PATH*4]:byte

mov edi,offset processInfo
mov esi,offset proExitCode
mov hWnd,rcx
mov wParam,r8
mov lParam,r9

cmp  edx,WM_DESTROY
je   wmDESTROY
cmp  edx,WM_CREATE
je   wmCREATE
cmp  edx,WM_COMMAND
je   wmCOMMAND
cmp  edx,WM_INITMENUPOPUP
je   wmINITMENUPOPUP
cmp  edx,WM_FINISH
je   TERMINATE
cmp  edx,WM_TIMER
je   wmTIMER
leave
jmp DefWindowProc

wmDESTROY:invoke GetExitCodeProcess,[rdi+PROCESS_INFORMATION.hProcess],esi;proExitCode
cmp dword ptr [rsi],STILL_ACTIVE
jne @f
invoke TerminateProcess,[rdi+PROCESS_INFORMATION.hProcess],0
@@: invoke CloseHandle,[rdi+PROCESS_INFORMATION.hProcess]
mov [rdi+PROCESS_INFORMATION.hProcess],rbx
invoke ExitProcess,NULL
wmCREATE:
;Узнаем длительность проигрывания wmv-файла
mov [rsp+30h],rbx ;hTemplateFile
mov qword ptr [rsp+28h],FILE_ATTRIBUTE_ARCHIVE ;dwFlagsAndAttributes
mov qword ptr [rsp+20h],OPEN_EXISTING ;dwCreationDisposition
mov ecx,offset FileName1+1    ;lpFileName
invoke CreateFile,,GENERIC_READ,\    ;dwDesiredAccess
FILE_SHARE_READ or FILE_SHARE_WRITE,\;dwShareMode
0 ;lpSecurityAttributes
mov hFile,rax;handle to file
mov [rsp+20h],rbx
lea r9d,lpcbData
lea edi,szBuff
invoke ReadFile,eax,edi,100h
invoke CloseHandle,hFile
 
mov rax,qword ptr szBuff[66h];duration in 100 nSec
mov edx,3518437209
mul edx
shr edx,13
mov duration,rdx;in mSec
;----------------------------------------------------
mov edx,offset aWmv
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,,0,KEY_READ,&hKey
xor esi,esi
@@:     mov lpcbData,MAX_VALUE_NAME
invoke RegEnumValue,hKey,esi,edi,&lpcbData,NULL,NULL,NULL,NULL
or eax,eax
jnz @f
mov lpcbData,100h
mov r9d,offset szREGSZ
invoke RegQueryValueEx,hKey,edi,0,,edi,&lpcbData
add edi,lpcbData
mov eax,[rdi-5]
or eax,20202000h
cmp eax,dword ptr aWmv;'vmw.'
jz @f
inc esi
jmp @b
@@:
;Получаем имя класса------------------------------------------
lea edx,szBuff
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,,0,KEY_READ,&hKey
lea eax,szBuff
add eax,lpcbData
mov dword ptr [rax-1],'ehs\'
mov dword ptr [rax+3],'ll'
invoke RegCloseKey,hKey
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,&szBuff,0,KEY_READ,&hKey
lea eax,lpcbData
mov [rsp+28h],rax
lea eax,szBuff
add eax,lpcbData
mov edi,eax
add edi,6
mov [rsp+20h],rdi
mov lpcbData,MAX_PATH
invoke RegQueryValueEx,hKey,0,0,,,&lpcbData
or word ptr [rdi-1],605Ch;\
mov rax,'dnammoc\'
mov [rdi+4],rax
mov [rdi+12],rbx
invoke RegCloseKey,hKey
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,&szBuff,0,KEY_READ,&hKey
mov lpcbData,MAX_PATH
mov r9d,offset szREGEXPANDSZ
invoke RegQueryValueEx,hKey,0,0,,&szBuff,&lpcbData
invoke RegCloseKey,hKey
lea edi,szBuff
add edi,lpcbData
sub edi,4
invoke GetCurrentDirectory,MAX_PATH,edi
lea edi,[rdi+rax]
mov aWmv[4],'"'
mov esi,offset FileName1
mov ecx,sizeof FileName1+6
rep movsb
lea ecx,szBuff
mov edx,offset szBuff1
invoke ExpandEnvironmentStrings,,,MAX_PATH
jmp wmBYE
wmINITMENUPOPUP:invoke GetExitCodeProcess,[rdi+PROCESS_INFORMATION.hProcess],esi
or eax,eax
jz @f;GetExitCodeProcess_TRUE
cmp dword ptr [rsi],STILL_ACTIVE ;cmp proExitCode,STILL_ACTIVE
jne @f ;     GetExitCodeProcess_STILL_ACTIVE
invoke EnableMenuItem,hMenu,MI_PROCESS_CREATE,MF_GRAYED
xor r8,r8; mov r8d,MF_ENABLED=0
jmp @0
@@: invoke EnableMenuItem,hMenu,MI_PROCESS_CREATE,MF_ENABLED
mov r8d,MF_GRAYED
@0:    invoke EnableMenuItem,hMenu,MI_PROCESS_TERMINATE
jmp wmBYE
wmCOMMAND:movzx eax,word ptr wParam
or r9,r9 ;cmp lParam,0
jnz wmBYE
cmp rax,MI_EXIT
ja wmBYE
jmp  [menu_handlers+rax*8]
PROCESS_CREATE:cmp [rdi+PROCESS_INFORMATION.hProcess],rbx
je pi_hProcess_IS_0
invoke CloseHandle,[rdi+PROCESS_INFORMATION.hProcess]
mov [rdi+PROCESS_INFORMATION.hProcess],rbx
pi_hProcess_IS_0:lea esi,progStartInfo
invoke GetStartupInfo,esi
invoke CreateProcess,0,&szBuff1,\
0,\;process security attributes
0,\;primary thread security attributes
0,\;handles are inherited
NORMAL_PRIORITY_CLASS,\;creation flags
0,\;use parent's environment
0,\;use parent's current directory
rsi,\;STARTUPINFO pointer
rdi ;receives PROCESS_INFORMATION
invoke CloseHandle,[rdi+PROCESS_INFORMATION.hThread]
invoke SetTimer,hWnd,1,duration,0
jmp wmBYE
TERMINATE:invoke GetExitCodeProcess,[rdi+PROCESS_INFORMATION.hProcess],esi;proExitCode
cmp dword ptr [rsi],STILL_ACTIVE
jne proExitCode_NOT_STILL_ACTIVE;a4;
invoke TerminateProcess,[rdi+PROCESS_INFORMATION.hProcess],0
proExitCode_NOT_STILL_ACTIVE:
invoke CloseHandle,[rdi+PROCESS_INFORMATION.hProcess]
mov [rdi+PROCESS_INFORMATION.hProcess],rbx;0
invoke PostMessage,hWnd,WM_INITMENUPOPUP,NULL,NULL
invoke KillTimer,hWnd,1
jmp wmBYE
wmTIMER:invoke PostMessage,,WM_FINISH,0,0
jmp wmBYE
EXIT: invoke DestroyWindow
wmBYE:  leave
retn
menu_handlers dq PROCESS_CREATE, TERMINATE, EXIT
WndProc endp
;---------------------------------------
ClassName       db 'Uncle Remus tales:#14 Process',0
hMenu dq ?
proExitCode dq ?;process exit code
FileName db "..\Images\br_Rabbit3.cur",0
szREGSZ db 'REG_SZ',0
szREGEXPANDSZ db 'REG_EXPAND_SZ',0
FileName1 db '\movie3'
aWmv db '.wmv',0,0
processInfo PROCESS_INFORMATION <>
szBuff1 db MAX_PATH dup(?)
duration dq ?
end
rc-file
Code: [Select]
#define MI_PROCESS_CREATE 0
#define MI_PROCESS_TERMINATE 1
#define MI_EXIT 2
#define IDR_MAINMENU 30

IDR_MAINMENU MENU
{
POPUP "&Process"
        {
         MENUITEM "&Create Process",MI_PROCESS_CREATE
         MENUITEM "&Terminate Process",MI_PROCESS_TERMINATE,GRAYED
         MENUITEM SEPARATOR
         MENUITEM "E&xit",MI_EXIT
        }
}
bat-file
Code: [Select]
cls
set masm64_path=\masm56\
set filename=%~n1
call :read_settings %filename%
@echo %kind_of_file%
goto %kind_of_file%
:GUI
if exist %filename%.exe del %filename%.exe
if exist %filename%.obj del %filename%.obj
if exist errors.txt del errors.txt
%masm64_path%bin\ml64 /Cp /c /I"%masm64_path%Include" %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%\bin\RC /r /i"%masm64_path%\Include" %filename%.rc >> errors.txt
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj %filename%.res >> errors.txt
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj >> errors.txt
)
if errorlevel 1 exit
if exist %1.res del %1.res
del %filename%.obj
del errors.txt
exit
:DLL
if exist %filename%.dll del %filename%.dll
%masm64_path%bin\ml64 /c /Cp /I %masm64_path%include %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%bin\RC /r  %filename%.rc >> errors.txt
if errorlevel 1 exit
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe  ^
%filename%.obj %filename%.res /DEF:%filename%.def >> errors.txt
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe  ^
%filename%.obj /DEF:%filename%.def >> errors.txt
)
if errorlevel 1 exit
if exist %1.res del %1.res
del %filename%.obj
del %filename%.exp
del errors.txt
exit
:read_settings
for /f "eol=# tokens=2-3" %%A in (%filename%.asm) do (
set kind_of_file=%%A
if %%B == # exit /b )
exit /b
There is movie3.wmv (https://yadi.sk/d/vQaulzqV3KHGMP) in same folder with exe-file
Title: Re: Uncle Remus Tales
Post by: hutch-- on June 20, 2017, 03:27:34 PM
Mikl,

What are you zipping these files with ? I could unzip the first one but the 00.zip cannot be unzipped with WinRar.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 20, 2017, 04:16:21 PM
Hi, hutch-- !
I used 7-zip menager (www.7-zip.org) compression method deflate, compression level maximum, dictionary size 32 KB, word size 64
And I used WinZip and produced NewZip.zip now
Title: Re: Uncle Remus Tales
Post by: hutch-- on June 21, 2017, 01:57:14 AM
I could download the asm file and exe file with no problems but the 00.zip file keeps giving the error message "unknown format or damaged".
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 21, 2017, 02:09:35 AM
hutch--,
Only files with Zip extension can be uploaded to your site. File 00.zip is a renamed file 00.png the browser knows about it and shows the correct picture with the wrong extension. I thought that you know about the features of your site
Title: Re: Uncle Remus Tales
Post by: hutch-- on June 21, 2017, 02:42:49 AM
I renamed the file to ".png" and can view the image but the exe does not run.

The suggestion, put it all together as one zip file making sure it works properly and post it so we can see what it does.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 21, 2017, 03:05:22 AM
hutch--,
download 14.zip and extract it in same folder with movie3.wmv
Title: Re: Uncle Remus Tales
Post by: hutch-- on June 21, 2017, 10:53:16 AM
Done, exe does not run. I can open the wmv file and it runs with VLC player. I am running Win10 64 US version.
Title: Re: Uncle Remus Tales
Post by: jj2007 on June 21, 2017, 05:42:24 PM
On Win7-64, exe runs fine, but the process starts only if there is moview3.wmv in the same folder.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 21, 2017, 06:46:44 PM
14.zip (6.12 kB - downloaded 20 times.)
jj2007 + hutch-- + caballero = 3
How did the program workes for another 17 men?
Title: Re: Uncle Remus Tales
Post by: caballero on June 21, 2017, 07:06:15 PM
Hi Mikl, 7 now, I executed the tut_14-04.exe with movie3.wmv in the same folder, but nothing happened except that it remains as a process. W7 64 bits.
Title: Re: Uncle Remus Tales
Post by: caballero on June 21, 2017, 07:25:18 PM
What it should do, play movies using mci? I made a multimedia player some years ago with fasm, I attach two version, the extended one is MP3WF01 and works ok with it, the MP3WF03 is a tiny version, when you open the file with it you can view it with the previous player, but when you click on accept cannot play it, I have to check it.

EDITED: The problem is the window size that doesn't allow to view the buttons to play it, if you put
cdXSize            equ  640
cdYSize            equ  440
for example, it wuould be nice
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 22, 2017, 09:11:37 AM
Hi, hutch-- and caballero!
Do you have a key .wmv in HKEY_CLASSES_ROOT? If there is the key, can you write the contents of HKEY_CLASSES_ROOT\.wmv names, types and values?
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 24, 2017, 11:53:36 AM
Quote
What it should do, play movies using mci?
Hi, caballero!
See
And you will write about branch registry contents HKEY_CLASSES_ROOT\.wmv names, types and values,  pleazzz..  This is necessary for correct errors in tut_14-04.exe
Title: Re: Uncle Remus Tales
Post by: jj2007 on June 24, 2017, 02:11:02 PM
And you will write about branch registry contents HKEY_CLASSES_ROOT\.wmv names, types and values,  pleazzz..  This is necessary for correct errors in tut_14-04.exe

Here is mine :icon14:
Title: Re: Uncle Remus Tales
Post by: caballero on June 24, 2017, 04:58:48 PM
I write this from another computer than the first time. Now, the window is up but seems not working. Here is my wmv register branch, as I see I need to clean it better because I dont' have winamp yet. What I don't know is why is this info good for you.

Quote
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.wmv]
@="Winamp3.File"
"PerceivedType"="video"
"Content Type"="video/x-ms-wmv"
"VLC.backup"="WMP11.AssocFile.WMV"
"Winamp_Back"="Winamp.File.WMV"

[HKEY_CLASSES_ROOT\.wmv\OpenWithList]

[HKEY_CLASSES_ROOT\.wmv\OpenWithList\ehshell.exe]

[HKEY_CLASSES_ROOT\.wmv\OpenWithProgIds]
"WMP11.AssocFile.WMV"=hex(0):
"WindowsLive.PhotoGallery.video.15.4"=""
"WindowsLive.MovieMaker.asset"=hex:

[HKEY_CLASSES_ROOT\.wmv\PersistentHandler]
@="{098f2470-bae0-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\.wmv\ShellEx]

[HKEY_CLASSES_ROOT\.wmv\ShellEx\{BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}]
@="{9DBD2C50-62AD-11D0-B806-00C04FD706EC}"

[HKEY_CLASSES_ROOT\.wmv\ShellEx\{e357fccd-a995-4576-b01f-234630154e96}]
@="{9DBD2C50-62AD-11D0-B806-00C04FD706EC}"
Title: Re: Uncle Remus Tales
Post by: TWell on June 24, 2017, 05:35:16 PM
Code: [Select]
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.wmv]
@="WMP11.AssocFile.WMV"
"Content Type"="video/x-ms-wmv"
"PerceivedType"="video"

[HKEY_CLASSES_ROOT\.wmv\OpenWithProgids]
"WMP11.AssocFile.WMV"=hex(0):
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 24, 2017, 08:49:33 PM
hi, TWell and caballero!
you have
Code: [Select]
HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\Play\command\"%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe" /prefetch:7 /Play "%L"but tut_14-04.exe not runs?
Title: Re: Uncle Remus Tales
Post by: TWell on June 25, 2017, 12:11:27 AM
crash at 0040037A, Exception: Access violation
   invoke ReadFile,eax,edi,100h
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 25, 2017, 12:45:25 AM
TWell
Code: [Select]
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local progStartInfo:STARTUPINFO
local hKey:qword
local lpcbData:dword
local hFile:qword
local szBuff[MAX_PATH*4]:byte
local old_rdi:qword
local old_rsi:qword

mov old_rdi,rdi
mov old_rsi,rsi
        . . . .
wmCREATE: . . .
lea edx,szBuff
invoke ReadFile,eax,,100h
        . . . .
wmBYE:  mov rdi,old_rdi
mov rsi,old_rsi
leave
retn
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 13, 2017, 03:22:22 PM
asm-file
Code: [Select]
; GUI #
include win64a.inc
include advapi32.inc
includelib advapi32.lib

MI_PROCESS_CREATE equ 0
MI_PROCESS_TERMINATE equ 1
MI_EXIT equ 2
IDR_MAINMENU equ 30
WM_FINISH equ WM_USER+100h
MAX_KEY_LENGTH equ 255
MAX_VALUE_NAME equ 16383
.code
WinMain proc
local msg:MSG

      xor ebx,ebx
mov edi,offset ClassName
mov esi,IMAGE_BASE
mov ecx,offset FileName
invoke LoadCursorFromFile
push rax ;hIconSm
push rdi ;lpszClassName
push IDR_MAINMENU;lpszMenuName
push COLOR_WINDOW;hbrBackground
push 10003h ;hCursor
push rax ;hIcon
push rsi ;hInstance
push rbx ;cbClsExtra & cbWndExtra
pushaddr WndProc;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
invoke RegisterClassEx,esp ;addr WNDCLASSEX
push rbx
push rsi ;rsi=400000h
shl esi,9 ;rsi=CW_USEDEFAULT
push rbx
push rbx
push 200
push 300
push rsi
push rsi
sub esp,20h
    invoke CreateWindowEx,WS_EX_CLIENTEDGE,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
invoke GetMenu,eax
mov hMenu,rax
    lea edi,msg
@@:    invoke GetMessage,edi,0,0,0
invoke DispatchMessage,edi
      jmp @b
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local progStartInfo:STARTUPINFO
local hKey:qword
local lpcbData:dword
local lpType:dword
local hFile:qword
local szBuff[MAX_PATH*4]:byte
local old_rdi:qword
local old_rsi:qword

mov hWnd,rcx
mov wParam,r8
mov lParam,r9
mov old_rdi,rdi
        mov old_rsi,rsi

cmp  edx,WM_DESTROY
je   wmDESTROY
cmp  edx,WM_CREATE
je   wmCREATE
cmp  edx,WM_COMMAND
je   wmCOMMAND
cmp  edx,WM_INITMENUPOPUP
je   wmINITMENUPOPUP
cmp  edx,WM_FINISH
je   TERMINATE
cmp  edx,WM_TIMER
je   wmTIMER
leave
jmp DefWindowProc

wmDESTROY:invoke GetExitCodeProcess,processInfo.hProcess,esi;proExitCode
cmp dword ptr proExitCode,STILL_ACTIVE
jne @f
invoke TerminateProcess,processInfo.hProcess,0
@@: invoke CloseHandle,processInfo.hProcess
mov processInfo.hProcess,rbx
invoke ExitProcess,NULL
wmCREATE:
;get the length of playing a wmv-file
mov [rsp+30h],rbx ;hTemplateFile
mov qword ptr [rsp+28h],FILE_ATTRIBUTE_ARCHIVE ;dwFlagsAndAttributes
mov qword ptr [rsp+20h],OPEN_EXISTING ;dwCreationDisposition
mov ecx,offset FileName1+1    ;lpFileName
invoke CreateFile,,GENERIC_READ,\    ;dwDesiredAccess
FILE_SHARE_READ or FILE_SHARE_WRITE,\;dwShareMode
0 ;lpSecurityAttributes
mov hFile,rax;handle to file
mov [rsp+20h],rbx
lea r9d,lpcbData
lea edi,szBuff
invoke ReadFile,eax,edi,100h
invoke CloseHandle,hFile
mov rax,qword ptr szBuff[66h];duration in 100 nSec
;Duration in 100nSec-units is divided by 10000 and get in duration in 1mSec-units
mov edx,3518437209;"magic number"
mul edx
shr edx,13
mov duration,rdx;in mSec
;----------------------------------------------------
;Open the section HKEY_CLASSES_ROOT\.wmv\OpenWithProgids
mov edx,offset aWmv1
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,,0,KEY_READ,&hKey
        or eax,eax
jnz bad0
xor esi,esi
; inc esi
@@:     mov lpcbData,MAX_VALUE_NAME
invoke RegEnumValue,hKey,esi,edi,&lpcbData,NULL,&lpType,NULL,NULL
;HKEY hKey, // A handle to an open registry key
;DWORD dwIndex,=esi // The index of the value to be retrieved
;LPTSTR lpValueName,edi=&szBuff // A pointer to a buffer that receives the name of the value as a null-terminated string
;LPDWORD lpcbValueName,=&lpcbData // A pointer to a variable that specifies the size of the buffer pointed to by the lpValueName parameter, in characters
;LPDWORD lpReserved,=0 // This parameter is reserved and must be NULL.
;LPDWORD lpType,=&lpType // A pointer to a variable that receives a code indicating the type of data stored in the specified value
;LPBYTE lpData,=0 // A pointer to a buffer that receives the data for the value entry
;LPDWORD lpcbData,=&lpcbData // A pointer to a variable that specifies the size of the buffer pointed to by the lpData parameter, in bytes
or eax,eax
jnz bad1;Until we get all the keys HKEY_CLASSES_ROOT\.wmv\OpenWithProgids
;Looking for a key with an end on .wmv
        cmp lpcbData,5;The string is longer than ".wmv" ?
jb a1; To the next line
mov eax,edi
add eax,lpcbData;Go to the end of the line
mov eax,[rax-4]
or eax,20202000h;We give an extension to the lower case
cmp eax,dword ptr aWmv;это ".wmv" ?
jz @f
a1: inc esi
jmp @b
bad0:   invoke MessageBox,0,&error0,&ClassName,MB_OK
jmp wmDESTROY
bad1:;Closed the section HKEY_CLASSES_ROOT\.wmv\OpenWithProgids
invoke RegCloseKey,hKey
invoke MessageBox,0,&error1,&ClassName,MB_OK
jmp wmDESTROY
@@:;Closed the section HKEY_CLASSES_ROOT\.wmv\OpenWithProgids
invoke RegCloseKey,hKey
;Get the name mplayerc.wmv or WMP11.AssocFile.WMV
;Make of it HKEY_CLASSES_ROOT\mplayerc.wmv\shell
;or HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell
add edi,lpcbData
cmp lpType,REG_SZ
jne @f
dec edi
@@: mov dword ptr [rdi],'ehs\'
mov dword ptr [rdi+4],'ll'
lea edx,szBuff
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,,0,KEY_READ,&hKey
;Read the meaning HKEY_CLASSES_ROOT\mplayerc.wmv\shell = open
;or        HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell = Play
        lea eax,lpcbData
mov [rsp+28h],rax
add edi,7;Length of string "\shell\"
mov [rsp+20h],rdi
mov lpcbData,MAX_PATH
invoke RegQueryValueEx,hKey,0,0,,edi,&lpcbData
;Closed the section HKEY_CLASSES_ROOT\mplayerc.wmv\shell
;   or  HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell
invoke RegCloseKey,hKey
;Open the section HKEY_CLASSES_ROOT\mplayerc.wmv\shell\open\command
;or       HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\play\command
or word ptr [rdi-1],605Ch;"\"+ lower case
mov rax,'dnammoc\'
mov [rdi+4],rax
mov [rdi+12],rbx
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,&szBuff,0,KEY_READ,&hKey
;Read the meaning HKEY_CLASSES_ROOT\mplayerc.wmv\shell\open\command
;"C:\Program Files (x86)\Combined Community Codec Pack\MPC\mpc-hc.exe" "%1"
;     or HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\play\command
;"%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe" /prefetch:7 /Play "%L"
mov lpcbData,MAX_PATH
lea r9d,lpType
invoke RegQueryValueEx,hKey,0,0,,&szBuff,&lpcbData
;Closed the section HKEY_CLASSES_ROOT\mplayerc.wmv\shell\open\command
;    or HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\play\command
invoke RegCloseKey,hKey
lea edi,szBuff
add edi,lpcbData
sub edi,4
invoke GetCurrentDirectory,MAX_PATH,edi
lea edi,[rdi+rax]
mov aWmv[4],'"'
mov esi,offset FileName1
mov ecx,sizeof FileName1+6
rep movsb
lea ecx,szBuff
mov edx,offset szBuff1
invoke ExpandEnvironmentStrings,,,MAX_PATH
jmp wmBYE
wmINITMENUPOPUP:mov edx,offset proExitCode
invoke GetExitCodeProcess,processInfo.hProcess
or eax,eax
jz @f;GetExitCodeProcess_TRUE
cmp dword ptr proExitCode,STILL_ACTIVE ;cmp proExitCode,STILL_ACTIVE
jne @f ;     GetExitCodeProcess_STILL_ACTIVE
invoke EnableMenuItem,hMenu,MI_PROCESS_CREATE,MF_GRAYED
xor r8,r8; mov r8d,MF_ENABLED=0
jmp @0
@@: invoke EnableMenuItem,hMenu,MI_PROCESS_CREATE,MF_ENABLED
mov r8d,MF_GRAYED
@0:    invoke EnableMenuItem,hMenu,MI_PROCESS_TERMINATE
jmp wmBYE
wmCOMMAND:movzx eax,word ptr wParam
or r9,r9 ;cmp lParam,0
jnz wmBYE
cmp rax,MI_EXIT
ja wmBYE
jmp  [menu_handlers+rax*8]
PROCESS_CREATE:cmp processInfo.hProcess,rbx
je pi_hProcess_IS_0
invoke CloseHandle,processInfo.hProcess
mov processInfo.hProcess,rbx
pi_hProcess_IS_0:lea esi,progStartInfo
invoke GetStartupInfo,esi
invoke CreateProcess,0,&szBuff1,\
0,\;process security attributes
0,\;primary thread security attributes
0,\;handles are inherited
NORMAL_PRIORITY_CLASS,\;creation flags
0,\;use parent's environment
0,\;use parent's current directory
rsi,\;STARTUPINFO pointer
&processInfo ;receives PROCESS_INFORMATION
invoke CloseHandle,processInfo.hThread
invoke SetTimer,hWnd,1,duration,0
jmp wmBYE
TERMINATE:mov edx,offset proExitCode
invoke GetExitCodeProcess,processInfo.hProcess
cmp dword ptr proExitCode,STILL_ACTIVE
jne proExitCode_NOT_STILL_ACTIVE;a4;
invoke TerminateProcess,processInfo.hProcess,0
proExitCode_NOT_STILL_ACTIVE:
invoke CloseHandle,processInfo.hProcess
mov processInfo.hProcess,rbx;0
invoke PostMessage,hWnd,WM_INITMENUPOPUP,NULL,NULL
invoke KillTimer,hWnd,1
jmp wmBYE
wmTIMER:invoke PostMessage,,WM_FINISH,0,0
jmp wmBYE
EXIT: invoke DestroyWindow
wmBYE:  mov rdi,old_rdi
        mov rsi,old_rsi
leave
retn
menu_handlers dq PROCESS_CREATE, TERMINATE, EXIT
WndProc endp
;---------------------------------------
.data
ClassName       db 'Uncle Remus tales:#14 Process',0
hMenu dq ?
proExitCode dq ?;process exit code
FileName db "..\Images\br_Rabbit3.cur",0
FileName1 db '\movie3'
aWmv db '.wmv',0,0
aWmv1           db '.wmv\OpenWithProgids',0
processInfo PROCESS_INFORMATION <>
szBuff1 db MAX_PATH dup(?)
duration dq ?
error0 db "No section HKEY_CLASSES_ROOT\.wmv\OpenWithProgids",0
error1 db "Did not find the application that plays the wmv-files",0
end
rc-file
Code: [Select]
#define MI_PROCESS_CREATE 0
#define MI_PROCESS_TERMINATE 1
#define MI_EXIT 2

#define IDR_MAINMENU 30

IDR_MAINMENU MENU
{
POPUP "&Process"
        {
         MENUITEM "&Create Process",MI_PROCESS_CREATE
         MENUITEM "&Terminate Process",MI_PROCESS_TERMINATE,GRAYED
         MENUITEM SEPARATOR
         MENUITEM "E&xit",MI_EXIT
        }
}
movie3.wmv (https://yadi.sk/d/vQaulzqV3KHGMP)
Title: Re: Uncle Remus Tales
Post by: jj2007 on July 13, 2017, 05:05:33 PM
lea eax,lpcbData

You rely on zero-extension, right?
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 13, 2017, 09:53:33 PM
Buona sera, signore jj2007!
The program doesn't play the wmv-file again?
Title: Re: Uncle Remus Tales
Post by: jj2007 on July 13, 2017, 10:56:29 PM
Добрый вечер, Майкл!

It plays, sure. I just wonder if your uses of 32-bit registers for pointers are safe. Is the stack guaranteed to be in 32-bit land?
Code: [Select]
        lea eax,lpcbData
mov [rsp+28h],rax
add edi,7;Length of string "\shell\"
mov [rsp+20h],rdi
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 13, 2017, 11:03:16 PM
The use of 32-bit registers with their zero extension in 64-bit and 32-bit addresses with /LARGEADDRESSAWARE:NO is just a way to make the tiny size program (https://wasm.in/styles/smiles_s/smile3.gif) I create my exe-/dll-/sys-files using bat-file
Code: [Select]
cls
set masm64_path=c:\masm64\
set filename=%~n1

call :read_settings %filename%
@echo %kind_of_file%
goto %kind_of_file%
:GUI
if exist %filename%.exe del %filename%.exe
if exist %filename%.obj del %filename%.obj
if exist errors.txt del errors.txt
%masm64_path%bin\ml64 /Cp /c /I"%masm64_path%Include" %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%\bin\RC /r /i"%masm64_path%\Include" %filename%.rc >> errors.txt
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj %filename%.res >> errors.txt
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj >> errors.txt
)
if errorlevel 1 exit
if exist %1.res del %1.res
del %filename%.obj
del errors.txt
exit
:DLL
if exist %filename%.dll del %filename%.dll
%masm64_path%bin\ml64 /c /Cp /I %masm64_path%include %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%bin\RC /r  %filename%.rc >> errors.txt
if errorlevel 1 exit
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe  ^
%filename%.obj %filename%.res /DEF:%filename%.def >> errors.txt
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe  ^
%filename%.obj /DEF:%filename%.def >> errors.txt
)
if errorlevel 1 exit
if exist %1.res del %1.res
del %filename%.obj
del %filename%.exp
del errors.txt
exit
:read_settings
for /f "eol=# tokens=2-3" %%A in (%filename%.asm) do (
set kind_of_file=%%A
if %%B == # exit /b )
exit /b
jj2007,
Do You live in Italy and try not to use Italian?
Title: Re: Uncle Remus Tales
Post by: jj2007 on July 13, 2017, 11:32:17 PM
OK, so you need the linker option. The result will be a bit like x32 ABI (https://en.wikipedia.org/wiki/X32_ABI) :biggrin:

Do You live in Italy and try not to use Italian?

Yes, I live here, and use 4 languages every day, including Italian, of course 8)
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 13, 2017, 11:43:59 PM
In my programs there is no need to use 48- or 64-bit addressing.
I taught myself Italian. Then there were no Google-translators. I just do not have enough practice.
Title: Re: Uncle Remus Tales
Post by: jj2007 on July 13, 2017, 11:48:39 PM
C'è un solo modo valido per imparare l'italiano: praticarlo con una bella italiana :biggrin:
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 13, 2017, 11:53:47 PM
imparare qualsiasi lingua è utile con una bella interprete sul cuscino (http://www.kolobok.us/smiles/artists/vishenka/d_martini.gif)
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 15, 2017, 02:34:07 AM
Quote
(http://masm32.com/board/Themes/default/images/icons/clip.gif)14.zip (7.1 kB - downloaded 64 times.)
one is jj2007 he has workig program, I'm interested - 63 men have workig program or they have unworking program?
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 16, 2017, 10:55:10 AM
It looks like some robot trains in downloading a file. Yesterday there were 64 downloads, today 128 and no comments about the program
Title: Re: Uncle Remus Tales
Post by: HSE on July 16, 2017, 11:09:57 AM
The robot only like 64bit. ¿? 

Number is similar to your other files, perhaps somebody is teaching with your files.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on July 16, 2017, 12:22:50 PM
Quote
perhaps somebody is teaching with your files
Hi, HSE!
It seems that this is a school class. (https://wasm.in/styles/smiles_s/mosking.gif) I think that one person would download the file once or twice. Worse, that with the one who downloads there is no feedback.
Quote
14.zip (7.1 kB - downloaded 258 times.)
It is only robot
Title: Re: Uncle Remus Tales
Post by: jj2007 on July 16, 2017, 05:05:30 PM
Or a really big school class ;)
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 03, 2017, 02:41:10 PM
Sticky drawing
rc-file
Code: [Select]
MYBP1 BITMAP tar_baby.bmpasm-file
Code: [Select]
; GUI #
include win64a.inc
.code
WinMain proc
local msg:MSG
 
    xor ebx,ebx
    mov esi,IMAGE_BASE
    mov ecx,offset FileName
invoke LoadCursorFromFile
    mov edi,offset ClassName
 
    push rax    ;hIconSm
    push rdi    ;lpszClassName
    push rbx    ;lpszMenuName
    push COLOR_WINDOW+1;hbrBackground
    push 10003h ;hCursor
    push rax    ;hIcon
    push rsi    ;hInstance
    push rbx    ;cbClsExtra & cbWndExtra
    pushaddr WndProc      ;lpfnWndProc
    push sizeof WNDCLASSEX;cbSize & style
    invoke RegisterClassEx,esp    ;addr WNDCLASSEX 

    push rbx
    push rsi    ;rsi=400000h
    shl esi,9   ;rsi=CW_USEDEFAULT
    push rbx
    push rbx
    push rsi
    push rsi
    push rsi
    push rsi
    sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE

    lea edi,msg
@@: invoke GetMessage,edi,0,0,0
    invoke DispatchMessage,edi
    jmp @b
WinMain endp
WndProc proc hwnd:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD
mov hwnd,rcx   

cmp edx,WM_CREATE
je wmCREATE
cmp edx,WM_DESTROY
je wmDESTROY
cmp edx,WM_PAINT
je wmPAINT
cmp dx,WM_MOUSEMOVE
je wmMOUSEMOVE
leave
jmp NtdllDefWindowProc_
 
wmDESTROY:invoke ReleaseDC,hwnd,DC
invoke DeleteDC,memDC
invoke DeleteObject,hBit1
invoke RtlExitUserProcess,NULL
wmCREATE:mov edx,offset aMYBP
invoke LoadBitmap,IMAGE_BASE
mov hBit1,rax
        invoke GetDC,hwnd
mov DC,rax
invoke CreateCompatibleDC,eax;DC
        mov memDC,rax
invoke SelectObject,eax,hBit1
jmp  wmBYE
wmMOUSEMOVE:;low order lParam  = x    high order lParam = y
mov word ptr expHPoint.x,r9w
shr r9,16
mov expHPoint.y,r9d
mov r8b,TRUE
invoke InvalidateRect,,0;,TRUE
jmp  wmBYE
wmPAINT:mov r8d,expHPoint.y
sub r8d,50
    mov edx,expHPoint.x
sub edx,50
    invoke BitBlt,DC,,,164,206,memDC,rbx,rbx,SRCCOPY
wmBYE: leave
retn
WndProc endp
;---------------------------------------
ClassName db "Uncle Remus tales:#6c Tar baby",0
expHPoint POINT <0>
FileName db "br_Rabbit3.cur",0
hBit1 HBITMAP ?
aMYBP db "MYBP1",0
memDC HDC ?
DC HDC ?
end
There are rc/asm/exe/ico/bmp/bat-files in 06.zip file
If you do not know who it is, then look at the picture and remember the tale of "brother rabbit, brother fox and tar baby"
Title: Re: Uncle Remus Tales
Post by: jj2007 on August 03, 2017, 05:19:13 PM
Nice example :t

invoke BitBlt,DC,,,164,206,memDC,rbx,rbx,SRCCOPY  ::)

Interesting syntax - is that an invoke macro, or a new UAsm feature? And what is pushaddr WndProc?

Btw where is this file: Error A2106: Cannot open file: "win64a.inc"?
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 03, 2017, 05:43:07 PM
Buon giorno, amico jj2007!
Questo file è per te
P.S. è il caldo in Italia?
Title: Re: Uncle Remus Tales
Post by: jj2007 on August 03, 2017, 07:05:12 PM
Buongiorno amico Mikl :icon14:

Si, fa molto caldo qui - 35 gradi+

Unfortunately, I get plenty of such errors:
Code: [Select]
\Masm32\Include64\temphls.inc(965) : Error A2200: Syntax error in control-flow directive
 \Masm32\Include64\temphls.inc(965): Included by
  win64a.inc(2): Included by
   Tmp_File.asm(3): Main line code
\Masm32\Include64\temphls.inc(968) : Error A2210: Syntax error: J_POLY_COND
 \Masm32\Include64\temphls.inc(968): Included by
  win64a.inc(2): Included by
   Tmp_File.asm(3): Main line code
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 24, 2017, 11:42:04 PM
tut_035-06.rc
Code: [Select]
#include "resource.h"
#define IDR_MAINMENU                    101
#define IDD_OPTIONDLG                   101
#define IDD_GOTODLG                     102
#define IDR_MAINACCEL                   103

#define IDC_BACKCOLORBOX                1000
#define IDC_TEXTCOLORBOX                1001
#define IDC_OK 1002
#define IDC_CANCEL 1003
#define IDC_LINENO                      1004
#define IDM_OPEN                        40001
#define IDM_SAVE                        40002
#define IDM_CLOSE                       40003
#define IDM_SAVEAS                      40004
#define IDM_EXIT                        40005
#define IDM_COPY                        40006
#define IDM_CUT                         40007
#define IDM_PASTE                       40008
#define IDM_DELETE                      40009
#define IDM_SELECTALL                   40010
#define IDM_OPTION                      40011
#define IDM_UNDO                        40012
#define IDM_REDO                        40013
#define IDM_FIND                        40014
#define IDM_FINDNEXT                    40015
#define IDM_REPLACE                     40016
#define IDM_GOTOLINE                    40017
#define IDM_FINDPREV                    40018
#define IDC_ICON1    500

IDC_ICON1 ICON "..\\Images\\br_Fox1.ico"
IDR_MAINMENU MENU DISCARDABLE
{
    POPUP "&File"
    {
        MENUITEM "&Open\tCtrl+O",               IDM_OPEN
        MENUITEM "Close\tCtrl+W",               IDM_CLOSE
        MENUITEM "&Save\tCtrl+S",               IDM_SAVE
        MENUITEM "Save As\tF12",                IDM_SAVEAS
        MENUITEM SEPARATOR
        MENUITEM "Exit\tAlt+F4",                IDM_EXIT
    }
    POPUP "&Edit"
    {
        MENUITEM "Undo\tCtrl+Z",                IDM_UNDO
        MENUITEM "Redo\tCtrl+Y",                IDM_REDO
        MENUITEM "&Copy\tCtrl+C",               IDM_COPY
        MENUITEM "Cut\tCtrl+X",                 IDM_CUT
        MENUITEM "Paste\tCtrl+V",               IDM_PASTE
        MENUITEM SEPARATOR
        MENUITEM "Delete\tDel",                 IDM_DELETE
        MENUITEM SEPARATOR
        MENUITEM "Select &All\tCtrl+A",         IDM_SELECTALL
    }
    POPUP "&Search"
    {
        MENUITEM "&Find...\tCtrl+F",            IDM_FIND
        MENUITEM "Find &Next\tF3",              IDM_FINDNEXT
        MENUITEM "Find &Prev\tCtrl+F3",        IDM_FINDPREV
        MENUITEM "&Replace...\tCtrl+R",          IDM_REPLACE
        MENUITEM SEPARATOR
        MENUITEM "&Go To Line\tCtrl+G",         IDM_GOTOLINE
    }
    MENUITEM "&Options",                         IDM_OPTION
}


IDD_OPTIONDLG DIALOG DISCARDABLE  0, 0, 183, 54
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Sans Serif"
{
    DEFPUSHBUTTON   "OK",IDC_OK,137,7,39,14
    PUSHBUTTON      "Cancel",IDC_CANCEL,137,25,39,14
    GROUPBOX        "",IDC_STATIC,5,0,124,49
    LTEXT           "Background Color:",IDC_STATIC,20,14,60,8
    LTEXT           "",IDC_BACKCOLORBOX,85,11,28,14,SS_NOTIFY | WS_BORDER
    LTEXT           "Text Color:",IDC_STATIC,20,33,35,8
    LTEXT           "",IDC_TEXTCOLORBOX,85,29,28,14,SS_NOTIFY | WS_BORDER
}

IDD_GOTODLG DIALOGEX 0, 0, 106, 30
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
CAPTION "Перейти на строку"
FONT 8, "MS Sans Serif", 0, 0, 1
{
    EDITTEXT        IDC_LINENO,32,4,30,11,ES_AUTOHSCROLL | ES_NUMBER,
                    WS_EX_CLIENTEDGE
    DEFPUSHBUTTON   "OK",IDOK,70,4,31,11
    PUSHBUTTON      "Отмена",IDCANCEL,70,17,31,11
    LTEXT           "Строка:",IDC_STATIC,1,5,30,8
}

IDR_MAINACCEL ACCELERATORS DISCARDABLE
{  // определение акселераторов
 "^O",IDM_OPEN
 "^W",IDM_CLOSE
 "^S",IDM_SAVE
 VK_F12,IDM_SAVEAS,VIRTKEY
 "^F",IDM_FIND
 "^G",IDM_GOTOLINE
 "^R",IDM_REPLACE
 VK_F3,IDM_FINDNEXT,VIRTKEY
 VK_F3,IDM_FINDPREV,VIRTKEY,CONTROL
}
asm/ico/cur/rc/exe-files in attach
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 26, 2017, 07:54:15 PM
Tiny IDE
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 27, 2017, 02:34:33 AM
Files in the archive have been downloaded 71 times, and nobody asks about the files content in the archive. It is very strange... These are mail-bots! (https://wasm.in/styles/smiles_s/mosking.gif)
Wow! File 36.zip was downloaded 140 times... Maybe somewhere installed a mirror site of this web-page
Title: Re: Uncle Remus Tales
Post by: mineiro on August 27, 2017, 09:22:06 PM
hello Mikl___
I have tried 35 and 36 files on linux under wine and received an error message. Sounds to me that wine don't have that function being called implemented but that's a default function so this is why I'm posting. What I'm thinking is just a function name convention I suppose (not sure). I don't know if you like to do that program wine compatible. I don't have windows on my machine this is why I don't have tried on windows ok.
This is the error I'm receiving, number 35 have same error on same function and same memory address in my machine:
:~/.wine/drive_c/36$ wine tut_36.exe
wine: Call from 0x7f53e39fce38 to unimplemented function ntdll.dll.NtdllDefWindowProc_A, aborting
wine: Unimplemented function ntdll.dll.NtdllDefWindowProc_A called at address 0x7f53e39fce38 (thread 0024), starting debugger...
When I dump disassembled tut_36.exe to see headers sections I found this (other functions are omited):
        2d0e      567  NtdllDefWindowProc_A

If you have intentions to do this wine compatible I can do some tests on my machine.

--Oh, I forgot to say, this is just a first view, I'm investigating this on my machine to see if it is a wine error ok. So, your example can be right and the function is really not implemented on wine.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 27, 2017, 10:26:15 PM
Olá Mineiro! No meu Windows 7 x64 existem
NTDLL.RtlExitUserProcess é redirecionado para Kernel32.ExitProcess
NTDLL.NtdllDialogWndProc_A é redirecionado para User32.DefDlgProcA
NTDLL.NtdllDefWindowProc_A é redirecionado para User32.DefWindowProcA
Eu pensei que era melhor chamar as funções diretamente de NTDLL.dll e não através das absorvente-funções. Estou usando um bat-file
Code: [Select]
set FileName=user32
dumpbin.exe /EXPORTS %windir%\System32\%FileName%.dll /OUT:%FileName%.txt
Title: Re: Uncle Remus Tales
Post by: jj2007 on June 05, 2018, 06:04:38 PM
Hi Fridebot, welcome to the forum :greensml:
Title: Re: Uncle Remus Tales
Post by: zedd151 on June 05, 2018, 06:06:29 PM
Hi Fridebot, welcome to the forum :greensml:

me too.  :badgrin:

Should learn proper English syntax.

They should be careful which threads  they post in  (http://masm32.com/board/index.php?topic=7179.msg77956#msg77956)

Frideborg will be a FriedBorg.   :greensml:
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 05, 2018, 10:22:25 PM
I was glad that someone came to talk in my topic. But it was just a bot (https://wasm.in/styles/smiles_s/scratch_one-s_head.gif)
Title: Re: Uncle Remus Tales
Post by: zedd151 on June 06, 2018, 02:20:53 AM
Quote from: Mikl__
.... But it was just a bot (https://wasm.in/styles/smiles_s/scratch_one-s_head.gif)

Hey,  we showed up too...    :icon_mrgreen:
Title: Re: Uncle Remus Tales
Post by: Mikl__ on June 06, 2018, 08:03:45 AM
Hi, zedd151!
I'm glad to see you again
Title: Re: Uncle Remus Tales
Post by: zedd151 on June 06, 2018, 08:26:19 AM
Just for the record I downloaded movie 01-04, renamed zips  and extracted movie.gif.  so what's the next step?


 :bgrin:
Title: Re: Uncle Remus Tales
Post by: zedd151 on June 06, 2018, 08:34:14 AM
No, okay I got it. I read further on and in the source == exe looking for movie.gif.

That's pretty good there, Mikl__.

edit == converted the screen capture to gif for size.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 03, 2018, 11:07:02 AM
Windows Creator
A training program for experimenting with numerous parameters of the functions used - so you do not have to edit and compile the source code of the "training" project each time, and you could select the necessary options right in the dialog box and immediately see the result.
Because the forum does not allow you to attach more than four files, so I had to break the message into three parts
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 03, 2018, 11:09:04 AM
continuation
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 03, 2018, 11:12:12 AM
ending
asm-/exe- and resource-files and bat-file for building
Title: Re: Uncle Remus Tales
Post by: jj2007 on August 03, 2018, 04:14:21 PM
Fascinating stuff, Mikl! In particular, I wonder how you build that 48-bit code ;)
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 04, 2018, 01:40:10 AM
Ciao, Jochen!
Why did you write about 48-bit code? (https://wasm.in/styles/smiles_s/scratch_one-s_head.gif)
Title: Re: Uncle Remus Tales
Post by: jj2007 on August 04, 2018, 02:10:49 AM
Have a closer look at the path:
(http://masm32.com/board/index.php?action=dlattach;topic=6275.0;attach=8300;image)
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 04, 2018, 02:16:58 AM
In the beginning there was a directory "masm64", then I created a new directory "masm63", then, well, you can guess yourself... (https://wasm.in/styles/smiles_s/mosking.gif)
Title: Re: Uncle Remus Tales
Post by: zedd151 on August 04, 2018, 02:58:08 AM
then I created a new directory "masm63"

(https://wasm.in/styles/smiles_s/mosking.gif)
 
Sounded like masm64 was a little under par.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 04, 2018, 11:24:12 AM
Ciao, Jochen!
Hi, All!
Tiny help for the windows creator

You must have a directory of masm48 and subdirectories of bin, lib, include. There are ml64.exe, link.exe etc. in masm48\bin and lib- and inc-files in lib- and include-subdirectories. You can change the folder name "masm48" to the one you use. Look carefully at the contents of the file asm3.bat and configure it for yourself. The names of the folders and the structure of your package with the assembler compiler ONLY inside the file asm3.bat.

If you see errors in the description in English, please write me about them and I will make corrections.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 05, 2018, 07:13:20 PM
Rotating Text Window
I once laid out the program with rotating text, now I had to update it, because with a sharp change in the size of the window, the rotating inscription lost the center of the window and its movements became unpredictable. Now I have corrected this defect
Code: [Select]
; GUI #
include win64a.inc
.code
WinMain proc
local msg:MSG
 
    xor ebx,ebx
    mov esi,IMAGE_BASE
    mov edi,offset ClassName
mov ecx,offset FileName
invoke LoadCursorFromFile
mov r12,rax
        mov ecx,0FF0000h
invoke CreateSolidBrush
    push r12 ;hIconSm
    push rdi ;lpszClassName
    push rbx ;lpszMenuName
    push rax ;hbrBackground
    push 10003h ;hCursor
    push r12 ;hIcon
    push rsi ;hInstance
    push rbx ;cbClsExtra & cbWndExtra
    pushaddr WndProc    ;lpfnWndProc
    push sizeof WNDCLASSEX;cbSize & style
    invoke RegisterClassEx,esp    ;addr WNDCLASSEX
    push rbx
    push rsi ;rsi=400000h
    shr esi,7 ;Special CreateWindow position value CW_USEDEFAULT=8000h
    push rbx
    push rbx
    push rsi
    push rsi
    push rsi
    push rsi
    sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
;create timer #0 in 50mSec
    invoke SetTimer,eax,0,50,0
; +---------------------------+
; | entering the message loop |
; +---------------------------+
lea edi,msg
@@: invoke GetMessage,edi,0,0,0
invoke DispatchMessage,edi
jmp @b
WinMain endp
WndProc proc hwnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local ps:PAINTSTRUCT
local newFont:qword
local oldFont:qword
local x1:dword
local y1:dword
local hDC:qword
local lpPoint:POINT
 
    mov hwnd,rcx
 
    cmp edx,WM_DESTROY
    je wmDESTROY
    cmp edx,WM_PAINT
    je wmPAINT
        cmp edx,WM_SIZE
    je wmSIZE
    cmp edx,WM_TIMER
    je wmTIMER
    leave
    jmp NtdllDefWindowProc_
wmDESTROY:invoke KillTimer,,0;destroy timer #0
invoke RtlExitUserProcess,0
wmSIZE: mov edx,offset expRect
invoke GetClientRect    ;get the size of the client area.
;Dimensions return to a variable expRect
mov eax,expRect.bottom
shr eax,1   
mov y,eax ;y-coordinate of the middle of the screen
mov eax,expRect.right
shr eax,1   
mov x,eax ;x-coordinate of the middle of the screen
jmp wmBYE
wmTIMER:invoke InvalidateRect,,0,TRUE;redraw the text with the current angle value
finit
jmp wmBYE
wmPAINT:lea edx,ps
invoke BeginPaint
mov hDC,rax
invoke SetTextColor,hDC,32C8C8h;RGB=50,200,200 golden letters
invoke SetBkColor,hDC,0FF0000h;RGB=0,0,255 on a blue background
;create a font with the rotation angle specified in lfEscapement and lfOrientation
pushaddr expFont
push DEFAULT_PITCH or FF_SCRIPT
push rbx        ;DEFAULT_QUALITY=0
push rbx        ;CLIP_DEFAULT_PRECIS=0
push rbx        ;OUT_DEFAULT_PRECIS=0
push OEM_CHARSET
push rbx
push rbx
push rbx
push 400
sub esp,20h
invoke CreateFont,26,12,angle,r8
mov newFont,rax
invoke SelectObject,hDC,rax
mov oldFont,rax
;---------text output
mov qword ptr [rsp+20h],sizeof expTxt;length of string
mov r9d,offset expTxt           ;line address
;---------I calculate the position of the beginning of the text
fld angle2;angle of text rotation in radians
fld st(0)
fsincos ;in st(0) the sine of the angle, in st(1) cosine
mov y1,227    ;half of hypotenuse
fimul y1    ;hypotenuse * sin = x
fistp x1
mov edx,x
add edx,x1
fimul y1    ;hypotenuse * cos = y
fistp y1    ;-y
fadd delta      ;increased the angle by 1.6 degrees
fst angle2
fmul delta2 ;translate radians to degrees
fsub delta3  ;The angle of the text is lagging behind the rotation angle by 180 degrees
fld st(0)
fmul delta4
fsubp st(1),st(0)
fistp angle     ;divide the angle by 360 degrees and remember the remainder
mov r8d,y
sub r8d,y1
invoke TextOut,hDC
invoke DeleteObject,newFont ;delete the new font
invoke SelectObject,hDC,oldFont;return the old font to the system
invoke EndPaint,hwnd,&ps
wmBYE:leave
    retn
WndProc endp
;---------------------------------------
ClassName db "Uncle Remus tales:#5 Painting with Rotation Text",0
expTxt  db "Win64 assembly with MASM is great and easy!",0
expFont db "script",0
angle   dq 0
angle2  dq 3.14159265358979323846264338328
delta   dq 0.02792526803190927323077905229;pi*1,6/180
delta2 dq 572.957795130823208767981548141;1800/pi
delta3 dq 1800.0
delta4 dq 0.00027777777777777777777777778;1/3600
hIcon dq ?
FileName db "br_Rabbit3.cur",0
expRect  RECT <>
x dd ?
y dd ?
end
Title: Re: Uncle Remus Tales
Post by: zedd151 on August 05, 2018, 07:30:53 PM
Could be a problem on my end, (no video driver available for Win 7 for this new hardware) but the text stays centered, but there is a lot of flicker in the text (disappearing and reappearing - correct  location, though)  Windows 7 , AMD A6-9220e, RADEON graphics.

I'm going to fire up windws 10 (has all drivers installed) and take another look at it...   8)
Title: Re: Uncle Remus Tales
Post by: zedd151 on August 05, 2018, 07:41:28 PM
I fubarred the captioning.

The TOP image is from Windows 10 Home 64 bit - all drivers installed. No flicker, but the text is odd.

The bottom image is from Windows 7 Pro 64 bit - No proper video drivers available, old OS New Hardware.
So the flickering is from my end, your program works well in Windows 10 - other than the odd font (strike
through and underlined) - might be an odd font variation from the OS???
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 05, 2018, 08:50:43 PM
Hi, zedd151!
Thanks for the noticed error. I'll try to fix the blinking text
Title: Re: Uncle Remus Tales
Post by: zedd151 on August 05, 2018, 09:41:59 PM
Hi, zedd151!
Thanks for the noticed error. I'll try to fix the blinking text

Don't worry about that just yet. Let a few others test your program.
My Windows 7 setup does not have the proper video drivers installed, only the default stock
Microsoft video drivers.

The program shows no signs of flickering in WIndows 10, in which I have the factory installed
RADEON video drivers installed. just the font looks weird..
Title: Re: Uncle Remus Tales
Post by: hutch-- on August 06, 2018, 03:55:13 AM
Mikl__, could I impose on you not to use too many bitmaps that are stored on this server as it takes up a lot more space than code and I cannot let the storage space fill up.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 06, 2018, 09:16:03 AM
Hi, hutch--!
Well, I will not abuse and upload bitmaps.
Title: Re: Uncle Remus Tales
Post by: hutch-- on August 06, 2018, 01:17:37 PM
 :biggrin:

Спасибо.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on August 08, 2018, 11:46:07 PM
Work with Fonts
asm-file
Code: [Select]
; GUI #
include win64a.inc
ID_RESET equ 0
ID_FONT equ 1
ID_HELP equ 2
ID_EXIT equ 3
IDM_MENU equ 37
IDC_ICON1 equ 500
IDR_MAINACCEL equ 105
.code
WinMain proc
local msg:MSG
   
xor ebx,ebx
mov ecx,offset FileName
invoke LoadCursorFromFile
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rax    ;hIconSm
push rdi    ;lpszClassName
push IDM_MENU    ;lpszMenuName
push COLOR_WINDOW;hbrBackground
push 10003h ;hCursor
push rax    ;hIcon 
push rsi    ;hInstance
push rbx    ;cbClsExtra & cbWndExtra
pushaddr WndProc ;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
invoke RegisterClassEx,esp;addr WNDCLASSEX
push rbx
push rsi    ;rsi=400000h
shl esi,9   ;rsi=CW_USEDEFAULT
push rbx
push rbx
push rsi
push rsi
push rsi
push rsi
sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
mov hwnd,rax
invoke LoadAccelerators,IMAGE_BASE,IDR_MAINACCEL
mov ACC,rax
    lea edi,msg
@@:     invoke GetMessage,edi,0,0,0
        invoke TranslateAccelerator,hwnd,ACC,edi
or eax,eax
jne @b
invoke TranslateMessage,edi
invoke DispatchMessage,edi
jmp @b
WinMain endp
;----------------------------------------
WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
local ps:PAINTSTRUCT
local hdc:qword
local size0:POINT
local string[255]:byte
local cf:CHOOSEFONT
local lf:LOGFONT

        mov hWnd,rcx
   
        cmp edx,WM_DESTROY
        je wmDESTROY
        cmp edx,WM_CREATE
        je wmCREATE
        cmp edx,WM_PAINT
        je wmPAINT
        cmp edx,WM_COMMAND
        je wmCOMMAND
        leave
        jmp NtdllDefWindowProc_
wmDESTROY:invoke DeleteDC,memDC
invoke DeleteObject,hNewFont1
invoke DeleteObject,hNewFont2
invoke RtlExitUserProcess,0
wmCOMMAND:and r8d,11111y;wParam
cmp r8d,ID_EXIT
ja wmBYE
jmp handler[r8*8]
FONT:
;----------------------------------
push rdi
xor eax,eax
mov ecx,(sizeof CHOOSEFONT)/8
lea edi,cf
rep stosq
pop rdi; ZeroMemory
mov     cf.lStructSize,sizeof CHOOSEFONT
mov rax,hwnd
mov cf.hwndOwner,rax
lea eax,lf
mov cf.lpLogFont,rax
mov cf.Flags,CF_SCREENFONTS or CF_EFFECTS;
lea ecx,cf
invoke ChooseFont
or eax,eax
jz wmBYE
lea ecx,lf
invoke CreateFontIndirect
invoke SelectObject,memDC,eax
invoke SetTextColor,memDC,cf.rgbColors
invoke SetBkMode,memDC,TRANSPARENT
mov edx,offset tm
invoke GetTextMetrics,memDC
lea ecx,string
mov edx,offset fmt1
lea r8d,lf.lfFaceName
mov r9d,tm.tmHeight
invoke wsprintf
;выводим строку
lea r9d,string
invoke TextOut,memDC,X,Y,,rax
mov eax,tm.tmHeight
add eax,tm.tmExternalLeading
add Y,rax
mov qword ptr [rsp+20h],sizeof string1
lea r9d,string1
invoke TextOut,memDC,X,Y
mov r8d,sizeof string1
lea edx,string1
lea r9d,size0
invoke GetTextExtentPoint32,memDC
mov eax,size0.x
mov X,rax
lea ecx,string
mov edx,offset fmt2
mov r8d,size0.x
invoke wsprintf
lea r9d,string
invoke TextOut,memDC,X,Y,,rax
mov eax,tm.tmHeight
add eax,tm.tmExternalLeading
add Y,rax
and X,0
lea ecx,string
mov edx,offset fmt3
invoke wsprintf,,,maxX,maxY
lea r9d,string
invoke TextOut,memDC,X,Y,,rax
mov eax,tm.tmHeight
add eax,tm.tmExternalLeading
add Y,rax
invoke InvalidateRect,hWnd,0,1
jmp wmBYE
RESET:  and X,0
and Y,0
invoke PatBlt,memDC,0,0,maxX,maxY,PATCOPY
        invoke InvalidateRect,hWnd,0,1
jmp wmBYE
HELP: mov ecx,offset mb
invoke MessageBoxIndirect
jmp wmBYE
wmCREATE:invoke GetSystemMetrics,SM_CXSCREEN
mov maxX,rax
        invoke GetSystemMetrics,SM_CYSCREEN
mov maxY,rax
invoke GetDC,hWnd
mov hdc,rax
invoke CreateCompatibleDC,eax
mov memDC,rax
invoke CreateCompatibleBitmap,hdc,maxX,maxY
        invoke SelectObject,memDC,eax
invoke GetStockObject,WHITE_BRUSH
        invoke SelectObject,memDC,eax
invoke PatBlt,memDC,0,0,maxX,maxY,PATCOPY
invoke SetBkMode,memDC,TRANSPARENT
        invoke ReleaseDC,hWnd,hdc
jmp wmBYE
wmPAINT:lea edx,ps
        invoke BeginPaint       
mov hdc,rax
        invoke BitBlt,eax,0,0,maxX,maxY,memDC,0,0,SRCCOPY       
        lea edx,ps
        invoke EndPaint,hWnd
wmBYE:  leave
        retn
handler dq RESET,FONT,HELP,wmDESTROY
WndProc endp
;-----------------------------------------
ClassName db "Uncle Remus tales:#5e Work with Font",0
expTxt db "Win64 assembly with MASM is great and easy",0
FileName db "br_Rabbit3.cur",0
hwnd dq ?
fmt1 db 'Font height "%s" is %d pixels',0
string1 db "This is the next line.",0
fmt2 db "Length of the previous line is %d units",0
fmt3 db "Screen size is %d by %d",0
ACC dq ?
tm TEXTMETRICA <>
X dq 0
Y dq 0
maxX dq ?
maxY dq ?
memDC dq ?
hOldFont dq ?
hNewFont1 dq ?
hNewFont2 dq ?
MBText db "F1: Help",10,"F2: Choose font",10,"F3: Clear screen",10,"Ctrl+X: Exit",0
mb label   MSGBOXPARAMS
  dd sizeof MSGBOXPARAMS,?;cbSize      
  dq 0  ;hwndOwner
  dq IMAGE_BASE  ;hInstance      
  dq MBText  ;lpszText    
  dq ClassName  ;lpszCaption
  dd MB_OK or MB_USERICON or MB_TOPMOST,?;dwStyle
  dq IDC_ICON1  ;lpszIcon
  dd 0,?;dwContextHelpId
  dq 0  ;lpfnMsgBoxCallback
  dd 0,?;dwLanguageId
end
rc-file
Code: [Select]
#include "resource.h"
#define ID_RESET 0
#define ID_FONT 1
#define ID_HELP 2
#define ID_EXIT 3
#define IDM_MENU 37
#define IDC_ICON1 500
#define IDR_MAINACCEL 105
IDC_ICON1 ICON DISCARDABLE "br_Bear4.ico"
IDM_MENU MENU
{
    POPUP "&Font"
    {
    MENUITEM "Choose &font\tF2",ID_FONT
    MENUITEM "&Clear Screeen\tF3",ID_RESET
    MENUITEM "&Help\tF1",ID_HELP
MENUITEM SEPARATOR
        MENUITEM "E&xit\tCtrl+X",ID_EXIT
}
    MENUITEM "E&xit",ID_EXIT
}
IDR_MAINACCEL ACCELERATORS DISCARDABLE

 VK_F1, ID_HELP,VIRTKEY
 VK_F2, ID_FONT,VIRTKEY
 VK_F3, ID_RESET,VIRTKEY
 "^X",  ID_EXIT
}
P.S. Hi, hutch--! Size of zip-file and png-files are 83 kBytes (https://wasm.in/styles/smiles_s/yes3.gif)
Title: Re: Uncle Remus Tales
Post by: Mikl__ on January 29, 2019, 01:28:21 PM
The program demonstrates the text output on the screen in 10 ways
I have already shown a similar program (http://masm32.com/board/index.php?topic=4190.msg47313#msg47313). But it had to be redone, as with an increase in the volume of the text, problems begin with its redrawing and blinking.
In the attachment the source code of the program, the icon and the exe-file
Title: Re: Uncle Remus Tales
Post by: felipe on January 29, 2019, 03:09:08 PM
mikl__ looks like an interesting program, but unfortunately seems like it dosen't work well (at least in my system... :idea:). when i run the program no window is displayed and the program remains running (i can see it with the taskmanager). so after that i have to kill the process... :idea:
Title: Re: Uncle Remus Tales
Post by: TimoVJL on January 29, 2019, 06:58:03 PM
What codepage the source text use ?
Title: Re: Uncle Remus Tales
Post by: Mikl__ on January 29, 2019, 09:41:57 PM
Hei Timo,
käytin Windows-1251-kooditaulukkoa (used the code page Windows-1251)
This is the Russian translation of "Uncle Remus's Tales". But this is not critical. This is a demonstration of displaying a few dozen lines..
Title: Re: Uncle Remus Tales
Post by: TimoVJL on January 29, 2019, 11:00:53 PM
Спасибо!
With notepad2 it is possible to convert and see the russian language text and comments.
Notepad2 have a Encoding Recode option.
Title: Re: Uncle Remus Tales
Post by: jj2007 on January 30, 2019, 08:12:33 AM
Looks exotic :P
Code: [Select]
mov r8d,offset expTxt0
mov edx,offset aStatic
sub esp,20h
invoke CreateWindowEx,0,,,SS_LEFT or WS_CHILD or WS_VISIBLE
mov hStaticText1,rax
;создания элемента STATIC для вывода текста функцией SendMessage
Title: Re: Uncle Remus Tales
Post by: AW on January 31, 2019, 12:15:28 AM
It does not launch as well here and I can't find a version of the win64a.inc that does not produce errors when building. I am sure Mikl__ might have posted a link to a working version somewhere, or may be I am just confused (Alzheimer, may be?).
Title: Re: Uncle Remus Tales
Post by: Mikl__ on January 31, 2019, 12:36:26 AM
Hmm... Strange
Title: Re: Uncle Remus Tales
Post by: Mikl__ on January 31, 2019, 12:39:11 AM
a continuation
Title: Re: Uncle Remus Tales
Post by: jj2007 on January 31, 2019, 01:13:49 AM
Hi Mikl,

I can't build it because I don't yet have a consistent Win64 installation, but nonetheless I have a question regarding these lines:
Code: [Select]
mov r8d,offset expTxt0
mov edx,offset aStatic
sub esp,20h

Now that is obviously 64-bit code. Does the fact that you use edx and esp mean that you assume the addresses are 32-bit? I remember vaguely that years ago a group of programmers tried to promote a system with 64-bit instructions but 32-bit addresses.
Title: Re: Uncle Remus Tales
Post by: AW on January 31, 2019, 01:50:23 AM
It builds with LARGEADDRESSAWARE:NO (you hate 64-bit!) in link and -Cp in ml64.
However it does not run.
You are using a set of unusual build parameters, so please let us know them. From a previous post I have seen things like /ALIGN:16 /SECTION:.text,W /BASE:0x400000. If I use these it does indeed launch but shows crap.
In short, how do you build this?  :biggrin:
Now all makes sense, including putting the data in the code section....
Title: Re: Uncle Remus Tales
Post by: AW on January 31, 2019, 02:25:05 AM
All right, it shows crap because I am not using the Windows-1251 character encoding.

(https://www.dropbox.com/s/xgv1te794oit1c9/remuscrap.jpg?dl=1)

I notice that the first tab with caption Static disappeared in my Windows 10.
Title: Re: Uncle Remus Tales
Post by: AW on February 03, 2019, 09:17:58 PM
BTW, even without Unicode you can display Russian strings to western people.
All you need to do is CreateFont with RUSSIAN_CHARSET (most fonts will do, no need for a Russian font).
Then when is time to render the string you SelectObject with that font before DrawText.
Title: Re: Uncle Remus Tales
Post by: Mikl__ on February 03, 2019, 11:19:34 PM
Hi, AW!
I am very sorry that any text except the English text is rubbish ("crap") for you. Of course, in order to display the text in 10 ways, it was necessary to take 10 chapters from "Uncle Remus' Stories" in the Nigger Dixie dialect.
Quote
This is the Russian translation of "Uncle Remus's Tales". But this is not critical. This is a demonstration of displaying a few dozen lines..
Title: Re: Uncle Remus Tales
Post by: jj2007 on February 04, 2019, 12:51:02 AM
Hi, Mikl!

It feels very strange to defend José, but in this particular case when he writes "crap" he means that the control does not display the cyrillian text correctly. Indeed, it shows something else - but that is a minor problem, it's just a codepage issue  8)
Title: Re: Uncle Remus Tales
Post by: AW on February 04, 2019, 02:04:52 AM
Hi, Mikl!
I can imagine, but I always thought Uncle Remus was Russian.   ::)

Oh JJ,
Thankies. it is indeed a "minor" codepage issue, although very few people know how to solve it. I searched the internet and did not found a single instance of the correct solution. Lots of incorrect suggestions.
Title: Re: Uncle Remus Tales
Post by: jj2007 on February 04, 2019, 04:20:30 AM
I can imagine :P

CreateFont with RUSSIAN_CHARSET is indeed an interesting idea, thanks; although in general it is easier to simply use the UTF-16 version of the edit control. You can even mix Russian, Chinese and Arabic then.
Title: Re: Uncle Remus Tales
Post by: AW on February 04, 2019, 07:21:40 PM
CreateFont with RUSSIAN_CHARSET is indeed an interesting idea, thanks; although in general it is easier to simply use the UTF-16 version of the edit control. You can even mix Russian, Chinese and Arabic then.
UTF-16 is better but in some countries is not well accepted. This may not happen in Russia but in Japan they still prefer Shift-JIS. In other words suppose you want to convince Japanese people to use Rich Masm, better you make the menus and everything else in Shift-JIS. This happened to me, my agent said we would sell lots of software in Japan with a Japanese localization but could only be Shift-JIS.  At the time I had a Windows XP Japanese release only for testing. Something crazy to navigate it.