Reply to Thread

Post a reply to the thread: Create Folder and error codes

Your Message

Click here to log in

What's the name of our main installation product (in uppercase letters), directly followed by the current year?

 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Topic Review (Newest First)

  • 06-21-2010, 11:57 PM
    linder

    Re: Create Folder and error codes

    Jimmy,

    No, there are only two possible return values:

    1.) If the function succeeds, the return value is nonzero.
    2.) If the function fails, the return value is zero.

    Friedrich
  • 06-21-2010, 06:37 PM
    jim

    Re: Create Folder and error codes

    Yes that was helpful.

    Is there a specific error returned for it cannot create the folder?

    Jimmy
  • 06-21-2010, 12:46 PM
    jim

    Re: Create Folder and error codes

    Yes. It makes since now.

    Will we ever get an error if it just cannot create it, not because it already exists so it did not create it?
  • 06-21-2010, 01:33 AM
    linder

    Re: Create Folder and error codes

    Jim,

    The "Create Folder" function returns "1" in %_SB_ERRORCODE% if the function succeeds (folder was created).

    It returns "0" if the folder creation failed (e.g. if the folder already existed).

    "An error occurs if the specified folder already exists" means the function returns "0" (= error) in %_SB_ERRORCODE%.

    BTW, "Create Folder" is a wrapper around the CreateDirectoryA Windows API.

    http://msdn.microsoft.com/en-us/libr...55(VS.85).aspx

    Does this help?

    Friedrich
  • 06-20-2010, 11:40 PM
    jim

    Create Folder and error codes

    I want to check for an error code when I create a folder. I have been creating the folders with no problem, but thought it would wise to check for an error just in case.

    I get an error code of 0 in my test installer made with SB72 after the create folder function. The folder already exists.

    The help file says:

    If the function succeeds, the %_SB_ERRORCODE% return value is nonzero.

    If the function fails, the return value is zero.

    Remarks

    The Create Folder function can be used to create multiple nested directories at the same time.

    An error occurs if the specified folder already exists.

    Which one is it really? Maybe I do not need to check for an error when creating a folder in the CSIDL_COMMON_DOCUMENTS location. Or check for the creation of a share or grant access.


    Jim

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •