Hooking DirectX EndScene from an injected DLL

I want to detour EndScene from an arbitrary DirectX 9 application to create a small overlay. As an example, you could take the frame counter overlay of FRAPS, which is shown in games when activated. I know the following methods to do this: Creating a new d3d9.dll, which is then copied to the games path. Since the current folder is searched first, before going to system32 etc., my modified D

从注入的DLL钩住DirectX EndScene

我想绕过任意DirectX 9应用程序的EndScene来创建一个小覆盖。 举个例子,你可以采用FRAPS的帧计数器覆盖,当游戏被激活时显示。 我知道下面的方法来做到这一点: 创建一个新的d3d9.dll,然后将其复制到游戏路径。 由于当前文件夹是首先搜索,在去system32等之前,我修改的DLL被加载,执行我的附加代码。 下行:在开始游戏之前,你必须把它放在那里。 与第一种方法相同,但直接替换system32中的DLL。 下行:你不能添

Pimpl idiom with inheritance

I want to use pimpl idiom with inheritance. Here is the base public class and its implementation class: class A { public: A(){pAImpl = new AImpl;}; void foo(){pAImpl->foo();}; private: AImpl* pAImpl; }; class AImpl { public: void foo(){/*do something*/}; }; And I want to be able to create the derived public class with its implementation class: class B

皮姆普成语与继承

