The MASM Forum

General => The Workshop => Topic started by: K_F on June 13, 2013, 11:59:50 PM

Title: Direct2D ?
Post by: K_F on June 13, 2013, 11:59:50 PM
Does anyone have any INC or LIB files on Direct2D ?
Thanks
:)
Title: Re: Direct2D ?
Post by: TouEnMasm on June 14, 2013, 02:23:15 AM

http://msdn.microsoft.com/en-us/library/windows/desktop/dd370994(v=vs.85).aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/dd370994(v=vs.85).aspx)

d2d1.h and d2d1.lib  (windows sdk)
Sorry but there is interfaces who are not translated by the "ready to use sdk".
Must have a special prototype or somethong else.I will have a look.
Title: Re: Direct2D ?
Post by: qWord on June 14, 2013, 02:54:03 AM
Quote from: K_F on June 13, 2013, 11:59:50 PM
Does anyone have any INC or LIB files on Direct2D ?
see Japheth's WinInc (http://www.japheth.de/WinInc.html).
Title: Re: Direct2D ?
Post by: TouEnMasm on June 14, 2013, 04:35:44 AM
Here the d2d1.sdk with all the needed declarations.
just replace the one here:
http://masm32.com/board/index.php?topic=563.msg4563#msg4563 (http://masm32.com/board/index.php?topic=563.msg4563#msg4563)
Quote
see Japheth's WinInc. ??????????     no d2d1 here

You need to download the dll d2d1.dll the lib is in the windows sdk
Title: Re: Direct2D ?
Post by: K_F on June 14, 2013, 05:29:56 AM
Thank you .. kind sirs/madams
:t
Title: Re: Direct2D ?
Post by: qWord on June 14, 2013, 01:13:48 PM
Quote from: ToutEnMasm on June 14, 2013, 04:35:44 AM
Quote
see Japheth's WinInc. ??????????     no d2d1 here ?
I simply forget that I've add my own translation years back.

In the attachment the DEF-file, the library and include files that can be used with WinInc (and of course a small -it-does-somehow-work-example-).
Title: Re: Direct2D ?
Post by: TouEnMasm on June 14, 2013, 02:50:59 PM
Bad chance
running direct2d "_ftol2 entry point not found in msvcrt.dll"
trying to recompile
bad chance
couldn't find inknown.inc in d2di.inc follow a list of include files:
Quote
   include unknwn.inc
   include dcommon.inc
   include D2DErr.inc
   include D2DBaseTypes.inc
   include dxgiformat.inc

Quote
From what I understand, ftol2 is a new function in VC 7 used
to convert floats to integers, and replaces ftol in VC 6.
no need of windows 7 for that.

Title: Re: Direct2D ?
Post by: qWord on June 14, 2013, 03:08:19 PM
yep, there were two files missing  :icon_cool:
(see previous post)
Title: Re: Direct2D ?
Post by: qWord on June 14, 2013, 03:17:19 PM
Quote from: ToutEnMasm on June 14, 2013, 02:50:59 PM
Bad chance
running direct2d "_ftol2 entry point not found in msvcrt.dll"
the executable does not import msvcrt.dll...

Quote from: ToutEnMasm on June 14, 2013, 02:50:59 PMcouldn't find inknown.inc
the file unknwn.inc comes with WinInc.

BTW: D2D requires Windows Vista SP2, Win7/8,...
Title: Re: Direct2D ?
Post by: TouEnMasm on June 14, 2013, 03:31:00 PM

Quote
the executable does not import msvcrt.dll...
This import is in the dll,and the executable need it

