in

andy vt's tools & blog

automating lazy

CommercialAddIn error: Could not located file lock.

Last post 03-02-2007 10:34 AM by ocalvo. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 02-09-2007 11:00 PM

    CommercialAddIn error: Could not located file lock.

    And Also:

    User: Mcx1

    FileName =

    I am getting the following infos on the Event Viewer1:

    User: Mcx1

    Could not located file lock.

     

  • 02-09-2007 11:24 PM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    More info about my configuration:

     My Recorded TV folder is actually located in another hard disk but by using mount points for volumen my recorded folder is still "c:\users\public\Recorded TV"

     I notice that the function ConvertDevicePathToDosPath is been used, do this function works if the path is using mount points?

     Regards,

     Oscar

  • 02-12-2007 12:30 PM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    ocalvo:

    More info about my configuration:

     My Recorded TV folder is actually located in another hard disk but by using mount points for volumen my recorded folder is still "c:\users\public\Recorded TV"

     I notice that the function ConvertDevicePathToDosPath is been used, do this function works if the path is using mount points?

     Regards,

     Oscar

    i'm assuming based on the username that this is a problem with the extender? does it work on the pc itself?

  • 02-17-2007 6:51 PM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    No, it happens in the console also.

    It is actually a bug in the AddIn, The problem is that C:\Users\Public is a volumen moint point, and the AddIn gets confused about the file name.

     

    C:\Users>dir
     Volume in drive C is System
     Volume Serial Number is 436B-7D2B

     Directory of C:\Users

    01/29/2007  02:00 AM    <DIR>          .
    01/29/2007  02:00 AM    <DIR>          ..
    01/17/2007  07:14 AM    <DIR>          Guest
    01/17/2007  07:14 AM    <DIR>          Mcx1
    12/12/2006  02:04 PM    <JUNCTION>     Public [\??\Volume{4ad55393-8a01-11db-afa1-000a3a53d77f}\]
                   0 File(s)              0 bytes
                   7 Dir(s)  68,167,938,048 bytes free

     

  • 02-17-2007 6:51 PM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    No, it happens in the console also.

    It is actually a bug in the AddIn, The problem is that C:\Users\Public is a volumen moint point, and the AddIn gets confused about the file name.

     

    C:\Users>dir
     Volume in drive C is System
     Volume Serial Number is 436B-7D2B

     Directory of C:\Users

    01/29/2007  02:00 AM    <DIR>          .
    01/29/2007  02:00 AM    <DIR>          ..
    01/17/2007  07:14 AM    <DIR>          Guest
    01/17/2007  07:14 AM    <DIR>          Mcx1
    12/12/2006  02:04 PM    <JUNCTION>     Public [\??\Volume{4ad55393-8a01-11db-afa1-000a3a53d77f}\]
                   0 File(s)              0 bytes
                   7 Dir(s)  68,167,938,048 bytes free

     

  • 02-17-2007 7:11 PM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    ocalvo:

    No, it happens in the console also.

    It is actually a bug in the AddIn, The problem is that C:\Users\Public is a volumen moint point, and the AddIn gets confused about the file name.

     

    C:\Users>dir
     Volume in drive C is System
     Volume Serial Number is 436B-7D2B

     Directory of C:\Users

    01/29/2007  02:00 AM    <DIR>          .
    01/29/2007  02:00 AM    <DIR>          ..
    01/17/2007  07:14 AM    <DIR>          Guest
    01/17/2007  07:14 AM    <DIR>          Mcx1
    12/12/2006  02:04 PM    <JUNCTION>     Public [\??\Volume{4ad55393-8a01-11db-afa1-000a3a53d77f}\]
                   0 File(s)              0 bytes
                   7 Dir(s)  68,167,938,048 bytes free

     

    i'll take a look at this when I get a chance, but I don't know when that will be as I don't have any hw that's setup like that...

    out of curiosity, why did you choose this approach v. a more traditional approach?
     

  • 03-01-2007 5:37 PM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    Mostly to avoid changing the "defaults".

     

  • 03-01-2007 7:47 PM In reply to

    • galt
    • Top 50 Contributor
    • Joined on 02-06-2007

    Re: CommercialAddIn error: Could not located file lock.

    Just curious, as I curently don't have Toolbox installed and have been considering adding a second harddrive where I'd store & edit recorded TV. Is that a problem for Media Center, and/or Toolbox? Or is it only a problem that way the original poster configured his Recorded TV folder?
  • 03-02-2007 7:19 AM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    galt:
    Just curious, as I curently don't have Toolbox installed and have been considering adding a second harddrive where I'd store & edit recorded TV. Is that a problem for Media Center, and/or Toolbox? Or is it only a problem that way the original poster configured his Recorded TV folder?

    I have a separate dedicated Recorded TV drive; it doesn't cause any problems for WMC or the tool to do that.  If you go that route, you might want to format with large cluster sizes to get a more efficient FAT.

  • 03-02-2007 8:57 AM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    I found the problem, its located in the function BuildDeviceMap, the function is enumeration on the set of logical drives. Instead it should enumerate on the set of volumens in the system.

     Here is the new implementation of BuildDeviceMap, it will be very nice if you can pick up this change for the next release:

      private static Dictionary<string, string> BuildDeviceMap()
      {
       Dictionary<string, string> localDeviceMap = new Dictionary<string, string>();
       StringBuilder lpVolumenName = new StringBuilder(MAX_PATH);
       StringBuilder lpVolumenDosName = new StringBuilder(MAX_PATH);
       StringBuilder lpVolumenPath = new StringBuilder(MAX_PATH);
       StringBuilder lpVolumenDevice = new StringBuilder(MAX_PATH);
       IntPtr findVolumenPtr = NativeMethods.FindFirstVolume(lpVolumenName, MAX_PATH);
       if (findVolumenPtr != IntPtr.Zero && findVolumenPtr.ToInt32()!=-1)
       {
        do
        {
         int len = 0;
         NativeMethods.GetVolumePathNamesForVolumeName(lpVolumenName.ToString(), lpVolumenPath, MAX_PATH, out len);
         lpVolumenDosName = lpVolumenName.Replace(@"\\?\", "");
         lpVolumenDosName = lpVolumenDosName.Replace(@"\", "");
         NativeMethods.QueryDosDevice(lpVolumenDosName.ToString(), lpVolumenDevice, MAX_PATH);
         localDeviceMap.Add(NormalizeDeviceName(lpVolumenDevice.ToString()), lpVolumenPath.ToString());
        } while (NativeMethods.FindNextVolume(findVolumenPtr, lpVolumenName, MAX_PATH) == 1);
        NativeMethods.FindVolumeClose(findVolumenPtr);
       }
       findVolumenPtr = IntPtr.Zero;
       localDeviceMap.Add(networkDevicePrefix.Substring(0, networkDevicePrefix.Length - 1), "\\");
       return localDeviceMap;
      }

      private static Dictionary<string, string> BuildDeviceMap()
      {
       Dictionary<string, string> localDeviceMap = new Dictionary<string, string>();
       StringBuilder lpVolumenName = new StringBuilder(MAX_PATH);
       StringBuilder lpVolumenDosName = new StringBuilder(MAX_PATH);
       StringBuilder lpVolumenPath = new StringBuilder(MAX_PATH);
       StringBuilder lpVolumenDevice = new StringBuilder(MAX_PATH);
       IntPtr findVolumenPtr = NativeMethods.FindFirstVolume(lpVolumenName, MAX_PATH);
       if (findVolumenPtr != IntPtr.Zero && findVolumenPtr.ToInt32()!=-1)
       {
        do
        {
         int len = 0;
         NativeMethods.GetVolumePathNamesForVolumeName(lpVolumenName.ToString(), lpVolumenPath, MAX_PATH, out len);
         lpVolumenDosName = lpVolumenName.Replace(@"\\?\", "");
         lpVolumenDosName = lpVolumenDosName.Replace(@"\", "");
         NativeMethods.QueryDosDevice(lpVolumenDosName.ToString(), lpVolumenDevice, MAX_PATH);
         localDeviceMap.Add(NormalizeDeviceName(lpVolumenDevice.ToString()), lpVolumenPath.ToString());
        } while (NativeMethods.FindNextVolume(findVolumenPtr, lpVolumenName, MAX_PATH) == 1);
        NativeMethods.FindVolumeClose(findVolumenPtr);
       }
       findVolumenPtr = IntPtr.Zero;
       localDeviceMap.Add(networkDevicePrefix.Substring(0, networkDevicePrefix.Length - 1), "\\");
       return localDeviceMap;
      }

     

    Filed under:
  • 03-02-2007 8:59 AM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    You will need these declaration in NativeMethods. 

     

      [DllImport("kernel32.dll", SetLastError = true)]
      internal static extern IntPtr FindFirstVolume(
        [Out] StringBuilder lpszVolumeName,
        [In] int cchBufferLength);

      [DllImport("kernel32.dll", SetLastError = true)]
      internal static extern int FindNextVolume(
       [In]IntPtr hFindVolume,
        [Out] StringBuilder lpszVolumeName,
       [In] int cchBufferLength);

      [DllImport("kernel32.dll", SetLastError = true)]
      internal static extern int FindVolumeClose(
       [In]IntPtr hFindVolume);

      [DllImport("kernel32.dll", SetLastError = true)]
      internal static extern IntPtr FindFirstVolumeMountPoint(
       [In] string lpszRootPathName,
       [Out] StringBuilder lpszVolumeMountPoint,
       [In] int cchBufferLength);

      [DllImport("kernel32.dll", SetLastError = true)]
      internal static extern int FindVolumeMountPointClose(
       [In] IntPtr hFindVolumeMountPoint);

      [DllImport("kernel32.dll", SetLastError = true)]
      internal static extern int GetVolumePathName(
       [In] string lpszFileName,
       [Out] StringBuilder lpszVolumePathName,
       [In] int cchBufferLength);

      [DllImport("kernel32.dll", SetLastError = true)]
      internal static extern int GetVolumePathNamesForVolumeName(
       [In] string lpszVolumeName,
       [Out] StringBuilder lpszVolumePathNames,
       [In] int cchBufferLength,
       [Out] out int lpcchReturnLength);

  • 03-02-2007 9:43 AM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    too bad you didn't get this to me yesterday, I could have put it in the 1.2.0.5 update.  It will be in the next build. 

    I added you to the Early Access group in recognition of your contribution.

    Thanks.
     

  • 03-02-2007 9:59 AM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    any reason it couldn't look like this -

    private static Dictionary<string, string> BuildDeviceMap()
            {
                Dictionary<string, string> localDeviceMap = new Dictionary<string, string>();
                StringBuilder lpVolumenName = new StringBuilder(MAX_PATH);
                StringBuilder lpVolumenDosName = new StringBuilder(MAX_PATH);
                StringBuilder lpVolumenPath = new StringBuilder(MAX_PATH);
                StringBuilder lpVolumenDevice = new StringBuilder(MAX_PATH);
                IntPtr findVolumenPtr = IntPtr.Zero;

                try
                {

                    findVolumenPtr = NativeMethods.FindFirstVolume(lpVolumenName, MAX_PATH);
                    if (findVolumenPtr != IntPtr.Zero && findVolumenPtr.ToInt32() != -1)
                    {
                        do
                        {
                            int len = 0;
                            NativeMethods.GetVolumePathNamesForVolumeName(lpVolumenName.ToString(), lpVolumenPath, MAX_PATH, out len);
                            lpVolumenDosName = lpVolumenName.Replace(@"\\?\", "");
                            lpVolumenDosName = lpVolumenDosName.Replace(@"\", "");
                            NativeMethods.QueryDosDevice(lpVolumenDosName.ToString(), lpVolumenDevice, MAX_PATH);
                            localDeviceMap.Add(NormalizeDeviceName(lpVolumenDevice.ToString()), lpVolumenPath.ToString());
                        } while (NativeMethods.FindNextVolume(findVolumenPtr, lpVolumenName, MAX_PATH) == 1);
                    }
                }
                finally
                {
                    if (findVolumenPtr != IntPtr.Zero)
                    {
                        NativeMethods.FindVolumeClose(findVolumenPtr);
                        findVolumenPtr = IntPtr.Zero;
                    }
                }

                localDeviceMap.Add(networkDevicePrefix.Substring(0, networkDevicePrefix.Length - 1), "\\");
                return localDeviceMap;
            }

    I moved the ptr release to a finally. 

  • 03-02-2007 10:34 AM In reply to

    Re: CommercialAddIn error: Could not located file lock.

    Yeah, much better.
Page 1 of 1 (14 items)
@2008 andy vt
Powered by Community Server (Non-Commercial Edition), by Telligent Systems