Happy New Year!

Delphi XE5 Update 2

If you're a user of Delphi XE5 or RAD Studio XE5, then unless you've been hiding under a rock you'll be very much aware that Update 2 was released a while back (10th December, 2013). There are quite a few changes, so it's basically one of those uninstall/reinstall cycles. On the EDN page for Update 2 you can pull down the web installer, which downloads all the required bits over the web as it sees the need to, or pull down the rather larger full Update 2 ISO CD image. When I used the CD image I found that Hotfix 1 and Hotfix 2 (also mentioned on the same page) appeared to be already applied.

However as François Piette pointed out, we now also have a Hotfix 3 for Update 2. This addresses a few missing .OBJ files (compiled versions of C source files for the JPEG support). In the absence of a README file, I decided these files belonged alongside their corresponding source files in $(BDS)\source\vcl\jpg\src (e.g. C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\source\vcl\jpg\src).

Update 2 does incorporate a good number of fixes, including the really annoying one where the form designer keyboard shortcuts (various permutations of CtrlShift and the cursor keys) werenot supported by the FMX form designer (as Marco posted).

Here are links for the Release Notes and the What's New page for XE5 Update Pack 2.

One of the key features added in Update 2 was iOS development support for C++ programmers.David Intersimone made a handful of posts showing how to use this support, and they have been accompanied by and followed up with a variety of videos on the Embo YouTube channel:

  • C++Builder XE5 iOS Preview slides, video
  • What's New in C++Builder XE5 for iOS, video
  • Building your first C++Builder multi-device application, post and video
  • Using TabControls, Gestures and Actions in your C++Builder XE5 for iOS apps, post andvideo
  • Using Image Effects Filters in your C++Builder for iOS apps, post and video
  • Location enabling your C++Builder for iOS apps, post and video
  • Mobile Code Snippets: IBLite on iOS, video
  • Mobile Code Snippets: Date Picker for iOS, video
  • Mobile Code Snippets: Sharesheet & Media Library Actions, video
  • Mobile Code Snippets: Sending & Cancelling Notifications, video
  • Mobile Code Snippets: Tap & Hold Interactive Gesture, video
  • Mobile Code Snippets: Sending & Resetting Badge Numbers, video
  • Mobile Code Snippets: Pinch & Zoom Interactive Gesture, video

Another neat feature slipped in is the Mobile Preview feature, which allows you to compile and test a good chunk of your mobile functionality within a Windows preview app. It's discussed by Marco here and Sarina DuPont here and documented here.

Recent VCL enhancements

Given Embo's focus on talking lots and lots about FMX over recent years it's easy to forget that the VCL is still being enhanced. Indeed so easy that when XE5 was released, the home page made nary a mention of VCL! Anyway, in an attempt to redress the balance DavidI emitted a blog postthat talks about the benefits of VCL in Delphi XE5.

In there he mentions support for64-bit Windows, full Unicode support, FireDAC, theREST client support, VCL stylesLiveBindingsMetropolis for Windows 8-like apps, and sensor support.

Some additional posts on the REST client support are:

New product features for old product users

I discovered that Embo have made some pages that talk about new features in releases since certain commonly used old versions. For those trying to find out how much merit there might be in upgrading to the current XE5 release from an old version these pages could prove pretty useful. So we have:

Warren Postma has a post citing a variety of reasons to upgrade: Modernize your codebase: Inspiration to Ditch your Ancient Delphi Version. Do read through them.

reFind for search/replace with PCRE

Here’s a tool I didn’t notice appear in Delphi XE5. It’s a command line find/replace tool that uses Perl-compatible regular expressions (PCRE). It’s documented in the XE5 docwiki and uses a rule file to control the process of running over a bunch of source files (and form files) making specified changes.

The tool comes from FireDAC (née AnyDac) and was designed to help migrate BDE components and code over to [Any|Fire]DAC equivalents, but of course can be applied to any search/replace scenario.

Embo’s Stephen Ball posted on the topic of source migration from Delphi 5 to Delphi XE5, which is where I first bumped into the tool. I’ve since seen it referenced on posts on Mick’s Mix and Marco’s blog.

Mobile coding topics

We've had a good spate of posts on how to do various things in Delphi mobile apps.

Here are some Android-specific ones:

Here is an iOS topic:

And here are some that cover both Android and iOS:

Additionally DavidI posted a useful set of resource links that came up in his Step Up to the Multi-Device App Platform webinar so do peruse them at your leisure.

DEP & ASLR in Windows projects

While looking into reFind I bumped into a new (to me) Delphi blog from Mick Grove called Mick’s Mix. A 2011 post on there reminded me of support added to Delphi 2007 and later to supportDEP (Windows XP SP2 and later) and ASLR (Windows Vista and later).

DEP is Data Execution Prevention, which helps avoid hacked data bytes being executed. This is done in 32-bit apps using AMD’s NX (no-execute page protection) processor feature and Intel’s XD (Execute Disable Bit) processor feature.

ASLR is Address Space Layout Randomization and helps foil buffer overrun exploits by randomising the load address of DLLs. Thus ASLR is only really pertinent to DLLs or packages.

According to a post by MSDN blogger Michael Howard, and echoed by a post by Hallvard Vassbotn, Delphi 2007 added support for ASLR and DEP by the small operation of adding this after the uses clause in the project file:

{$SETPEOPTFLAGS $140}

This sets 2 flags in the DllCharacteristics field of the IMAGE_OPTIONAL_HEADER section of the PE file that your DLL will be emitted as by the linker.

IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE and IMAGE_DLLCHARACTERISTICS_NX_COMPAT are defined byMicrosoft’s MSDN documentation as having the values 0x0040 and 0x0100 respectively.

IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE is defined as: the DLL can be relocated at load time.