Quote
IMPORTS for d2d1.dll
    msvcrt.dll
              330010FC Import Address Table
              33063464 Import Name Table
              FFFFFFFF time date stamp
              FFFFFFFF Index of first forwarder reference

      6FF59BA1    194 _ftol2
      6FF5EEC0     47 _CIsqrt
      6FF59E3A    195 _ftol2_sse
      6FF60EB1     41 _CIfmod
      6FF6112D    2EB _onexit
      6FF5D1A8    3C8 _vsnprintf
      6FFBB2EF    101 _amsg_exit
      6FF5C151    1D5 _initterm
      6FF7DC75     6A _XcptFilter
      6FF5A449    242 _lock
      6FF5F509     8D __dllonexit
      6FF5A42D    3A6 _unlock
      6FF59790    4EE memset
      6FF59CEE    4DE malloc
      6FF5B10D    4FF realloc
      6FF59894    4A6 free
      6FF59E5A    4EC memmove
      6FF59DF1    177 _finite
      6FF59E12    220 _isnan
      6FF73E27    159 _except_handler4_common
      6FFB6EA9    2FC _purecall
      6FF78A22     48 _CItan
      6FF59910    4EA memcpy
      6FF5F95F    49B floor
      6FF75A24     3D _CIatan2
      6FF5EF16     3E _CIcos
      6FF759E4     45 _CIsin
Title: Re: Direct2D ?
Post by: qWord on June 14, 2013, 03:42:34 PM
Quote from: ToutEnMasm on June 14, 2013, 03:31:00 PM

Quote
the executable does not import msvcrt.dll...
This import is in the dll,and the executable need it
yes, but that is not my problem - you might repair your windows installation.
Title: Re: Direct2D ?
Post by: TouEnMasm on June 14, 2013, 04:26:09 PM

The _ftol2 is not in windows XP,it's a not a defaut of my system.It is only in the msvcrt.dll of win7.
i try to compile your source:
Direct2D.obj : error LNK2001: unresolved external symbol _DEFINE_ENUM_FLAG_OPERATORS@4

It is used as this in your source:

E:\image2d\d2d1.INC
73 : DEFINE_ENUM_FLAG_OPERATORS proto  :D2D1_DRAW_TEXT_OPTIONS
198 : DEFINE_ENUM_FLAG_OPERATORS proto  :D2D1_PATH_SEGMENT
249 : DEFINE_ENUM_FLAG_OPERATORS proto  :D2D1_LAYER_OPTIONS
265 : DEFINE_ENUM_FLAG_OPERATORS proto  :D2D1_WINDOW_STATE
284 : DEFINE_ENUM_FLAG_OPERATORS proto  :D2D1_RENDER_TARGET_USAGE
291 : DEFINE_ENUM_FLAG_OPERATORS proto  :D2D1_PRESENT_OPTIONS
312 : DEFINE_ENUM_FLAG_OPERATORS proto  :D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS

Perhaps a little help ?

