Looks like you would call GetDriveType in kernel32 and see if you get
DRIVE_NO_ROOT_DIR

http://msdn.microsoft.com/en-gb/library/windows/desktop/aa364939(v=vs.85).asp
x


-----Original Message-----
From: Steven Ogilvie [mailto:steven.ogil...@titus.com] 
Sent: 05 March 2013 16:13
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] C++ custom actions

Classification: Public 


Is that not working for you? What does the MSI log file report? Make sure you
turn on MSI logging:
http://support.microsoft.com/kb/223300

did you look at that C# link? You can use the logic there as well

Steve

-----Original Message-----
From: chintala srinivas [mailto:chentala.srini...@gmail.com]
Sent: March-05-13 10:55 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] C++ custom actions

Hi Steven,

Thank you,

As per client requirement I supposed to convert custom actions from C# to
C++.

The below is C# customaction which I used previously,  [CustomAction]
        public static ActionResult SetPROP(Session session)
        {
            try
            {
                DriveInfo di = new DriveInfo("D");
                if (di.DriveType.ToString().Equals("Fixed") && (di.IsReady))
                {
                    session["PROP1"] = "D:\\";
                    session["PROP2"] = "D:";
                }
                else
                {
                    session["PROP1"] = "C:\\";
                    session["PROP2"] = "C:";
                }
            }
            catch (Exception ex)
            {
            }
            return ActionResult.Success;
        }
My Properies
        <Property Id="PROP1" Value="D:\" />
        <Property Id="PROP2" Value="D:" />

Customaction
<CustomAction Id="SetPROP" BinaryKey="CustomActions.dll" DllEntry="SetPROP"
Execute="immediate" Return="ignore" />

In ExecuteSeq
<Custom Action="SetPROP" After="ValidateProductID"/>


I would like to know how to check disk drives in C++


On Tue, Mar 5, 2013 at 9:02 PM, Steven Ogilvie
<steven.ogil...@titus.com>wrote:

> Classification: Public
>
>
> Why use C++ use C# :)
>
> Here is an example:
> http://stackoverflow.com/questions/7222782/how-to-get-the-drive-letter
> -from-a-full-name-of-the-drive
>
> Here are two functions I use to GET or SET a windows installer 
> property in C#
>
> /// <summary>
>         /// Sets a windows installer property
>         /// </summary>
>         /// <param name="session">Session session</param>
>         /// <param name="propertyName">MSI property</param>
>         /// <param name="value">string to populate</param>
>         private static void SetSessionProperty(Session session, string 
> propertyName, string value)
>         {
>             try
>             {
>                 if (session == null)
>                 {
>                     throw new ArgumentNullException("session");
>                 }
>
>                 session[propertyName] = value;
>             }
>             catch (Exception ex)
>             {
>                 WriteErrorLogInstall(session, "Exception when 
> executing SetSessionProperty.", ex, true);
>             }
>         }
>
>         /// <summary>
>         /// Gets a windows installer property
>         /// </summary>
>         /// <param name="session">Session session</param>
>         /// <param name="propertyName">MSI property</param>
>         /// <param name="isCustomActionData">true or false</param>
>         /// <returns>returns the windows installer property as a 
> string</returns>
>         private static string GetSessionProperty(Session session, 
> string propertyName, bool isCustomActionData)
>         {
>             string sessionProperty = string.Empty;
>
>             try
>             {
>                 if (session == null)
>                 {
>                     throw new ArgumentNullException("session");
>                 }
>
>                 sessionProperty = isCustomActionData ?
> session.CustomActionData[propertyName] : session[propertyName];
>             }
>             catch (Exception ex)
>             {
>                 WriteErrorLogInstall(session, "Exception when 
> executing GetSessionProperty.", ex, true);
>             }
>
>             return sessionProperty;
>         }
>
>
> -----Original Message-----
> From: chintala srinivas [mailto:chentala.srini...@gmail.com]
> Sent: March-05-13 10:23 AM
> To: WiX-users@lists.sourceforge.net
> Subject: [WiX-users] C++ custom actions
>
> Hi,
>
> I am very new to th C++ customaction.
> Can any one help me on how to write C++ custom action for finding
> disk(D:\) is avilable or not. If not then assign c:\ to the property.
>
> Regards,
> Srinivas.
>
> ----------------------------------------------------------------------
> -------- Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics Download AppDynamics Lite 
> for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
> This message has been marked as Public by Steven Ogilvie.
>
> The above classification labels were added to the message by TITUS 
> Message Classification.
> Visit www.titus.com for more information.
>
>
> ----------------------------------------------------------------------
> -------- Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics Download AppDynamics Lite 
> for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
-----------------------------------------------------------------------------
-
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite for free
today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



This message has been marked as Public by Steven Ogilvie.

The above classification labels were added to the message by TITUS Message
Classification.
Visit www.titus.com for more information.

-----------------------------------------------------------------------------
-
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to