The GetTempFileName function fails and you receive an access denied error in Windows Vista or in Windows Server 2008

Symptoms

When an application calls the GetTempFileName function to create a temporary file on a computer that is running Windows Vista or Windows Server 2008, the function fails. Additionally, you receive a transient error that resembles the following:

Access to the path is denied.
You do not have access to <filepath>.

Cause

This issue occurs because the GetTempFileName function handles a duplicated file name incorrectly.

When the GetTempFileName function tries to create a temporary file name, the function checks whether a duplicated file name already exists. If the GetTempFileName function finds a duplicated file name, and if the file is pending deletion, the function handles the duplicated file name incorrectly. Therefore, you receive an ERROR_ACCESS_DENIED error code.

Note The expected behavior is that the function would again try to create a temporary file name.

Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:

http://support.microsoft.com/contactus/?ws=supportNote The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must be running Windows Vista Service Pack 2 (SP2) or Windows Server 2008 Service Pack 2 (SP2).

For more information about how to obtain a Windows Vista service pack, click the following article number to view the article in the Microsoft Knowledge Base:

935791 How to obtain the latest Windows Vista service pack

For more information about how to obtain a Windows Server 2008 service pack, click the following article number to view the article in the Microsoft Knowledge Base:

968849 How to obtain the latest service pack for Windows Server 2008

Restart requirement

You may have to restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The global version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.

Windows Vista and Windows Server 2008 file information notes

Important Windows Vista hotfixes and Windows Server 2008 hotfixes are included in the same packages. However, only "Windows Vista" is listed on the Hotfix Request page. To request the hotfix package that applies to one or both operating systems, select the hotfix that is listed under "Windows Vista" on the page. Always refer to the "Applies To" section in articles to determine the actual operating system that each hotfix applies to.

  • The files that apply to a specific product, SR_Level (RTM, SPn), and service branch (LDR, GDR) can be identified by examining the file version numbers as shown in the following table.

    Version

    Product

    SR_Level

    Service branch

    6.0.600 2. 22xxx

    Windows Vista and Windows Server 2008

    SP2

    LDR

  • The MANIFEST files (.manifest) and the MUM files (.mum) that are installed for each environment are listed separately┬áin the "Additional file information for Windows Server 2008 and for Windows Vista" section. MUM files and MANIFEST files, and the associated security catalog (.cat) files, are very important to maintain the state of the updated components. The security catalog files, for which the attributes are not listed, are signed with a Microsoft digital signature.

For all supported x86-based versions of Windows Server 2008 and of Windows Vista

File name

File version

File size

Date

Time

Platform

Kernel32.dll

6.0.6002.22499

891,904

06-Oct-2010

16:32

x86

For all supported x64-based versions of Windows Server 2008 and of Windows Vista

File name

File version

File size

Date

Time

Platform

Kernel32.dll

6.0.6002.22499

1,218,560

06-Oct-2010

16:52

x64

Kernel32.dll

6.0.6002.22499

858,624

06-Oct-2010

16:34

x86

For all supported IA-64-based versions of Windows Server 2008

File name

File version

File size

Date

Time

Platform

Kernel32.dll

6.0.6002.22499

2,185,728

06-Oct-2010

16:17

IA-64

Kernel32.dll

6.0.6002.22499

858,624

06-Oct-2010

16:34

x86

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

For more information about the GetTempFileName function, visit the following Microsoft Developer Network (MSDN) website:

General information about the GetTempFileName functionFor more information about NTSTATUS values, visit the following MSDN website:

General information about NTSTATUS valuesFor more information about a similar issue in Windows 7 and in Windows Server 2008 R2, click the following article number to view the article in the Microsoft Knowledge Base:

982613 The "GetTempFileName" function fails together with an access denied error in Windows 7 or in Windows Server 2008 R2


Additional file information

Additional file information for Windows Vista and for Windows Server 2008

Additional files for all supported x86-based versions of Windows Vista and of Windows Server 2008

File name

Update.mum

File version

Not applicable

File size

3,078

Date (UTC)

06-Oct-2010

Time (UTC)

21:36

Platform

Not applicable

File name

X86_235c96ef4c848fd6df67b7c3bf4c3ef0_31bf3856ad364e35_6.0.6002.22499_none_edec99bd0b902ea2.manifest

File version

Not applicable

File size

696

Date (UTC)

06-Oct-2010

Time (UTC)

21:36

Platform

Not applicable

File name

X86_microsoft-windows-kernel32_31bf3856ad364e35_6.0.6002.22499_none_95d5b2a66cd04c0e.manifest

File version

Not applicable

File size

4,517

Date (UTC)

06-Oct-2010

Time (UTC)

16:55

Platform

Not applicable

Additional files for all supported x64-based versions of Windows Vista and of Windows Server 2008

File name

Amd64_428741b1c32e6488c7d19b194c89df26_31bf3856ad364e35_6.0.6002.22499_none_aae94ab7493eef51.manifest

File version

Not applicable

File size

1,042

Date (UTC)

06-Oct-2010

Time (UTC)

21:36

Platform

Not applicable

File name

Amd64_microsoft-windows-kernel32_31bf3856ad364e35_6.0.6002.22499_none_f1f44e2a252dbd44.manifest

File version

Not applicable

File size

4,523

Date (UTC)

06-Oct-2010

Time (UTC)

17:11

Platform

Not applicable

File name

Update.mum

File version

Not applicable

File size

3,102

Date (UTC)

06-Oct-2010

Time (UTC)

21:36

Platform

Not applicable

File name

Wow64_microsoft-windows-kernel32_31bf3856ad364e35_6.0.6002.22499_none_fc48f87c598e7f3f.manifest

File version

Not applicable

File size

5,321

Date (UTC)

06-Oct-2010

Time (UTC)

16:39

Platform

Not applicable

Additional files for all supported IA-64-based versions of Windows Server 2008

File name

Ia64_e1b54b4a7e7fcc8564a42553a0141c8b_31bf3856ad364e35_6.0.6002.22499_none_cfa7edc7ee0c6fc5.manifest

File version

Not applicable

File size

1,040

Date (UTC)

06-Oct-2010

Time (UTC)

21:35

Platform

Not applicable

File name

Ia64_microsoft-windows-kernel32_31bf3856ad364e35_6.0.6002.22499_none_95d7569c6cce550a.manifest

File version

Not applicable

File size

4,520

Date (UTC)

06-Oct-2010

Time (UTC)

16:30

Platform

Not applicable

File name

Update.mum

File version

Not applicable

File size

2,255

Date (UTC)

06-Oct-2010

Time (UTC)

21:35

Platform

Not applicable

File name

Wow64_microsoft-windows-kernel32_31bf3856ad364e35_6.0.6002.22499_none_fc48f87c598e7f3f.manifest

File version

Not applicable

File size

5,321

Date (UTC)

06-Oct-2010

Time (UTC)

16:39

Platform

Not applicable

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×