Title: Re: Direct2D ?
Post by: qWord on June 14, 2013, 05:02:41 PM
I used jWasm, which is obviously more tolerant .... I've comment out all that invalid DEFINE_ENUM_FLAG_OPERATORS prototypes.
However, for MASM (I'm using version 10) there is still the problem with the prototype bug (if a prototype occurs in an (macro-)expression that is evaluated, MASM adds an useless EXTERNAL-entry to the object file). Therefore I would suggest to use jWasm instead of MASM, even if the modified source is buildable with MLv10.

I've update the attachment in my above post.
Title: Re: Direct2D ?
Post by: TouEnMasm on June 14, 2013, 11:26:23 PM

I find this :Why direct2d is patently ridiculous
http://braid-game.com/news/2009/01/a-demonstration-that-direct2d-is-patently-ridiculous/ (http://braid-game.com/news/2009/01/a-demonstration-that-direct2d-is-patently-ridiculous/)

I don't give my opinion on the subject.I find it enough ridiculous to not work with XP only for convert a real to an integer.
Title: Re: Direct2D ?
Post by: qWord on June 15, 2013, 01:26:31 AM
Quote from: ToutEnMasm on June 14, 2013, 11:26:23 PMI find it enough ridiculous to not work with XP only for convert a real to an integer.
Who said that this is the only reason? Did you copy over the d2d1 DLL an expect that it simply works?
Title: Re: Direct2D ?
Post by: TouEnMasm on June 15, 2013, 02:56:34 AM
Surely my bad english:I don't understand
Quote
Did you copy over the d2d1 DLL an expect that it simply works?
I have not even try to register it , I had just put it in the same directory as your application.What I have to do ? (an expect ?)
Title: Re: Direct2D ?
Post by: K_F on June 16, 2013, 07:52:53 PM
And.. the last request...  :P

Does anyone have a link to the Win7 SDK help file..  that's easy and straight forward to install.

I downloaded the Ms stuff and it's a complete abortion of an install.. won't install for a gazillion stupid problems/errors.
I've used reg cleaners ..etc to clear the left over MSI garbage,... but absolute nudder.  :dazzled:

I have checked Msoft website and have enabled necessary services for the install.. but F... , they are useless.
The mind boggles at all this crud.

thanks for any help

Title: Re: Direct2D ?
Post by: TouEnMasm on June 17, 2013, 03:20:23 PM

Link to sdk 7
http://www.microsoft.com/en-us/download/details.aspx?id=18950 (http://www.microsoft.com/en-us/download/details.aspx?id=18950)

Best way to install or uninstall the sdk is the web install.
If you have other sdk in your computer,find the good version of the web install and use it.
Title: Re: Direct2D ?
Post by: K_F on June 18, 2013, 04:48:27 PM
I've been avoiding that - have an acute aversion to 'online installations'.. even from Ms
but maybe there's no other way.  :(
Title: Re: Direct2D ?
Post by: K_F on June 18, 2013, 11:38:44 PM
Quote from: ToutEnMasm on June 17, 2013, 03:20:23 PM
Best way to install or uninstall the sdk is the web install.
Even that doesn't work... fark!!

It always comes up with the same GUID error which is the SDK MSI installation itself, as far as I can see.
Then I manually trudge through the RegEdt32 deleting any such references, and then a Reg Cleaner to sweep up any other junk - still no joy
The mind boggles at this lot.. what on earth have they done ??

Have an idea.. be back later..
Title: Re: Direct2D ?
Post by: dedndave on June 18, 2013, 11:50:34 PM
your problems may be related to Windows Installer, itself
i recall some real headaches with that, before i caught on - lol

when i "build" a drive now, one of the first things i do is to install Windows Installer v4.5
no more headaches

but, if you start off with WI v 3.1 or no WI at all, you are in for some fun - lol
Title: Re: Direct2D ?
Post by: K_F on June 19, 2013, 01:29:53 AM
Maybe that's an idea Amigo.. so tell me.. where do I find this.. character ... Windows Installer v4.5?
Is there a link through the canyon ?  :biggrin:

On MSoft website.. there's a few on them ?
Title: Re: Direct2D ?
Post by: dedndave on June 19, 2013, 01:44:41 AM
you can check the version that you have installed
hang on, let me find it.....
Title: Re: Direct2D ?
Post by: dedndave on June 19, 2013, 01:49:14 AM
it's in the system32 folder, and named msiexec.exe
you can mouse over it to see the version number

http://www.microsoft.com/en-us/download/details.aspx?id=8483 (http://www.microsoft.com/en-us/download/details.aspx?id=8483)

i see they now have a version 5.0, as well
more info....

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/c3f91eac-d880-41fa-b86d-5568d4ead02f (http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/c3f91eac-d880-41fa-b86d-5568d4ead02f)

it would appear they have 4.5 and 5.0 installed concurrently on windows 7 - lol
at any rate, you are not the first to have this problem
i would google for "can't install windows 7 SDK" to see what others have done
Title: Re: Direct2D ?
Post by: K_F on June 19, 2013, 04:30:18 AM
Windows ® Installer. V 5.0.7601.17514

I'm running Win7 Pro (64Bit)
Title: Re: Direct2D ?
Post by: Dubby on June 19, 2013, 06:16:15 AM
what the installation LOG say? usually it's on temp folder...
Title: Re: Direct2D ?
Post by: K_F on June 19, 2013, 06:34:02 AM
Quote from: Dubby on June 19, 2013, 06:16:15 AM
what the installation LOG say? usually it's on temp folder...
Hi Dubby... You're going to have to explain which 'temp' folder -> 'C:\Windows\Temp' maybe ?
As there are quiet a few temp folders !
Title: Re: Direct2D ?
Post by: Dubby on June 19, 2013, 06:46:41 AM
type %temp% in the address bar or in a run dialog... it should bring you to the temp folder which used by the SDK Installer... the name usually obvious... sorry I can't recalls it..
by the way if you are choosing the iso make sure choose the 64 bit ones.. because you have windows 7 x64...

I have two version of those SDK because I thought I could install the x86 on my x64 win, but apparently it won't...  :icon13:
Title: Re: Direct2D ?
Post by: K_F on June 19, 2013, 07:56:00 AM
Ah.. OK.. I'll give it a go
Thanks

Report back later => 24 hrs  ;)
Title: Re: Direct2D ?
Post by: K_F on June 19, 2013, 08:48:48 PM
I did not see any temp files created during the install, but have copied the log files for both a Web and ISO install.
If you can make sense of this, it might help - thanks
Title: Re: Direct2D ?
Post by: dedndave on June 19, 2013, 09:28:44 PM
it looks like the Help Viewer is hosing you up