我想用pimpl成语来继承。 这是基础公共类及其实现类: class A { public: A(){pAImpl = new AImpl;}; void foo(){pAImpl->foo();}; private: AImpl* pAImpl; }; class AImpl { public: void foo(){/*do something*/}; }; 我希望能够用它的实现类创建派生的公共类: class B : public A { public: void bar(){pAImpl->bar();}; // Can't do! pAimpl is A's private

Listing all devices open AL does not work

I have found some examples that claims to list all output devices for audio using openAL, however I can only get them to list the currently selected device on OSX (Yosemite, Maverick). I am using a mac and have the default sound card (Built-in Output) as well as an airplay device and some sound flower devices. (Note: On windows it lists all devices) I am expecting s = (char *)alcGetString(NU

列出所有打开AL的设备不起作用

我发现了一些声称使用openAL列出了所有音频输出设备的例子,但是我只能让他们列出当前在OSX上选择的设备(Yosemite,Maverick)。 我正在使用一个mac,并且有默认声卡(内置输出)以及一个airplay设备和一些声音花卉设备。 (注意:在Windows上列出所有设备) 我期待s = (char *)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); 列出至少默认卡和声音花器件。 它什么都不返回。 s = (char *)alcGetString(NULL, ALC_DEV

How commonly used are the xilinx chips?

I'm beginning to learn embedded with C (and maybe some C++) and someone from the office said they're willing to donate a free xilinx chip they've got sitting on their shelf. I was thinking more along the lines of an Arduino, especially that the Arduino tutorials and sample projects are abundant. Can someone confirm how xilinx chips compare to arduino? Are they known within the ind

xilinx芯片常用的是什么?

我开始学习嵌入C语言(也许还有一些C ++),办公室的人表示他们愿意捐赠他们坐在书架上的免费Xilinx芯片。 我正在思考更多的Arduino,特别是Arduino的教程和示例项目非常丰富。 有人可以确认xilinx芯片与arduino的比较吗? 他们是否在行业内以任何方式更为“真实世界”? 或不? 是否有我应该避免的具体赛灵思芯片(可能是旧款型号),至少在我还在起步的时候? 由于缺乏教程,他们的学习曲线是否比Arduino更为陡峭?

How can I get the list of files in a directory using C or C++?

How can I determine the list of files in a directory from inside my C or C++ code? I'm not allowed to execute the 'ls' command and parse the results from within my program. In small and simple tasks I do not use boost, I use dirent.h which is also available for windows: DIR *dir; struct dirent *ent; if ((dir = opendir ("c:\src\")) != NULL) { /* print all the files and directori

如何使用C或C ++获取目录中的文件列表?

如何从C或C ++代码中确定目录中的文件列表? 我不能执行'ls'命令并从我的程序中解析结果。 在小而简单的任务中,我不使用boost,我使用dirent.h ,它也可用于Windows: DIR *dir; struct dirent *ent; if ((dir = opendir ("c:\src\")) != NULL) { /* print all the files and directories within directory */ while ((ent = readdir (dir)) != NULL) { printf ("%sn", ent->d_name); } closedir (d

Inline assembly language

I am doing 64 bit migration and i need to port inline assembly code to cpp Here is he code void ExternalFunctionCall::callFunction(ArgType resultType, void* resultBuffer) { // I386 // just copy the args buffer to the stack (it's already layed out correctly) int* begin = m_argsBegin; int* ptr = m_argsEnd; while (ptr > begin) { int val = *(--ptr);

内联汇编语言

我正在做64位迁移,我需要将内联汇编代码移植到cpp这里是他的代码 void ExternalFunctionCall::callFunction(ArgType resultType, void* resultBuffer) { // I386 // just copy the args buffer to the stack (it's already layed out correctly) int* begin = m_argsBegin; int* ptr = m_argsEnd; while (ptr > begin) { int val = *(--ptr); __asm push val }

ptr behaviour while passing through function

In below code snippet i am getting segmentation fault while passing unique_ptr as as value. usually this is known issue with auto_ptr as due to ownership issue (Assignee pointer becomes NULL) it can't be accessed after assignment. but why i am facing the same issue with unique_ptr even though it is having move semantics. what i understood auto_ptr use copy constructor and unique_ptr use m

ptr行为,同时通过函数

在下面的代码片段中,我将unique_ptr作为值传递给了分段错误。 通常这是auto_ptr的已知问题,原因是所有权问题(Assignee指针变为NULL),赋值后无法访问它。 但为什么即使它具有移动语义,我仍然面临与unique_ptr相同的问题。 我所了解的auto_ptr使用拷贝构造函数和unique_ptr使用移动功能来传输所有权。 但是,在这两种情况下,受让人指针都变为空,那么在这里移动语义的意义何在。 我相信如果unique_ptr作为下面的语句

ptr<T>>

The class Foo has an rvalue reference constructor that moves the contained vector of unique_ptr's so why does the following code give the following error, both with or without the std::move on the Foo() in main? Error 1 error C2280: 'std::unique_ptr> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>&

PTR <T >>

Foo类有一个右值引用构造函数,用于移动unique_ptr所包含的向量,那么为什么下面的代码会给出以下错误:无论是否在main中的Foo()上都有std :: move? 错误1错误C2280:'std :: unique_ptr>&std :: unique_ptr <_Ty,std :: default_delete <_Ty >> :: operator =(const std :: unique_ptr <_Ty,std :: default_delete <_Ty >>&)' :尝试引用已删除的函数 class Foo{ public: Fo

Emulating explicit cast in C++03

I'm working on a legacy library that needs to be backwards compatible with C++03, but is also forward compatible to take advantage of C++11 features like move semantics and explicit casting. So, is it possible to emulate explicit casting in C++03? I know obviously about the explicit bool (or "safe" bool) idiom - but that's only for casting to a boolean type. Is it possible t

在C ++ 03中模拟显式强制转换

我正在研究一个遗留库,它需要向后兼容C ++ 03,但是它也是向前兼容的,以利用移动语义和显式强制转换等C ++ 11功能。 那么,是否有可能在C ++ 03中模拟显式转换? 我明显知道显式布尔(或“安全”布尔)成语 - 但这只是为了转换为布尔类型。 是否有可能在C ++ 03中模拟一个普通的显式操作符? 我检查了一下,并在一本名为“不完美的C ++:实际编程的实用解决方案”的书中找到了关于此的讨论。 在本书中,他们讨论了关于在C

c++

Possible Duplicate: std::auto_ptr to std::unique_ptr What C++ Smart Pointer Implementations are available? Lets say I have this struct : struct bar { }; When I use auto_ptr like this: void foo() { auto_ptr<bar> myFirstBar = new bar; if( ) { auto_ptr<bar> mySecondBar = myFirstBar; } } then at auto_ptr<bar> mySecondBar = myFirstBar; C++ transf

C ++

可能重复: std :: auto_ptr到std :: unique_ptr 什么C ++智能指针实现可用? 可以说我有这个struct : struct bar { }; 当我像这样使用auto_ptr时 : void foo() { auto_ptr<bar> myFirstBar = new bar; if( ) { auto_ptr<bar> mySecondBar = myFirstBar; } } 然后在auto_ptr<bar> mySecondBar = myFirstBar; C ++将myFirstBar的所有权转移给mySecondBar,并且没有编