IMAGE_DLLCHARACTERISTICS_NX_COMPAT is defined as: the image is compatible with data execution prevention (DEP).

Neither of these constants is defined in Delphi’s Winapi.Windows.pas, but for readability you could alternatively write this below the DLL project’s uses clause:

const
  IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = $0040;
  IMAGE_DLLCHARACTERISTICS_NX_COMPAT = $0100;

{$SETPEOPTFLAGS IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE or
                IMAGE_DLLCHARACTERISTICS_NX_COMPAT}

For ASLR in DLLs and packages you can alternatively use the undocumented {$DYNAMICBASE ON}directive (as mentioned by Michael and Hallvard), which has the same effect as setting theIMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE PE opt flag. Thus this would be a viable equivalent:

const
  IMAGE_DLLCHARACTERISTICS_NX_COMPAT = $0100;

{$SETPEOPTFLAGS IMAGE_DLLCHARACTERISTICS_NX_COMPAT}
{$DYNAMICBASE ON}

Note that in more recent product releases you can also pass these optional PE header flags using a linker switch. In the Linking section of the Project Options dialog you can pass the combined decimal flags value to the Set extra PE Header optional flags field, so $140 would need a value of 320 to be passed in.

You can see that the flags have been noted by looking at the properties of your project when running using a tool such as Process Explorer from SysInternals.

Happening in delphi world的更多相关文章

  1. TExternalThread TThread -- Delphi -- Cannot terminate an externally created thread ?

    Cannot terminate an externally created thread ? The VCL has a new TExternalThread class which derive ...

  2. delphi Drag and Drop sample 鼠标拖放操作实例

    Drag and Drop is a common operation that makes the interface user friendly: a user can drag/drop inf ...

  3. Restrict form resize -- Delphi

    http://www.delphipages.com/forum/showthread.php?t=58391 Hi, How would I restrict a form from being r ...

  4. 学习笔记:7z在delphi的应用

    最近做个发邮件的功能,需要将日志文件通过邮件发送回来用于分析,但是日志文件可能会超级大,测算下来一天可能会有800M的大小.所以压缩是不可避免了,delphi中的默认压缩算法整了半天不太好使,就看了看 ...

  5. delphi连接sql存储过程

    针对返回结果为参数的 一. 先建立自己的存储过程 ALTER PROCEDURE [dbo].[REName] ) AS BEGIN select ROW_NUMBER() over(order by ...

  6. delphi 2010与delphi XE破解版的冲突

    在系统中同时安装了Dephi 2010LITE版与Delphi XE lite后,总是会有一个有问题 是因为两者都是读取C:\ProgramData\Embarcadero目录下的license文件, ...

  7. [Delphi] Delphi版本号对照

    VER300    Delphi Seattle / C++Builder Seattle    23    230    (Delphi:Win32/Win64/OSX/iOS32/iOS64/An ...

  8. delphi tidhttp 超时设置无效的解决方法

    现在delphi都发布到xe8了,tidhttp还有缺陷,那就是超时设置在没有网络或者连不上服务器的时候是无效的,不管你设置为多少都要10-20秒.connectTimeout和readTimeout ...

  9. Delphi Code Editor 之 编辑器选项

    Delphi Code Editor 之 编辑器选项 可从Code Editor的右键菜单中选择“Properties”菜单项来查看编辑器选项.也可以从主菜单[Tools | Editor Optio ...

随机推荐

  1. knockout 学习使用笔记-----event绑定传参ko属性

    在绑定event的时候,需要传入ViewModal 本身的属性值(其实没必要,js直接能获取到,此处为测试相关参数的传递),如果不加(),会将绑定的function传进event(至于为嘛传了个fun ...

  2. Java并发(5):同步容器

    一. 同步容器出现的原因 在Java的集合容器框架中,主要有四大类别:List.Set.Queue.Map. List.Set.Queue接口分别继承了Collection接口,Map本身是一个接口. ...

  3. $python包管理工具pip的安装和使用

    pip是python的一个非常好用的包管理工具,可以用来很方便地安装和管理各种三方库,本文对其基本用法进行介绍. 安装pip Windows系统上安装 python 2.7.9及以上版本的window ...

  4. WPF MVVM模式下ComboBox级联效果 选择第一项

    MVVM模式下做的省市区的级联效果.通过改变ComboBox执行命令改变市,区. 解决主要问题就是默认选中第一项 1.首先要定义一个属性,继承自INotifyPropertyChanged接口.我这里 ...

  5. Silverlight应用小知识点

    1 Silverlight目录下创建的类   与  根目录下创建的类:  是不同的:  Silverlight 不能调用根目录下的类:

  6. 【c++习题】【17/4/13】stack

    1.stack 模板.动态内存分配.析构 #include "stack2.cpp" #include <iostream> using namespace std; ...

  7. Java:判断字符串中包含某字符的个数

    Java:判断字符串中包含某字符的个数 JAVA中查询一个词在内容中出现的次数: public int getCount(String str,String key){ if(str == null ...

  8. qt项目: error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1900”不匹配值“1800”

    error LNK2038: 检测到“_MSC_VER”的不匹配项:  值“1900”不匹配值“1800” 该错误 网上通常的解释是: 原因:由于你使用了vs2012,相比较vs2010以及之前的vs ...

  9. 一个线程知识点, 一个MongoDB的知识点

    //WINForm窗体中切换前后台线程执行任务: protected void RunOnUI(Action action) { Invoke(action); } protected void Ru ...

  10. shell printf命令:格式化输出语句

    printf 命令用于格式化输出, 是echo命令的增强版.它是C语言printf()库函数的一个有限的变形,并且在语法上有些不同. 注意:printf 由 POSIX 标准所定义,移植性要比 ech ...