from this link...
http://blogs.msdn.com/b/vsnetsetup/archive/2012/03/14/unable-to-install-microsoft-windows-sdk-for-windows-7-and-net-framework-4.aspx (http://blogs.msdn.com/b/vsnetsetup/archive/2012/03/14/unable-to-install-microsoft-windows-sdk-for-windows-7-and-net-framework-4.aspx)
Quote
"Windows SDK for Windows 7 & .NET Framework 4" cannot be installed on a machine that has:

1) Microsoft Visual C++ 2010 X86 Runtime - 10.0.40219

2) Microsoft Visual C++ 2010 X86 redistributable 10.0.40219

3) Microsoft Visual C++ 2010 X64 Runtime - 10.0.40219

4) Microsoft Visual C++ 2010 X64 redistributable 10.0.40219

The above Microsoft Visual C++ 2010 packages are part of the "Visual Studio 2010 Service Pack 1" installation. When we try to install "Windows SDK for Windows 7 & .NET Framework 4.0" on a machine that has "Visual Studio 2010 SP1" it will fail with below error message....

are there any error messages displayed ?
have you looked at the system Event log ?
Title: Re: Direct2D ?
Post by: dedndave on June 19, 2013, 09:31:29 PM
another interesting link...

http://blogs.msdn.com/b/windowssdk/archive/2009/09/16/windows-7-sdk-setup-common-installation-issues-and-fixes.aspx (http://blogs.msdn.com/b/windowssdk/archive/2009/09/16/windows-7-sdk-setup-common-installation-issues-and-fixes.aspx)
Title: Re: Direct2D ?
Post by: Dubby on June 19, 2013, 10:03:12 PM
or this one...

http://support.microsoft.com/kb/2717426
Title: Re: Direct2D ?
Post by: K_F on June 19, 2013, 10:37:52 PM
I've read through all those Ms pages...
But I think Dave has it... I have Help Viewer and Redistibutable C++2010 installed and .net 4
I'll remove those one at a time and see what happens

Thanks
Title: Re: Direct2D ?
Post by: qWord on June 20, 2013, 05:36:49 AM
Quote from: ToutEnMasm on June 15, 2013, 02:56:34 AMI have not even try to register it , I had just put it in the same directory as your application.What I have to do ? (an expect ?)
my thought: you can not simply copy a system DLL from a newer Windows version to an older version unless it somewhere documented that is works. The documentation says there is no support for Windows XP.
Title: Re: Direct2D ?
Post by: TouEnMasm on June 20, 2013, 04:09:28 PM
Quote
The documentation says there is no support for Windows XP
That was for that I said it couldn't work and don't understand wich soluce you have. The _ftol2 function is missing in the msvrt.dll of windows XP and there is no way to solve this.
If you have a way ,I get it.
Title: Re: Direct2D ?
Post by: K_F on June 20, 2013, 05:50:10 PM
I have a simple fantasy...
To walk into Msofts development offices...

"So.. you're the proj engineer for the SDK installation package... Pack your bags.. You're FIRED!"
"Ah! and you're the SDK developer.. join your friend over there.. you should have complained, BYE"

I should phone my good fried Donald T.. he's pretty good at firing  :icon_mrgreen:
Title: Re: Direct2D ?
Post by: MichaelW on June 23, 2013, 08:28:13 AM
Quote from: ToutEnMasm on June 14, 2013, 04:26:09 PM
The _ftol2 is not in windows XP,it's a not a defaut of my system.It is only in the msvcrt.dll of win7.

FWIW, it's on my Windows XP system, but not in a DLL. It's a compiler support procedure in the RTLs included Microsoft Visual C++ Toolkit 2003. And because it's a compiler support procedure it does not have a normal call interface.

#include <stdio.h>
#include <conio.h>

long long _ftol2(double);

void main( void )
{
    double f = 123.456;
    long long ll;

    printf("%f\n", f);

    ll = (long long)f;       // line 13

    printf("%I64d\n", ll);

    ll = _ftol2(f);

    printf("%I64d\n", ll);

    __asm
    {
        fld QWORD PTR f
        call _ftol2
        mov DWORD PTR ll, eax
        mov DWORD PTR ll+4, edx
    }

    printf("%I64d\n", ll);
    getch();
}


; Listing generated by Microsoft (R) Optimizing Compiler Version 13.10.3077

TITLE test.c
.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif

INCLUDELIB LIBC
INCLUDELIB OLDNAMES

_DATA SEGMENT
$SG875 DB '%f', 0aH, 00H
$SG877 DB '%I64d', 0aH, 00H
ORG $+1
$SG878 DB '%I64d', 0aH, 00H
ORG $+1
$SG879 DB '%I64d', 0aH, 00H
_DATA ENDS
PUBLIC _main
PUBLIC __real@405edd2f1a9fbe77
EXTRN _printf:NEAR
EXTRN _getch:NEAR
EXTRN __ftol2:NEAR
EXTRN __ftol2:NEAR
EXTRN __fltused:NEAR
; COMDAT __real@405edd2f1a9fbe77
; File c:\program files\microsoft visual c++ toolkit 2003\my\ftol2\test.c
CONST SEGMENT
__real@405edd2f1a9fbe77 DQ 0405edd2f1a9fbe77r ; 123.456
; Function compile flags: /Odt
CONST ENDS
_TEXT SEGMENT
_ll$ = -16 ; size = 8
_f$ = -8 ; size = 8
_main PROC NEAR
; Line 7
push ebp
mov ebp, esp
sub esp, 16 ; 00000010H
; Line 8
fld QWORD PTR __real@405edd2f1a9fbe77
fst QWORD PTR _f$[ebp]
; Line 11
sub esp, 8
fstp QWORD PTR [esp]
push OFFSET FLAT:$SG875
call _printf
add esp, 12 ; 0000000cH
; Line 13
fld QWORD PTR _f$[ebp]
call __ftol2
mov DWORD PTR _ll$[ebp], eax
mov DWORD PTR _ll$[ebp+4], edx
; Line 15
mov eax, DWORD PTR _ll$[ebp+4]
push eax
mov ecx, DWORD PTR _ll$[ebp]
push ecx
push OFFSET FLAT:$SG877
call _printf
add esp, 12 ; 0000000cH
; Line 17
fld QWORD PTR _f$[ebp]
sub esp, 8
fstp QWORD PTR [esp]
call __ftol2
add esp, 8
mov DWORD PTR _ll$[ebp], eax
mov DWORD PTR _ll$[ebp+4], edx
; Line 19
mov edx, DWORD PTR _ll$[ebp+4]
push edx
mov eax, DWORD PTR _ll$[ebp]
push eax
push OFFSET FLAT:$SG878
call _printf
add esp, 12 ; 0000000cH
; Line 23
fld QWORD PTR _f$[ebp]
; Line 24
call __ftol2
; Line 25
mov DWORD PTR _ll$[ebp], eax
; Line 26
mov DWORD PTR _ll$[ebp+4], edx
; Line 29
mov ecx, DWORD PTR _ll$[ebp+4]
push ecx
mov edx, DWORD PTR _ll$[ebp]
push edx
push OFFSET FLAT:$SG879
call _printf
add esp, 12 ; 0000000cH
; Line 30
call _getch
; Line 31
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
END


123.456000
123
-9223372036854775808
123


Title: Re: Direct2D ?
Post by: TouEnMasm on June 23, 2013, 06:54:46 PM

Good sample,
it is also in the VC++ 2010 express with:

Quote
__ftol2 __ftol2_pentium4 __ftol2_sse __ftol2_sse_excpt
the sse version give a different output

Quote
123.456000
123
18981627292024832
18981625144541307